|
|
Link Object to a Vertex Added on: Mon Aug 14 2000 |
Page: 1 2 3 4 5 6 7 8 9 10 |
Now for the final button. Type:
on LinkME_button pressed do (
Child_Obj.position.controller = position_script()
Child_Obj.position.controller.script = "getvert parentOBJ vertnum"
) --close on LinkMe This has the same button syntax as the first one we did and it only has two additional lines of script. The first line changes the child_obj's position controller. Animatable objects have controllers and we want the controller to use MAXScript.
So we assign the position_script controller to the child_Obj by typing "Child_Obj.position.controller = position_script()" Other info you can get out of an object is.
Object.name - its name like teapot01
Object.pos - its current position (0,0,0)
Object.controller - its main controller ie) look at, PRS, Link
Object.rotation.controller - the rotation controller Look though the help file. You will get tons of info from it.
The last line of text assigns the "mini-script" to the child_obj's position script controller.
The function getvert takes two parameters. The first is the object with the vertex.
The second is the vertex number. The function returns the position of that vertex.
This position is what the scriptable controller uses.
SO....this is what you should have now.MainFloater = NewRolloutFloater "Link To Vertex" 300 315
Rollout Vert_Linker "Vertex Linker" (
group "Pick Vert" (
Label getvert1L "Select a vertex to be parent"
Label getvert2L "then hit 'Get Selected Vert'"
Button GetVert_Button "Get Selected Vert"
Label vertnumL "Vertex Number: (none selected)"
) -- close group
group "Pick Child" (
Label childL "Select Child Object"
PickButton GetChild_PB "Get Child"
Label childnameL "Child Object: (none)"
) -- close group
group "Link ME Plz!" (
Button LinkME_Button "Link ME!" enabled:off
) --close group
-----------------------------------------------------------------------------
on GetVert_Button pressed do (
parentOBJ = $
vertnum = (getvertselection parentOBJ)[1]
vertnumL.text = "Vertex Number: " + (vertnum as string)
VertPicked = true
if ChildPicked == true do LinkME_Button.enabled = on
) -- close on getvert
-----------------------------------------------------------------------------
on GetChild_PB picked obj do (
Child_Obj = obj
childnameL.text = "Child Object: " + Child_Obj.name
ChildPicked = true
if VertPicked == true do LinkME_button.enabled = on
) --close on getchild
-----------------------------------------------------------------------------
on LinkME_button pressed do (
Child_Obj.position.controller = position_script()
Child_Obj.position.controller.script = "getvert parentOBJ vertnum"
) --close on linkme
) -- Close Rollout
addRollout Vert_Linker MainFloater -- Add Rollout to the main floater
|
|
|
|