[maya] [python] finding overridden parameters in Maya

Hi there,

I recently wrote a tool using Python in Maya, that would display and create a ui for the overriden parameters of a render layer, so that the artist would know what is actually being performed in a render layer… kind of like ‘take list’ of Houdini. the backbone of it is ‘editRenderLayerAdjustment’ command which queries the adjustments to given render layers. The problem is that this command doesn’t provide a full dag path to the object, so in case there are adjustments on objects with the same name on a render layer, it fails to handle the situation. So I am wondering if there is a way out there (maybe Maya API?) that can help me find out exactly which objects that I receiving from this command or maybe another command that would do the job… Any ideas?

Thanks!

Can you use editRenderLayerMembers -q -fn ?

thanks for the reply! editRenderLayerMembers command still doesn’t help too much as I might have 10 different object with the same name as a member in the render layer, and there is still no way for me to know which of them have their parameters overridden. Though -fn command is exactly what I am looking for, it is a shame that ‘editRenderLayerAdjustment’ doesn’t accept that flag.

I’m not familiar with the command, so this is a stab in the dark: What if you use the PyMEL version of the command? Does it return PyNodes?

Otherwise, is it possible for you to rename the objects to be unique?

Hi Chris thanks for the reply… As we deal with lots of referenced objects, renaming is not a viable option. as for the pyMel, I am not really familiar with it, but the help page for the command suggests that it returns similar values that cmds equivalent does. (in fact it says it is based on the cmds command, not a maya api call or anything like that ( Support and Problem Solving | Autodesk Support) )

Yes, but for instance, the ls() command also says it is derived from maya.cmds but when you use it, it returns PyNodes which are pointers to the actual object, rather than a string.

I don’t know what to do in order to test this command, otherwise I’d try it out. If it outputs PyNodes, then the name or the uniqueness thereof doesn’t matter. I notice that the input argument for layer is “PyNode” so I’d say this is worth a test.

edit:


import pymel.core as pm
pm.editRenderLayerAdjustment(and use whatever arguments you were using. If it returns a list, do a type() test on one of the items and see if it is a PyNode)

http://download.autodesk.com/global/docs/maya2012/en_us/PyMel/pynodes.html#pynodes-are-not-strings

hey thanks for the pymel code snippet! unfortunately unlike the -ls command, the cmds implementation of the editRenderLayerAdjustment command doesn’t handle full names so the pymel made no difference. It returns a list of unicodes. and I think I discovered a bug in maya as well (tested this in 2011 and 2012)

If you have objects of same names (say under different named groups), if you override the parameters of one of them in a render layer(say translateY), then the other object with the same name gets the same parameter overriden as well :S

[QUOTE=geminiPrevails;16562] I think I discovered a bug in maya as well (tested this in 2011 and 2012)

If you have objects of same names (say under different named groups), if you override the parameters of one of them in a render layer(say translateY), then the other object with the same name gets the same parameter overriden as well :S[/QUOTE]

I’ve seen this behavior in hypergraph/hypershade when using nodes that have the same name under different hierarchies. The UI will display one node, but you’re actually affecting another.

[QUOTE=patconnole;16563]I’ve seen this behavior in hypergraph/hypershade when using nodes that have the same name under different hierarchies. The UI will display one node, but you’re actually affecting another.[/QUOTE]

thanks for sharing this, I will be extra careful from now on when there are objects with same names involved…

Hey, can you apply namespaces to your nodes to differentiate them? You could do this temporarily, then remove them when you are done…

Hi, thanks for the reply… that’s a cool idea, I should try that, or maybe even try to have an internal representation for objects with same name in the tool itself to differentiate them.