Пример #1
0
def make_aov(aov, type='rgb'):
    """
        Creates an AOV if it doesn't already exist.

        Args:
        aov = The name of the AOV to make.
        type = The data type of the new aov. Valid values are:
            int
            bool
            float
            rgb
            rgba
            vector
            vector2
            pointer
    """
    allowed_types = [
        'int', 'bool', 'float', 'rgb', 'rgba', 'vector', 'vector2', 'pointer'
    ]
    if type not in allowed_types:
        raise Exception('Type {} is not allowed!'.format(type))

    all_aovs = aovs.AOVInterface().getAOVNodes(names=True)
    exists = 0
    for sublist in all_aovs:
        if aov in sublist:
            exists = 1
            print '{} AOV already exits!'.format(aov)
            break
    if not exists:
        aovs.AOVInterface().addAOV(aov, aovType=type)
        print 'created {}!'.format(aov)
Пример #2
0
def create_custom_aovs(char):

    if char == "girl":
        customAOVlist = ["mask_lips", "mask_lips_smear", "mask_tattoo", "mask_makeup_graphic", "mask_makeup_graphic_sharp", "mask_eyebrows", "mask_facing_ratio"]
    elif char == "man":
        customAOVlist = []
    elif char == "transgender":
        customAOVlist = ["mask_trans_graphic_skirt", "mask_trans_beard", "mask_trans_ears", "mask_trans_glitter", "mask_trans_eyes_red", "mask_trans_lips", "mask_trans_ass_text"]
    elif char == "vladimir":
        customAOVlist = []
    
    currentAOVlist = aovs.AOVInterface().getAOVNodes(names=True)
        
    for i in customAOVlist:
        currentAOVlist = aovs.AOVInterface().getAOVNodes(names=True)
        aov_already_created = False
        
        for j in range (0, len(currentAOVlist)):
            if i in currentAOVlist[j]:
                aov_already_created = True
                print "AOV [" + i + "] has already been created, skipping"
        if aov_already_created == False:
            aovs.AOVInterface().addAOV(i, aovType='rgba')
            print "AOV [" + i + "] has been added"

    # connect facing ratio shader
    if char == "girl":
        cmds.connectAttr("*:mat_aov_facingratio.outColor", "aiAOV_mask_facing_ratio.defaultValue", force=True)
Пример #3
0
def add_aov(aov_name):
    aov_names = [i.name for i in aovs.getAOVs()]
    if aov_name not in aov_names:
        try:
            aovs.AOVInterface().addAOV(aov_name)
        except:
            pass
Пример #4
0
def newAOVPrompt(default=''):
    result = pm.cmds.promptDialog(button=['Create', 'Cancel'],
                                  defaultButton='Create',
                                  cancelButton='Cancel',
                                  message='AOV Name',
                                  title='New AOV',
                                  text=default)
    if result == 'Create':
        core.createOptions()
        newAOV = pm.promptDialog(
            query=True, text=True
        )  #[0:29] # channel names in the exr driver are limited to 29 characterss
        if len(newAOV) > 29:
            oldAOV = newAOV
            newAOV = newAOV[0:29]
            cmds.confirmDialog(
                message=
                "The name %s is longer than 29 characters, truncated to : %s" %
                (oldAOV, newAOV))
        if str(newAOV).replace("_", "").isalnum():
            return newAOV, aovs.AOVInterface().addAOV(newAOV)
        else:
            print "Invalid AOV Name"
            return None, None
    else:
        print "AOV creation canceled"
        return None, None
Пример #5
0
def create_aov():
    print "create_aov"

    try:
        aov_dict = {
            "N": "rgb",
            "P": "vector",
            "Z": "float",
            "diffuse": "rgb",
            "diffuse_albedo": "rgb",
            "diffuse_direct_amb": "rgb",
            "diffuse_fill": "rgb",
            "diffuse_indirect_amb": "rgb",
            "diffuse_key": "rgb",
            "diffuse_rim": "rgb",
            "emission": "rgb",
            "motionvector": "rgb",
            "specular": "rgb",
            "specular_albedo": "rgb",
            "specular_amb": "rgb",
            "specular_direct_amb": "rgb",
            "specular_fill": "rgb",
            "specular_indirect_amb": "rgb",
            "specular_key": "rgb",
            "specular_rim": "rgb",
            "sss": "rgb",
            "sss_albedo": "rgb",
            "transmission": "rgb"
        }
        for name, type in aov_dict.items():
            aovs.AOVInterface().addAOV(name, type)

        return 1
    except:
        return False
