I am creating my own mesh modifier node in Maya, and I want the new node to be automatically selected when it is created. An example of what I mean is Maya’s extrude node: when you select some faces and do extrude, the new node “polyExtrudeFace1” is selected in the channel box, so you can see all of its attributes. When I create my custom node, it is not automatically selected. The user has to click on it before the attributes are shown.
I tried to follow the instructions here: http://ewertb.soundlinker.com/api/api.033.php
But every time my code gets to the “getAPathTo” function, I get an error “RuntimeError: (kInvalidParameter): Object is incompatible with this method”
I think it is because my MObject has a type of kPluginDependNode. But I always get confused when it comes to MObjects.
# myNode is an MObject
print myNode.apiTypeStr() # prints kPluginDependNode
print myNode.hasFn(OpenMaya.MFn.kDagNode) # prints False
So my question is:
How can I get a DAG path to my custom node?
- OR -
Is there some other way to add my custom node to the active selection, without having to get a DAG path?