How to clean up "Render Stats" of all geometry in Maya?

Mar 5 2009

animationpython

No matter what renderer you are going to use, you should take care of geometry’s “Render Stats” before rendering, especially when you are planning to decompose a rendering job into several layers/passes. Here is a quick python scripts based on pymel to do that.

from pymel import *

def dgVerifyRenderStats(surfaces=None):
    '''
dgVerifyRenderStats

deps: none

verify and adjust all surface's render stats.
double sided, opposite, smooth shading, motion blur
visible in reflections/refractions, casts/receive shadows
primary visibility
    '''
    def _verifier(surface):
        surface.doubleSided.set(0)
        surface.opposite.set(0)
        surface.smoothShading.set(1)
        surface.motionBlur.set(1)
        surface.visibleInReflections.set(1)
        surface.visibleInRefractions.set(1)
        surface.castsShadows.set(1)
        surface.receiveShadows.set(1)
        surface.primaryVisibility.set(1)

    # save the selection
    selections = ls(selection=True)

    if surfaces is None:
        surfaces = ls(long=True, type='surfaceShape')
    map(_verifier, surfaces)

    # restore the selection
    select(selections, r=True)
comments powered by Disqus