Пример #6
0
def rebuild_arnold_aov():
    aov_lists = list()
    sg_nodes = pm.ls(type='shadingEngine')
    if len(sg_nodes) > 200:
        sg_nodes = sg_nodes[:200]
    for se in sg_nodes:
        for aov in se.aiCustomAOVs:
            print '[OF] Info:find', aov, aov.aovName.get()
            aov_lists.append(aov.aovName.get())
    for wc in pm.ls(type='aiWriteColor'):
        print wc.aovName.get()
        m = re.compile('(.*) \(Inactive\)').match(wc.aovName.get())
        if m:
            print '[OF] Info:find', wc, wc.aovName.get()
            aov_lists.append(m.groups()[0])
        else:
            if wc.aovName.get():
                print '[OF] Info:find', wc, wc.aovName.get()
                aov_lists.append(wc.aovName.get())
    aov_lists = list(set(aov_lists))
    for aov in aov_lists:
        if aov and aov not in get_aov_name_lists():
            try:
                aovs.AOVInterface().addAOV(aov)
                print '[OF] Info: Rebuild %s' % aov
            except:
                pass
Пример #7
0
def createAOV(name):
    aovInterface = aovs.AOVInterface()

    #
    #默认的 Z通道 的AOV filter是closet, 项目需要改成默认的gaussian
    #则将键 Z 从 arnold的aov默认filter字典里清除
    if name == 'Z':
        updateDefaultFilterByName('Z')

    #创建AOV
    if DEFAULT_AOV_DATA_TYPES.has_key(name):
        aovName = name
        aovType = DEFAULT_AOV_DATA_TYPES[name]
        aov = aovInterface.addAOV(aovName, aovType)
    else:
        aovName = name
        aov = aovInterface.addAOV(aovName)
    #

    #创建AOV材质球
    if aovName == 'AO':
        CNG.createAO(aov.node.defaultValue)
    elif aovName == 'NOM':
        CNG.createNOM(aov.node.defaultValue)
    elif aovName == 'Fre':
        CNG.createFresnel(aov.node.defaultValue)
    elif aovName == 'Zdp':
        CNG.createZ(aov.node.defaultValue)
    elif aovName == 'COCC':
        CNG.createCOCC(aov.node.defaultValue)
    else:
        pass

    return aov
Пример #8
0
def create_default_aovs():

    defaultAOVlist = ["P", "N", "Z", "coat", "specular", "diffuse", "direct", "indirect", "sss", "transmission"]
    currentAOVlist = aovs.AOVInterface().getAOVNodes(names=True)

    for i in defaultAOVlist:
        currentAOVlist = aovs.AOVInterface().getAOVNodes(names=True)
        aov_already_created = False

        for j in range (0, len(currentAOVlist)):
            if i in currentAOVlist[j]:
                aov_already_created = True
                print "AOV [" + i + "] has already been created, skipping"
        if aov_already_created == False:
            aovs.AOVInterface().addAOV(i)
            print "AOV [" + i + "] has been added"
Пример #9
0
def rebuild_arnold_aov():
    for aov in get_all_aov_list():
        if aov:
            if aov not in get_aov_names():
                try:
                    aovs.AOVInterface().addAOV(aov)
                except:
                    pass
Пример #10
0
def addZ(*args):  #Create DEPTH pass with shader
    if not pm.objExists('aiAOV_%s' % 'ZDEPTH'):  #check AOV already exists
        aovZ = aovs.AOVInterface().addAOV('ZDEPTH')
        aovZ = pm.PyNode('aiAOV_ZDEPTH')
        sin = pm.shadingNode('samplerInfo', asShader=True, name='INFO_Z')
        sin.pointCamera.pointCameraZ >> aovZ.defaultValue
        pm.setAttr('aiAOV_ZDEPTH.type', 4)
        print 'ZDEPTH AOV DONE!'
Пример #11
0
def switchLayerAOV(trigger):
    existsAOVs = aovs.AOVInterface().getAOVNodes(names=True)

    for existsAOV in existsAOVs:
        #aovName = existsAOV[0]
        aovNode = existsAOV[1].getName()
        cmds.editRenderLayerAdjustment(aovNode + ".enabled")
        cmds.setAttr(aovNode + ".enabled", trigger)
