Hi,

I'd like to change the default attribute values of a certain node type, but 
because of an existing asset library I can't simply change the defaults in 
the plugin, because that would break existing Maya scenes. I tried using 
OpenMaya.MDGMessage.addNodeAddedCallback() to setup a callback to change 
the attributes after node creation and it works ok, but the problem is that 
the callback executes not only when a new node is created by hand (or 
script) but also when a scene file is loaded / imported / referenced. I 
could disable the callback for scene load using another callback (yuck!) 
but it sounds like its leading into a mess of callbacks fighting with each 
other. I'm also not super happy about having a callback that examines the 
node type of every created node either, I'm afraid that it would slow down 
some scripts.

So the question is: is there a bulletproof solution for doing something 
like this? Or are there any tricks to check the reason of the 
addNodeAddedCallback being called? Or should I simply hijack createNode and 
shadingNode commands and wrap them into custom code (for both mel and 
python)? Any suggestion is much appreciated!

Cheers,
Szabolcs

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/2bd95713-2224-4b8f-8dfb-cf74b0f275a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to