GetSkeleton

Description

Gets the objects in a skeleton (root, bones, and effector).

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference. Normally you can get the output arguments via either XSIApplication.ExecuteCommand method (C#) or the ISIVTCollection (scripting languages), but this command already returns a value.

The only available workaround in this case is to create a VBScript custom command which returns both the output arguments and the return value in one array. For details, see What Happens when the Function Already Returns a Value?.

Scripting Syntax

oReturn = GetSkeleton( InputObj, [Index] );

Return Value

Returns an XSICollection that contains the root, the bones, and the effector (in that order).

Parameters

Parameter Type Description
InputObj String An object in a skeleton (the root, a bone, or the effector).
Index Integer Returns the index of the object in the skeleton.

Default Value: 0

Possible Values:

Description:

0 Root
[1..NbElements-2] Bones
NbElements-1 Effector

Examples

VBScript Example

' The following creates a 3 bones skeleton, asks for info using the second bone

' and prints out the	bone index, the total number of elements in the skeleton 

' and selects the root. It also activates the joints rotation limits.

dim MySkeleton, BoneIndex, NbElements, MyRoot

Create2DSkeleton -3.004, 2.152, 0.000, -1.531, -1.163, 0.000, 0.000, 0.000, 1.000, 1 

AppendBone , 0.853, 1.396, 0.000 

AppendBone , 2.578, -1.532, 0.000

set MySkeleton =  GetSkeleton("bone1", BoneIndex )

NbElements = MySkeleton.count 

LogMessage "Element Index: " & Index 

LogMessage "Nb Elements: " & NbElements

'Select skeleton root	

MyRoot = MySkeleton(0)

SelectObj( MyRoot )

for i=1 to NbElements-2

	'Activate the RotationLimits on every joint (except the effector joint)

	SetValue MySkeleton(i) & ".joint.rotlim_active", TRUE

next