Пример #12
0
def addNorm():
    if not pm.objExists('aiAOV_NRM'):  #check AO already exists
        shdrNorm = pm.shadingNode('aiUtility', asShader=True, name='GEN_NRM')
        shdrNorm.shadeMode.set(2)
        shdrNorm.colorMode.set(3)
        aovNorm = aovs.AOVInterface().addAOV('NRM')
        aovNorm = pm.PyNode('aiAOV_NRM')
        shdrNorm.outColor >> aovNorm.defaultValue
        print 'NORMAL AOV DONE!'
Пример #13
0
 def add_custom_aov(cls, name):
     if name not in cls.get_aov_name_lists():
         try:
             aovs.AOVInterface().addAOV(name)
         except:pass
     pm.PyNode('aiAOV_%s.type' % name).set(5)
     pm.PyNode('aiAOV_%s.enabled' % name).set(1)
     print "[OF] info: add aov ******%s****** successful" % name
     return name
Пример #14
0
def delAOV():
    #删除所有的AOV
    try:
        aovInterface = aovs.AOVInterface()
        result = aovInterface.getAOVs()
        aovInterface.removeAOVs(result)
    except:
        return False
    return True
Пример #15
0
 def add_costom_aov(self, name):
     if self.renderer == 'arnold':
         if not name in self.get_aov_name_lists():
             try:
                 aovs.AOVInterface().addAOV(name)
             except:
                 pass
         pm.PyNode('aiAOV_%s.type' % name).set(5)
         pm.PyNode('aiAOV_%s.enabled' % name).set(1)
Пример #16
0
def add_aov(name):
    if pm.PyNode('defaultRenderGlobals').currentRenderer.get() == 'arnold':
        if not name in get_aov_name_lists():
            try:
                aovs.AOVInterface().addAOV(name)
            except:
                pass
        pm.PyNode('aiAOV_%s.type' % name).set(5)
        pm.PyNode('aiAOV_%s.enabled' % name).set(1)
Пример #17
0
def aovs_setup(lights):
    """updating render settings AOVs tab"""
    # enable beauty
    createOptions()
    arnold_options = pm.PyNode("defaultArnoldRenderOptions")
    arnold_options.aovMode.set(1)

    # enable default aovs
    default_aovs = [
        "diffuse_direct", "diffuse_indirect", "specular_direct",
        "specular_indirect", "sss_direct", "sss_indirect", "N", "P", "Z",
        "crypto_asset", "crypto_material", "crypto_object", "AO"
    ]
    default_aovs.extend(lights)
    for aov in default_aovs:
        if not aovs.AOVInterface().getAOVNode(aov):
            aovs.AOVInterface().addAOV(aov)

    # enable custom aovs
    # ambient occlusion
    ao_name = "aiAmbientOcclusion"
    if not pm.ls(type=ao_name):
        ao_aov = pm.PyNode("aiAOV_AO")
        ao_shader = pm.shadingNode(ao_name, asShader=1)
        ao_sg = pm.sets(name=ao_name + "SG",
                        empty=1,
                        renderable=1,
                        noSurfaceShader=1)
        ao_shader.outColor >> ao_aov.defaultValue
        ao_shader.outColor >> ao_sg.surfaceShader

    # create light group for each of the lights
    for light in lights:
        shape = pm.PyNode(light).getShape()
        shape.aiAov.set(light)

    # merge aovs
    arnold_driver = pm.PyNode("defaultArnoldDriver")
    arnold_driver.mergeAOVs.set(1)
    arnold_driver.halfPrecision.set(1)
    print ">> aov setup"
    return
Пример #18
0
def addOcc(*args):  #Create Occlution pass with shader
    if not pm.objExists('aiAOV_%s' % 'AO'):  #check AO already exists
        shdrAO = pm.shadingNode('aiAmbientOcclusion',
                                asShader=True,
                                name='GEN_AO')
        shdrAO.farClip.set(50)
        shdrAO.samples.set(2)
        aovAO = aovs.AOVInterface().addAOV('AO')
        aovAO = pm.PyNode('aiAOV_AO')
        shdrAO.outColor >> aovAO.defaultValue
        print 'AO AOV DONE!'
