XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Loc constraints

03-08-2011, 07:13 PM
Im trying to create a loc for every joint in the slection. But its not working, the loop works it just wont create the locator or constraint it to the joints.

//Create locators for the selected joints.
string $jnt[] = `select -hierarchy`;

int $i;
for ($i; $i<size($jnt); $i++)
string $loc[] = `spaceLocator`;
pointConstraint $loc[0] $jnt[$i] ;

03-08-2011, 10:19 PM
`select -hi` doesn't return anything. don't use select in a script if you don't need to. to get the names of things use `ls` or `listRelatives`
something along the lines of:
string $jnt[] = `listRelatives -allDescendents topNode`; // or omit topNode if relying on selection (don't ;) )should do it.
Also, you aren't explicitely setting $i to anything...
for ($i=0; $i<size($jnt); $i++)if $i is never given an explicit starting value, the results may not be totally predicatable 100% of the time..


03-08-2011, 10:37 PM
Thanks Nathan. Did not know about the allDescendents. Will make a note of that.

CGTalk Moderation
03-08-2011, 10:37 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.