本文整理汇总了Python中maya.cmds.nodeType函数的典型用法代码示例。如果您正苦于以下问题:Python nodeType函数的具体用法?Python nodeType怎么用?Python nodeType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nodeType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nameChangedCB
def nameChangedCB(self, node, prevName, client):
''' Callback when a node is renamed '''
if prevName == "" or not prevName or prevName.startswith("_"):
return
handle = MObjectHandle( node )
if not handle.isValid():
return
mobject = handle.object()
nodeFn = MFnDependencyNode ( mobject )
if nodeFn.hasUniqueName():
nodeName = nodeFn.name()
if cmds.getClassification(cmds.nodeType(nodeName), satisfies="shader"):
if cmds.nodeType(nodeName) == "displacementShader":
items = self.displacementList.findItems(prevName, QtCore.Qt.MatchExactly)
for item in items:
item.setText(nodeName)
# renaming shaders in caches
for cache in self.ABCViewerNode.values():
cache.renameDisplacement(prevName, nodeName)
self.checkShaders()
else:
items = self.shadersList.findItems(prevName, QtCore.Qt.MatchExactly)
for item in items:
item.setText(nodeName)
if cmds.nodeType(nodeName) == "shadingEngine":
# renaming shaders in caches
for cache in self.ABCViewerNode.values():
cache.renameShader(prevName, nodeName)
self.checkShaders()
示例2: get_scene_texture_connections
def get_scene_texture_connections():
conns =[]
for mat in cmds.ls(mat=True):
if cmds.nodeType(mat) == 'lambert':
dif_conn = cmds.listConnections('%s.color' % mat)
nrm_conn = cmds.listConnections('%s.normalCamera' % mat)
if dif_conn:
conns.append(dif_conn[0])
if nrm_conn:
for itm in cmds.listConnections(nrm_conn):
if cmds.nodeType(itm) == 'file':
conns.append(itm)
break
if cmds.nodeType(mat) == 'blinn' or cmds.nodeType(mat) == 'phong':
dif_conn = cmds.listConnections('%s.color' % mat)
nrm_conn = cmds.listConnections('%s.normalCamera' % mat)
spc_conn = cmds.listConnections('%s.specularColor' % mat)
if dif_conn:
conns.append(dif_conn[0])
if nrm_conn:
#conns.append(nrm_conn[0])
for itm in cmds.listConnections(nrm_conn):
if cmds.nodeType(itm) == 'file':
conns.append(itm)
break
if spc_conn:
conns.append(spc_conn[0])
return conns
示例3: copy_user_attr
def copy_user_attr(selparentshapes, seltargetshapes, copyUV=True):
listattrvalue = {}
listdatatype = {}
userattr = cmds.listAttr(selparentshapes, ud=True)
if copyUV and cmds.nodeType(seltargetshapes) == 'mesh' and cmds.nodeType(selparentshapes) == 'mesh':
cmds.transferAttributes(selparentshapes, seltargetshapes, transferUVs=1, transferColors=2, searchMethod=3, sampleSpace=5, flipUVs=False)
if userattr:
for attr in userattr:
nodetype = cmds.nodeType(selparentshapes)
checkrendershape = cmds.getAttr(selparentshapes + '.intermediateObject')
if checkrendershape != 1 or nodetype != 'mesh':
key = attr
value = cmds.getAttr("%s.%s" % (selparentshapes, key))
data = cmds.getAttr("%s.%s" % (selparentshapes, key), typ=True)
listattrvalue[key] = value
listdatatype[key] = data
checkrendershape = cmds.getAttr(seltargetshapes + '.intermediateObject')
if checkrendershape != 1:
for key in listattrvalue:
if not cmds.attributeQuery(key, node=seltargetshapes, ex=True):
if listdatatype[key] == 'string':
cmds.addAttr(seltargetshapes, longName=key, dataType=listdatatype[key])
cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key], type=listdatatype[key])
else:
cmds.addAttr(seltargetshapes, longName=key)
cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key])
else:
cmds.warning('Attribute ' + key + ' already on ' + seltargetshapes)
if cmds.getAttr("%s.%s" % (seltargetshapes, key), se=True):
if listdatatype[key] == 'string':
cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key], type=listdatatype[key])
else:
cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key])
示例4: ucGetBasePoints
def ucGetBasePoints():
sels = cmds.ls( sl=1 )
model.fnMeshList = []
model.fnCrvList = []
model.meshPoints = []
model.crvPoints = []
for target in sels:
targetShapes = cmds.listRelatives( target, s=1 )
for shape in targetShapes:
if cmds.nodeType( shape ) == 'mesh':
fnMesh = om.MFnMesh( functions.getMObject( shape ) )
points = om.MPointArray()
fnMesh.getPoints( points )
model.fnMeshList.append( fnMesh )
model.meshPoints.append( points )
elif cmds.nodeType( shape ) == 'nurbsCurve':
fnCurve = om.MFnNurbsCurve( functions.getMObject( shape ) )
points = om.MPointArray()
fnCurve.getCVs( points )
model.fnCrvList.append( fnCurve )
model.crvPoints.append( points )
示例5: __check_scene
def __check_scene(self):
#--- this method checks the scene
#--- check if something is selected
sel = cmds.ls(selection = True)
if sel:
#--- check if selection is a mesh
transform = None
for i in sel:
if cmds.nodeType(i) == 'transform':
transform = i
if cmds.listRelatives(transform, allDescendents = True, type = 'mesh'):
mesh = cmds.listRelatives(transform,
allDescendents = True,
type = 'mesh')[0]
if cmds.nodeType(mesh) == 'mesh':
#--- store the mesh
self.mesh = transform
#--- get current frame
self.currentFrame = cmds.currentTime(query = True)
#--- get timestamp
ts = str(time.time())
self.time_stamp = str(ts.split('.')[0] + ts.split('.')[1])
else:
raise Exception('The selected object is not a mesh!')
else:
raise Exception('The selected object is not a mesh!')
else:
raise Exception('You have to select a mesh, dude!')
示例6: 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)
示例7: 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)
getRemapAndMutilplyNodes(dst)
示例8: check_name_match
def check_name_match(self, parents=None, targets=None, topology=None):
target_events_list = {}
for parent in parents:
parent_name = parent.split('|')[-1].split(':')[-1]
copy_event_parent = False
target_match = []
for target in targets:
copy_event_target = False
target_name = target.split('|')[-1].split(':')[-1]
if parent_name == target_name:
if cmds.nodeType(parent) == cmds.nodeType(target) == 'mesh':
tp = [parent]
tt = [target]
topocheck = self.check_topology_match(parents=tp, targets=tt, globout=False)
if parent in topocheck and target in topocheck[parent]:
target_match.append(target)
self.found_matches[parent] = target_match
copy_event_target = True
else:
target_match.append(target)
self.found_matches[parent] = target_match
copy_event_target = True
if not copy_event_target and target_events_list.get(target) != True:
target_events_list[target] = False
if copy_event_target:
target_events_list[target] = True
copy_event_parent = True
if not copy_event_parent:
self.non_found_parent.append(parent)
for target in target_events_list:
if not target_events_list[target]:
self.non_found_target.append(target)
self.non_found_target = list(set(self.non_found_target))
self.non_found_parent = list(set(self.non_found_parent))
return self.found_matches, self.non_found_parent, self.non_found_target
示例9: on_actionLoadSourceControl_triggered
def on_actionLoadSourceControl_triggered(self, clicked=None):
if clicked == None:return
selectOBJ = mc.ls(sl=True)
if len(selectOBJ) == 0:return
self.sourceControlFLD.setText(selectOBJ[0])
KeyableAttr = mc.listAttr(selectOBJ[0], k=True)
del self.sourceAtrLst[:]
del self.targentAtrLst[:]
# loop Attributes..
for Attr in KeyableAttr:
SDKeys = mc.connectionInfo('%s.%s'%(selectOBJ[0], Attr), dfs=True)
# loop driven Attributes..
for key in SDKeys:
if mc.nodeType(key) == 'unitConversion':
keyNode = mc.connectionInfo('%s.output'%key.split('.')[0], dfs=True)[0].split('.')[0]
elif mc.nodeType(key) not in ('animCurve','animCurveTA', 'animCurveTL', 'animCurveTT','animCurveTU','animCurveUA','animCurveUL','animCurveUT','animCurveUU'):
continue
else:
keyNode = key.split('.')[0]
DriverValues = mc.keyframe(keyNode, q=True, fc=True)
DrivenValues = mc.keyframe(keyNode, q=True, vc=True)
DriverAttribute = mc.connectionInfo('%s.output'%keyNode, dfs=True)[0]
# if more than one Drivers, from add node get the attribute..
if DriverAttribute.endswith(']'):
DriverAttribute = mc.connectionInfo('%s.output'%(DriverAttribute.split('.')[0]), dfs=True)[0]
self.sourceAtrLst.append(['%s.%s'%(selectOBJ[0], Attr), DriverAttribute, DriverValues, DrivenValues])
self.on_actionInputSearchReplace_triggered()
示例10: SundayRenderToolsChangeTextureResolution
def SundayRenderToolsChangeTextureResolution(object, level):
sel = cmds.ls(selection = True)
if object == 'selected':
if len(sel) == 0:
SundayDialogPy.SundayDialogConfirm('ERROR ', 'Nothing selected.', 'OK')
else:
cmds.hyperShade('', shaderNetworksSelectMaterialNodes = True)
selShader = cmds.ls(selection = True)
for curSelShader in selShader:
notes = cmds.hyperShade(listUpstreamNodes = curSelShader)
for note in notes:
if cmds.nodeType(note) == 'file' or cmds.nodeType(note) == 'psdFileTex':
cmds.select(note)
SundayRenderToolsChangeTextureResolutionSet(level, note)
continue
elif object == 'global':
notes = cmds.ls(type = 'file')
for note in notes:
cmds.select(note)
SundayRenderToolsChangeTextureResolutionSet(level, note)
try:
cmds.select(sel)
except:
pass
示例11: stabilizer
def stabilizer ():
global _camera_
_point = cmds.ls (selection = True)
if cmds.objExists ('stabilizator_expression') == False and len(_point) > 0:
_camera_ = Camera()
_point = _point[0]
if (cmds.nodeType (_point) == 'mesh' or cmds.nodeType (_point) == 'transform') and _camera_.transform != 'empty':
_expression = r'''
$pos=`python "fmmu.get_normalized_screen_position(\"''' + _point + r'''\")"`;
setAttr "''' + _camera_.shape + r'''.horizontalFilmOffset" $pos[2];
setAttr "''' + _camera_.shape + r'''.verticalFilmOffset" $pos[3];'''
print "=================================="
print _expression
cmds.expression (name = 'stabilizator_expression', string = _expression)
cmds.frameLayout ('adjustCam_frml', edit = True, visible = True)
cmds.symbolButton ('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__deStabilize.xpm', annotation = 'deStabilizer')
cmds.floatField ('field_overscan', edit = True, value = _camera_.overscan)
else:
if cmds.objExists ('stabilizator_expression') == True:
cmds.delete ('stabilizator_expression')
cmds.symbolButton ('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__stabilize.xpm', annotation = 'deStabilizer')
cmds.frameLayout ('adjustCam_frml', edit = True, collapse = True, visible = False)
try:
_camera_.reset_camera()
except:
pass
示例12: latticeRemove
def latticeRemove():
#undo enable
cmds.undoInfo(openChunk=True)
#getting nodes
sel = cmds.ls(selection=True)
if not sel:
cmds.warning('No nodes selected!')
return
lat = sel[-1]
objs = sel[0:-1]
if cmds.nodeType(cmds.listRelatives(lat, shapes=True)[0]) != 'lattice':
cmds.warning('Last selected is NOT a lattice!')
return
#removing from lattice
for obj in objs:
try:
cmds.lattice(lat, e=True, remove=True, geometry=obj)
#disconnecting shapes
shapes = cmds.listRelatives(obj, shapes=True)
for shp in shapes:
source = cmds.listConnections(shp + '.inMesh', source=True)
if cmds.nodeType(source) == 'ffd':
attr = cmds.listConnections(shp + '.inMesh', plugs=True)[0]
cmds.disconnectAttr(attr, shp + '.inMesh')
except:
pass
cmds.undoInfo(closeChunk=True)
示例13: setCharacterInput
def setCharacterInput(_HIK, _HIK_source, **kwargs):
if not ( cmds.nodeType(_HIK) == 'HIKCharacterNode' and cmds.nodeType(_HIK_source) == 'HIKCharacterNode' ):
print u'HIKCharacterNode를 입력하세요.'
return
# sourceHide
_sourceHide = False
if kwargs.get('sourceHide') or kwargs.get('sh'):
_input = ''
# 해당 키워드에 해당하는 키값을 받아오고
if kwargs.get('sourceHide'):
_input = kwargs.get('sourceHide')
elif kwargs.get('sh'):
_input = kwargs.get('sh')
# 맞으면.. 아래 실행
_sourceHide = _input
# 연결
mel.eval( 'mayaHIKsetCharacterInput( "%s", "%s" );'%(_HIK, _HIK_source) )
mel.eval( '$gHIKCurrentCharacter = "%s";'%_HIK)
mel.eval( 'hikUpdateCurrentCharacterFromScene();')
if _sourceHide:
# 소스 루트 알아옴.
_root = getRootParent(_HIK_source)
cmds.setAttr(_root+'.v',0)
示例14: deleteLocalControler
def deleteLocalControler(self, target ):
if not cmds.objExists( target ): return None
transNode = cmds.listConnections( target, type='retargetTransNode' )
orientNode = cmds.listConnections( target, type='retargetOrientNode' )
if cmds.nodeType( target ) == 'editMatrixByCurve' :
cmds.delete( target )
else:
targetP = fnc.getP( target )
targetPShape = cmds.listRelatives( targetP, s=1 )[0]
if cmds.nodeType( targetPShape ) == 'retargetLocator':
cmds.delete( targetP )
else:
cmds.delete( target )
if transNode:
length = fnc.getLastIndex( transNode[0]+'.localData' )+1
for i in range( length ):
if not cmds.listConnections( transNode[0]+'.localData[%d].localMatrix' % i ):
mel.eval( 'removeMultiInstance %s[%d]' %( transNode[0]+'.localData', i ) )
if orientNode :
length = fnc.getLastIndex( orientNode[0]+'.localData' )+1
for i in range( length ):
if not cmds.listConnections( orientNode[0]+'.localData[%d].localMatrix' % i ):
mel.eval( 'removeMultiInstance %s[%d]' %( orientNode[0]+'.localData', i ) )
示例15: positionReorderDoIt
def positionReorderDoIt(*args):
meshes = []
sourceMeshText = cmds.textField( 'sourceMeshTextField', query=True, text=True )
if sourceMeshText == '':
cmds.error('source mesh textfield is empty')
if cmds.objExists(sourceMeshText) == False:
cmds.error('the source mesh ( '+sourceMeshText+' ) does not exist')
if cmds.nodeType(sourceMeshText) != 'mesh':
shapes = cmds.listRelatives( sourceMeshText, shapes=True )
if shapes is None or len(shapes) < 1 or cmds.nodeType(shapes[0]) != 'mesh':
cmds.error('source ( '+sourceMeshText+' ) is not a mesh')
meshes.append( sourceMeshText )
destinationMeshText = cmds.textField( 'destinationMeshTextField', query=True, text=True )
if destinationMeshText == '':
cmds.error('destination mesh textfield is empty')
if cmds.objExists(destinationMeshText) == False:
cmds.error('the destination mesh ( '+destinationMeshText+' ) does not exist')
if cmds.nodeType(destinationMeshText) != 'mesh':
shapes = cmds.listRelatives( destinationMeshText, shapes=True )
if shapes is None or len(shapes) < 1 or cmds.nodeType(shapes[0]) != 'mesh':
cmds.error('destination ( '+destinationMeshText+' ) is not a mesh')
meshes.append( destinationMeshText )
positionReorder( meshes=meshes )