Пример #19
0
 def postLightCreation(self, transformNode, shapeNode, *args, **kwargs):
     '''Place here all custom stuff you want to do with the created light node'''
     mc.setAttr(shapeNode + '.aiAov', 'LG_' + transformNode, type='string')
     newAOVName = 'RGBA_LG_' + transformNode
     aovNode = aovs.AOVInterface().addAOV(newAOVName).node
     mc.setAttr(aovNode + ".name",
                'RGBA_LG_' + transformNode,
                type="string")
     mc.setAttr(aovNode + ".type", 6)
     mc.setAttr(aovNode + ".enabled", True)
     mc.select(shapeNode, replace=True)
Пример #20
0
def addUV(*args):  #Create UV pass with shader
    if not pm.objExists('aiAOV_UV'):  #check if UV AOV already exists
        shdrUV = pm.shadingNode('aiUtility', asShader=True, name='GEN_UV')
        shdrUV.shadeMode.set(2)
        shdrUV.color.set(0, 0, 0)
        siUV = pm.shadingNode('samplerInfo', asShader=True, name='INFO_UV')
        siUV.uvCoord.uCoord >> shdrUV.color.colorR
        siUV.uvCoord.vCoord >> shdrUV.color.colorG
        aovUV = aovs.AOVInterface().addAOV('UV')
        aovUV = pm.PyNode('aiAOV_UV')
        shdrUV.outColor >> aovUV.defaultValue
        print 'UV AOV DONE!'
Пример #21
0
    def rebuild_arnold_aov(self, *args):
        # arnold rebuild aov
        aov_lists = list()
        # get shading group's aovname
        sg_nodes = pm.ls(type='shadingEngine')
        #if len(sg_nodes) > 200:
        #    sg_nodes = sg_nodes[:200]
        progress_dialog = QProgressDialog(
            '<Total: %s>build aov...,Please wait......' % len(sg_nodes),
            'Cancel', 0, len(sg_nodes))
        progress_dialog.setWindowModality(Qt.WindowModal)
        progress_dialog.show()
        value = 0
        for sg in sg_nodes:
            progress_dialog.setValue(value)
            if progress_dialog.wasCanceled():
                break
            for aov in sg.aiCustomAOVs:
                print '[OF] Info:find', aov, aov.aovName.get()
                aov_lists.append(aov.aovName.get())
            value += 1
        # get aiWriteColor's aovname
        if pm.ls(type='aiWriteColor'):
            for wc in pm.ls(type='aiWriteColor'):
                print wc.aovName.get()
                m = re.compile('(.*) \(Inactive\)').match(wc.aovName.get())
                if m:
                    print '[OF] Info:find', wc, wc.aovName.get()
                    aov_lists.append(m.groups()[0])
                else:
                    if wc.aovName.get():
                        print '[OF] Info:find', wc, wc.aovName.get()
                        aov_lists.append(wc.aovName.get())
        #get aiUserDataColor's aov_name
        if pm.ls(type='aiUserDataColor'):
            for node in pm.ls(type='aiUserDataColor'):
                print "[OF] info:find %s" % node.colorAttrName.get()
                aov_lists.append(node.colorAttrName.get())

        aov_lists = list(set(aov_lists))
        for aov in aov_lists:
            if aov and aov not in self.get_aov_name_lists():
                if aov not in alofhair_aovs:
                    try:
                        aovs.AOVInterface().addAOV(aov)
                        print '[OF] Info: Rebuild %s' % aov
                    except:
                        pass

        for aov in self.get_aov_name_lists():
            if aov.startswith('mask') or aov.startswith('rim'):
                mc.setAttr('aiAOV_%s.type' % aov, 5)
