Determining the actual class of an object

Hi,

How can I determine the actual class an object? For example: 

var oRoot = Scene.getSelectedNode(1).getSkeleton();var numProps = oRoot.getNumProperties();var oProp;for(var i = 0; i < numProps; ++i){   oProp = oRoot.getProperty(i);   // determine the class of current oProp   ???}

I've tried "typeof" and "oProp.__proto__" and all returns "Object". How can I determine which subclass of DzProperty oProp actually is?

Thanks

 

Comments

  • Richard HaseltineRichard Haseltine Posts: 96,818
    edited November 2017

    className() is supported for all items derived from QObject. You can also use .isA( classname ) if you want to check for ientity, or mor safely .inherits( classname ) to allow for later abstraction (for example, the figures in DS 3 are now subdividied and don't exist in their own right, so anything that checked for isA( "DzSkeleton" ) rather than inherits( "DzSkeleton" ) would fail in DS4).

    Post edited by Richard Haseltine on
  • Thanks. Those functions/methods fit the bill perfectly.

Sign In or Register to comment.