PDA

View Full Version : Query Layer Override Value


fallenrelics
09-23-2010, 04: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)
[u'blinn1.color', u'pSphereShape1.instObjGroups[0]']

This would result in my overrides list.
So how can I getAttr for blinn1.color on layer2 while on masterLayer?

Stringkeeper
11-09-2010, 01:39 PM
Hey, did somebody find a solution to this? I am having the same problem.

fallenrelics
11-09-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).

Stringkeeper
11-09-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...

jadamburke
11-15-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.

fallenrelics
11-16-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.)

Jacobborsting
11-16-2010, 01:49 PM
@jadamburke:
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[0].value.

Pietas
05-19-2011, 10: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?

fallenrelics
05-25-2011, 06: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 *
layerOverrides=listConnections("defaultRenderGlobals.endFrame", plugs=1)
for eachLayer in layerOverrides:
__value=eachLayer.replace("plug", "value")
__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.

CGTalk Moderation
05-25-2011, 06: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.