nodeFn.setName(“myNodeTypeShape#”);
}
"
Been REALLY picky, I am am wondering if this is the only solution available, because that method rename my node AFTER creation, not AT CREATION.
Is that how Maya function internally when creating a standard Maya Node?
The postConstructor() setName method is what I use for my custom nodes.
Maya calls the postConstructor as soon as the actual constructor has finished. You can not set the name any sooner as the node will not exist yet. From the perspective of a user or MEL/Python script calling the createNode command they will only ever see the object with the ‘setName’ name.
What’s also not made clear in the docs is the ‘Shape’ and ‘#’ are magic words.
When Maya sees the word ‘Shape’ in the name of a node (via ‘setName’ c++ command or ‘createNode -n’ MEL command) it will rename the parent transform node to match the name given, with the word ‘Shape’ removed from the name. See example below. When Maya sees a ‘#’ in the name it will replace it with an auto numbering that makes the name unique among sibling nodes.
This is the info I was searching for, naming my name as early as possible:
[QUOTE=Keir Rice;7519]
Maya calls the postConstructor as soon as the actual constructor has finished. You can not set the name any sooner as the node will not exist yet.
[/QUOTE]