Ejemplo n.º 1
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
Ejemplo n.º 2
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
Ejemplo n.º 3
0
 def createShaderCmd(self, name, objs=None):
     #创建IDP材质球按钮命令
     print name
     if objs:
         geos = objs
     else:
         geos = pm.ls(sl=1)
     shader, sg = CNG.createIDPNode(name)
     CNG.assignShader(geos, shader, sg)
Ejemplo n.º 4
0
 def createShaderCmd(self, name, objs = None):
     #创建IDP材质球按钮命令 
     print name
     if objs : 
         geos = objs
     else :
         geos = pm.ls(sl=1)
     shader, sg = CNG.createIDPNode(name)
     CNG.assignShader(geos, shader, sg)
Ejemplo n.º 5
0
 def createLayerCmd(self, name):
     #创建渲染层按钮命令
     if name == 'chr_idp1':
         idp_dic = CNG.makeidp1Dic()
     elif name == 'chr_idp2':
         idp_dic = CNG.makeidp2Dic()
     elif name == 'chr_idp3' or name == 'bg_idp3':
         idp_dic = CNG.makeidp3Dic()
     else:
         idp_dic = {}
     CRL.createRenderLayer(name)
     self.arnold.setRenderLayer(name)
     if idp_dic:
         for key, value in idp_dic.items():
             if value:
                 self.createShaderCmd(key, value)
Ejemplo n.º 6
0
 def createLayerCmd(self, name):
     #创建渲染层按钮命令
     if name == 'chr_idp1':
         idp_dic = CNG.makeidp1Dic()
     elif name == 'chr_idp2':
         idp_dic = CNG.makeidp2Dic()
     elif name == 'chr_idp3' or name == 'bg_idp3':
         idp_dic = CNG.makeidp3Dic()
     else :
         idp_dic = {}
     CRL.createRenderLayer(name)
     self.arnold.setRenderLayer(name)
     if idp_dic:
         for key, value in idp_dic.items():
             if value:
                 self.createShaderCmd(key, value)
def createRenderLayer(name):
    #创建渲染层
    #
    #参数name: 需要输入渲染层的名字
    #
    #获取所有的模型对象
    allgeos = getallGeos()
    topgrp = list(set([i.getParent(-1) for i in allgeos]))

    members = getallTops()
    #切换渲染器
    try:
        defaultLayer = pm.nodetypes.RenderLayer.defaultRenderLayer()
        defaultLayer.setCurrent()
    except:
        pass

    #删除所有的AOV
    at.delAOV()

    #删除所有的渲染层
    renderLayers = pm.ls(type='renderLayer')
    for rl in renderLayers:
        if 'defaultRenderLayer' not in rl.name():
            pm.delete(rl)

    #创建渲染层
    if name == "bg_color":
        for key in ['AO', 'NOM', 'Fre', 'Z']:
            at.createAOV(key)
        members = getsetTops() + getlightTops()
    elif name == "chr_color":
        for key in ['AO', 'NOM', 'Fre', 'sss']:
            at.createAOV(key)
        im = importLight()
        members = getchrandpropTops() + im
    elif name == "night_chr_color":
        for key in ['AO', 'NOM', 'Fre', 'sss']:
            at.createAOV(key)
        im = importLight()
        members = getchrandpropTops() + im
    elif name in [
            "chr_idp1", "chr_idp2", "chr_idp3", "bg_idp1", "bg_idp2", "bg_idp3"
    ]:
        delAllShaders(topgrp)
        shader, sg = CNG.createIDPNode('Maeet')
        CNG.assignShader(topgrp, shader, sg)
    elif name == "shadow":
        delAllShaders(topgrp)
        at.createAOV('COCC')
        shader, sg = CNG.createShadow()
        CNG.assignShader(topgrp, shader, sg)
    elif name == "RGBlight":
        delAllShaders(topgrp)
        shader, sg = CNG.createRGBlight()
        CNG.assignShader(topgrp, shader, sg)
    elif name == "FOGlight":
        delAllShaders(topgrp)
        shader, sg = CNG.createFOGlight()
        CNG.assignShader(topgrp, shader, sg)
    else:
        pass

    if name == 'night_chr_color':
        layerName = 'chr_color'
    else:
        layerName = name
    try:
        layer = pm.nodetypes.RenderLayer.findLayerByName(layerName)
    except:
        layer = pm.createRenderLayer(name=layerName, e=1)
    try:
        defaultLayer = pm.nodetypes.RenderLayer.defaultRenderLayer()
        defaultLayer.renderable.set(0)
    except:
        pass
    layer.setCurrent()
    if members:
        layer.addMembers(members)
    try:
        saveFile(name)
    except:
        pass
Ejemplo n.º 8
0
def createRenderLayer(name):
    # 创建渲染层
    #
    # 参数name: 需要输入渲染层的名字
    #
    # 获取所有的模型对象
    allgeos = getallGeos()
    topgrp = list(set([i.getParent(-1) for i in allgeos]))

    members = getallTops()
    # 切换渲染器
    try:
        defaultLayer = pm.nodetypes.RenderLayer.defaultRenderLayer()
        defaultLayer.setCurrent()
    except:
        pass

    # 删除所有的AOV
    at.delAOV()

    # 删除所有的渲染层
    renderLayers = pm.ls(type="renderLayer")
    for rl in renderLayers:
        if "defaultRenderLayer" not in rl.name():
            pm.delete(rl)

    # 创建渲染层
    if name == "bg_color":
        for key in ["AO", "NOM", "Fre", "Z"]:
            at.createAOV(key)
        members = getsetTops() + getlightTops()
    elif name == "chr_color":
        for key in ["AO", "NOM", "Fre", "sss"]:
            at.createAOV(key)
        im = importLight()
        members = getchrandpropTops() + im
    elif name == "night_chr_color":
        for key in ["AO", "NOM", "Fre", "sss"]:
            at.createAOV(key)
        im = importLight()
        members = getchrandpropTops() + im
    elif name in ["chr_idp1", "chr_idp2", "chr_idp3", "bg_idp1", "bg_idp2", "bg_idp3"]:
        delAllShaders(topgrp)
        shader, sg = CNG.createIDPNode("Maeet")
        CNG.assignShader(topgrp, shader, sg)
    elif name == "shadow":
        delAllShaders(topgrp)
        at.createAOV("COCC")
        shader, sg = CNG.createShadow()
        CNG.assignShader(topgrp, shader, sg)
    elif name == "RGBlight":
        delAllShaders(topgrp)
        shader, sg = CNG.createRGBlight()
        CNG.assignShader(topgrp, shader, sg)
    elif name == "FOGlight":
        delAllShaders(topgrp)
        shader, sg = CNG.createFOGlight()
        CNG.assignShader(topgrp, shader, sg)
    else:
        pass

    if name == "night_chr_color":
        layerName = "chr_color"
    else:
        layerName = name
    try:
        layer = pm.nodetypes.RenderLayer.findLayerByName(layerName)
    except:
        layer = pm.createRenderLayer(name=layerName, e=1)
    try:
        defaultLayer = pm.nodetypes.RenderLayer.defaultRenderLayer()
        defaultLayer.renderable.set(0)
    except:
        pass
    layer.setCurrent()
    if members:
        layer.addMembers(members)
    try:
        saveFile(name)
    except:
        pass