(SDK) check if the object can be used as an Object for INode


#1

i’m creating a node by:

MAXScript_interface7->CreateObjectNode(obj, name);

my question is - can I check that the Object (obj) is valid to make a INode?
i don’t want to use try/catch as some sdk examples do


#2

how are you creating the object that makes you think it’s not valid ?


#3

i can pass a reference target or class. if it’s a class i create an instance of this class (and of course check if the class is creatable).
but it might be a controller or material class for example… which cannot be used to make a node


#4

that’s easy then

Object* obj = dynamic_cast<Object*>(input);
if(obj != NULL).....

with RTTI set in the compile


#5

or

inline BOOL isObject(ReferenceTarget* ref) { return ref->GetInterface(I_OBJECT) ? TRUE : FALSE; }


#6

thanks! it works. enough and safe