[C++ API] Possible to iterate over the group node in maya dag?

cplusplus
cpp
maya

#1

Been looking for a little while at how to access the Group node in the Dag for the Maya API, can’t seem to find it.

I wan’t to check the scenes for these group nodes:


#2

Those nodes are transform nodes that do not have shapes, so you’ll have to check for relatives that are shape nodes.


#3

So then would I be able to use MFn::kTransform? and then check the api class (I’m guessing?)


#4

So in C++ once you have a transform node (through checking if the object that you’re iterating over is an MFn:kTransform), you can get it’s shape using extendToShape. If that returns a null then it is most likely a group node. BUT, there isn’t a true and full way to tell.

There are operations in Maya that can create empty transform nodes, like splitting mesh into it’s separate components. This will return in the example I give above and, depending on your use case, then likely be an error to you.


#5

Perfect, thank you so much!