Ejemplo n.º 1
0
def sag_magicFGLayer(mode, chanList):
    if mode:
        ind = sag_magicLayer_promptReplace()
        if ind != '':
            chanList = ind.split()
        else:
            confirmDialog(title='Error',
                          message='Incorrect numbers specified!',
                          button=['Cancel'])
            return

    for chan in chanList:
        rLay = duplicate('magic', inputConnections=True)
        rLay = rename(rLay, 'magic_' + str(chan) + '_fg')
        editRenderLayerGlobals(currentRenderLayer=rLay)

        sag_exrCube('disable')

        ibl = listConnections('mentalrayGlobals.imageBasedLighting',
                              s=True,
                              d=False)
        if ibl != None:
            editRenderLayerAdjustment(ibl[0] + '.colorGain')
            setAttr(ibl[0] + '.colorGain', 0, 0, 0, type='double3')

        for shd in ls('magic_shading:*', type='mip_rayswitch'):
            if not ('magic_shading:magic_' + str(chan) + '_') in shd:
                conn = listConnections(shd + '.finalgather',
                                       s=True,
                                       d=False,
                                       c=True,
                                       p=True)
                if conn != None:
                    editRenderLayerAdjustment(shd + '.finalgather')
                    disconnectAttr(conn[1], conn[0])
Ejemplo n.º 2
0
def sag_magicFGLayer( mode, chanList ):
        if mode:
                ind = sag_magicLayer_promptReplace()
                if ind != '':
                        chanList = ind.split()
                else:
                        confirmDialog( title = 'Error', message = 'Incorrect numbers specified!', button = ['Cancel'] )
                        return

        for chan in chanList:
                rLay = duplicate( 'magic', inputConnections = True )
                rLay = rename( rLay, 'magic_' + str( chan ) + '_fg' )
                editRenderLayerGlobals( currentRenderLayer = rLay )

                sag_exrCube( 'disable' )

                ibl = listConnections( 'mentalrayGlobals.imageBasedLighting', s = True, d = False )
                if ibl != None:
                        editRenderLayerAdjustment( ibl[0] + '.colorGain' )
                        setAttr( ibl[0] + '.colorGain', 0, 0, 0, type = 'double3' )

                for shd in ls( 'magic_shading:*', type = 'mip_rayswitch' ):
                        if not ('magic_shading:magic_' + str( chan ) + '_') in shd:
                                conn = listConnections( shd + '.finalgather', s = True, d = False, c = True, p = True )
                                if conn != None:
                                        editRenderLayerAdjustment( shd + '.finalgather' )
                                        disconnectAttr( conn[1], conn[0] )
Ejemplo n.º 3
0
def sag_magicLayer(envName):
    select(clear=True)

    # ENVIRONMENT TO TURN INTO MAGIC
    env = [
        'shot:Ridge:location',
        's:/SAVVA/Locations_Compilation/Woodland/Ridge/data/Ridge_magic_shading.mb'
    ]
    if envName == 'Forest_Night_02':
        env = [
            'shot:Forest_Night_02:location',
            's:/SAVVA/Locations_Compilation/Woodland/Forest_Night_02/data/Forest_Night_02_magic_shading.mb'
        ]
    elif envName == 'Angatsetus_field':
        env = [
            'shot:Angatsetus_field:location',
            's:/SAVVA/Locations_Compilation/Woodland/Angatsetus_field/data/Angatsetus_field_magic_shading.mb'
        ]

    # CREATE RENDER LAYER MAGIC
    createRenderLayer(name='magic', empty=True, g=True, makeCurrent=True)

    editRenderLayerAdjustment('miDefaultOptions.forceMotionVectors')
    setAttr('miDefaultOptions.forceMotionVectors', 0)

    editRenderLayerAdjustment('miDefaultOptions.finalGather')
    setAttr('miDefaultOptions.finalGather', 1)

    editRenderLayerAdjustment('miDefaultOptions.finalGatherRays')
    setAttr('miDefaultOptions.finalGatherRays', 300)

    editRenderLayerAdjustment('miDefaultOptions.finalGatherPresampleDensity')
    setAttr('miDefaultOptions.finalGatherPresampleDensity', 0.3)

    editRenderLayerAdjustment('miDefaultOptions.finalGatherPoints')
    setAttr('miDefaultOptions.finalGatherPoints', 20)

    editRenderLayerAdjustment('miDefaultFramebuffer.gamma')
    setAttr('miDefaultFramebuffer.gamma', 1.0)

    editRenderLayerAdjustment('miDefaultOptions.scanline')
    setAttr('miDefaultOptions.scanline', 0)

    editRenderLayerAdjustment('miDefaultOptions.rayTracing')
    setAttr('miDefaultOptions.rayTracing', 1)

    sag_exrCube('masks')

    # HIDE ALL ROOT OBJECTS EXCEPT FOR SOME SPECIFIC ONES
    for each in ls('|*', type='transform') + ls(
            '|*:*', type='transform', long=True) + ls('|*:*:*',
                                                      type='transform'):
        if not each in [
                env[0], 'exrLayerCube', 'persp', 'top', 'side', 'front'
        ] and each.find('shot:cam:') < 0:
            setAttr(each + '.v', 0)

    # REFERENCE MAGIC NETWORK
    file(env[1], reference=True, namespace='magic_shading')
    nm = file(env[1], query=True, namespace=True)

    # ASSIGN DEFAULT RAYSWITCH TO EVERYTHING
    envSGs = ls(env[0][:env[0].rfind(':')] + ':*', type='shadingEngine') + ls(
        env[0][:env[0].rfind(':')] + ':*:*', type='shadingEngine') + ls(
            env[0][:env[0].rfind(':')] + ':*:*:*', type='shadingEngine') + ls(
                env[0][:env[0].rfind(':')] + ':*:*:*:*', type='shadingEngine')

    shd = nm + ':magic_0_default_rayswitch'

    if objExists(shd):
        for each in envSGs:
            conns = listConnections(each + '.miMaterialShader',
                                    s=True,
                                    d=False,
                                    p=True,
                                    c=True)
            if conns != None:
                editRenderLayerAdjustment(each + '.miMaterialShader')
                if not isConnected(shd + '.message',
                                   each + '.miMaterialShader'):
                    connectAttr(shd + '.message',
                                each + '.miMaterialShader',
                                force=True)

            conns = listConnections(each + '.miLightMapShader',
                                    s=True,
                                    d=False,
                                    p=True,
                                    c=True)
            if conns != None:
                editRenderLayerAdjustment(each + '.miLightMapShader')
                disconnectAttr(conns[1], conns[0])

            conns = listConnections(each + '.miShadowShader',
                                    s=True,
                                    d=False,
                                    p=True,
                                    c=True)
            if conns != None:
                editRenderLayerAdjustment(each + '.miShadowShader')
                disconnectAttr(conns[1], conns[0])

    # ASSIGN SPECIFIC RAYSWITCHES
    raySwchs = ls(nm + ':magic*', type='mip_rayswitch')
    raySwchs.remove(shd)

    for each in raySwchs:
        sgs = getAttr(each + '.magic_sg').split()
        for sg in sgs:
            connectAttr(each + '.message',
                        sg + '.miMaterialShader',
                        force=True)
