View Full Version : Query Layer Override Value
09 September 2010, 03:57 PM
Is there anyway to query the value of a layer override from the masterLayer?
For instance I can find out if layer2 has a override through:
print cmds.editRenderLayerAdjustment('layer2', q=1)
This would result in my overrides list.
So how can I getAttr for blinn1.color on layer2 while on masterLayer?
11 November 2010, 01:39 PM
Hey, did somebody find a solution to this? I am having the same problem.
11 November 2010, 03:19 PM
I ended up cycling through each render layer then querying. It works but I dont like it, since, it actually modifies the scene and asks the user if he/she wants to save the changes (even when there are none).
11 November 2010, 03:24 PM
Ok thanks, I guess there isn't even another may to do it, because Maya actually has to update the DAG to evaluate the if there is a override...
11 November 2010, 10:38 PM
You can query the overrides without switching layers by simply doing a getAttr layerName.adjustments[index].value where index represents the array number for that specific override. I use this method in my abxRenderLayers (http://www.creativecrash.com/maya/marketplace/scripts-plugins/rendering/misc/c/abxrenderlayers--2) script.
allot of other tricks are necessary to handle connection and shader overrides though.
11 November 2010, 12:00 AM
Very nice. Although, with some quick testing it seems like the value does not get updated unless another layer has been selected after setting the override value atleast once. (No such problem with pymel.)
11 November 2010, 01:49 PM
Thats really interresting, and it sorta works.
But if I make an override on start/end frame in render globals and query it from the masterLayer I get values that are 1/25 of the actual value. So if i've set the override on startframe to 250, I get 10 when I query it with getAttr layerName.adjustments.value.
05 May 2011, 09:35 AM
I am also interested in finding the start/end frame on each renderlayer.
How do I know what index those have?
Is the index constant or changes depending on the order the overrides was created?
is there any documentation for the adjustments attribute?
05 May 2011, 05:13 PM
I believe if you query the defaultRenderManager's out connections to the layer your interested in it will tell you the index of the value on the layer.
from pymel.core import *
for eachLayer in layerOverrides:
__print value, getAttr(value)
unfortunately, as mentioned that attr doesn't seem to be stored as integers as expected. also apparently you will need to change to a different render layer before these attrs get updated
In otherwords, you just need to trace the connections one way or the other.
05 May 2011, 05:13 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.