I got this great question the other day, it may seem simple however that is what is so great about the question.
Everyone thinks it's so simple that no one ever writes about it!
What do you do in Maya once you use the Plug-in Manager or the MEL command loadPlugin to load your plug-in.
Once you have loaded your plug-in, shhh, this is the part no one tells you, you still have to create your node in the scene!
To do this you can use the MEL command ‘createNode {nodename}’ so for example to create any Maya default node you could do this:
createNode Transform;
Here we are creating a standard node that comes with Maya (there are hundreds), the name of the node matches the node name in the documentation under Nodes and Attribute Reference, which you can access from the standard help documentation that comes with Maya:
But you can also use this createNode for custom nodes that you creating using the Maya API. Let’s say you have compiled the Devkit sample ‘pnTrianglesNode’, you would do this after loading the plug-in:
createNode pnTriangles;
One you run this command, the node is now actually in your Maya scene, and will be saved there on scene save. From here you just need to connect other nodes to this node in your scene.
Also, the other way to create nodes in the API is to use the class MDGModifier, there is a method there called createNode.
~Kristine





Subscribe
Comments