Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Assign User Defined on Object Creation
  RSS 2.0 ATOM  

Assign User Defined on Object Creation
Rate this thread
 
37851
 
Permlink of this thread  
avatar
  • IonDave
  • Posted: 16 December 2009 08:53 AM
  • Location: Lacey, WA
  • Total Posts: 40
  • Joined: 17 March 2009 07:43 PM

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

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

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.

Replies: 0
avatar
  • IonDave
  • Posted: 16 December 2009 10:03 AM

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

Replies: 0