Ejemplo n.º 4
0
def sag_renderSetup_create(lay, **attrs):
    # DESELECT EVERYTHING
    select(clear=True)

    # CREATE RENDER LAYER & SET IT'S SETTINGS
    createRenderLayer(name=lay, empty=True, g=attrs['glob'], makeCurrent=True)

    if 'mvec' in attrs:
        editRenderLayerAdjustment('miDefaultOptions.forceMotionVectors')
        setAttr('miDefaultOptions.forceMotionVectors', attrs['mvec'])

    if 'fg' in attrs:
        editRenderLayerAdjustment('miDefaultOptions.finalGather')
        setAttr('miDefaultOptions.finalGather', attrs['fg'])

    if 'gamma' in attrs:
        editRenderLayerAdjustment('miDefaultFramebuffer.gamma')
        setAttr('miDefaultFramebuffer.gamma', attrs['gamma'])

    if 'scan' in attrs:
        editRenderLayerAdjustment('miDefaultOptions.scanline')
        setAttr('miDefaultOptions.scanline', attrs['scan'])

    if 'rayt' in attrs:
        editRenderLayerAdjustment('miDefaultOptions.rayTracing')
        setAttr('miDefaultOptions.rayTracing', attrs['rayt'])

    setAttr('defaultRenderGlobals.imageFormat', 51)
    editRenderLayerAdjustment('defaultRenderGlobals.imageFormat')

    setAttr('miDefaultFramebuffer.datatype', 16)
    editRenderLayerAdjustment('miDefaultFramebuffer.datatype')

    setAttr('miDefaultOptions.motionBlur', 0)
    setAttr('mentalrayGlobals.exportCustomMotion', 0)
    setAttr('mentalrayGlobals.exportMotionOffset', 0)
    setAttr('mentalrayGlobals.exportMotionOutput', 0)

    setAttr('defaultRenderGlobals.imageFilePrefix', '', type='string')
    setAttr('defaultRenderGlobals.animation', 1)
    setAttr('defaultRenderGlobals.animationRange', 1)
    setAttr('defaultRenderGlobals.startFrame', 1)
    setAttr('defaultRenderGlobals.endFrame', 1)
    setAttr('defaultRenderGlobals.extensionPadding', 4)
    setAttr('defaultRenderGlobals.outFormatControl', 0)
    setAttr('defaultRenderGlobals.enableDefaultLight', 0)

    # SETUP EXR CUBE
    maya.mel.eval('SetupEXRexport')
    if 'exr' in attrs:
        sag_exrCube(attrs['exr'])

    # SETUP CAMERAS BACKGROUND
    if 'camBg' in attrs:
        cams = ls(type=['camera', 'stereoRigCamera'])
        for cam in ['perspShape', 'frontShape', 'sideShape', 'topShape']:
            cams.remove(cam)

        for cam in cams:
            if listConnections(cam + '.backgroundColorR', s=True,
                               d=False) == None:
                editRenderLayerAdjustment(cam + '.backgroundColor')
                setAttr(cam + '.backgroundColor',
                        attrs['camBg'][0],
                        attrs['camBg'][1],
                        attrs['camBg'][2],
                        type='double3')

    # SORT OBJECTS IN THE ROOT OF THE SCENE
    roots = {'cams': [], 'envs': [], 'chars': [], 'misc': []}
    core = ['exrLayerCube', 'persp', 'top', 'side', 'front']

    for each in ls('|*', type='transform') + ls(
            '|*:*', type='transform', long=True) + ls('|*:*:*',
                                                      type='transform'):
        if referenceQuery(each, isNodeReferenced=True):
            filePath = referenceQuery(each, filename=True)
            if each.find('shot:cam:') > -1:
                roots['cams'].append(each)
            elif 'locations_compilation' in filePath.lower():
                roots['envs'].append(each)
            elif 'characters' in filePath.lower():
                roots['chars'].append(each)
            else:
                roots['misc'].append(each)
        else:
            if not each in core:
                roots['misc'].append(each)

    # HIDE ALL ROOT OBJECTS EXCEPT FOR NEEDED ONES
    if 'keep' in attrs:
        toHide = roots['misc'][:]
        if not 'envs' in attrs['keep']:
            toHide += roots['envs']
        if not 'chars' in attrs['keep']:
            toHide += roots['chars']
        for each in toHide:
            setAttr(each + '.v', 0)

    # TURN OFF PRIMARY VISIBILITY FOR SPECIFIED TYPES
    if 'primVisOff' in attrs:
        for each in attrs['primVisOff']:
            for eachRoot in roots[each]:
                select(eachRoot, replace=True)
                sag_utils_hiGeo()
                for eachGeo in ls(sl=True):
                    setAttr(eachGeo + '.primaryVisibility', 0)
        select(clear=True)

    # ASSIGN NEW SHADING TO SPECIFIED TYPES
    if 'shade' in attrs:
        sag_auxShaders()
        for eachPair in attrs['shade']:
            for eachRoot in roots[eachPair[0]]:
                sag_renderSetup_shade(eachRoot, eachPair[1])
        select(clear=True)

    # SET HAIR MODE
    headCtrls = ls('*head_control') + ls('*:head_control') + ls(
        '*:*:head_control') + ls('*:*:*:head_control') + ls(
            '*:*:*:*:head_control') + ls('*:*:*:*:*:head_control')
    if 'hair' in attrs:
        for each in headCtrls:
            if attributeQuery('hair', node=each, exists=True):
                editRenderLayerAdjustment(each + '.hair')
                setAttr(each + '.hair', attrs['hair'])

    # ENV
    if lay == 'env':
        if objExists('env_lights_grp'):
            setAttr('env_lights_grp.v', 1)

    # CHARS
    if lay in ['chars', 'furry']:
        for eachRoot in roots['envs']:
            select(eachRoot, replace=True)
            sag_utils_hiGeo()
            sag_utils_castReceiveOverride(
                'set', ['miTransparencyCast', 'transparency'])
        select(clear=True)
        if lay == 'furry':
            setAttr('miDefaultOptions.rapidSamplesCollect', 10)
            #editRenderLayerAdjustment( 'miDefaultOptions.rapidSamplesCollect' )

            setAttr('miDefaultOptions.rapidSamplesShading', 6)
            #editRenderLayerAdjustment( 'miDefaultOptions.rapidSamplesShading' )

            inds = getAttr('miDefaultOptions.stringOptions', multiIndices=True)
            for ind in inds:
                if getAttr('miDefaultOptions.stringOptions[' + str(ind) +
                           '].name') == 'rast transparency depth':
                    if int(
                            getAttr('miDefaultOptions.stringOptions[' +
                                    str(ind) + '].value')) < 64:
                        setAttr('miDefaultOptions.stringOptions[' + str(ind) +
                                '].value',
                                64,
                                type='string')
        elif lay == 'chars':
            editRenderLayerAdjustment('miDefaultOptions.maxSamples')
            setAttr('miDefaultOptions.maxSamples', 3)

            editRenderLayerAdjustment('miDefaultOptions.finalGatherRays')
            setAttr('miDefaultOptions.finalGatherRays', 750)

            editRenderLayerAdjustment(
                'miDefaultOptions.finalGatherPresampleDensity')
            setAttr('miDefaultOptions.finalGatherPresampleDensity', 1.0)

            editRenderLayerAdjustment('miDefaultOptions.finalGatherPoints')
            setAttr('miDefaultOptions.finalGatherPoints', 20)

            editRenderLayerAdjustment(
                'miDefaultOptions.finalGatherTraceDiffuse')
            setAttr('miDefaultOptions.finalGatherTraceDiffuse', 0)

    # OCCL AND SHADOW
    if lay in ['occl', 'shadow']:
        for eachRoot in roots['envs']:
            select(eachRoot, replace=True)
            sag_utils_hiGeo()
            if lay == 'occl':
                for eachGeo in ls(sl=True):
                    eachPar = listRelatives(eachGeo,
                                            parent=True,
                                            fullPath=True)[0]
                    if not attributeQuery('miLabel', node=eachPar,
                                          exists=True):
                        addAttr(eachPar,
                                ln='miLabel',
                                at='long',
                                keyable=True,
                                dv=13)
                    else:
                        editRenderLayerAdjustment(eachPar + '.miLabel')
                        setAttr(eachPar + '.miLabel', 13)
            elif lay == 'shadow':
                sag_utils_castReceiveOverride('set',
                                              ['castsShadows', 'shadow'])
                if objExists('env_lights_grp'):
                    setAttr('env_lights_grp.v', 1)
        select(clear=True)

    # CROSSMASK
    rgbShd = ['red_SHD', 'green_SHD', 'blue_SHD']
    if lay in ['crossMask']:
        for eachRoot in roots['envs']:
            sag_renderSetup_shade(eachRoot, 'black_SHD')

        i = 0
        for eachRoot in roots['chars']:
            sag_renderSetup_shade(eachRoot, rgbShd[(i % 3)])
            i += 1

    #EYEMASK
    if lay in ['eyeMask_rgb']:
        dup = duplicate('eyeMask_rgb', ic=True, name='eyeMask_hsv')
        for eachLay in ['eyeMask_rgb', 'eyeMask_hsv']:
            editRenderLayerGlobals(crl=eachLay)

            for eachRoot in roots['chars']:
                select(eachRoot, replace=True)
                sag_utils_hiGeo()
                eyes = []
                allTrs = []
                for eachGeo in ls(sl=True, long=True):
                    trs = listRelatives(eachGeo, parent=True)[0]
                    allTrs.append(trs)
                    for par in eachGeo.split('|')[1:]:
                        hist = listHistory(par)
                        for eachHist in hist:
                            if eachHist in headCtrls:
                                if not getAttr(trs + '.v', l=True):
                                    setAttr(trs + '.v', 0)
                    if eachGeo.find('eye') > -1 and eachGeo.find(
                            'GlassShape') > -1:
                        eyes.append(trs)
                select(eyes, replace=True)
                sag_eyeMasks(eachLay.split('_')[-1])

                allTrs = list(set(allTrs))
                for eachEye in eyes:
                    allTrs.remove(eachEye)
                sag_renderSetup_shade(allTrs, 'black_SHD')

    #DOFREFERENCE
    if lay in ['dofReference']:
        if objExists('env_lights_grp'):
            setAttr('env_lights_grp.v', 1)

        focDist = sag_renderSetup_prompt('Focus Distance',
                                         'Input focus distance:')
        if focDist == None or focDist == '':
            focDist = 100

        for cam in cams:
            if listConnections(cam + '.depthOfField', s=True, d=False) == None:
                editRenderLayerAdjustment(cam + '.depthOfField')
                setAttr(cam + '.depthOfField', 1)
            if listConnections(cam + '.focusDistance', s=True,
                               d=False) == None:
                editRenderLayerAdjustment(cam + '.focusDistance')
                setAttr(cam + '.focusDistance', float(focDist))
            if listConnections(cam + '.fStop', s=True, d=False) == None:
                editRenderLayerAdjustment(cam + '.fStop')
                setAttr(cam + '.fStop', 2)
            if listConnections(cam + '.focusRegionScale', s=True,
                               d=False) == None:
                editRenderLayerAdjustment(cam + '.focusRegionScale')
                setAttr(cam + '.focusRegionScale', 1)

            editRenderLayerAdjustment(cam + '.renderable')
            if cam == 'shot:cam:CCenterCamShape':
                setAttr(cam + '.renderable', 1)
            else:
                setAttr(cam + '.renderable', 0)

        editRenderLayerAdjustment('miDefaultOptions.maxSamples')
        setAttr('miDefaultOptions.maxSamples', 2)

        editRenderLayerAdjustment('miDefaultOptions.finalGatherRays')
        setAttr('miDefaultOptions.finalGatherRays', 100)

        editRenderLayerAdjustment(
            'miDefaultOptions.finalGatherPresampleDensity')
        setAttr('miDefaultOptions.finalGatherPresampleDensity', 1.0)

        editRenderLayerAdjustment('miDefaultOptions.finalGatherPoints')
        setAttr('miDefaultOptions.finalGatherPoints', 10)

        editRenderLayerAdjustment('miDefaultOptions.finalGatherTraceDiffuse')
        setAttr('miDefaultOptions.finalGatherTraceDiffuse', 2)
