|
I have all of the bones in a Biped selected and I want the script to loop through all of the bones and create a Point at each joint. Then I need to assign 3 User Defined parameters to each Point based on the current bone’s own name and parent or child name.
My question is this: How do I setUserProp to each point without losing the selection set of bone objects while in the for loop?
pseudocode:
for o in selection do(
-- create Point at bone joint
-- setUserProp <p> "type" "Hinge" --Or pick better default joint type
-- setUserProp <p> "body1" o.name
-- setUserProp <p> "body2" o.parent.name --(or o.children[1].name)
)-- End For
~Dave
http://www.max-realms.com - 3ds Max models, tutorials and forums
Max3-2010
|
|
|
|
Make a copy of the selection collection, though it’s not necessary because you don’t need to select each point (as you create it) in order to change its properties.
myBones = for obj in selection collect obj
for obj in myBones do
(
newPoint = point pos:obj.pos
setUserProp newPoint "type" "Hinge"
setUserProp newPoint "body1" obj.name -- and so on
)
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
Oh, okay. So create the new points into a variable and assign new user properties to it instead of per object. Makes sense. Thanks so much.
~Dave
http://www.max-realms.com - 3ds Max models, tutorials and forums
Max3-2010
|
|
|