Пример #22
0
def createArnoldAOVTab():
    parentForm = cmds.setParent(query=True)

    aovNode = aovs.AOVInterface()
    pm.columnLayout('enableAOVs', adjustableColumn=True)

    pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)

    pm.attrControlGrp(attribute=aovNode.node.aovMode, label='Mode')

    # the tab gets recreated from scratch each time rather than updated and each
    # time the AOVOptionMenuGrp adds itself to the AOVChanged callback list.
    # we must remove it or we'll leave behind invalid copies
    global _aovDisplayCtrl
    if _aovDisplayCtrl is not None:
        aovs.removeAOVChangedCallback(_aovDisplayCtrl.update)

    _aovDisplayCtrl = shaderTemplate.AOVOptionMenuGrp('aiOptions',
                                                      'displayAOV',
                                                      label='Render View AOV',
                                                      allowCreation=False,
                                                      includeBeauty=True,
                                                      allowEmpty=False,
                                                      allowDisable=False)
    _aovDisplayCtrl._setToChildMode()
    _aovDisplayCtrl._doSetup(aovNode.node.name() + '.displayAOV')

    pm.setParent(parentForm)

    cmds.scrollLayout('arnoldAOVsScrollLayout', horizontalScrollBarThickness=0)

    cmds.columnLayout('arnoldTabColumn', adjustableColumn=True)

    ed = ArnoldAOVEditor(aovNode)

    cmds.formLayout(parentForm,
                    edit=True,
                    af=[('enableAOVs', "top", 5), ('enableAOVs', "left", 0),
                        ('enableAOVs', "right", 0),
                        ('arnoldAOVsScrollLayout', "bottom", 0),
                        ('arnoldAOVsScrollLayout', "left", 0),
                        ('arnoldAOVsScrollLayout', "right", 0)],
                    an=[('enableAOVs', "bottom")],
                    ac=[('arnoldAOVsScrollLayout', "top", 5, 'enableAOVs')])

    pm.setUITemplate('attributeEditorTemplate', popTemplate=True)

    cmds.setParent(parentForm)
    pm.evalDeferred(ed.fixOptionMenus)
    ed.setEnabledState()
    pm.scriptJob(attributeChange=(aovNode.node.aovMode, ed.setEnabledState),
                 parent=ed.mainCol)
Пример #23
0
def setup_mtoa():
    mu.unlock_renderer('arnold')
    mel.eval('loadPreferredRenderGlobalsPreset("arnold");')
    mel.eval('mayaHasRenderSetup;')

    setup_minimal_mtoa()

    # --- Setup Cryptomatte AOV ---
    import mtoa.aovs as aovs
    try:
        aovs.AOVInterface().addAOV('crypto_material',
                                   aovType='rgb',
                                   aovShader='cryptomatte')
    except Exception as e:
        LOGGER.error('Error creating cryptomatte AOV: %s', e)
Пример #24
0
 def add_mask_aov(cls):
     aov_lists = [int(cls.MASK_PATTERN.findall(i)[0])
                  for i in cls.get_aov_name_lists() if cls.MASK_PATTERN.findall(i)]
     if not aov_lists:
         new_aov = "mask00"
     else:
         new_aov = "mask%02d" % (sorted(aov_lists)[-1]+1)
     try:
         aovs.AOVInterface().addAOV(new_aov)
     except:pass
     print "[OF] info: add aov ******%s****** successful" % new_aov
     pm.PyNode('aiAOV_%s.type' % new_aov).set(5)
     shader = cls.create_aiuserdatacolor_shader(new_aov)
     shader.outColor >> pm.PyNode('aiAOV_%s' % new_aov).defaultValue
     return new_aov
Пример #25
0
    def createall():
        Mysshdr = pymel.shadingNode("surfaceShader", asShader=True)
        pymel.rename(Mysshdr, "An_XYZ")

        Mysampler = pymel.shadingNode("samplerInfo", asUtility=True)
        pymel.rename(Mysampler, "An_sampler")

        Myrange = pymel.shadingNode("setRange", asUtility=True)
        pymel.rename(Myrange, "An_range")

        Mymltipl = pymel.shadingNode("multiplyDivide", asUtility=True)
        pymel.rename(Mymltipl, "An_multy")

        pymel.connectAttr("An_sampler.pointCameraX",
                          "An_multy.input1X",
                          force=True)
        pymel.connectAttr("An_sampler.pointCameraY",
                          "An_multy.input1Y",
                          force=True)
        pymel.connectAttr("An_sampler.pointCameraZ",
                          "An_multy.input1Z",
                          force=True)
        pymel.setAttr("An_multy.input2X", 1)
        pymel.setAttr("An_multy.input2Y", 1)
        pymel.setAttr("An_multy.input2Z", 1)

        pymel.connectAttr(" An_multy.outputX", "An_range.valueX", force=True)
        pymel.connectAttr(" An_multy.outputY", "An_range.valueY", force=True)
        pymel.connectAttr(" An_multy.outputZ", "An_range.valueZ", force=True)
        pymel.setAttr("An_range.minX", 1)
        pymel.setAttr("An_range.minY", 1)
        pymel.setAttr("An_range.minZ", 1)

        pymel.connectAttr(" An_range.outValue.outValueX",
                          "An_XYZ.outColorR",
                          force=True)
        pymel.connectAttr(" An_range.outValue.outValueY",
                          "An_XYZ.outColorG",
                          force=True)
        pymel.connectAttr(" An_range.outValue.outValueZ",
                          "An_XYZ.outColorB",
                          force=True)

        aovs.AOVInterface().addAOV('XYZ')
        pymel.connectAttr("An_XYZ.outColor",
                          "aiAOV_XYZ.defaultValue",
                          force=True)
