Thanks for the help Chad. Just to clarify, the docs also say this callback is obsolete and to use another method that when I click it, it takes me to the same deprecated one - this also happens in addNodeDirtyCallback. What should we use instead?
Richard On Sat, Nov 28, 2009 at 7:38 PM, Chad Vernon <[email protected]> wrote: > You could create a flag to only get it once in the compute method. Or you > could create a callback MNodeMessage::addNameChangedCallback which gets > called whenever the name changes. Unfortunately, the docs say it's not > available in Python. > > -Chad > > On Wed, Nov 25, 2009 at 6:52 AM, Richard Kazuo <[email protected]>wrote: > >> Hi all, I was wondering how I could get access to a created node's name in >> Maya's DG. >> >> I tried getting it using the *self.name()* method inside the *__init__*and >> that crashes Maya. I checked the MPxNode documentation and it says the >> node is not yet created in the constructor, so it makes sense. The docs say >> I should use the *postConstructor *method, but I tried it and it doesn't >> give me the name - I can only access it on the *compute *method. >> >> This is what I used to test: >> >> class testNode(OpenMayaMPx.MPxNode): >> def __init__(self): >> #print 'constructor>', self.name() #this crashes Maya >> OpenMayaMPx.MPxNode.__init__(self) >> >> def postConstructor(self): >> print 'post constructor>', self.name() >> >> def compute(self,plug,dataBlock): >> print 'compute>', self.name() >> >> >> Maya only prints out the node name in the compute section. >> Any thoughts on how I could get the node's name only once (outside the >> compute)? I can access *self.typeName()* though. Maybe I'm messing with >> something I shouldn't? >> >> Thanks in advance, >> Richard >> >> >> -- >> http://groups.google.com/group/python_inside_maya >> > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
