• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.shadingNode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.shadingNode函数的典型用法代码示例。如果您正苦于以下问题:Python shadingNode函数的具体用法?Python shadingNode怎么用?Python shadingNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了shadingNode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _water

 def _water(self):
     node = cmds.shadingNode('water', asTexture=True)
     tex = cmds.shadingNode('place2dTexture', asUtility=True)
     cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
     cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
     cmds.setAttr(tex + '.repeatU', 1)
     cmds.setAttr(tex + '.repeatV', 1)
开发者ID:K240,项目名称:miExecutor,代码行数:7,代码来源:mayaNode.py


示例2: substanceOutput

def substanceOutput():
    node = cmds.shadingNode('substanceOutput', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 1)
    cmds.setAttr(tex + '.repeatV', 1)
开发者ID:minoue,项目名称:miExecutor,代码行数:7,代码来源:MayaNodes.py


示例3: grid

def grid():
    node = cmds.shadingNode('grid', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 4)
    cmds.setAttr(tex + '.repeatV', 4)
开发者ID:minoue,项目名称:miExecutor,代码行数:7,代码来源:MayaNodes.py


示例4: createShader

def createShader(textureNode, shaderType='blinn', fromColour=False, fromNormal=True, fromSpecular=True):

    if fromColour and fromNormal and fromSpecular:
        raise UserWarning('You have to choose which component to start from')
    if not fromColour and not fromNormal and not fromSpecular:
        raise UserWarning('You have to choose which component to start from')
    if not fromColour and fromNormal and fromSpecular:
        raise UserWarning('You have to choose which component to start from')
       
    colorTexture = textureNode
    alphaTexture = textureNode
    normalTexture = textureNode
    specularTexture = textureNode
    
    if shaderType == 'blinn':
        # createShader and shadingGroup
        shader = cmds.shadingNode('blinn', asShader=True)
        shadingGroup = cmds.sets(shader)
    if fromColour and fromSpecular:
        # create bump/normal node
        bumpNode = cmds.shadingNode('bump2d', asUtility=True)
        cmds.setAttr(bumpNode+'.bumpInterp', 1)
        # connect normal map to bump node
        cmds.connectAttr(normalTexture+'.outAlpha', bumpNode+'.bumpValue')
        # connect bump to shader
        cmds.connectAttr(bumpNode+'.outNormal', shader+'.normalCamera')
开发者ID:shrimo,项目名称:dmptools,代码行数:26,代码来源:textureCreator.py


示例5: blendS

def blendS(name, fk, ik, child):
    cmds.shadingNode( 'blendColors', n=name, au=True)
    cmds.connectAttr( '%s.scale' % fk , '%s.color1' % name)
    cmds.connectAttr( '%s.scale' % ik , '%s.color2' % name)
    cmds.connectAttr('%s.output' % name, '%s.scale' % child)
    cmds.setAttr('%s.blender' % name, 0)
    return name
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:fsaGeneralModule.py


示例6: assignArnoldShaders

