getting dependsOn to work in maxscript

getting dependsOn to work in maxscript

Anonymous
Not applicable
1,936 Views
7 Replies
Message 1 of 8

getting dependsOn to work in maxscript

Anonymous
Not applicable

Hello,

I found these neat little directions on how to make my UVW Map gizmo to follow the dummy object in world space.

 

"Place a dummy on a path constraint. $Dummy01
Create a plane $Plane01
On your Plane add a UVW Map modifier.

In trackView find the Gizmo track and assign "Transform Script" controller for that "Gizmo"
In the script expression window copy and paste this code.


trackObj=$Dummy01
dependsOn trackObj
trackObj.transform * inverse $Plane01.objectTransform


Your UVW Map gizmo will now follow the dummy object in world space."

 

This all worked great in Max 9 but it doesnt in Max 2011.

It gives me a "Unknown property: "transform" in undefined.

 

I have no clue. 

From what I understand dependsOn doesnt work the same way in later max versions.

Does anyone know how to make this example work using maxscript?

 

The dependsOn help for max was not helpfull to me.

 

Thank you.

 

 

 

 

0 Likes
Accepted solutions (1)
1,937 Views
7 Replies
Replies (7)
Message 2 of 8

Swordslayer
Advisor
Advisor
Accepted solution

dependsOn was deprecated already in max 8 IIRC, more than a decade ago - you don't need it now, and absolute names in script are a big no-no, too. Here's how to do it properly:

 

bindTM.gif

Message 3 of 8

Anonymous
Not applicable

is their a way to rotate the gizmo 90 degrees within the expression before it follows the object?

0 Likes
Message 4 of 8

denisT.MaxDoctor
Advisor
Advisor
trackObj=$Dummy01
dependsOn trackObj
trackObj.transform * inverse $Plane01.objectTransform

this piece of code is not correct! (if you want to drive a uvw map gizmo of course)

 

0 Likes
Message 5 of 8

Anonymous
Not applicable

Sorry I should have elaborated.

--this script rotates the gizmo making the planar gizmo face postive x axis with top of gizmo pointing up. yea 
 resetMaxFile #noPrompt
 myball = sphere name:"myball" pos:[56,56,-30] radius:25
 mypointer = PointHelperObj name:"mypointer" pos:[-31,34,-6] constantscreensize:true centermarker:true cross:false isHidden:false box:true
 SUMapModifier = UVWmap()
 SUMapModifier.maptype = 0
 SUMapModifier.axis = 0  --axis is X
 addmodifier myball SUMapModifier
 SUMapModifier.gizmo.rotation = (quat 0 1 -1 0) as matrix3

------------------------------------------------------------

------this script is same as above but then the following transform script controller added below it.

 resetMaxFile #noPrompt
 mypointer = PointHelperObj name:"mypointer" pos:[-31,34,-6] constantscreensize:true centermarker:true box:true
 myball = sphere name:"myball" pos:[56,56,-30] radius:25
 mypointer = PointHelperObj name:"mypointer" pos:[-31,34,-6] constantscreensize:true centermarker:true box:true
 SUMapModifier = UVWmap()
 SUMapModifier.maptype = 0
 SUMapModifier.axis = 0  --axis is X
 addmodifier myball SUMapModifier
 SUMapModifier.gizmo.rotation = (quat 0 1 -1 0) as matrix3


-----with the transformscript part added below it now rotates the gizmo 90 with top of gizmo pointing in negative y axis which I dont want.

myball.modifiers[#UVW_Mapping].Gizmo.controller = transform_script ()
myball.modifiers[#UVW_Mapping].Gizmo.controller.addNode "master" (mypointer)
myball.modifiers[#UVW_Mapping].Gizmo.controller.addNode "parent" (myball)
myball.modifiers[#UVW_Mapping].Gizmo.controller.script = "master.transform * inverse parent.objectTransform"

---So the question is how can I make sure the gizmo facing direction doesnt change after the transform script added.
Is their something I can add to the expression master.transform...etc to keep my gizmo facing positive x direction like my first example?

thank you.
0 Likes
Message 6 of 8

denisT.MaxDoctor
Advisor
Advisor
master.transform * inverse parent.objectTransform

i want to say that this expression (above) is not correct.

it supposes that uvw map gizmo is in the object's transform space. which is not true. the gizmo is in ModContext space 

0 Likes
Message 7 of 8

Anonymous
Not applicable

how would you correct it denis.T? Is that the source of my problem of getting a 90 rotation on the gizmo? because other than that it worked as expected as I wrote it.

0 Likes
Message 8 of 8

denisT.MaxDoctor
Advisor
Advisor

i don't go so deep in your problem... i just see that gizmo space is not transformed correct to the world space.

 

see MXS help Modifier Sub-Object Transform Properties as an example

0 Likes