Maxscript control vertex
Hi i'm learning script development in 3ds max, in this basic script i want to move vertex with Spinners, the script work fine at execution but if i change the value of a Spinner nothing is updated, Can someone help me with some code to fix this problem?
Thanks for the attention!
/* Create and rename a basic plane */ BaseUI = Plane realWorldMapSize:on length:10 width:10 lengthsegs:3 widthsegs:3 pos:[0,0,0] isSelected:on BaseUI.name = "Base UI" /* Convert the created plane to editable poly */ macros.run "Modifier Stack" "Convert_to_Poly" /* Delete the middle face */ subobjectLevel = 4 $.EditablePoly.SetSelection #Face #{5} $.EditablePoly.delete #Face subobjectLevel = 0 /* Adding attributes rollout */ Attrib = attributes UISettings ( /* */ parameters UIParameters rollout:UIRollout( LLSParameter type:#float ui:(LLSpinner) RLSParameter type:#float ui:(RLSpinner) TLSParameter type:#float ui:(TLSpinner) BLSParameter type:#float ui:(BLSpinner) ) /* */ rollout UIRollout "UIRollout"( label LLLabel "Left line:" align:#left spinner LLSpinner range:[0,2048,10] fieldWidth:80 type:#float align:#center offset:[10,-20] label RLLabel "Right line:" align:#left spinner RLSpinner range:[0,2048,1] fieldWidth:80 type:#float align:#center offset:[10,-20] label TLLabel "Top line:" align:#left spinner TLSpinner range:[0,2048,1] fieldWidth:80 type:#float align:#center offset:[10,-20] label BLLabel "Bottom line:" align:#left spinner BLSpinner range:[0,2048,1] fieldWidth:80 type:#float align:#center offset:[10,-20] ) ) custAttributes.add $.baseObject Attrib sss = float_script() sss.script = "$.baseObject.UISettings.BLSParameter" for vert in $.Verts[2] do vert.pos.x = sss.value
Comments
Use on ..changed
You said on execution it works fine but when you change the spinner it does nothing.
You could try using something similar to this for changing the vertex position when the spinner value has changed.You could also modify your code so that the vertex position(s) is/are updated everytime the spinner value changes (see second codeblock).
Hope this helps
-Maarten