the overrides are for the entire layer, so if the shape is part of that
layer it gets the layer setting
this code should do what you need

print '*****************'
print '-1 = uses scene'
print '0 = override on'
print '1 = override off'
print '*****************'

attrs = ['castsShadows', 'receiveShadows', 'motionBlur',
'primaryVisibility', 'smoothShading', 'visibleInRefractions',
'visibleInReflections', 'doubleSided', 'opposite', 'depthJitter',
'ignoreSelfShadowing']
values = []

layer = 'layer2'
script = cmds.getAttr('%s.attributeOverrideScript' % layer)
splits = script.split(' ')

for s in splits:
    temp = s.split('=')
    value = -1
    for a in attrs:
        if temp[0] == a:
            value = int(temp[1])
            break
    values.append(value)

for i in range(len(attrs)):
    print '%s = %d' % (attrs[i], values[i])


On Fri, Sep 3, 2010 at 10:48 AM, Dave Nunez <[email protected]> wrote:

> Hey guys, have been trying to query layer overrides attrs and I can't
> find where the attribute overrides are.
>
> from the docs,
>
> # Query the current layer for the list of adjustments
> cmds.editRenderLayerAdjustment( query=True, alg=True )
> # castsShadows         nurbsSphereShape1.castsShadows
> #                      pPlaneShape1.castsShadows
> #                      pSphereShape1.castsShadows
> # instObjGroups        pCylinderShape1.instObjGroups[0]
> # motionBlurByFrame    defaultRenderGlobals.motionBlurByFrame
> # receiveShadows       nurbsSphereShape1.receiveShadows
> #                      pPlaneShape1.receiveShadows
> #                      pSphereShape1.receiveShadows
> # shadingSamples       defaultRenderQuality.shadingSamples
>
>
> so from the example above, how would I get the
> pPlaneShape1.castsShadows attr for that render layer.
>
> I could switch layers using the gui and get the attrs that way but
> that would take a long time.
>
> Cheers, -d
>
>
> --
> When things get too complicated, it sometimes makes sense to stop and
> wonder: Have I asked the right question?
> -Enrico Bombieri
>
> --
> http://groups.google.com/group/python_inside_maya
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to