Ejemplo n.º 5
0
def sag_magicLayer( envName ):
        select( clear = True )

        # ENVIRONMENT TO TURN INTO MAGIC
        env = [ 'shot:Ridge:location', 's:/SAVVA/Locations_Compilation/Woodland/Ridge/data/Ridge_magic_shading.mb' ]
        if envName == 'Forest_Night_02':
                env = [ 'shot:Forest_Night_02:location', 's:/SAVVA/Locations_Compilation/Woodland/Forest_Night_02/data/Forest_Night_02_magic_shading.mb' ]
        elif envName == 'Angatsetus_field':
                env = [ 'shot:Angatsetus_field:location', 's:/SAVVA/Locations_Compilation/Woodland/Angatsetus_field/data/Angatsetus_field_magic_shading.mb' ]

        # CREATE RENDER LAYER MAGIC
        createRenderLayer( name = 'magic', empty = True, g = True, makeCurrent = True )

        editRenderLayerAdjustment( 'miDefaultOptions.forceMotionVectors' )
        setAttr( 'miDefaultOptions.forceMotionVectors', 0 )

        editRenderLayerAdjustment( 'miDefaultOptions.finalGather' )
        setAttr( 'miDefaultOptions.finalGather', 1 )

        editRenderLayerAdjustment( 'miDefaultOptions.finalGatherRays' )
        setAttr( 'miDefaultOptions.finalGatherRays', 300 )

        editRenderLayerAdjustment( 'miDefaultOptions.finalGatherPresampleDensity' )
        setAttr( 'miDefaultOptions.finalGatherPresampleDensity', 0.3 )

        editRenderLayerAdjustment( 'miDefaultOptions.finalGatherPoints' )
        setAttr( 'miDefaultOptions.finalGatherPoints', 20 )

        editRenderLayerAdjustment( 'miDefaultFramebuffer.gamma' )
        setAttr( 'miDefaultFramebuffer.gamma', 1.0 )

        editRenderLayerAdjustment( 'miDefaultOptions.scanline' )
        setAttr( 'miDefaultOptions.scanline', 0 )

        editRenderLayerAdjustment( 'miDefaultOptions.rayTracing' )
        setAttr( 'miDefaultOptions.rayTracing', 1 )

        sag_exrCube( 'masks' )

        # HIDE ALL ROOT OBJECTS EXCEPT FOR SOME SPECIFIC ONES
        for each in ls( '|*', type = 'transform' ) + ls( '|*:*', type = 'transform', long = True ) + ls( '|*:*:*', type = 'transform' ):
                if not each in [ env[0], 'exrLayerCube', 'persp', 'top', 'side', 'front' ] and each.find( 'shot:cam:' ) < 0:
                        setAttr( each + '.v', 0 )

        # REFERENCE MAGIC NETWORK
        file( env[1], reference = True, namespace = 'magic_shading' )
        nm = file( env[1], query = True, namespace = True )

        # ASSIGN DEFAULT RAYSWITCH TO EVERYTHING
        envSGs = ls( env[0][:env[0].rfind(':')] + ':*', type = 'shadingEngine' ) + ls( env[0][:env[0].rfind(':')] + ':*:*', type = 'shadingEngine' ) + ls( env[0][:env[0].rfind(':')] + ':*:*:*', type = 'shadingEngine' ) + ls( env[0][:env[0].rfind(':')] + ':*:*:*:*', type = 'shadingEngine' )

        shd = nm + ':magic_0_default_rayswitch'

        if objExists( shd ):
                for each in envSGs:
                        conns = listConnections( each + '.miMaterialShader', s = True, d = False, p = True, c = True )
                        if conns != None:
                                editRenderLayerAdjustment( each + '.miMaterialShader' )
                                if not isConnected( shd + '.message', each + '.miMaterialShader' ):
                                        connectAttr( shd + '.message', each + '.miMaterialShader', force = True )

                        conns = listConnections( each + '.miLightMapShader', s = True, d = False, p = True, c = True )
                        if conns != None:
                                editRenderLayerAdjustment( each + '.miLightMapShader' )
                                disconnectAttr( conns[1], conns[0] )

                        conns = listConnections( each + '.miShadowShader', s = True, d = False, p = True, c = True )
                        if conns != None:
                                editRenderLayerAdjustment( each + '.miShadowShader' )
                                disconnectAttr( conns[1], conns[0] )

        # ASSIGN SPECIFIC RAYSWITCHES
        raySwchs = ls( nm + ':magic*', type = 'mip_rayswitch' )
        raySwchs.remove( shd )

        for each in raySwchs:
                sgs = getAttr( each + '.magic_sg' ).split()
                for sg in sgs:
                        connectAttr( each + '.message', sg + '.miMaterialShader', force = True )
