本文整理汇总了Python中pymel.core.shadingNode函数的典型用法代码示例。如果您正苦于以下问题:Python shadingNode函数的具体用法?Python shadingNode怎么用?Python shadingNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shadingNode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: doIDShdNetwork
def doIDShdNetwork(*args):
## check if the shading network is existing
shdName = 'idSetup'
if( len( pm.ls(shdName + "_SHD") ) ) != 0:
pm.confirmDialog(t="Warning", message="The shader has been existed!", icon='warning')
return 0
# aiUserDataColor
dataColor = pm.shadingNode('aiUserDataColor', asUtility=True, name=shdName+'DataColor')
dataColor.colorAttrName.set('idcolor')
# aiUserDataString
dataString = pm.shadingNode('aiUserDataString', asUtility=True, name=shdName+'DataString')
dataString.stringAttrName.set('Id')
# aiWriteColor
writeColor = pm.shadingNode('aiWriteColor', asUtility=True, name=shdName+'WriteColor')
# aiUtility
aiIDShd = pm.shadingNode('aiUtility', asShader=True, name=shdName+'_SHD')
aiIDShd.shadeMode.set(2)
# connections
dataColor.outColor >> writeColor.input
dataString.outValue >> writeColor.aovName
writeColor.outColor >> aiIDShd.color
开发者ID:nadibeu,项目名称:arnoldDev,代码行数:27,代码来源:arnold_id_assign_v004b.py
示例2: sumAttr
def sumAttr(sumCtrl=None,
ctrlAttrA=None, ctrlAttrB=None,
ctrlAttrResult=None,
scaleA=None, scaleB=None):
pmaNode = pm.shadingNode('plusMinusAverage',n='%s_Sum'%sumCtrl, asUtility=1)
if scaleA:
scaleA_node = pm.shadingNode('multiplyDivide',n='%s_ScaleA'%sumCtrl, asUtility=1)
pm.setAttr('%s.input1X'%scaleA_node,scaleA)
pm.connectAttr(ctrlAttrA,'%s.input2X'%scaleA_node,f=1)
pm.connectAttr('%s.outputX'%scaleA_node,'%s.input1D[0]'%pmaNode,f=1)
else:
pm.connectAttr(ctrlAttrA,'%s.input1D[0]'%pmaNode,f=1)
if scaleB:
scaleB_node = pm.shadingNode('multiplyDivide',n='%s_ScaleB'%sumCtrl, asUtility=1)
pm.setAttr('%s.input1X'%scaleB_node,scaleB)
pm.connectAttr(ctrlAttrB,'%s.input2X'%scaleB_node,f=1)
pm.connectAttr('%s.outputX'%scaleB_node,'%s.input1D[1]'%pmaNode,f=1)
else:
pm.connectAttr(ctrlAttrB,'%s.input1D[1]'%pmaNode,f=1)
try:
pm.addAttr(sumCtrl, ln=ctrlAttrResult.split('.')[1], k=1)
except Exception, e:
raise( e )
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:26,代码来源:snippetsCollection.py
示例3: createLight
def createLight(self, position):
value = self.distance_float.value()
if self.lightType_menu.currentIndex() == 1:
light = pm.shadingNode('areaLight', asLight=True)
pm.setAttr(light + '.intensity', 500)
pm.setAttr(light + '.decayRate', 2)
pm.setAttr(light + '.areaLight', 1)
elif self.lightType_menu.currentIndex() == 2:
light = pm.shadingNode('spotLight', asLight=True)
pm.setAttr(light + '.intensity', 500)
pm.setAttr(light + '.decayRate', 2)
elif self.lightType_menu.currentIndex() == 3:
light = pm.shadingNode('directionalLight', asLight=True)
elif self.lightType_menu.currentIndex() == 4:
light = pm.shadingNode('pointLight', asLight=True)
pm.setAttr(light + '.intensity', 500)
pm.setAttr(light + '.decayRate', 2)
pm.rename(light, light_name)
pm.xform(light, a=True, t=position)
pm.xform(light, r=True, t=(0, 0, value))
return light
开发者ID:Huston94,项目名称:Orbital_Light_Previewer,代码行数:29,代码来源:orbitLights_UI.py
示例4: offsets_hookUp
def offsets_hookUp():
loc = pm.ls(sl=True)[-1]
iks = pm.ls(sl=True)[:-1]
loc.addAttr('chomp', k=True, at='double', min=0, max=10)
for attr in ['offset','offsetMax','offsetMin']:
for ik in iks:
attrName = '%s_%s'%(ik.name().replace('_IK',''), attr)
loc.addAttr(attrName, at='double', k=False, dv=0)
for ik in iks:
attrName = '%s_offset'%ik.name().replace('_IK','')
attrNameMax = '%s_offsetMax'%ik.name().replace('_IK','')
attrNameMin = '%s_offsetMin'%ik.name().replace('_IK','')
loc.attr(attrName).set(1, cb=True)
loc.attr(attrNameMin).set(0, cb=True)
loc.attr(attrNameMax).set(1, cb=True)
linearMult = pm.shadingNode('multDoubleLinear', n=ik.name().replace('_IK','_LMD'), asUtility=True)
remapValue = pm.shadingNode('remapValue', n=ik.name().replace('_IK','_RMV'), asUtility=True)
loc.chomp.connect(linearMult.input1)
loc.attr(attrName).connect(linearMult.input2)
linearMult.output.connect(remapValue.inputValue)
loc.attr(attrNameMin).connect(remapValue.outputMin)
loc.attr(attrNameMax).connect(remapValue.outputMax)
remapValue.outValue.connect(ik.offset)
开发者ID:AndresMWeber,项目名称:jobScripts,代码行数:28,代码来源:rig_potholeMonsterAChompRig.py
示例5: Maya_createNode
def Maya_createNode(self, nodeType, *args):
if nodeType == 'aiStandard':
# Ask for name
name = self.User_inputDialog("Create aiStandard", "Enter a name for the node: ")
# Create and assign shader
aiStd = pc.shadingNode('aiStandard', asShader=True, name=name)
aiStdSg = pc.sets(renderable=True, noSurfaceShader=True, empty=True, name=name + 'SG')
aiStd.outColor >> aiStdSg.surfaceShader
self.UI_refreshShaders()
return(str(aiStd))
if nodeType == 'file':
# Ask for name
name = self.User_inputDialog("Create file", "Enter a name for the node: ")
# Ask for location of the file
location = pc.fileDialog2(fm=1, dialogStyle=2)
myTex = pc.shadingNode('file', asTexture=True, name=name)
myTex.fileTextureName.set(location)
return(str(myTex))
if nodeType == 'ygColorCorrect':
# Ask for name
name = self.User_inputDialog("Create ygColorCorrect", "Enter a name for the node: ")
ygC = pc.shadingNode('ygColorCorrect', asShader=True, name=name)
return(str(ygC))
开发者ID:ma55acre,项目名称:MayaDev,代码行数:31,代码来源:arnold_lookdevassist.py
示例6: create_system
def create_system(self):
shader = pm.shadingNode('transmat', asShader= True)
volume = pm.polyCube(name= 'fog_volume', width=40,
height=40, depth=40)[0]
pm.hyperShade(volume, assign= shader)
parti_volume = pm.mel.eval('mrCreateCustomNode -asShader "" parti_volume;')
pm.setAttr('%s.scatter' % (parti_volume), 1,1,1, type= 'double3' )
pm.setAttr('%s.min_step_len' % (parti_volume), .03)
pm.setAttr('%s.max_step_len' % (parti_volume), .2)
pm.connectAttr('%s.outValue' % (parti_volume),
'%sSG.miVolumeShader' % (shader), force= True)
light_node = pm.shadingNode('%s' % (self.light_types[value]),
asLight= True)
light_node.translate.set(0,15,0)
light_node.rotate.set(-90,0,0)
light = pm.rename(light_node, 'fog_light')
pm.connectAttr('%s.message' % (light.getShape()),
'%s.lights[0]' % (parti_volume), force= True)
if self.checkBox.getValue() == 1:
# mrCreateCustomNode -asUtility "" physical_light;
# // Result: Connected physical_light1.message to fog_lightShape.mentalRayControls.miLightShader. //
phys_light = pm.mel.eval('mrCreateCustomNode -asUtility "" physical_light;')
pm.connectAttr('%s.message' % (phys_light),
'%s.mentalRayControls.miLightShader' % (light.getShape()))
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:32,代码来源:light_rig.py
示例7: Maya_createFullNetwork
def Maya_createFullNetwork(self, withFile, nodeName, *args):
if not withFile:
nodeName = self.Maya_createNode('file')
fileNode = pc.PyNode(nodeName)
aiName = self.Maya_createNode('aiStandard')
aiNode = pc.PyNode(aiName)
# DiffCC
diffCC = pc.shadingNode('ygColorCorrect', asTexture=True, name='diffCC_' + aiNode)
# specCC
specCC = pc.shadingNode('ygColorCorrect', asTexture=True, name='specCC_' + aiNode)
# roughCC
roughCC = pc.shadingNode('ygColorCorrect', asTexture=True, name='roughCC_' + aiNode)
# bumpCC
bumpCC = pc.shadingNode('ygColorCorrect', asTexture=True, name='bumpCC_' + aiNode)
# Bump node
bumpNode = pc.shadingNode('bump2d', asUtility=True, name='bump_' + aiNode)
# Connect everything
fileNode.outColor >> diffCC.image
fileNode.outColor >> specCC.image
fileNode.outColor >> roughCC.image
fileNode.outColor >> bumpCC.image
bumpCC.outAlpha >> bumpNode.bumpValue
bumpNode.outNormal >> aiNode.normalCamera
diffCC.outColor >> aiNode.color
specCC.outColor >> aiNode.KsColor
roughCC.outAlpha >> aiNode.specularRoughness
开发者ID:ma55acre,项目名称:MayaDev,代码行数:35,代码来源:arnold_lookdevassist.py
示例8: setupNetwork
def setupNetwork(aovName, *args):
# If already existing, do nothing
listShd = pc.ls(aovName+'_SHD')
if len(listShd) == 0:
# aiUserDataColor
dataColor = pc.shadingNode('aiUserDataColor', asShader=True, name=aovName+'DataColor')
dataColor.setAttr('colorAttrName', aovName, type='string')
# aiWriteColor
writeColor = pc.shadingNode('aiWriteColor', asShader=True, name=aovName+'WriteColor')
# Target aiStandard
aiStd = pc.shadingNode('surfaceShader', asShader = True, name=aovName+'_SHD')
# Make connections
dataColor.outColor >> writeColor.beauty
writeColor.outColor >> aiStd.outColor
# Creates AOV
aovs.AOVInterface().addAOV('id_'+aovName)
idAov = pc.PyNode('aiAOV_id_'+aovName)
# Connect the shader previously created to the default shader input of the AOV
aiStd.outColor >> idAov.defaultValue
else:
print "Network already in place. Skipping setup."
开发者ID:ma55acre,项目名称:MayaDev,代码行数:25,代码来源:arnold_ids.py
示例9: texNode
def texNode(cgfx, texType, shdName):
"""
:return:
"""
import pymel.core as pm
# create file nodes for all textures and set them up
texFile = pm.shadingNode("file", asTexture = True, n = str(shdName+texType+"_File"))
placeUV = pm.shadingNode("place2dTexture", asUtility = True, n = str(shdName+texType+"_uvPlace"))
placeUV.coverage >> texFile.coverage
placeUV.translateFrame >> texFile.translateFrame
placeUV.rotateFrame >> texFile.rotateFrame
placeUV.mirrorU >> texFile.mirrorU
placeUV.mirrorV >> texFile.mirrorV
placeUV.stagger >> texFile.stagger
placeUV.wrapU >> texFile.wrapU
placeUV.wrapV >> texFile.wrapV
placeUV.repeatUV >> texFile.repeatUV
placeUV.offset >> texFile.offset
placeUV.rotateUV >> texFile.rotateUV
placeUV.noiseUV >> texFile.noiseUV
placeUV.vertexUvOne >> texFile.vertexUvOne
placeUV.vertexUvTwo >> texFile.vertexUvTwo
placeUV.vertexUvThree >> texFile.vertexUvThree
placeUV.vertexCameraOne >> texFile.vertexCameraOne
placeUV.outUV >> texFile.uv
placeUV.outUvFilterSize >> texFile.uvFilterSize
return texFile
开发者ID:carlkeifer3,项目名称:pipeline,代码行数:30,代码来源:textureNode.py
示例10: create_VarFkCtrls
def create_VarFkCtrls( IdName, guideSurface, numberOfCtrls ):
# create controls
ctrlGrp = pm.group( name = IdName + '_ctrls', empty = True, world = True)
ctrlGrp.inheritsTransform.set(0)
listOfCtrls = []
for currentCtrlIndex in range(numberOfCtrls):
if numberOfCtrls > 1:
FolliclePos = ( 1.0 / (numberOfCtrls-1) ) * currentCtrlIndex
else:
FolliclePos = ( 1.0 / (numberOfCtrls) ) * currentCtrlIndex
# create controlshape
currentCtrl = pm.circle( name = ( 'ctrl_vFK' + str( currentCtrlIndex+1 )+ '_' + IdName ), c=(0,0,0), nr=(1,0,0), sw=360, r=1.5, d=3, ut=0, tol=0.01, s=8, ch=False)
currentCtrl[0].overrideEnabled.set(True)
currentCtrl[0].overrideColor.set(4)
# lock'n hide translates + scaleX
currentCtrl[0].translateX.set( lock = True, keyable = False, channelBox = False )
currentCtrl[0].translateY.set( lock = True, keyable = False, channelBox = False )
currentCtrl[0].translateZ.set( lock = True, keyable = False, channelBox = False )
currentCtrl[0].scaleX.set( lock = True )
# add strength, position, radius attributes
pm.addAttr( longName='rotateStrength', attributeType='float', keyable=True, defaultValue=1 )
pm.addAttr( longName='position', attributeType='float', keyable=True, min=0-FolliclePos, max=1-FolliclePos )
pm.addAttr( longName='radius', attributeType='float', keyable=True, min=0.0001, defaultValue=0.3 )
# position min/max relative to defaultposition so ctrl can be zeroed out. Is remapped later back to 0 to 1 when connected to Follicle
currentFollicle = create_follicle( guideSurface[0], uPos=FolliclePos, vPos=0.5 )
currentFollicle.simulationMethod.set(0)
currentFollicle.collide.set(0)
currentFollicle.flipDirection.set( True )
currentFollicle = pm.listRelatives( currentFollicle, parent=True )
# connect to strength multiplier
rotateStrengthMultiplier = pm.shadingNode( 'multiplyDivide', asUtility = True, n = str( currentCtrl[0] ) + '_strength_mult' )
currentCtrl[0].rotate >> rotateStrengthMultiplier.input1
pm.connectAttr( currentCtrl[0] + '.rotateStrength', rotateStrengthMultiplier + '.input2X', f=1 )
pm.connectAttr( currentCtrl[0] + '.rotateStrength', rotateStrengthMultiplier + '.input2Y', f=1 )
pm.connectAttr( currentCtrl[0] + '.rotateStrength', rotateStrengthMultiplier + '.input2Z', f=1 )
# compensate position zero value by current follicle position
jntposZeroCompensate = pm.shadingNode( 'plusMinusAverage', asUtility = True, n=currentCtrl[0] + '_jntposZeroCompensate' )
pm.setAttr( jntposZeroCompensate + '.input1D[0]', pm.getAttr( currentFollicle[0].getShape() + '.parameterU' ) )
pm.connectAttr( currentCtrl[0] + '.position', jntposZeroCompensate + '.input1D[1]', f=1 )
pm.connectAttr( jntposZeroCompensate + '.output1D', currentFollicle[0].getShape() + '.parameterU', f=1 )
# grouping
buf = createBufGrp( currentCtrl )[0]
pm.parent( buf, ctrlGrp, relative = True )
pm.parent( currentFollicle, ctrlGrp )
# connect follicle position to control buffer
currentFollicle[0].translate >> buf.translate
listOfCtrls.append( currentCtrl[0] )
pm.select( clear = 1 )
print( 'Successfully created ' + currentCtrl[0] )
return listOfCtrls
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:59,代码来源:jo_varFk.py
示例11: make_file_nodes
def make_file_nodes(textures, shaders, attribute='color'):
""" Creates (or uses existing) file nodes and assigns them to shaders on the given attribute
Args:
textures [str]: list of file paths to textures
shaders [pm.nodetypes.Blinn] list of blinn (or other) shaders
attribute (str): attribute to connect texture to on shader
"""
file_nodes = []
print shaders
for shader in shaders:
udims = re.findall('1[01][0-9][0-9]', shader.name())
file_node = shader_udim = tex_match = None
if udims:
shader_udim=udims[0]
# Get the corresponding exr for the proper udim of the shader
if shader_udim:
for texture in textures:
print 'checking texture %s against udim search %s'%(tex_match, shader_udim)
try:
tex_match = re.search('.*%s.*'%shader_udim, texture).group()
print 'texture %s matches for udim search %d'%(tex_match, shader_udim)
break
except:
pass
# Get connected file node or make a non-existing one
connected_textures = shader.attr(attribute).listConnections()
if connected_textures and shader_udim:
print 'Using previously connected file nodes for attribute %s on shader %s'%(attribute, shader.name())
file_node = connected_textures[0]
# Special bump map section
if attribute == 'normalCamera':
try:
bump_node = shader.attr(attribute).listConnections()[0]
file_node = bump_node.bumpValue.listConnections()[0]
except:
pass
else:
file_node = pm.shadingNode('file',
asTexture=True,
n=file_name%(shader_udim, attribute))
# Special bump map section
if attribute == 'normalCamera':
bump_node = pm.shadingNode('bump2d', asUtility=True)
file_node.alphaIsLuminance.set(True)
file_node.outAlpha.connect(bump_node.bumpValue)
bump_node.outNormal.connect(shader.attr(attribute))
else:
file_node.outColor.connect(shader.attr(attribute))
# Now if we have a file node and a matching exr we can finally set the file texture name
if tex_match and file_node:
file_node.fileTextureName.set(tex_match)
file_nodes.append(file_node)
return file_nodes
开发者ID:AndresMWeber,项目名称:aw,代码行数:57,代码来源:lib_udim.py
示例12: complex_outdoor
def complex_outdoor(* args):
#create_ibl()
my_sun = pm.shadingNode('directionalLight', asLight= True)
pm.rename(my_sun, 'Sun')
my_sky = pm.shadingNode('areaLight', asLight= True)
new_light = pm.rename(my_sky, 'Sky')
new_light.translate.set(0,16,0)
new_light.rotate.set(-90,0,0)
new_light.scale.set(16,16,16)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:9,代码来源:light_rig.py
示例13: createFlcs
def createFlcs(self,direction,ends):
folicles = []
pm.select(cl=1)
for i in range(self.numJnt):
jnt = self.ikJntList[i]
print jnt
pm.select(cl=1)
flcShape = pm.createNode('follicle', name = self.srf.name() + '_flcShape_' + str(i).zfill(2) )
flcTransform = flcShape.getParent()
flcTransform.rename(flcShape.name().replace('flcShape','flc') )
folicles.append(flcTransform)
srfShape = pm.listRelatives(self.srf)[0]
srfShape.local.connect(flcShape.inputSurface)
srfShape.worldMatrix[0].connect(flcShape.inputWorldMatrix)
flcShape.outRotate.connect(flcTransform.rotate)
flcShape.outTranslate.connect(flcTransform.translate)
#flcShape.flipDirection.set(1)
cposNode = pm.shadingNode( 'closestPointOnSurface', asUtility = True ,n = jnt.name() + '_cpos')
decMtx = pm.shadingNode('decomposeMatrix',asUtility = True, name = jnt.name() + '_dmtx')
self.srf.getShape().worldSpace[0].connect(cposNode.inputSurface)
decMtx.outputTranslate.connect(cposNode.inPosition)
jnt.worldMatrix[0].connect(decMtx.inputMatrix)
pm.addAttr(jnt, shortName='jointPosition', longName='jointPosition', defaultValue=0, minValue=0, maxValue=1)
jntPos = cposNode.parameterU.get()
jnt.jointPosition.set(jntPos)
self.cposList.append(cposNode)
#cposNode.parameterU >> flcShape.parameterU
flcShape.parameterV.set(0.5)
pm.orientConstraint(flcTransform,self.rigJntList[i],mo=1)
#pm.pointConstraint(flcTransform,self.rigJntList[i],mo=1,weight=0)
blendAttr = pm.shadingNode( 'blendTwoAttr', asUtility = True ,n = flcTransform.name() + '_b2a')
self.stretchRev.outputX >> blendAttr.attributesBlender
jnt.jointPosition >> blendAttr.input[0]
cposNode.parameterU >> blendAttr.input[1]
blendAttr.output >> flcShape.parameterU
pm.select(cl=1)
flcGrp = pm.group(folicles,n=self.srf.name() + '_flc_grp')
pm.select(cl=1)
pm.parent(flcGrp,self.mainGrp)
self.flcTransformList = folicles
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:57,代码来源:bdTail.py
示例14: add_squash_n_stretch
def add_squash_n_stretch(self, follicles):
"""
Args:
None
Returns (None)
Usage:
"""
base_name = '%s_flexiPlane' % self.flexiPlaneNameField.getText()
wire_name = '%s_wire_CRV' % base_name
main_crv_name = '%s_main_CTRL' % base_name
wire = pm.PyNode(wire_name)
arc_len = pm.arclen(wire, ch = True)
pm.rename( arc_len, wire_name + 'info' )
arc_len_val = pm.getAttr( wire_name + 'info.arcLength')
multDiv_length = pm.shadingNode( 'multiplyDivide', asUtility = True )
pm.rename( multDiv_length, base_name + '_div_squashStretch_length' )
pm.setAttr( base_name + '_div_squashStretch_length.operation', 2 )
pm.connectAttr( wire_name + 'info.arcLength', base_name + '_div_squashStretch_length.input1X' )
pm.setAttr( base_name + '_div_squashStretch_length.input2X', arc_len_val )
multDiv_volume = pm.shadingNode( 'multiplyDivide', asUtility = True )
pm.rename( multDiv_volume, base_name + '_div_volume' )
pm.setAttr( base_name + '_div_volume.operation', 2 )
pm.setAttr( base_name + '_div_volume.input1X', 1 )
pm.connectAttr( base_name + '_div_squashStretch_length.outputX', base_name + '_div_volume.input2X', f = True )
conditional_volume = pm.shadingNode( 'condition', asUtility = True )
pm.rename( conditional_volume, base_name + '_cond_volume' )
pm.setAttr( base_name + '_cond_volume.secondTerm', 1 )
pm.connectAttr( main_crv_name + '.squashN_stretch', base_name + '_cond_volume.firstTerm' )
multDiv_globelScale = pm.shadingNode( 'multiplyDivide', asUtility = True )
pm.rename( multDiv_globelScale, base_name + '_mult_globalScale' )
pm.connectAttr( base_name + '_div_volume.outputX', base_name + '_mult_globalScale.input1X' )
pm.connectAttr( main_crv_name + '.scaleX', base_name + '_mult_globalScale.input2X' )
pm.connectAttr( base_name + '_mult_globalScale.outputX', base_name + '_cond_volume.colorIfTrueR' )
for index,follicle in enumerate(follicles):
jnt_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
INDEX = 'flexiPlane_jnt%03d' % (index+1),
SUFFIX = 'JNT')
jnt_offset_name = jnt_name.replace('_JNT','Offset_GRP')
tweek_crv_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
INDEX = 'flexiPlane_tweak%03d' % (index+1),
SUFFIX = 'CTRL')
pm.scaleConstraint( tweek_crv_name + 'Con_GRP', jnt_offset_name )
pm.connectAttr( base_name + '_cond_volume.outColorR', jnt_name + '.scaleX')
pm.connectAttr( base_name + '_cond_volume.outColorR', jnt_name + '.scaleZ')
pm.select( clear = True )
开发者ID:michaelanieves,项目名称:Rigging,代码行数:56,代码来源:flexi_plane.py
示例15: addUV
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!'
开发者ID:kiryha,项目名称:AnimationDNA,代码行数:12,代码来源:renderManager.py
示例16: createRenderNode
def createRenderNode(self, nodeType=None):
log.debug("createRenderNode callback for renderer {0} with node: {1}".format(self.rendererName.lower(), nodeType))
if nodeType == "TheaMaterial":
mat = pm.shadingNode("TheaMaterial", asShader=True)
bsdf = pm.shadingNode("BasicBSDF", asShader=True)
bsdf.outColor >> mat.bsdf
shadingGroup = pm.sets(renderable=True, noSurfaceShader=True, empty=True, name="{0}SG".format(mat))
mat.outColor >> shadingGroup.surfaceShader
return
mat = pm.shadingNode(nodeType, asShader=True)
shadingGroup = pm.sets(renderable=True, noSurfaceShader=True, empty=True, name="{0}SG".format(mat))
mat.outColor >> shadingGroup.surfaceShader
开发者ID:MassW,项目名称:OpenMaya,代码行数:13,代码来源:mtth_initialize.py
示例17: addJntPosAttr
def addJntPosAttr(self):
for jnt in self.ikJntList:
cposNode = pm.shadingNode( 'closestPointOnSurface', asUtility = True )
decMtx = pm.shadingNode('decomposeMatrix',asUtility = True )
self.srf.getShape().worldSpace[0].connect(cposNode.inputSurface)
decMtx.outputTranslate.connect(cposNode.inPosition)
jnt.worldMatrix[0].connect(decMtx.inputMatrix)
pm.addAttr(jnt, shortName='jointPosition', longName='jointPosition', defaultValue=0, minValue=0, maxValue=1)
jntPos = cposNode.parameterU.get()
jnt.jointPosition.set(jntPos)
pm.delete([cposNode,decMtx])
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:14,代码来源:bdTail.py
示例18: addCtrlJntAffected
def addCtrlJntAffected(ctrl,jntTotal):
pm.addAttr(ctrl,longName='jointsAffected', defaultValue=0, minValue=0.0, maxValue=jntTotal,keyable=False)
numJntMd = pm.shadingNode('multiplyDivide', asUtility = True )
numJntSr = pm.shadingNode('setRange', asUtility = True )
ctrl.falloff.connect(numJntMd.input1.input1X)
numJntMd.input2.input2X.set(2)
numJntMd.output.outputX.connect(numJntSr.value.valueX)
numJntSr.maxX.set(jntTotal)
numJntSr.oldMaxX.set(1)
numJntSr.outValueX.connect(ctrl.jointsAffected)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:14,代码来源:bdVarFk_01.py
示例19: make_proxy_wheel
def make_proxy_wheel(obj, wheel_name, cutout=False):
tolerance = .5
sel = pm.selected()
bb = obj.getBoundingBox()
radius = max(bb.depth(), bb.width(), bb.height())/2
height = min(bb.depth(), bb.width(), bb.height())
axis = [0,1,0]
if bb.height() - bb.width() > tolerance: # allow for a tolerance of difference
axis = [1,0,0]
if bb.width() - bb.depth() > tolerance:
axis = [0,0,1]
#print axis, bb.depth(), bb.width(), bb.height()
cylinder = pm.polyCylinder(n=wheel_name, axis=axis, height=height, radius=radius, sc=True)
pm.xform(cylinder, t=bb.center())
cylinder_shape = cylinder[0].getShape()
bevel_edges = cylinder_shape.e[0:39]
pm.polyBevel(bevel_edges, com=0, fraction=0.4, offsetAsFraction=1,
autoFit=1, segments=4, worldSpace=1, uvAssignment=0,
smoothingAngle=30, fillNgons=1, mergeVertices=1,
mergeVertexTolerance=0.0001, miteringAngle=180, angleTolerance=180, ch=1)
pm.polyExtrudeFacet(cylinder_shape.f[180:219], ltz=-0.16, lsx=0.2, lsy=0.2)
light_faces_indexes = [224, 225, 228, 229, 232, 233, 244, 245, 248, 249, 252, 253]
dark_faces = [face for face in cylinder_shape.f[:] if face.index() not in light_faces_indexes]
dark_lambert = pm.shadingNode("blinn", n="dark_shader", asShader=True)
dark_lambert.color.set([.16, .16, .16])
dark_lambert.eccentricity.set(0.5)
dark_lambert.specularColor.set([.16, .16, .16])
dark_set = pm.sets( renderable=True, noSurfaceShader=True, empty=True, name="dark_shaderSG" )
dark_lambert.outColor.connect(dark_set.surfaceShader)
pm.sets(dark_set, forceElement=dark_faces)
light_faces = [cylinder_shape.f[index] for index in light_faces_indexes]
light_lambert = pm.shadingNode("lambert", n="light_shader", asShader=True)
light_lambert.color.set([.7, .7, .7])
light_set = pm.sets( renderable=True, noSurfaceShader=True, empty=True, name="light_shaderSG" )
light_lambert.outColor.connect(light_set.surfaceShader)
pm.sets(light_set, forceElement=light_faces)
if cutout:
if "r_" == wheel_name[:2]:
pm.delete(cylinder_shape.f[200:219])
if "l_" == wheel_name[:2]:
pm.delete(cylinder_shape.f[180:199])
pm.select(sel,r=True)
return cylinder[0]
开发者ID:AndresMWeber,项目名称:aw,代码行数:50,代码来源:car_cleaner.py
示例20: create_node_by_type
def create_node_by_type(node_type, **kwargs):
"""Create node by type.
Args:
node_type (str): Type of the node to be created
**kwargs: Extra arguments to use in some nodes types creation.
Returns:
PyNode: New node of the goal and use specified.
"""
cmds.select(clear=True)
if node_type == "spaceLocator":
return pm.PyNode(cmds.spaceLocator(p=(0, 0, 0))[0])
elif node_type == "empty":
return pm.PyNode(cmds.group(empty=True))
elif node_type == "joint":
return pm.PyNode(cmds.joint())
elif node_type == "circle":
radius = kwargs["radius"] if "radius" in kwargs else 5
degree = kwargs["degree"] if "degree" in kwargs else 3
sections = kwargs["sections"] if "sections" in kwargs else 8
sweep = kwargs["sweep"] if "sweep" in kwargs else 360
normal = kwargs["normal"] if "normal" in kwargs else (0, 1, 0)
return pm.PyNode(cmds.circle(radius=radius, degree=degree, sections=sections, sweep=sweep, normal=normal)[0])
elif node_type == "renderBox":
sizeX = kwargs["sizeX"] if "sizeX" in kwargs else 2
sizeY = kwargs["sizeY"] if "sizeY" in kwargs else 2
sizeZ = kwargs["sizeZ"] if "sizeZ" in kwargs else 2
new_node = pm.PyNode(cmds.createNode("renderBox"))
new_node.attr("sizeX").set(sizeX)
new_node.attr("sizeY").set(sizeY)
new_node.attr("sizeZ").set(sizeZ)
return pm.PyNode(new_node.listRelatives(parent=True, fullPath=True)[0])
elif node_type == "plusMinusAverage":
return pm.PyNode(pm.shadingNode("plusMinusAverage", asUtility=True))
elif node_type == "multiplyDivide":
return pm.PyNode(pm.shadingNode("multiplyDivide", asUtility=True))
开发者ID:esernaalonso,项目名称:dev,代码行数:49,代码来源:utils.py
注:本文中的pymel.core.shadingNode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论