Access an object's modifiers

 
 
 
Posted by:dxmedia
Data created:22 April 2011

Hello,

I would like to know how can I get to an object's modifiers, given that o have the onject reference or node.

Thanks

If your IINode has a modifier stack in it, you can cast its ObjRef to IIDerivedObject. From there you can access the modifiers by index.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Thanks so much. This eas a great help.

One question though, is there a way other than try...catch to test if the object has modifiers/can be casted ?

bool canBeCasted = myNode.ObjRef is IIDerivedObject;

Marsel Khadiyev (Software Developer, EPHERE Inc.)

Or use:

var derivedObject = myNode.ObjRef as IIDerivedObject;

if (derivedObject != null)

    Console.WriteLine (derivedObject);

 

 

 

Light