def assignArnoldShaders(chromnBall,grayBall,whiteBall):
    #create and assign chromn ball shader
    chromnBallShader = mc.shadingNode('aiStandard', asShader = True, n = "mat_chromnBall")
    chromnBallSG = mc.sets(n = chromnBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(chromnBallShader+".outColor", chromnBallSG+".surfaceShader", f = True)
    mc.setAttr(chromnBallShader+".color",0,0,0, type = "double3")
    mc.setAttr(chromnBallShader+".Kd",0)
    mc.setAttr(chromnBallShader+".Ks",1)
    mc.setAttr(chromnBallShader+".specularRoughness",0)
    mc.sets(chromnBall,e = True, forceElement = chromnBallSG)
        
    #create and assign gray ball shader
    grayBallShader = mc.shadingNode('aiStandard', asShader = True, n = "mat_grayBall")
    grayBallSG = mc.sets(n = grayBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(grayBallShader+".outColor", grayBallSG+".surfaceShader", f = True)
    mc.setAttr(grayBallShader+".color",0.18,0.18,0.18, type = "double3")
    mc.setAttr(grayBallShader+".Kd",1)
    mc.setAttr(grayBallShader+".KsColor",0,0,0, type = "double3")
    mc.setAttr(grayBallShader+".Ks",0)
    mc.setAttr(chromnBallShader+".specularRoughness",0)
    mc.sets(grayBall,e = True, forceElement = grayBallSG)
    
    #create and assign white ball shader
    whiteBallShader = mc.shadingNode('aiStandard', asShader = True, n = "mat_whiteBall")
    whiteBallSG = mc.sets(n = whiteBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(whiteBallShader+".outColor", whiteBallSG+".surfaceShader", f = True)
    mc.setAttr(whiteBallShader+".color",1,1,1, type = "double3")
    mc.setAttr(whiteBallShader+".Kd",1)
    mc.setAttr(whiteBallShader+".KsColor",0,0,0, type = "double3")
    mc.setAttr(whiteBallShader+".Ks",0)
    mc.setAttr(chromnBallShader+".specularRoughness",0)
    mc.sets(whiteBall,e = True, forceElement = whiteBallSG)
开发者ID:jackieliao67,项目名称:lightingTools,代码行数:32,代码来源:lgtSpheresCreator.py


示例7: updateColor

 def updateColor(self, mID, colorname):
     """
     Update the color of the Maya's Mesh Node associated with a this
     StrandItem, this is done by creating a shadingNode for each color or
     connecting the Mesh Mode to an existing shadingNode if one exists
     for a given color.
     """
     m = Mom()
     meshName = "%s%s" % (m.helixMeshName, mID)
     color = QColor(colorname)
     colorval = "%d_%d_%d" % (color.red(), color.green(), color.blue())
     shaderName = "%s%d_%d_%d" % (m.helixShaderName, color.red(),
                                               color.green(),
                                               color.blue())
     if not cmds.objExists(shaderName):
         # Shader does not exist create one
         cmds.shadingNode('lambert', asShader=True, name=shaderName)
         cmds.sets(n="%sSG" % shaderName, r=True, nss=True, em=True)
         cmds.connectAttr("%s.outColor" % shaderName,
                          "%sSG.surfaceShader" % shaderName)
         cmds.setAttr("%s.color" % shaderName,
                      color.redF(), color.greenF(), color.blueF(),
                      type="double3")
         cmds.sets(meshName, forceElement="%sSG" % shaderName)
     else:
         #shader exist connect
         cmds.sets(meshName, forceElement="%sSG" % shaderName)
开发者ID:nate-w,项目名称:cadnano2.5,代码行数:27,代码来源:stranditem.py


示例8: linkFileToSpecular

def linkFileToSpecular(src, dst):
    cmds.shadingNode("remapHsv", n="%s_remapHsc" % dst, au=1)
    cmds.shadingNode("solidFractal", n="%s_solidFractal" % dst, at=1)
    cmds.shadingNode("place3dTexture", n="%s_place3dTexture" % dst, at=1)
    cmds.shadingNode("multiplyDivide", n="%s_multiplyDivide" % dst, au=1)
    cmds.shadingNode("ramp", n="%s_ramp" % dst, at=1)
    cmds.setAttr("%s.saturation[1].saturation_Position" % ("%s_remapHsc" % dst), 1)
    cmds.setAttr("%s.saturation[1].saturation_FloatValue" % ("%s_remapHsc" % dst), 0)
    cmds.setAttr("%s.value[0].value_FloatValue" % ("%s_remapHsc" % dst), 0)
    cmds.setAttr("%s.value[0].value_Position" % ("%s_remapHsc" % dst), 0.025)
    cmds.setAttr("%s.value[1].value_FloatValue" % ("%s_remapHsc" % dst), 1)
    cmds.setAttr("%s.value[1].value_Position" % ("%s_remapHsc" % dst), 0.075)
    cmds.connectAttr(
        "%s.worldInverseMatrix[0]" % ("%s_place3dTexture" % dst), "%s.placementMatrix" % ("%s_solidFractal" % dst), f=1
    )
    cmds.connectAttr("%s.outColor" % src, "%s.color" % ("%s_remapHsc" % dst), f=1)
    cmds.connectAttr("%s.outColor" % ("%s_remapHsc" % dst), "%s.input1" % ("%s_multiplyDivide" % dst), f=1)
    cmds.connectAttr("%s.outColor" % ("%s_solidFractal" % dst), "%s.input2" % ("%s_multiplyDivide" % dst), f=1)
    cmds.connectAttr("%s.output" % ("%s_multiplyDivide" % dst), "%s.colorGain" % ("%s_ramp" % dst), f=1)
    if cmds.nodeType(dst) == "RedshiftArchitectural":
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.diffuse'%dst)
        cmds.connectAttr("%s.outColor" % ("%s_ramp" % dst), "%s.refl_color" % dst, f=1)
    elif cmds.nodeType(dst) == "aiStandard":
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.color'%dst)
        cmds.connectAttr("%s.outColor" % ("%s_ramp" % dst), "%s.KsColor" % dst, f=1)
        # cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.color'%dst, f = 1)
    else:
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.color'%dst)
        cmds.connectAttr("%s.outColor" % ("%s_ramp" % dst), "%s.reflectedColor" % dst, f=1)
        # cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.color'%dst, f = 1)
    linkTopRemapNodeToAll("%s_ramp" % dst)
开发者ID:chuckbruno,项目名称:remap,代码行数:31,代码来源:RemapAndIllumanceForSelectObjsInstance.py


示例9: createDecoratorNodes

    def createDecoratorNodes(self, coords, mID):
        """Create a actual Maya Nodes for a new Pre-Decortators"""
        m = Mom()
        stapleModIndicatorName = "%s%s" % (m.decoratorNodeName, mID)
        transformName = "%s%s" % (m.decoratorTransformName, mID)
        meshName = "%s%s" % (m.decoratorMeshName, mID)
        shaderName = "%s" % m.decoratorShaderName

        cmds.createNode("transform", name=transformName, skipSelect=True)
        cmds.setAttr("%s.rotateX" % transformName, 90)
        cmds.setAttr("%s.translateX" % transformName, coords[0])
        cmds.setAttr("%s.translateY" % transformName, coords[1])
        cmds.setAttr("%s.translateZ" % transformName, coords[2])
        cmds.createNode("mesh", name=meshName, parent=transformName, skipSelect=True)
        # cmds.createNode("spPreDecoratorNode", name=stapleModIndicatorName)
        cmds.createNode("polySphere", name=stapleModIndicatorName, skipSelect=True)
        cmds.setAttr("%s.radius" % stapleModIndicatorName, 0.25)
        cmds.setAttr("%s.subdivisionsAxis" % stapleModIndicatorName, 4)
        cmds.setAttr("%s.subdivisionsHeight" % stapleModIndicatorName, 4)

        # cmds.connectAttr("%s.outputMesh" % stapleModIndicatorName,
        #                 "%s.inMesh" % meshName)
        cmds.connectAttr("%s.output" % stapleModIndicatorName, "%s.inMesh" % meshName)

        if not cmds.objExists(shaderName):
            # Shader does not exist create one
            cmds.shadingNode("lambert", asShader=True, name=shaderName)
            cmds.sets(n="%sSG" % shaderName, r=True, nss=True, em=True)
            cmds.connectAttr("%s.outColor" % shaderName, "%sSG.surfaceShader" % shaderName)
            cmds.setAttr("%s.color" % shaderName, 0.0, 0.0, 0.0, type="double3")
            cmds.sets(meshName, forceElement="%sSG" % shaderName)
        else:
            # shader exist connect
            cmds.sets(meshName, forceElement="%sSG" % shaderName)
        return (stapleModIndicatorName, transformName, meshName, shaderName)
开发者ID:alaindomissy,项目名称:cadnano2,代码行数:35,代码来源:virtualhelixitem.py


示例10: _VRayWater

 def _VRayWater(self):
     node = cmds.shadingNode("VRayWater", asTexture=True)
     tex = cmds.shadingNode("place2dTexture", asUtility=True)
     cmds.connectAttr(tex + ".outUV", node + ".uvCoord")
     cmds.connectAttr(tex + ".outUvFilterSize", node + ".uvFilterSize")
     cmds.setAttr(tex + ".repeatU", 1)
     cmds.setAttr(tex + ".repeatV", 1)
开发者ID:K240,项目名称:miExecutor,代码行数:7,代码来源:vray.py


示例11: ConstraintVisibility

    def ConstraintVisibility(self, Objects , ControlObject , SpaceSwitchName = 'spaceSwitch', reverse = False ):
        if (self.AddNumericParameter (ControlObject, Name = SpaceSwitchName)):
            SWMultDiv = cmds.shadingNode("multiplyDivide",asUtility = True ,name = SpaceSwitchName + "SWMultDivide" )
            SWMultDiv = self.NameConv.RMRenameBasedOnBaseName(ControlObject, SWMultDiv, NewName = SWMultDiv)
            cmds.connectAttr(ControlObject+"."+SpaceSwitchName ,SWMultDiv+".input1X")
            cmds.setAttr(SWMultDiv+".input2X",10)
            cmds.setAttr(SWMultDiv+".operation",2)
        else:
            SWMultDiv = cmds.listConnections(ControlObject + "." + SpaceSwitchName, type = "multiplyDivide")[0]

        if reverse == True:
            ConnectionsList = cmds.listConnections (SWMultDiv + ".outputX", type = "reverse")
            reverseSW = ""
            if ConnectionsList and len(ConnectionsList) >= 1:
                reverseSW = ConnectionsList[0]
            else :
                reverseSW = cmds.shadingNode('reverse', asUtility=True, name = SpaceSwitchName + "SWReverse")
                reverseSW = self.NameConv.RMRenameBasedOnBaseName(ControlObject, reverseSW, NewName ="SWReverse")
                cmds.connectAttr( SWMultDiv + ".outputX", reverseSW + ".inputX")

                if self.NameConv.RMIsNameInFormat (ControlObject):
                    reverseSW = self.NameConv.RMRenameBasedOnBaseName(ControlObject,reverseSW, NewName = reverseSW)
                else:
                    reverseSW = self.NameConv.RMRenameNameInFormat(reverseSW)
            for eachObject in Objects:
                cmds.connectAttr(reverseSW + ".outputX", eachObject + ".visibility")
        
        else:
            for eachObject in Objects:
                cmds.connectAttr(SWMultDiv + ".outputX", eachObject + ".visibility")
开发者ID:rendermotion,项目名称:RMMel,代码行数:30,代码来源:RMSpaceSwitch.py


示例12: shaderAssigner

def shaderAssigner() :
	# Assigning temporary shader to selected objects
	sels = mc.ls( sl=True )
	name = ''
	side = ''

	nameResult = mc.promptDialog(
					title='Shading Name',
					message='Enter Name:',
					button=['OK', 'Cancel'],
					defaultButton='OK',
					cancelButton='Cancel',
					dismissString='Cancel'
				)
	
	if nameResult == 'OK':
	    name = mc.promptDialog(query=True, text=True)
    
	if name :
		
		shadingName = '%sTmp_lambert' % name
		
		if not mc.objExists( shadingName ) :
			
			mc.shadingNode( 'lambert' , asShader=True , n=shadingName )
		
		mc.select( sels , r=True )
		cmd = 'hyperShade -assign %s;' % shadingName
		mm.eval( cmd )
		
		mc.select( shadingName , r=True )
开发者ID:myCodeTD,项目名称:pkmel,代码行数:31,代码来源:pkTools.py


示例13: connectThroughBC

def connectThroughBC(parentsA, parentsB, children, instance, switchattr ):
    constraints = []
    for j in range(len(children)):
        switchPrefix = children[j].partition('_')[2]
        bcNodeT = cmds.shadingNode("blendColors", asUtility=True, n=instance + 'bcNodeT_switch_' + switchPrefix)
        bcNodeR = cmds.shadingNode("blendColors", asUtility=True, n=instance + 'bcNodeR_switch_' + switchPrefix)
        bcNodeS = cmds.shadingNode("blendColors", asUtility=True, n=instance + 'bcNodeS_switch_' + switchPrefix)
        
        constraints.append([bcNodeT, bcNodeR, bcNodeS])
        # connect to switchattr
        if switchattr == 'None':
            cmds.setAttr(bcNodeT  + '.blender', 1)
            cmds.setAttr(bcNodeR  + '.blender', 1)
            cmds.setAttr(bcNodeS  + '.blender', 1)
        else:
            cmds.connectAttr(switchattr, bcNodeT  + '.blender')
            cmds.connectAttr(switchattr, bcNodeR  + '.blender')
            cmds.connectAttr(switchattr, bcNodeS  + '.blender')

        # Input Parents
        cmds.connectAttr(parentsA[j] + '.translate', bcNodeT + '.color1')        
        cmds.connectAttr(parentsA[j] + '.rotate', bcNodeR + '.color1')       
        cmds.connectAttr(parentsA[j] + '.scale', bcNodeS + '.color1')
        if parentsB != 'None':
            cmds.connectAttr(parentsB[j] + '.translate', bcNodeT + '.color2')
            cmds.connectAttr(parentsB[j] + '.rotate', bcNodeR + '.color2')
            cmds.connectAttr(parentsB[j] + '.scale', bcNodeS + '.color2')
        # Output to Children
        cmds.connectAttr(bcNodeT + '.output', children[j] + '.translate')
        cmds.connectAttr(bcNodeR + '.output', children[j] + '.rotate')
        cmds.connectAttr(bcNodeS + '.output', children[j] + '.scale')
    return constraints
开发者ID:RiggingDojo,项目名称:AnomaliaRigging,代码行数:32,代码来源:utils.py


示例14: assignVrayShaders

def assignVrayShaders(chromnBall,grayBall,whiteBall):
    #create and assign chromn ball shader
    chromnBallShader = mc.shadingNode('VRayMtl', asShader = True, n = "mat_chromnBall")
    chromnBallSG = mc.sets(n = chromnBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(chromnBallShader+".outColor", chromnBallSG+".surfaceShader", f = True)
    mc.setAttr(chromnBallShader+".color",0,0,0, type = "double3")
    mc.setAttr(chromnBallShader+".diffuseColorAmount",0)
    mc.setAttr(chromnBallShader+".reflectionColor",1,1,1,type = "double3")
    mc.setAttr(chromnBallShader+".refractionIOR",15)
    mc.sets(chromnBall,e = True, forceElement = chromnBallSG)
        
    #create and assign gray ball shader
    grayBallShader = mc.shadingNode('VRayMtl', asShader = True, n = "mat_grayBall")
    grayBallSG = mc.sets(n = grayBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(grayBallShader+".outColor", grayBallSG+".surfaceShader", f = True)
    mc.setAttr(grayBallShader+".color",0.18,0.18,0.18, type = "double3")
    mc.setAttr(grayBallShader+".reflectionColorAmount",0)
    mc.sets(grayBall,e = True, forceElement = grayBallSG)
    
    #create and assign white ball shader
    whiteBallShader = mc.shadingNode('VRayMtl', asShader = True, n = "mat_whiteBall")
    whiteBallSG = mc.sets(n = whiteBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(whiteBallShader+".outColor", whiteBallSG+".surfaceShader", f = True)
    mc.setAttr(whiteBallShader+".color",1,1,1, type = "double3")
    mc.setAttr(whiteBallShader+".reflectionColorAmount",0)
    mc.sets(whiteBall,e = True, forceElement = whiteBallSG)
开发者ID:jackieliao67,项目名称:lightingTools,代码行数:26,代码来源:lgtSpheresCreator.py


示例15: ImportCustomTexture

def ImportCustomTexture(name):
	
	os.system("cd ~/maya/2014-x64/scripts; python texture.py")
	
	file = '/usr/tmp/texture.jpg'
	
	#create a shader
	shader=cmds.shadingNode( "blinn", asShader=True )

	#a file texture node
	shaderName = file_node=cmds.shadingNode( "file", asTexture=True )
	
	print shaderName
	
	#attach file to node
	cmds.setAttr( '%s.fileTextureName' %file_node, file, type = "string")
 
	# a shading group
	shading_group= cmds.sets(renderable=True,noSurfaceShader=True,empty=True)

	#connect shader to sg surface shader
	cmds.connectAttr('%s.outColor' %shader ,'%s.surfaceShader' %shading_group)

	#connect file texture node to shader's color
	cmds.connectAttr('%s.outColor' %file_node, '%s.color' %shader)

	cmds.sets(name, edit=True, forceElement=shading_group)
开发者ID:Gmadges,项目名称:PastWork,代码行数:27,代码来源:TerrainLib.py


示例16: addUVsChecker

def addUVsChecker(objects, uRepeats=4, vRepeats=4):
	"""
	Applies UVs checkers onto given geometry objects.

	:param objects: Current objects list.
	:type objects: list
	:param uRepeats: U checker repeats.
	:type uRepeats: float
	:param vRepeats: V checker repeats.
	:type vRepeats: float
	:return: Definition succes.
	:rtype: bool
	"""

	for object in objects:
		for shader in getAttachedShaders(object):
			file = getFirstItem(filter(lambda x: re.search("\.color$", x[1]), getConnections(shader)))
			if file is not None:
				if "UVsChecker" in getFirstItem(file):
					continue

			file = cmds.shadingNode("file", asTexture=True)
			cmds.setAttr("{0}.fileTextureName".format(file), os.path.normpath(os.path.join(RESOURCES_DIRECTORY, CHECKER_IMAGE)), type="string")
			place2dTexture = cmds.shadingNode("place2dTexture", asUtility=True)
			cmds.setAttr("{0}.repeatU".format(place2dTexture), uRepeats)
			cmds.setAttr("{0}.repeatV".format(place2dTexture), vRepeats)
			for uvAttribute in ("coverage", "translateFrame", "rotateFrame", "mirrorU", "mirrorV", "stagger", "wrapU", "wrapV" , "repeatUV" , "vertexUvOne" , "vertexUvTwo" , "vertexUvThree" , "vertexCameraOne", "noiseUV", "offset", "rotateUV"):
				cmds.connectAttr("{0}.{1}".format(place2dTexture, uvAttribute), "{0}.{1}".format(file, uvAttribute), force=True)

			cmds.connectAttr("{0}.outColor".format(file), "{0}.color".format(shader), force=True)
			cmds.rename(file, "UVsChecker_{0}_file".format(shader))
			cmds.rename(place2dTexture, "UVsChecker_{0}_place2dTexture".format(shader))

	return True
开发者ID:KelSolaar,项目名称:Snippets,代码行数:34,代码来源:uvsUtilities.py


示例17: assignMayaShaders

def assignMayaShaders(chromnBall,grayBall,whiteBall):
    #create and assign chromn ball shader
    chromnBallShader = mc.shadingNode('blinn', asShader = True, n = "mat_chromnBall")
    chromnBallSG = mc.sets(n = chromnBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(chromnBallShader+".outColor", chromnBallSG+".surfaceShader", f = True)
    mc.setAttr(chromnBallShader+".color",0,0,0, type = "double3")
    mc.setAttr(chromnBallShader+".diffuse",0)
    mc.setAttr(chromnBallShader+".specularColor",1,1,1,type = "double3")
    mc.setAttr(chromnBallShader+".reflectivity",1)
    mc.setAttr(chromnBallShader+".eccentricity",0)
    mc.setAttr(chromnBallShader+".specularRollOff",1)
    mc.sets(chromnBall,e = True, forceElement = chromnBallSG)

    #create and assign gray ball shader
    grayBallShader = mc.shadingNode('lambert', asShader = True, n = "mat_grayBall")
    grayBallSG = mc.sets(n = grayBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(grayBallShader+".outColor", grayBallSG+".surfaceShader", f = True)
    mc.setAttr(grayBallShader+".color",0.18,0.18,0.18, type = "double3")
    mc.setAttr(grayBallShader+".diffuse",1)
    mc.sets(grayBall,e = True, forceElement = grayBallSG)

    #create and assign white ball shader
    whiteBallShader = mc.shadingNode('lambert', asShader = True, n = "mat_whiteBall")
    whiteBallSG = mc.sets(n = whiteBallShader + "SG", renderable = True, noSurfaceShader = True, empty = True)
    mc.connectAttr(whiteBallShader+".outColor", whiteBallSG+".surfaceShader", f = True)
    mc.setAttr(whiteBallShader+".diffuse",1)
    mc.setAttr(whiteBallShader+".color",1,1,1, type = "double3")
    mc.sets(whiteBall,e = True, forceElement = whiteBallSG)
开发者ID:jackieliao67,项目名称:lightingTools,代码行数:28,代码来源:lgtSpheresCreator.py


示例18: pathFollow

def pathFollow (curve , control, objectArray, NameConv = None):
	if not NameConv:
		NameConv = RMNameConvention.RMNameConvention()
	controlAttr = cmds.listAttr(control)
	if "Percent" not in controlAttr:
		cmds.addAttr(control,at="float", ln = "Percent", h = 0, k = 1)
	if "Stretch" not in controlAttr:
		cmds.addAttr(control,at="float", ln = "Stretch", hnv = 1, hxv = 0, h = 0, k = 1, smn = 0)

	numberOfElements = len(objectArray)
	sumPath = []
	multiplyDivide = [] 
	index = 0
	for eachObject in objectArray:
		motionPath = cmds.pathAnimation(eachObject, c = curve , follow = True , worldUpType =  "scene", name = "motionpath%s"%index)
		motionPath = NameConv.RMRenameNameInFormat(motionPath)
		multDivFactor = cmds.shadingNode('multiplyDivide', asUtility = True, name = "factor%s"%index)
		multDivFactor = NameConv.RMRenameNameInFormat(multDivFactor)
		cmds.connectAttr("%s.Stretch"%control ,"%s.input1X"%multDivFactor)
		cmds.setAttr("%s.input2X"%multDivFactor, float(index)/float(len(objectArray)))
		cmds.setAttr("%s.operation"%multDivFactor, 1)
		multiplyDivide.append(multDivFactor)
		addition = cmds.shadingNode('plusMinusAverage', asUtility = True, name = "Addition%s"%index)
		addition = NameConv.RMRenameNameInFormat(addition)
		cmds.connectAttr("%s.outputX"%multDivFactor ,"%s.input1D[0]"%addition)
		cmds.connectAttr("%s.Percent"%control ,"%s.input1D[1]"%addition)
		cmds.connectAttr("%s.output1D"%addition,"%s.uValue"%motionPath, force = True)
		index+=1
开发者ID:rendermotion,项目名称:RMMel,代码行数:28,代码来源:MultiPathObjects.py


示例19: createMayaNetwork

def createMayaNetwork(filename):
    lambert = m.shadingNode('lambert', asShader=True)
    sg = m.sets(renderable=True, noSurfaceShader=True, empty=True, name=lambert + 'SG')
    m.connectAttr(lambert + '.outColor', sg + '.surfaceShader', force=True)

    fileNode = m.shadingNode('file', asTexture=True)
    placement = m.shadingNode('place2dTexture', asUtility=True)
    m.connectAttr(placement + '.coverage', fileNode + '.coverage', force=True)
    m.connectAttr(placement + '.translateFrame', fileNode + '.translateFrame', force=True)
    m.connectAttr(placement + '.rotateFrame', fileNode + '.rotateFrame', force=True)
    m.connectAttr(placement + '.mirrorU', fileNode + '.mirrorU', force=True)
    m.connectAttr(placement + '.mirrorV', fileNode + '.mirrorV', force=True)
    m.connectAttr(placement + '.stagger', fileNode + '.stagger', force=True)
    m.connectAttr(placement + '.wrapU', fileNode + '.wrapU', force=True)
    m.connectAttr(placement + '.wrapV', fileNode + '.wrapV', force=True)
    m.connectAttr(placement + '.repeatUV', fileNode + '.repeatUV', force=True)
    m.connectAttr(placement + '.offset', fileNode + '.offset', force=True)
    m.connectAttr(placement + '.rotateUV', fileNode + '.rotateUV', force=True)
    m.connectAttr(placement + '.noiseUV', fileNode + '.noiseUV', force=True)
    m.connectAttr(placement + '.vertexUvOne', fileNode + '.vertexUvOne', force=True)
    m.connectAttr(placement + '.vertexUvTwo', fileNode + '.vertexUvTwo', force=True)
    m.connectAttr(placement + '.vertexUvThree', fileNode + '.vertexUvThree', force=True)
    m.connectAttr(placement + '.vertexCameraOne', fileNode + '.vertexCameraOne', force=True)
    m.connectAttr(placement + '.outUV', fileNode + '.uv', force=True)
    m.connectAttr(placement + '.outUvFilterSize', fileNode + '.uvFilterSize', force=True)

    m.connectAttr(fileNode + '.outColor', lambert + '.color', force=True)

    m.setAttr(fileNode + '.fileTextureName', filename, typ='string')

    return sg
开发者ID:Italic-,项目名称:maya-prefs,代码行数:31,代码来源:create_test_scene.py


示例20: createBlossomShader

def createBlossomShader(rgb_blossom):
    """
    It creates a shading network for the blossom material.

    rgb_branch:   RGB values (0-1) for the diffuse colour of the branches.

    On Exit:      Creates a Lambert node connected to a Shading Group which will be applied to the petals. Furthermore, two
                  non-customizable additional shaders will be created and applied to the stamen and pedicel of the blossom. 
    """
    global blossomMat, blossomSG
    import globalVar
    reload(globalVar)

    blossomPetalsMat = cmds.shadingNode( 'lambert', asShader=True, name='blossomPetalsMat'+str(globalVar.plantNumber) )
    cmds.setAttr( blossomPetalsMat + '.color', rgb_blossom[0], rgb_blossom[1], rgb_blossom[2] )
    blossomPetalsSG = cmds.sets( renderable=True, noSurfaceShader=True, empty=True,
        name='blossomPetalsSG'+str(globalVar.plantNumber) )
    cmds.connectAttr( blossomPetalsMat + '.outColor', blossomPetalsSG + '.surfaceShader', f=True )

    blossomStamenMat = cmds.shadingNode( 'lambert', asShader=True, name='blossomStamenMat'+str(globalVar.plantNumber) )
    cmds.setAttr( blossomStamenMat + '.color', 0.848, 0.8484, 0.186 )
    blossomStamenSG = cmds.sets( renderable=True, noSurfaceShader=True, empty=True,
        name='blossomStamenSG'+str(globalVar.plantNumber) )
    cmds.connectAttr( blossomStamenMat + '.outColor', blossomStamenSG + '.surfaceShader', f=True )

    blossomPedicelMat = cmds.shadingNode( 'lambert', asShader=True, name='blossomPedicelMat'+str(globalVar.plantNumber) )
    cmds.setAttr( blossomPedicelMat + '.color', 0, 0.494, 0 )
    blossomPedicelSG = cmds.sets( renderable=True, noSurfaceShader=True, empty=True,
        name='blossomPedicelSG'+str(globalVar.plantNumber) )
    cmds.connectAttr( blossomPedicelMat + '.outColor', blossomPedicelSG + '.surfaceShader', f=True )
开发者ID:docwhite,项目名称:LSystemsMaya,代码行数:30,代码来源:LS_interpreter.py



注:本文中的maya.cmds.shadingNode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.shelfButton函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.sets函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap