PDA

View Full Version : How to return controller type....


Snape
08-21-2007, 08:07 AM
Hi,

Does anyone know how to return a controller type such as: Controller:Position_Rotation_Scale into the listener as 'type:#point3'.

I have an array of controllers that are all different types of controllers and I need my script to identify the type of controller for each one.

I was hoping that something like this would work (where objectTrackArray is the array of controllers):

print objectTrackArray[1].type

but this doesnt work.

Does anyone know the correct syntax for this, I can't find it in the help...

Thanks

Spencer

JohnSwafford
08-21-2007, 08:39 AM
Hi,

Does anyone know how to return a controller type such as: Controller:Position_Rotation_Scale into the listener as 'type:#point3'.

I have an array of controllers that are all different types of controllers and I need my script to identify the type of controller for each one.

I was hoping that something like this would work (where objectTrackArray is the array of controllers):

print objectTrackArray[1].type

but this doesnt work.

Does anyone know the correct syntax for this, I can't find it in the help...

Thanks

Spencer




MyCon = bezier_float()
Controller:Bezier_Float
classOf MyCon
bezier_float
classOf MyCon==bezier_float
true
if (classOf MyCon==bezier_float) do (print (classOf MyCon as string))
"bezier_float"

focomoso
08-21-2007, 08:40 AM
Use:

print classof objectTrackArray[1].value

to get the type of the data of a controller. That'll return "Matrix3" for a position_rotation_scale controller (not point3).

If you want to know the type of controller, which I think is what you're really looking for, you can use the classof on the controller itself:

print classof objectTrackArray[1]

This returns "prs" for position_rotation_scale.

Snape
08-21-2007, 10:30 AM
Hey thanks very much for your replies guys!

I need this to create a self generating custom attributes script, a typical line in the attribute script might be:

FCNT_R_EyebrowX type:#float

where 'float' is the bit I need to generate with the required code.

It looks like:

classof objectTrackArray[1].value

is the way forward.

Thanks again for all your help!!

Spence

CGTalk Moderation
08-21-2007, 10:30 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.