Пример #26
0
    def add_mask_aov(self, *args):
        aov_lists = [
            int(self.MASK_PATTERN.findall(i)[0])
            for i in self.get_aov_name_lists() if self.MASK_PATTERN.findall(i)
        ]
        hair_aov_lists = [
            int(self.HAIR_PATTERN.findall(i)[0])
            for i in self.get_aov_name_lists() if self.HAIR_PATTERN.findall(i)
        ]
        all_aov_lists = [
            int(self.ALL_PATTERN.findall(i)[0])
            for i in self.get_aov_name_lists() if self.ALL_PATTERN.findall(i)
        ]
        if self.renderer == "arnold":
            if not pm.checkBox('hair_check', q=1, value=1) and not pm.checkBox(
                    'all_check', q=1, value=1):
                shader = self.create_default_mask_aov_shader()
                if not aov_lists:
                    new_aov = "mask00"
                else:
                    new_aov = "mask%02d" % (sorted(aov_lists)[-1] + 1)
            if pm.checkBox('hair_check', q=1, value=1):
                if not hair_aov_lists:
                    new_aov = 'hair00'
                else:
                    new_aov = "hair%02d" % (sorted(hair_aov_lists)[-1] + 1)
                shader = self.create_aiuserdatacolor_shader(new_aov)
            if pm.checkBox('all_check', q=1, value=1):
                if not all_aov_lists:
                    new_aov = 'all00'
                else:
                    new_aov = "all%02d" % (sorted(all_aov_lists)[-1] + 1)
                shader = self.create_aiuserdatacolor_shader(new_aov)
            try:
                aovs.AOVInterface().addAOV(new_aov)
            except:
                pass
            print "[OF] info: add aov ******%s****** successful" % new_aov
            pm.PyNode('aiAOV_%s.type' % new_aov).set(5)
            shader.outColor >> pm.PyNode('aiAOV_%s' % new_aov).defaultValue

        elif self.renderer == "mentalRay":
            if not aov_lists:
                self.add_mr_aov("mask00")
            else:
                self.add_mr_aov("mask%02d" % (sorted(aov_lists)[-1] + 1))
