I have actually worked with DzSkeleton in my Bullet world (I cannot explain much more since the library I am working on is not available to the public now) but I actually need to work with all the other subclasses of DzNode, in particular everything that has a geometry.

How can I discriminate towards these classes? Since if I use DzNode class i get, other than DzSkeleton’s geometry, even the geometry of every child (DzBone).

So checking if DzNode has geometry is not an option.

I have read of QtObject metatype system but I am not sure on how to use it.

I know only scripting, but if the item is a DzSkeleton then classFactory().className() will return that - as long as it’s supported (check it inherits DzBase) - if I understand the DS3 docs I just looked at. (In script classname is directly available in the base class).

But whi can’t it work using DzSkeleton? Isn’t it a class which is inherited by DzFigure and DzLegacyFigure?

You can search for DzSkeleton in nodes if you want. What I’m saying is you can also search for DzFigure instead,
and cast that to a skeleton. This is because skeletons don’t seem to exist by themselves.
DzFigure also contains access to other useful data, like the skin and bone binding, weights, etc…

But whi can’t it work using DzSkeleton? Isn’t it a class which is inherited by DzFigure and DzLegacyFigure?

You can search for DzSkeleton in nodes if you want. What I’m saying is you can also search for DzFigure instead,
and cast that to a skeleton. This is because skeletons don’t seem to exist by themselves.
DzFigure also contains access to other useful data, like the skin and bone binding, weights, etc…

At the (considerable) risk of misusing terminology I thin DzSkeleton is a virtual class - you can’t create members, but you can create members of it’s derivatives (DzFigure and DzLegacyFigure). You should, however, use DzSkeleton as an inheritance check if you are in a situation where either derivative type would be relevant.

I haven’t compiled this… but if it doesn’t, it should be pretty close…

// Get the primary selectionDzNode *node = dzScene->getPrimarySelection();// If we've got a node selectedif( node ){// If the node can be cast to a DzBoneif( qobject_cast<DzBone*>(node) ){// We want the skeleton nodenode = node->getSkeleton();}

// Get the objectDzObject *object = node->getObject();// If we've got an objectif( object ){// Get the current shapeDzShape *shape = object->getCurrentShape();// If we've got a shapeif( shape ){// Get the geometryDzGeometry *geometry = shape->getGeometry();} }// Else if we don't have an objectelse{// Provide feedbackQMessageBox::warning(dzApp->getDialogParent(),tr("Resource Error"), tr("The selected item has no object."), QMessageBox::Ok );}}// Else if a node is not selectedelse{// Provide feedbackQMessageBox::warning(dzApp->getDialogParent(),tr("Selection Error"), tr("You must have a node in the scene selected."), QMessageBox::Ok );}

If you want to limit which DzNode subclasses you get the object from, you can use something like…

// If the node can be cast to a [weight mapped] DzFigureif( DzFigure *figure = qobject_cast<DzFigure*>(node) ){// Get the objectobject = figure->getObject();}// Else if the node can be cast to a [parametric] DzLegacyFigureelse if( DzLegacyFigure *legacyFigure = qobject_cast<DzLegacyFigure*>(node) ){// Get the objectobject = legacyFigure->getObject();}// Else if the node can be cast to a DzSkeletonelse if( DzSkeleton *skeleton = qobject_cast<DzSkeleton*>(node) ){// Get the objectobject = skeleton->getObject();}