Ejemplo n.º 6
0
def sag_eyeMasks(mode):
    if mode in ['rgb', 'hsv']:
        sag_utils_hiGeo()
        sag_utils_selSG()

        sgList = ls(sl=True)

        for sg in sgList:
            hist = listHistory(sg)

            eyeShd = ''
            glassShd = ''
            for each in hist:
                if nodeType(each) == 'eyeShader':
                    eyeShd = each
                elif nodeType(each) == 'p_MegaTK':
                    glassShd = each

            if glassShd != '':
                refr_shd = glassShd.replace(':', '_') + '_eyeMask_rgb_refract'
                if not objExists(refr_shd):
                    shadingNode('mib_refract', asUtility=True, name=refr_shd)
                setAttr(refr_shd + '.refract', 1, 1, 1, type='double3')
                if not isConnected(glassShd + '.ior_in_refr',
                                   refr_shd + '.ior'):
                    connectAttr(glassShd + '.ior_in_refr',
                                refr_shd + '.ior',
                                force=True)
                if not isConnected(refr_shd + '.outValue',
                                   sg + '.miMaterialShader'):
                    editRenderLayerAdjustment(sg + '.miMaterialShader')
                    connectAttr(refr_shd + '.outValue',
                                sg + '.miMaterialShader',
                                force=True)

            if eyeShd != '':
                if mode == 'rgb':
                    # RGB MASK
                    red = ['.pupilColor']
                    green = [
                        '.centerColor1', '.centerColor2', '.peripheryColor1',
                        '.peripheryColor2', '.middleRingColor1',
                        '.middleRingColor2', '.bigRingColor1',
                        '.bigRingColor2', '.smallRingColor1',
                        '.smallRingColor2'
                    ]
                    blue = [
                        '.scleraColor1', '.scleraColor2', '.bloodVesselColor'
                    ]

                    eyeDup = eyeShd.replace(':', '_') + '_eyeMask_rgb'
                    if not objExists(eyeDup):
                        eyeDupTmp = duplicate(eyeShd, ic=True)[0]
                        rename(eyeDupTmp, eyeDup)

                    for attr in red + green + blue:
                        conns = listConnections(eyeDup + attr,
                                                s=True,
                                                d=False,
                                                p=True)
                        if conns != None:
                            disconnectAttr(conns[0], eyeDup + attr)
                        setAttr(eyeDup + attr,
                                attr in red,
                                attr in green,
                                attr in blue,
                                type='double3')

                    conns = listConnections(sg + '.miMaterialShader',
                                            s=True,
                                            d=False,
                                            p=True,
                                            c=True)
                    if conns != None:
                        if not isConnected(eyeDup + '.message',
                                           sg + '.miMaterialShader'):
                            editRenderLayerAdjustment(sg + '.miMaterialShader')
                            connectAttr(eyeDup + '.message',
                                        sg + '.miMaterialShader',
                                        force=True)

                    conns = listConnections(sg + '.miLightMapShader',
                                            s=True,
                                            d=False,
                                            p=True,
                                            c=True)
                    if conns != None:
                        editRenderLayerAdjustment(sg + '.miLightMapShader')
                        disconnectAttr(conns[1], conns[0])

                    conns = listConnections(sg + '.miShadowShader',
                                            s=True,
                                            d=False,
                                            p=True,
                                            c=True)
                    if conns != None:
                        editRenderLayerAdjustment(sg + '.miShadowShader')
                        disconnectAttr(conns[1], conns[0])

                elif mode == 'hsv':
                    # HSV MASK
                    hsv_mask = 'hsv_mask'
                    hsv_gamma = 'hsv_mask_gamma'
                    hsvToRgb = 'hsv_mask_hsvToRgb'
                    h_ramp = 'hsv_mask_hRamp'
                    sv_ramp = 'hsv_mask_svRamp'
                    hsv_place2d = 'hsv_mask_place2d'

                    if not objExists(hsv_mask):
                        shadingNode('gluk_constant',
                                    asShader=True,
                                    name=hsv_mask)
                    if not isConnected(hsv_mask + '.message',
                                       sg + '.miMaterialShader'):
                        editRenderLayerAdjustment(sg + '.miMaterialShader')
                        connectAttr(hsv_mask + '.message',
                                    sg + '.miMaterialShader',
                                    force=True)

                    if not objExists(hsv_gamma):
                        shadingNode('gammaCorrect',
                                    asUtility=True,
                                    name=hsv_gamma)
                        setAttr(hsv_gamma + '.gamma',
                                0.4545,
                                0.4545,
                                0.4545,
                                type='double3')
                        connectAttr(hsv_gamma + '.outValue',
                                    hsv_mask + '.color',
                                    force=True)

                    if not objExists(hsvToRgb):
                        shadingNode('hsvToRgb', asUtility=True, name=hsvToRgb)
                        connectAttr(hsvToRgb + '.outRgb',
                                    hsv_gamma + '.value',
                                    force=True)

                    if not objExists(h_ramp):
                        shadingNode('ramp', asTexture=True, name=h_ramp)
                        removeMultiInstance(h_ramp + '.colorEntryList[1]',
                                            b=True)
                        setAttr(h_ramp + '.colorEntryList[0].color',
                                0,
                                0,
                                0,
                                type='double3')
                        setAttr(h_ramp + '.colorEntryList[2].color',
                                360,
                                0,
                                0,
                                type='double3')
                        setAttr(h_ramp + '.colorEntryList[2].position', 1)
                        setAttr(h_ramp + '.type', 3)
                        connectAttr(h_ramp + '.outColor',
                                    hsvToRgb + '.inHsv',
                                    force=True)

                    if not objExists(sv_ramp):
                        shadingNode('ramp', asTexture=True, name=sv_ramp)
                        removeMultiInstance(h_ramp + '.colorEntryList[1]',
                                            b=True)
                        setAttr(sv_ramp + '.colorEntryList[0].color',
                                0,
                                0,
                                1,
                                type='double3')
                        setAttr(sv_ramp + '.colorEntryList[2].color',
                                0,
                                1,
                                1,
                                type='double3')
                        setAttr(sv_ramp + '.colorEntryList[2].position', 0.7)
                        setAttr(sv_ramp + '.type', 4)
                        connectAttr(sv_ramp + '.outColor',
                                    h_ramp + '.colorOffset',
                                    force=True)

                    if not objExists(hsv_place2d):
                        shadingNode('place2dTexture',
                                    asUtility=True,
                                    name=hsv_place2d)
                        setAttr(hsv_place2d + '.rotateUV', -90)
                        connectAttr(hsv_place2d + '.outUV',
                                    h_ramp + '.uvCoord',
                                    force=True)
                        connectAttr(hsv_place2d + '.outUV',
                                    sv_ramp + '.uvCoord',
                                    force=True)
                        connectAttr(hsv_place2d + '.outUvFilterSize',
                                    h_ramp + '.uvFilterSize',
                                    force=True)
                        connectAttr(hsv_place2d + '.outUvFilterSize',
                                    sv_ramp + '.uvFilterSize',
                                    force=True)

    elif mode == 'layer':
        editRenderLayerAdjustment('miDefaultOptions.forceMotionVectors')
        setAttr('miDefaultOptions.forceMotionVectors', 0)

        editRenderLayerAdjustment('miDefaultOptions.finalGather')
        setAttr('miDefaultOptions.finalGather', 0)

        editRenderLayerAdjustment('miDefaultFramebuffer.gamma')
        setAttr('miDefaultFramebuffer.gamma', 1.0)

        sag_exrCube("disable")