Пример #27
0
def createAOVS():

	#avaialbe aovs in maya
	BUILTIN_AOVS = ['P', 'Z', 'N', 'opacity', 'motionvector', 'Pref', 'raycount', 'cputime', 'ID', 'RGBA', 'direct', 'indirect', 'emission', 'background', 'diffuse', 'specular',
 'transmission', 'sss', 'volume', 'albedo', 'diffuse_direct', 'diffuse_indirect', 'diffuse_albedo', 'specular_direct', 'specular_indirect', 'specular_albedo', 'coat',
 'coat_direct', 'coat_indirect', 'coat_albedo', 'sheen', 'sheen_direct', 'sheen_indirect', 'sheen_albedo', 'transmission_direct', 'transmission_indirect',
 'transmission_albedo', 'sss_direct', 'sss_indirect', 'sss_albedo', 'volume_direct', 'volume_indirect', 'volume_albedo', 'volume_opacity', 'volume_Z',
 'shadow_matte', 'AA_inv_density']

	#avaialbe aovs in maya
	LIGHTING_AOVS = ['RGBA', 'direct', 'indirect', 'emission', 'diffuse', 'specular', 'transmission', 'sss', 'volume', 'diffuse_direct', 'diffuse_indirect', 'diffuse_albedo',
 'specular_direct', 'specular_indirect', 'specular_albedo', 'coat', 'coat_direct', 'coat_indirect', 'coat_albedo', 'transmission_direct', 'transmission_indirect',
 'transmission_albedo', 'sss_direct', 'sss_indirect', 'sss_albedo', 'volume_direct', 'volume_indirect', 'volume_albedo', 'shadow_matte', 'sheen', 'sheen_direct',
 'sheen_indirect', 'sheen_albedo']

	#3rd party aovs
	EXTRA_AOVS = ['crypto_asset', 'crypto_material', 'crypto_object']

	#deliverable aovs for comp
	PRODUCTION_AOVS = ['RGBA', 'diffuse', 'diffuse_indirect', 'specular', 'specular_direct', 'specular_indirect', 'N', 'P', 'Pref', 'Z']

	#leave user added aovs and add missing
	EXISTING_AOVS = []
	for aov in aovs.getAOVNodes(names=False):
		EXISTING_AOVS.append(str(aov))
	EXISTING_AOVS = [aov.replace('aiAOV_', '') for aov in EXISTING_AOVS]

	NEW_AOVS = list(set(PRODUCTION_AOVS) - set(EXISTING_AOVS))

	for item in NEW_AOVS:
		addAOV = aovs.AOVInterface().addAOV(item)

	#split light groups
	for item in PRODUCTION_AOVS:
		if item in LIGHTING_AOVS:
			cmds.setAttr('aiAOV_' + item + '.lightGroups', 1)
		
	#print NEW_AOVS

	cmds.setAttr('defaultArnoldDriver' + '.mergeAOVs', 1)
Пример #28
0
def create_new_aov(aov_name):
    """

    :param aov_name: name of the aov to create as a string
    :return: object name of the aov created as a string
    """

    scene_aovs = [x for x in cmds.ls(type="aiAOV")]
    ai_aov = "aiAOV_%s" % aov_name

    if ai_aov in scene_aovs:
        print "%s already exists in the scene" % aov_name
        return False

    new_aov = aovs.AOVInterface()

    data_type = "rgb"
    new_aov.addAOV(aov_name, data_type)

    # Set AOV disabled
    cmds.setAttr("%s.enabled" % ai_aov, 0)

    return ai_aov
def Load_AOV(type):
    if cmds.renderer('arnold', exists=True):
        if type == "basic":
            aov_list = [
                "N", "coat", "diffuse", "emission", "sheen", "specular",
                "transmission"
            ]
        if type == "direct":
            aov_list = [
                "N", "coat_direct", "coat_indirect", "diffuse_direct",
                "diffuse_indirect", "emission", "sheen_direct",
                "sheen_indirect", "specular_direct", "specular_indirect",
                "transmission"
            ]
        if type == "technical": aov_list = ["AO", "FacingRatio", "P"]

        for aov in aov_list:
            try:
                print("Adding " + aov + " to render aov list")
                aovs.AOVInterface().addAOV(aov)
                #AOs
                if aov == "AO":
                    createAOV = cmds.createNode("aiAmbientOcclusion",
                                                name="aiAmbientOcclusion_ID")
                    cmds.connectAttr('aiAmbientOcclusion_ID.outColor',
                                     'aiAOV_AO.defaultValue')

                #FaceRatio
                if aov == "FacingRatio":
                    UtiD = cmds.createNode("aiFacingRatio",
                                           name="aiFacingRatio_ID")
                    cmds.connectAttr('aiFacingRatio_ID.outValue',
                                     'aiAOV_FacingRatio.defaultValue')

            except:
                print("ERROR: AOV " + aov + " already exists")
Пример #30
0
def create_new_aov(aov_name, data_type="rgb"):
    """
    Create a new aov

    :param aov_name: the aov name to create as a string
    :param data_type: the data type for the aov to create as a string
    :return: the ai aov name for the created aov as a string
    """

    scene_aovs = [x for x in cmds.ls(type="aiAOV")]

    ai_aov_name = "aiAOV_%s" % aov_name

    if ai_aov_name in scene_aovs:
        print "%s already exists in the scene" % aov_name
        return False

    new_aov = aovs.AOVInterface()
    new_aov.addAOV(aov_name, data_type)

    # Set AOV disabled
    cmds.setAttr("%s.enabled" % ai_aov_name, 0)

    return ai_aov_name