Does anyone know any scripting to change a layer override attribute value without actually having that render Layer active?
So active Render Layer is A and I am going to set an objects primary ray off/on for Render Layer B.
Thanks
Jacob
Sorry no one has replied to this. I will take a stab. Do you mean how to change RenderLayer Member Overrides, programmatically?
Like this?
cmds.setAttr("layer1.attributeOverrideScript", "primaryVisibility=", type="string")
cmds.setAttr("layer1.attributeOverrideScript", "primaryVisibility=0", type="string")
cmds.setAttr("layer1.attributeOverrideScript", "primaryVisibility=1", type="string")
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/44926a6c-88b8-4b0a-a7b0-630281b1d91b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I usually do it like this (sort of):
current_layer = cmds.editRenderLayerGlobals( query=True, currentRenderLayer=True ) # Register the currently active render layer
cmds.editRenderLayerGlobals(currentRenderLayer='renderLayerA') # step to renderLayerA
cmds.setAttr('vraySettings.primaryEngine', 0) # Set some value
cmds.editRenderLayerAdjustment('vraySettings.primaryEngine') # Create the override
...
...
...
cmds.editRenderLayerGlobals(currentRenderLayer=current_layer) # Step back to the renderlayer you had active before running the script
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0zfs42JLKV2NwXFPUvgdfK_J8%3D31YjhFgabzyJcYNieg%40mail.gmail.com.
I usually do it like this (sort of):
current_layer = cmds.editRenderLayerGlobals( query=True, currentRenderLayer=True ) # Register the currently active render layer cmds.editRenderLayerGlobals(currentRenderLayer='renderLayerA') # step to renderLayerA cmds.setAttr('vraySettings.primaryEngine', 0) # Set some value cmds.editRenderLayerAdjustment('vraySettings.primaryEngine') # Create the override ... ... ... cmds.editRenderLayerGlobals(currentRenderLayer=current_layer) # Step back to the renderlayer you had active before running the script
On Wed, Oct 29, 2014 at 10:52 PM, Justin Israel <justin...@gmail.com> wrote:
Sorry no one has replied to this. I will take a stab. Do you mean how to change RenderLayer Member Overrides, programmatically?
Like this?
cmds.setAttr("layer1.attributeOverrideScript", "primaryVisibility=", type="string") cmds.setAttr("layer1.attributeOverrideScript", "primaryVisibility=0", type="string") cmds.setAttr("layer1.attributeOverrideScript", "primaryVisibility=1", type="string")
On Tue, Oct 28, 2014 at 10:41 PM, <jacob...@gmail.com> wrote:
Hi all
Does anyone know any scripting to change a layer override attribute value without actually having that render Layer active?
So active Render Layer is A and I am going to set an objects primary ray off/on for Render Layer B.
Thanks
Jacob
--
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 python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/44926a6c-88b8-4b0a-a7b0-630281b1d91b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 python_inside_maya+unsub...@googlegroups.com.
def get_attr_in_layer(attr=None, layer=None):Old thread, but I stumbled upon this recently.
Thanks to the layer.adjustments hint from Justin in this thread, I’m now fetching overrides without stepping to a renderlayer (yay!):
def get_overrides(layer):
overrides = {}
c = 0
for plug in cmds.listConnections(layer+'.adjustments', destination=False, source=True, plugs=True):
print 'Override found:', plug
adjusted_values = []
attr_values = cmds.getAttr(layer+'.adjustments[' + str(c) + ']')
for attr_value in attr_values:
unadjusted_value = attr_value[0]
adjusted_value = attr_value[1]
adjusted_values.append(adjusted_value)
overrides[plug] = adjusted_values
c += 1
return overrides
overrides = get_overrides(layer='defaultRenderLayer')
Right now, this function returns any overrides for the given render layer.
Figured I’d share this.
Cheers,
Fredrik
Looking at the history it seems the others offered far more than I did on this one.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWMEgRHkY3BkAfMC9%2B_xR53bVsOmMGsvcz7xOY4B40Nt1A%40mail.gmail.com.
Just stumbled upon a weird one.
When you cmds.getAttr('defaultRenderglobals.endframe') you get e.g. 1, if your end frame is set to 1.
However, and this is the weird part, if you have an override in a render layer and you use the snipped I just previously posted to fetch it, you won’t get an integer back. Instead you’ll get a float. At first glance it looks like you’re getting 1/25 of the actual value back. But if you try different endframe values, you’ll see that this factor changes.
Does anyone on here know how this value is actually stored in Maya?
Cheers,
Fredrik