Ejemplo n.º 7
0
def sag_renderSetup_create( lay, **attrs ):
        # DESELECT EVERYTHING
        select( clear = True )

        # CREATE RENDER LAYER & SET IT'S SETTINGS
        createRenderLayer( name = lay, empty = True, g = attrs['glob'], makeCurrent = True )

        if 'mvec' in attrs:
                editRenderLayerAdjustment( 'miDefaultOptions.forceMotionVectors' )
                setAttr( 'miDefaultOptions.forceMotionVectors', attrs['mvec'] )

        if 'fg' in attrs:
                editRenderLayerAdjustment( 'miDefaultOptions.finalGather' )
                setAttr( 'miDefaultOptions.finalGather', attrs['fg'] )

        if 'gamma' in attrs:
                editRenderLayerAdjustment( 'miDefaultFramebuffer.gamma' )
                setAttr( 'miDefaultFramebuffer.gamma', attrs['gamma'] )

        if 'scan' in attrs:
                editRenderLayerAdjustment( 'miDefaultOptions.scanline' )
                setAttr( 'miDefaultOptions.scanline', attrs['scan'] )

        if 'rayt' in attrs:
                editRenderLayerAdjustment( 'miDefaultOptions.rayTracing' )
                setAttr( 'miDefaultOptions.rayTracing', attrs['rayt'] )

        setAttr( 'defaultRenderGlobals.imageFormat', 51 )
        editRenderLayerAdjustment( 'defaultRenderGlobals.imageFormat' )

        setAttr( 'miDefaultFramebuffer.datatype', 16 )
        editRenderLayerAdjustment( 'miDefaultFramebuffer.datatype' )

        setAttr( 'miDefaultOptions.motionBlur', 0 )
        setAttr( 'mentalrayGlobals.exportCustomMotion', 0 )
        setAttr( 'mentalrayGlobals.exportMotionOffset', 0 )
        setAttr( 'mentalrayGlobals.exportMotionOutput', 0 )

        setAttr( 'defaultRenderGlobals.imageFilePrefix', '', type = 'string' )
        setAttr( 'defaultRenderGlobals.animation', 1 )
        setAttr( 'defaultRenderGlobals.animationRange', 1 )
        setAttr( 'defaultRenderGlobals.startFrame', 1 )
        setAttr( 'defaultRenderGlobals.endFrame', 1 )
        setAttr( 'defaultRenderGlobals.extensionPadding', 4 )
        setAttr( 'defaultRenderGlobals.outFormatControl', 0 )
        setAttr( 'defaultRenderGlobals.enableDefaultLight', 0 )

        # SETUP EXR CUBE
        maya.mel.eval( 'SetupEXRexport' )
        if 'exr' in attrs:
                sag_exrCube( attrs['exr'] )

        # SETUP CAMERAS BACKGROUND
        if 'camBg' in attrs:
                cams = ls( type = ['camera', 'stereoRigCamera'] )
                for cam in [ 'perspShape', 'frontShape', 'sideShape', 'topShape' ]:
                        cams.remove( cam )

                for cam in cams:
                        if listConnections( cam + '.backgroundColorR', s= True, d = False ) == None:
                                editRenderLayerAdjustment( cam + '.backgroundColor' )
                                setAttr( cam + '.backgroundColor', attrs['camBg'][0], attrs['camBg'][1], attrs['camBg'][2], type = 'double3' )

        # SORT OBJECTS IN THE ROOT OF THE SCENE
        roots = { 'cams':[], 'envs':[], 'chars':[], 'misc':[] }
        core = ['exrLayerCube', 'persp', 'top', 'side', 'front']

        for each in ls( '|*', type = 'transform' ) + ls( '|*:*', type = 'transform', long = True ) + ls( '|*:*:*', type = 'transform' ):
                if referenceQuery( each, isNodeReferenced = True ):
                        filePath = referenceQuery( each, filename = True )
                        if each.find( 'shot:cam:' ) > -1:
                                roots['cams'].append( each )
                        elif 'locations_compilation' in filePath.lower():
                                roots['envs'].append( each )
                        elif 'characters' in filePath.lower():
                                roots['chars'].append( each )
                        else:
                                roots['misc'].append( each )
                else:
                        if not each in core:
                                roots['misc'].append( each )

        # HIDE ALL ROOT OBJECTS EXCEPT FOR NEEDED ONES
        if 'keep' in attrs:
                toHide = roots['misc'][:]
                if not 'envs' in attrs['keep']:
                        toHide += roots['envs']
                if not 'chars' in attrs['keep']:
                        toHide += roots['chars']
                for each in toHide:
                        setAttr( each + '.v', 0 )

        # TURN OFF PRIMARY VISIBILITY FOR SPECIFIED TYPES
        if 'primVisOff' in attrs:
                for each in attrs['primVisOff']:
                        for eachRoot in roots[each]:
                                select( eachRoot, replace = True )
                                sag_utils_hiGeo()
                                for eachGeo in ls( sl = True ):
                                        setAttr( eachGeo + '.primaryVisibility', 0 )
                select( clear = True )

        # ASSIGN NEW SHADING TO SPECIFIED TYPES
        if 'shade' in attrs:
                sag_auxShaders()
                for eachPair in attrs['shade']:
                        for eachRoot in roots[eachPair[0]]:
                                sag_renderSetup_shade( eachRoot, eachPair[1] )
                select( clear = True )

        # SET HAIR MODE
        headCtrls = ls( '*head_control' ) + ls( '*:head_control' ) + ls( '*:*:head_control' ) + ls( '*:*:*:head_control' ) + ls( '*:*:*:*:head_control' ) + ls( '*:*:*:*:*:head_control' )
        if 'hair' in attrs:
                for each in headCtrls:
                        if attributeQuery( 'hair', node = each, exists = True ):
                                editRenderLayerAdjustment( each + '.hair' )
                                setAttr( each + '.hair', attrs['hair'] )

        # ENV
        if lay == 'env':
                if objExists( 'env_lights_grp' ):
                        setAttr( 'env_lights_grp.v', 1 )

        # CHARS
        if lay in ['chars', 'furry']:
                for eachRoot in roots['envs']:
                        select( eachRoot, replace = True )
                        sag_utils_hiGeo()
                        sag_utils_castReceiveOverride( 'set', ['miTransparencyCast', 'transparency'] )
                select( clear = True )
                if lay == 'furry':
                        setAttr( 'miDefaultOptions.rapidSamplesCollect', 10 )
                        #editRenderLayerAdjustment( 'miDefaultOptions.rapidSamplesCollect' )

                        setAttr( 'miDefaultOptions.rapidSamplesShading', 6 )
                        #editRenderLayerAdjustment( 'miDefaultOptions.rapidSamplesShading' )

                        inds = getAttr( 'miDefaultOptions.stringOptions', multiIndices = True )
                        for ind in inds:
                                if getAttr( 'miDefaultOptions.stringOptions[' + str(ind) + '].name' ) == 'rast transparency depth':
                                        if int(getAttr( 'miDefaultOptions.stringOptions[' + str(ind) + '].value' )) < 64:
                                                setAttr( 'miDefaultOptions.stringOptions[' + str(ind) + '].value', 64, type = 'string' )
                elif lay == 'chars':
                        editRenderLayerAdjustment( 'miDefaultOptions.maxSamples' )
                        setAttr( 'miDefaultOptions.maxSamples', 3 )

                        editRenderLayerAdjustment( 'miDefaultOptions.finalGatherRays' )
                        setAttr( 'miDefaultOptions.finalGatherRays', 750 )

                        editRenderLayerAdjustment( 'miDefaultOptions.finalGatherPresampleDensity' )
                        setAttr( 'miDefaultOptions.finalGatherPresampleDensity', 1.0 )

                        editRenderLayerAdjustment( 'miDefaultOptions.finalGatherPoints' )
                        setAttr( 'miDefaultOptions.finalGatherPoints', 20 )

                        editRenderLayerAdjustment( 'miDefaultOptions.finalGatherTraceDiffuse' )
                        setAttr( 'miDefaultOptions.finalGatherTraceDiffuse', 0 )

        # OCCL AND SHADOW
        if lay in ['occl', 'shadow'] :
                for eachRoot in roots['envs']:
                        select( eachRoot, replace = True )
                        sag_utils_hiGeo()
                        if lay == 'occl':
                                for eachGeo in ls( sl = True ):
                                        eachPar = listRelatives( eachGeo, parent = True, fullPath = True )[0]
                                        if not attributeQuery( 'miLabel', node = eachPar, exists = True ):
                                                addAttr( eachPar, ln = 'miLabel', at = 'long', keyable = True, dv = 13 )
                                        else:
                                                editRenderLayerAdjustment( eachPar + '.miLabel' )
                                                setAttr( eachPar + '.miLabel', 13 )
                        elif lay == 'shadow':
                                sag_utils_castReceiveOverride( 'set', ['castsShadows', 'shadow'] )
                                if objExists( 'env_lights_grp' ):
                                        setAttr( 'env_lights_grp.v', 1 )
                select( clear = True )

        # CROSSMASK
        rgbShd = ['red_SHD', 'green_SHD', 'blue_SHD']
        if lay in ['crossMask']:
                for eachRoot in roots['envs']:
                        sag_renderSetup_shade( eachRoot, 'black_SHD' )

                i = 0
                for eachRoot in roots['chars']:
                        sag_renderSetup_shade( eachRoot, rgbShd[(i%3)] )
                        i += 1

        #EYEMASK
        if lay in ['eyeMask_rgb']:
                dup = duplicate( 'eyeMask_rgb', ic = True, name = 'eyeMask_hsv' )
                for eachLay in [ 'eyeMask_rgb', 'eyeMask_hsv' ]:
                        editRenderLayerGlobals( crl = eachLay )

                        for eachRoot in roots['chars']:
                                select( eachRoot, replace = True )
                                sag_utils_hiGeo()
                                eyes = []
                                allTrs = []
                                for eachGeo in ls( sl = True, long = True ):
                                        trs = listRelatives( eachGeo, parent = True )[0]
                                        allTrs.append( trs )
                                        for par in eachGeo.split( '|' )[1:]:
                                                hist = listHistory( par )
                                                for eachHist in hist:
                                                        if eachHist in headCtrls:
                                                                if not getAttr( trs + '.v', l = True ):
                                                                        setAttr( trs + '.v', 0 )
                                        if eachGeo.find( 'eye' ) > -1 and eachGeo.find( 'GlassShape' ) > -1:
                                                eyes.append( trs )
                                select( eyes, replace = True )
                                sag_eyeMasks( eachLay.split( '_' )[-1] )

                                allTrs = list( set( allTrs ) )
                                for eachEye in eyes:
                                        allTrs.remove( eachEye )
                                sag_renderSetup_shade( allTrs, 'black_SHD' )

        #DOFREFERENCE
        if lay in ['dofReference']:
                if objExists( 'env_lights_grp' ):
                        setAttr( 'env_lights_grp.v', 1 )

                focDist = sag_renderSetup_prompt( 'Focus Distance', 'Input focus distance:' )
                if focDist == None or focDist == '':
                        focDist = 100

                for cam in cams:
                        if listConnections( cam + '.depthOfField', s = True, d = False ) == None:
                                editRenderLayerAdjustment( cam + '.depthOfField' )
                                setAttr( cam + '.depthOfField', 1 )
                        if listConnections( cam + '.focusDistance', s = True, d = False ) == None:
                                editRenderLayerAdjustment( cam + '.focusDistance' )
                                setAttr( cam + '.focusDistance', float(focDist) )
                        if listConnections( cam + '.fStop', s = True, d = False ) == None:
                                editRenderLayerAdjustment( cam + '.fStop' )
                                setAttr( cam + '.fStop', 2 )
                        if listConnections( cam + '.focusRegionScale', s = True, d = False ) == None:
                                editRenderLayerAdjustment( cam + '.focusRegionScale' )
                                setAttr( cam + '.focusRegionScale', 1 )

                        editRenderLayerAdjustment( cam + '.renderable' )
                        if cam == 'shot:cam:CCenterCamShape':
                                setAttr( cam + '.renderable', 1 )
                        else:
                                setAttr( cam + '.renderable', 0 )

                editRenderLayerAdjustment( 'miDefaultOptions.maxSamples' )
                setAttr( 'miDefaultOptions.maxSamples', 2 )

                editRenderLayerAdjustment( 'miDefaultOptions.finalGatherRays' )
                setAttr( 'miDefaultOptions.finalGatherRays', 100 )

                editRenderLayerAdjustment( 'miDefaultOptions.finalGatherPresampleDensity' )
                setAttr( 'miDefaultOptions.finalGatherPresampleDensity', 1.0 )

                editRenderLayerAdjustment( 'miDefaultOptions.finalGatherPoints' )
                setAttr( 'miDefaultOptions.finalGatherPoints', 10 )

                editRenderLayerAdjustment( 'miDefaultOptions.finalGatherTraceDiffuse' )
                setAttr( 'miDefaultOptions.finalGatherTraceDiffuse', 2 )
