Tagged 'General Scripting'

Cropping all material texture the same.... how?

Hi all

I have this common issue where lets say i have a diffuse map, reflection and normal map and its a LEAF atlas downloaded from megascans. If i wanted to crop/place so that i extract only 1 leaf, i usually do it manually and adjust the map so that its the same co-ordinates for each texture - is there a simpler way to this via a script? I realise there is the bezier flaot thing that can possibly do this? but i was hoping there is a script out there to help with this?

Cheers

Rotation of one object relative to another

Hello . I'm trying to rotate one object relative to another. But it's not like it doesn't work so that when the slider changes, it's smooth.

In 1 case, I managed to make it rotate, but there it constantly adds value when the slider changes.
In 2 cases, I managed to make a smooth rotation, but for some reason it rotates relative to 0 coordinates.

Help solve the problem.

try (destroydialog Transformer) catch()
 
rollout Transformer "Transformer" width:200
(
	local nodeRoot
	local originTM = #()
	local nodeArray = #()
 
	group "Position: "
	(

JigsawMaker?

Does anyone have this script still? I can't download it from the site and his webpage is down.

http://www.scriptspot.com/3ds-max/scripts/jigsawmaker

DotNet Draw in Label

Hi. It’s not like it’s impossible to make the text be on top of the DrawRectangle during the Draft and after releasing the MouseUp everything goes back.

    try(destroydialog drawRol) catch()
    rollout drawRol "Draw in Label"
    (
     dotNetControl lb "System.Windows.Forms.Label" width:240 height:30 pos:[10, 10]
 
     local PaintRdy = false
 
     on lb mouseDown s e do
     (
    	 PaintRdy = true
     )
 
     on lb mouseUp s e do
     (
    	 PaintRdy = false
     )
 
     on lb mouseMove s e do
     (
    	if PaintRdy do
    	(

Arc by 3 Points

Original Post : https://forums.cgsociety.org/t/how-to-create-a-arc-through-3-points-with...

(
	local p1 = point pos:[0,0,0], p2 = point pos:[20,80,0], p3 = point pos:[100,100,0]
	local a = p1.pos, b = p2.pos, c = p3.pos
	fn intersection2d p1 r1 p2 r2 = (
		local dx = p2.x - p1.x, dy = p2.y - p1.y,
		det = r2.x * r1.y - r2.y * r1.x
		p1 + r1 * (dy * r2.x - dx * r2.y) / det
	)
	fn Make_Arc a b c ccw:false = (
		local ab = b - a, bc = c - b, mab = a + 0.5 * ab, mbc = b + 0.5 * bc,
		ab = normalize ab; bc = normalize bc

Circle by Point and Tangent

(
	local pt1 = point pos:[50,50,0] , pt2 = point pos:[10,45,0],
	p = pt1.pos, vo = pt2.pos , d = distance p vo , vi = p+(normalize (p-vo))*d,
	r = d/0.551915024494, -- http://gorkamendieta.es/wordpress/maxscript-circle-using-bezier-curves/
	m = matrixFromNormal (normalize (vo-p)) , c = p+m.row1*r, -- there should be better solution to get the vector (m.row1)
	cr = circle radius:r pos:c dir:-m.row3
	in coordsys local rotate cr (AngleAxis -90 x_axis)
	addModifier cr (Edit_Spline())
	select cr ; max modify mode ; subObjectLevel = 1
)

Save the transform relative to another object when transforming.

Help . Hello. There are for example 3 points. How to get a transform matrix of 1 point when transforming 2 points to 3, so that the position and rotation itself is also preserved between 1 and 2 point. (as if point 1 was linked to point 2)

ObjT = $Point002.transform
TrgtT = $Point003_Point.transform
OffT = $Point001_Point.transform

TmOffset = TrgtT * inverse ObjT

in coordsys local TmOffset .rotation = inverse (TmOffset.rotation as quat)
TmOffset.pos += TmOffset.pos

export selected object as .dwg on D Drive

Can you please help me write a simple script to export a selected object as 1.dwg on drive d?
Thanks.

gwText unregister when mouse move

Hi, I want the text I draw to be hidden after mouse move/pan/rotate or over time in viewport.
Here's my code:

(
	global GW_displayText
	unregisterRedrawViewsCallback GW_displayText
	fn GW_displayText = (
		rect = (box2 13 47 96 97)
		gw.Hrect rect red
		gw.hMarker (point3 20 207 0) #smallDiamond color:yellow
		gw.hText (point3 27 200 0) ("This is not a Standard material. Actual typ1e:") color:yellow
		gw.enlargeUpdateRect #whole 
		gw.updateScreen()
	)
	registerRedrawViewsCallback GW_displayText
)

edge slice not work

hi
i made this script.
but that is not work.

this script is to slice with 1 selected edge on topview

pls help

myobj = selection[1]
polyOp.getEdgeSelection selection[1]
local edgeVerts = polyOp.getEdgeVerts selection[1] 1
local edgeVerts2 = polyOp.getEdgeVerts selection[1] 2
p1 = (polyOp.getVert selection[1] edgeVerts[1])
p2 = (polyOp.getVert selection[1] edgeVerts2[1])
myobj.slice [p1[2]-p2[2],p2[1]-p1[1], 0] [p1[1]-myobj.pos[1], p1[2]-myobj.pos[2],-myobj.pos[3]]

Syndicate content