PDA

View Full Version : Accessing different controllers in a list controller with macsript


3rd Dimentia
02-26-2009, 10:03 AM
Hi, I have a small problem where I don't know how to access each controller in a rotation list controller.
If I have different types of controllers in the list I know I can do something like this:

$BoneAnim.rotation.controller.Euler_XYZ.zrotation

But if I have 2 Euler_XYZ controllers in the list controller, I don't know the syntax to access these seperately. I want to use this code inside a rotation script controller.


Thanks,

Cg.

Polimeno
02-26-2009, 10:35 AM
hey,
check the Help File in SubAnims

first test
$BoneAnim.rotation.Zero_Euler_XYZ.Z_rotation

the same using subAnim
$BoneAnim.controller[2][2][3]

show properties
showproperties $BoneAnim.controller[2]

-- returns
.weight : float array
.average (Average_Weights) : boolean
.count : integer
.active : index
.Frozen_Rotation : quat
.Zero_Euler_XYZ : quat
.Available : quat
false

hope it helps

ZeBoxx2
02-26-2009, 11:06 AM
alternatively, see the List controller's Interface;

showinterfaces $.radius.controller
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
<integer>getCount()
<void>setActive <index>listIndex
<integer>getActive()
<void>delete <index>listIndex
<void>cut <index>listIndex
<void>paste <index>listIndex
<TSTR by value>getName <index>listIndex
<void>setName <index>listIndex <string>name
<control>getSubCtrl <index>index
<float>getSubCtrlWeight <index>index
Actions:


The interface would provides the fool-proof access methods; though it'd be unlikely that the subanim indices would change.

3rd Dimentia
02-26-2009, 11:20 AM
Ah yes, thank you guys. Yes, I always forget about subanim. :) Lucky I have generous people like you to remind me when my brain fails me. Also thanks to Ehsan.

Cg.

PEN
02-26-2009, 11:32 AM
Sub anim indexs is not always the easiest way to do it as you can't really see what you are getting. You can use getSubAnimNames and get the named tracks and then use those to get to the tracks that you want. More typing but easier to deal with when you come back to it. Also the order cold change in some thing like a list controller and then the index will be incorrect. Problem with using names is the name could change or you could have two of the same name.

Something like...


$[#transform][#position][#Animation][#Z_position]

CGTalk Moderation
02-26-2009, 11:32 AM
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.