Ejemplo n.º 8
0
def sag_eyeMasks( mode ):
        if mode in [ 'rgb', 'hsv' ]:
                sag_utils_hiGeo()
                sag_utils_selSG()

                sgList = ls( sl = True )

                for sg in sgList:
                        hist = listHistory( sg )

                        eyeShd = ''
                        glassShd = ''
                        for each in hist:
                                if nodeType( each ) == 'eyeShader':
                                        eyeShd = each
                                elif nodeType( each ) == 'p_MegaTK':
                                        glassShd = each

                        if glassShd != '':
                                refr_shd = glassShd.replace( ':', '_' ) + '_eyeMask_rgb_refract'
                                if not objExists( refr_shd ):
                                        shadingNode( 'mib_refract', asUtility = True, name = refr_shd )
                                setAttr( refr_shd + '.refract', 1, 1, 1, type = 'double3' )
                                if not isConnected( glassShd + '.ior_in_refr', refr_shd + '.ior' ):
                                        connectAttr( glassShd + '.ior_in_refr', refr_shd + '.ior', force = True )
                                if not isConnected( refr_shd + '.outValue', sg + '.miMaterialShader' ):
                                        editRenderLayerAdjustment( sg + '.miMaterialShader' )
                                        connectAttr( refr_shd + '.outValue', sg + '.miMaterialShader', force = True )

                        if eyeShd != '':
                                if mode == 'rgb':
                                        # RGB MASK
                                        red = [ '.pupilColor' ]
                                        green = [ '.centerColor1', '.centerColor2', '.peripheryColor1', '.peripheryColor2', '.middleRingColor1', '.middleRingColor2', '.bigRingColor1', '.bigRingColor2', '.smallRingColor1', '.smallRingColor2' ]
                                        blue = [ '.scleraColor1', '.scleraColor2', '.bloodVesselColor' ]

                                        eyeDup = eyeShd.replace( ':', '_' ) + '_eyeMask_rgb'
                                        if not objExists( eyeDup ):
                                                eyeDupTmp = duplicate( eyeShd, ic = True )[0]
                                                rename( eyeDupTmp, eyeDup )

                                        for attr in red + green + blue:
                                                conns = listConnections( eyeDup + attr, s = True, d = False, p = True )
                                                if conns != None:
                                                        disconnectAttr( conns[0], eyeDup + attr )
                                                setAttr( eyeDup + attr, attr in red, attr in green, attr in blue, type = 'double3' )

                                        conns = listConnections( sg + '.miMaterialShader', s = True, d = False, p = True, c = True )
                                        if conns != None:
                                                if not isConnected( eyeDup + '.message', sg + '.miMaterialShader' ):
                                                        editRenderLayerAdjustment( sg + '.miMaterialShader' )
                                                        connectAttr( eyeDup + '.message', sg + '.miMaterialShader', force = True )

                                        conns = listConnections( sg + '.miLightMapShader', s = True, d = False, p = True, c = True )
                                        if conns != None:
                                                editRenderLayerAdjustment( sg + '.miLightMapShader' )
                                                disconnectAttr( conns[1], conns[0] )

                                        conns = listConnections( sg + '.miShadowShader', s = True, d = False, p = True, c = True )
                                        if conns != None:
                                                editRenderLayerAdjustment( sg + '.miShadowShader' )
                                                disconnectAttr( conns[1], conns[0] )

                                elif mode == 'hsv':
                                        # HSV MASK
                                        hsv_mask = 'hsv_mask'
                                        hsv_gamma = 'hsv_mask_gamma'
                                        hsvToRgb = 'hsv_mask_hsvToRgb'
                                        h_ramp = 'hsv_mask_hRamp'
                                        sv_ramp = 'hsv_mask_svRamp'
                                        hsv_place2d = 'hsv_mask_place2d'

                                        if not objExists( hsv_mask ):
                                                shadingNode( 'gluk_constant', asShader = True, name = hsv_mask )
                                        if not isConnected( hsv_mask + '.message', sg + '.miMaterialShader' ):
                                                editRenderLayerAdjustment( sg + '.miMaterialShader' )
                                                connectAttr( hsv_mask + '.message', sg + '.miMaterialShader', force = True )

                                        if not objExists( hsv_gamma ):
                                                shadingNode( 'gammaCorrect', asUtility = True, name = hsv_gamma )
                                                setAttr( hsv_gamma + '.gamma', 0.4545, 0.4545, 0.4545, type = 'double3' )
                                                connectAttr( hsv_gamma + '.outValue', hsv_mask + '.color', force = True )

                                        if not objExists( hsvToRgb ):
                                                shadingNode( 'hsvToRgb', asUtility = True, name = hsvToRgb )
                                                connectAttr( hsvToRgb + '.outRgb', hsv_gamma + '.value', force = True )

                                        if not objExists( h_ramp ):
                                                shadingNode( 'ramp', asTexture = True, name = h_ramp )
                                                removeMultiInstance( h_ramp + '.colorEntryList[1]', b = True )
                                                setAttr( h_ramp + '.colorEntryList[0].color', 0, 0, 0, type = 'double3' )
                                                setAttr( h_ramp + '.colorEntryList[2].color', 360, 0, 0, type = 'double3' )
                                                setAttr( h_ramp + '.colorEntryList[2].position', 1 )
                                                setAttr( h_ramp + '.type', 3 )
                                                connectAttr( h_ramp + '.outColor', hsvToRgb + '.inHsv', force = True )

                                        if not objExists( sv_ramp ):
                                                shadingNode( 'ramp', asTexture = True, name = sv_ramp )
                                                removeMultiInstance( h_ramp + '.colorEntryList[1]', b = True )
                                                setAttr( sv_ramp + '.colorEntryList[0].color', 0, 0, 1, type = 'double3' )
                                                setAttr( sv_ramp + '.colorEntryList[2].color', 0, 1, 1, type = 'double3' )
                                                setAttr( sv_ramp + '.colorEntryList[2].position', 0.7 )
                                                setAttr( sv_ramp + '.type', 4 )
                                                connectAttr( sv_ramp + '.outColor', h_ramp + '.colorOffset', force = True )

                                        if not objExists( hsv_place2d ):
                                                shadingNode( 'place2dTexture', asUtility = True, name = hsv_place2d )
                                                setAttr( hsv_place2d + '.rotateUV', -90 )
                                                connectAttr( hsv_place2d + '.outUV', h_ramp + '.uvCoord', force = True )
                                                connectAttr( hsv_place2d + '.outUV', sv_ramp + '.uvCoord', force = True )
                                                connectAttr( hsv_place2d + '.outUvFilterSize', h_ramp + '.uvFilterSize', force = True )
                                                connectAttr( hsv_place2d + '.outUvFilterSize', sv_ramp + '.uvFilterSize', force = True )


        elif mode == 'layer':
                editRenderLayerAdjustment( 'miDefaultOptions.forceMotionVectors' )
                setAttr( 'miDefaultOptions.forceMotionVectors', 0 )

                editRenderLayerAdjustment( 'miDefaultOptions.finalGather' )
                setAttr( 'miDefaultOptions.finalGather', 0 )

                editRenderLayerAdjustment( 'miDefaultFramebuffer.gamma' )
                setAttr( 'miDefaultFramebuffer.gamma', 1.0 )

                sag_exrCube( "disable" )