本文整理汇总了Python中maya.cmds.filterExpand函数的典型用法代码示例。如果您正苦于以下问题:Python filterExpand函数的具体用法?Python filterExpand怎么用?Python filterExpand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filterExpand函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: use_weight_set
def use_weight_set():
cmds.select(cmds.cluster(cmds.textScrollList('UI_cluster_list', q=True, si=True)[0], q=True, g=True)[0])
mel.eval("ConvertSelectionToVertices;")
weights = cmds.percent (cmds.textScrollList('UI_cluster_list', q=True, si=True)[0], q=True, v=True)
cmds.filterExpand( ex=True, sm=31 )
elements = cmds.ls(sl=True, fl=True)
return elements, weights
开发者ID:MaxIsJames,项目名称:max-scripts,代码行数:7,代码来源:softcluster.py
示例2: expandSelection
def expandSelection():
'''Expands current component selection to its max bounds'''
oldSize = len(cmds.filterExpand(sm=[28,29,31,32,33,34,35]))
while(1):
cmds.polySelectConstraint(pp=1,t=0x00100)
newSize = len(cmds.filterExpand(sm=[28,29,31,32,33,34,35]))
if oldSize == newSize: break
oldSize = newSize
开发者ID:rocktavious,项目名称:DevToolsLib,代码行数:8,代码来源:mayaUtils.py
示例3: getObjectVertices
def getObjectVertices(ob, verts):
ov = cmds.polyListComponentConversion(ob, tv=1)
ov = cmds.filterExpand(ov, ex=1, fp=1, sm=31)
verts = cmds.filterExpand(verts, ex=1, fp=1, sm=31)
# print ov
# print verts
com = []
for v in verts:
if v in ov:
com.append(v)
return com
开发者ID:kotchin,项目名称:mayaSettings,代码行数:15,代码来源:Cas_convertRigidToSmooth.py
示例4: meshFaceConstraintList
def meshFaceConstraintList(faceList=[], transformList=[], orient=True, prefix=''):
"""
"""
# ==========
# - Checks -
# ==========
# Face List
if not faceList:
faceList = cmds.filterExpand(sm=34)
if not faceList: raise Exception('No mesh face list specified for constraint!')
# Transform List
if not transformList:
transformList = ['' for vtx in vtxList]
# Vertex / Face list length
if not len(faceList) == len(transformList):
raise Exception('Face and Transform list length mis-match!')
# ======================
# - Create Constraints -
# ======================
constraintList = []
for i in range(len(faceList)):
cmds.select(cl=True)
itPrefix = prefix + '_' + str(i)
constraintList.append(meshFaceConstraint(faceList[i], transformList[i], orient=orient, prefix=itPrefix))
# =================
# - Return Result -
# =================
return constraintList
开发者ID:bennymuller,项目名称:glTools,代码行数:35,代码来源:autoRivet.py
示例5: GrpEdgstoVertx
def GrpEdgstoVertx():
sel=mc.ls(sl=True)
if sel:
if (mc.filterExpand(sel[0], sm = 32)):
if not len(sel)==1:
seled = flatten(sel)
seled1 = seled[:]
edgGrps = []
comEdges = []
for i in range(len(seled1)):
if len(seled) > 1:
if seled1[i] in comEdges:
continue
mc.select(seled1[i], r = 1)
mel.eval('polySelectEdges edgeLoopOrBorder')
loopEdges = flatten(mc.ls(sl=1))
comEdges = list(set(seled).intersection(set(loopEdges)))
#edgGrps.append(comEdges)
print comEdges
if comEdges not in edgGrps :
edgGrps.append(comEdges)
mc.select(cl=1)
for each in comEdges:
mc.select(each,add=True)
mel.eval('polyToCurve -form 2 -degree 3')
else:
mel.eval('polyToCurve -form 2 -degree 3')
mc.select(cl=1)
else:
mc.confirmDialog (title='Error' ,message= 'Please Select Edges', button=['OK'] ,defaultButton='Yes')
else:
mc.confirmDialog (title='Error' ,message= 'Nothing Selected..Please Select any Edges', button=['OK'] ,defaultButton='Yes')
开发者ID:sid2364,项目名称:Maya_Python,代码行数:32,代码来源:SR_GrpEdgstoVertx.py
示例6: buildEdgeCurves
def buildEdgeCurves(edges,name,color=None):
'''
Build poly edge curves.
Group, name and color resulting curves.
@param edges: List of poly edges to extract as curves.
@type edges: str
@param name: Curve and group name prefix.
@type name: str
@param color: Color to apply to the edge curve (group).
@type color: int or str or None
'''
# Get Edges
edges = mc.filterExpand(ex=True,sm=32) # Poly Edges
if not edges: raise Exception('Invalid or empty edge list!')
# Get Master Group
masterGrp = buildMasterCurveGroup('edgeCurveGroup')
# Get Curve Group
curveGrp = buildCurveGroup(name,color)
try: mc.parent(curveGrp,masterGrp)
except: pass
# Build Edge Curves
crvList = []
for edge in edges:
crv = mc.polyToCurve(edge,form=2,degree=1)[0]
for at in 'trs': mc.setAttr(crv+'.'+at,l=True,cb=False)
mc.parent(crv,curveGrp)
# Return Result
return curveGrp
开发者ID:auqeyjf,项目名称:glTools,代码行数:32,代码来源:polyEdgeCurve.py
示例7: storeSelection
def storeSelection(self):
#Handle Object Selection
for item in cmds.ls(sl=1,tr=1,l=1):
obj = ObjSelData(item)
self.__setitem__(item, obj)
#Handle Component Selection
for item in cmds.ls(hl=1,l=1):
obj = ObjSelData(item, hilite=True)
obj.populateSubSelection()
self.__setitem__(item, obj)
#Handle Components whose mesh is hilited
sel_comps = []
clean_set = set()
for compType in ObjSelData._filterExpandMap.values():
sel_comps += cmds.filterExpand(ex=0,fp=1,sm=compType) or []
for item in sel_comps:
shape = item.split('.')[0]
parent = shape.rsplit('|',1)[0]
clean_set.add(parent)
for item in list(clean_set) :
obj = ObjSelData(item, hilite=True)
obj.populateSubSelection()
self.__setitem__(item, obj)
开发者ID:rocktavious,项目名称:DevToolsLib,代码行数:25,代码来源:selection.py
示例8: MakeJntAndIKs
def MakeJntAndIKs(side):
"""
选择两圈眼球上的线,生成骨骼和ik,side的值例如:R_In or R_Out
ps: 选择骨骼链的子物体,打组,centerPivot,在原点生成一个骨点,用组约束骨点,正确命名,然后将IK组分别放到对应骨点下边。
"""
lx_start=mc.xform('loc_eyeCenter01',q=1,ws=1,t=1)
lx_mouthPnt= mc.filterExpand(sm=31)
mc.select (cl=1)
lx_Jnts=[]
lx_IKs = []
for i in lx_mouthPnt :
lx_end=mc.xform(i,q=1,ws=1,t=1)
lx_stJnt=mc.joint (n=("Jnt_"+side+"_st"),p=(lx_start[0],lx_start[1],lx_start[2]),radius=0.1)
lx_edJnt=mc.joint (n=("Jnt_"+side+"_ed"),p=(lx_end[0],lx_end[1],lx_end[2]),radius=0.1)
lx_scik =mc.ikHandle (n=("scik_"+side+str(01)),sj=lx_stJnt,ee=lx_edJnt,sol="ikSCsolver")
#mc.setAttr((str(lx_scik[0]) +".visibility") ,0)
mc.select(cl=1)
lx_Jnts.append(lx_stJnt)
lx_IKs .append(lx_scik[0])
mc.select(lx_Jnts,r=1)
mc.group(n=("grp_Jnts"+side))
mc.select(lx_IKs,r=1)
mc.group(n=("grp_iks"+side))
mc.setAttr((str("grp_iks"+side) +".visibility") ,0)
#3.选择眼皮曲线,执行脚本,生成
def MakeEyeLidJnts(cuvs):
开发者ID:auqeyjf,项目名称:pubTool,代码行数:28,代码来源:j_MakeFacial.py
示例9: setObjectToShatterCmd
def setObjectToShatterCmd(self, *args):
'''
'''
if not (cmds.draggerContext(self._IScontextTool._mContext, exists = True)):
iMinTime = cmds.playbackOptions(query = True, minTime = True)
cmds.currentTime(iMinTime, edit = True)
polySelection = cmds.filterExpand(selectionMask = 12)
if polySelection:
if len(polySelection) > 0:
mBreakNode = cmds.listConnections(polySelection[0], sh = True, type = 'fxBreakGeometry')
if not mBreakNode:
cmds.button(self._ISaddBtn, edit = True, label = 'Please wait... checking mesh toplogy')
self._IScontextTool.checkForNonManifoldMeshes(polySelection[0])
cmds.delete(polySelection[0], ch = True)
self.resetIShatterGUI()
self._IScontextTool._mVoroObject = polySelection[0]
cmds.button(self._ISaddBtn, edit = True, label = polySelection[0])
cmds.button(self._ISdelBtn, edit = True, enable = True)
cmds.button(self._ISprocessBtn, edit = True, enable = True)
cmds.checkBox(self._ISborderEdgesCbx, edit = True, enable = True)
cmds.checkBox(self._IShideObjectsCbx, edit = True, enable = True)
else:
cmds.confirmDialog(title = 'Oups... IShatter Error', message = 'You must select one mesh object first !', button = 'OK', defaultButton = 'Yes', cancelButton = 'No', dismissString = 'No')
开发者ID:jeffhong21,项目名称:scripts,代码行数:31,代码来源:IShatterGUI.py
示例10: alignUVs
def alignUVs(doU, minU, doV, inV):
"""
align selected uvs based on the one most on top, bottom, left, right
"""
# get the selected UVs from current selection
selectedItems = cmds.filterExpand(ex=False, sm=35) # 35 means UVs
uvMin = []
uvMax = []
# get the 3d bounding box of selection
uvInfo = cmds.polyEvaluate(bc2=True)
uvMin[0] = uvInfo[0]
uvMin[1] = uvInfo[2]
uvMax[0] = uvInfo[1]
uvMax[1] = uvInfo[3]
if doU:
if minU:
cmds.polyEditUV(r=False, u=uvMin[0])
else:
cmds.polyEditUV(r=False, u=uvMax[0])
if doV:
if minV:
cmds.polyEditUV(r=False, v=uvMin[1])
else:
cmds.polyEditUV(r=False, v=uvMax[1])
开发者ID:shrimo,项目名称:dmptools,代码行数:25,代码来源:modeling.py
示例11: alignVertices
def alignVertices(minX, maxX, minY, maxY, minZ, maxZ):
"""
align vertices in 3d
"""
# get the selected vertices from current selection
selectedItems = cmds.filterExpand(ex=False, sm=31) # 31 means vertices
# get the 3d bounding box of selection
bInfo = cmds.polyEvaluate(bc=True)
xmin = bInfo[0][0]
xmax = bInfo[0][1]
ymin = bInfo[1][0]
ymax = bInfo[1][1]
zmin = bInfo[2][0]
zmax = bInfo[2][1]
if minX:
cmds.move(xmin, moveX=True)
if maxX:
cmds.move(xmax, moveX=True)
if minY:
cmds.move(ymin, moveY=True)
if maxY:
cmds.move(ymax, moveY=True)
if minZ:
cmds.move(zmin, moveZ=True)
if maxZ:
cmds.move(zmax, moveZ=True)
开发者ID:shrimo,项目名称:dmptools,代码行数:27,代码来源:modeling.py
示例12: getMeshVertexData
def getMeshVertexData( mesh ):
returnData = []
exportObject = 'bwExportObject'
cmds.duplicate( mesh, n=exportObject )
cmds.polyTriangulate(exportObject)
numOfFaces = cmds.polyEvaluate(exportObject, f=True )
for i in xrange(0, numOfFaces):
faceSelect = exportObject + '.f[' + str(i) + ']'
fVertices = []
fVertices = cmds.polyListComponentConversion(faceSelect, ff = True, tvf = True)
fVertices = cmds.filterExpand(fVertices, sm = 70, ex = True)
print fVertices
for vertex in fVertices:
faceDict = {}
vName = cmds.polyListComponentConversion(vertex, fvf = True, tv = True)
xyz = []
xyz = cmds.xform(vName, q = True, os = True, t = True)
faceDict['x'] = round(xyz[0], 2)
faceDict['y'] = round(xyz[1], 2)
faceDict['z'] = round(xyz[2], 2)
normal = []
normal = cmds.polyNormalPerVertex(vertex, q = True, xyz = True)
faceDict['xN'] = round(normal[0], 2)
faceDict['yN'] = round(normal[1], 2)
faceDict['zN'] = round(normal[2], 2)
# vuv = []
# vuv = cmds.polyListComponentConversion(vertex, fvf = True, tuv = True)
# uvCoords = []
# uvCoords = cmds.polyEditUV(vuv[0], q = True, u = True, v = True)
# faceDict['u'] = round(uvCoords[0], 2)
# faceDict['v'] = round(uvCoords[0], 2)
returnData.append(faceDict)
cmds.delete(exportObject)
return json.dumps(returnData)
开发者ID:buba447,项目名称:mayaMidiConnect,代码行数:34,代码来源:bw.py
示例13: doIt
def doIt(self,argList):
polygons = cmds.filterExpand(sm=12)
if not polygons:
print 'Please select a polygon.'
return
paths = cmds.fileDialog2(dialogStyle=2, fileMode = 3, okCaption = "Save", cancelCaption = "Cancel")
if not paths:
return
for p in range(0, len(polygons)):
polygon = polygons[p]
related_cluster = mel.eval('findRelatedSkinCluster '+polygon)
if related_cluster == '':
print 'Please bind skin for this polygon.' + polygon
continue
path = paths[0]
joints = cmds.skinPercent(related_cluster, polygon+'.vtx[0]', q = True, t = None);
f = open(path+'/'+polygon+'.weights', 'w')
vertices = cmds.getAttr(polygon+'.vrts', multiIndices = True);
for i in range(0, len(vertices)):
infs = cmds.skinPercent(related_cluster, polygon+'.vtx['+str(vertices[i])+']', q = True, v = True)
pos = cmds.xform(polygon+'.vtx['+str(vertices[i])+']', q=1, ws=1, t=1)
f.write('vp ' + str(pos[0])+' '+str(pos[1])+' '+str(pos[2]) + '\n')
f.write('vinf');
for j in range(0, len(infs)):
f.write(' ' + joints[j] + ' ' + str(infs[j]))
f.write('\n')
f.close()
print 'Export Complete.'
开发者ID:teststaybaka,项目名称:Maya_Plugin_SkinMapExporterImporter,代码行数:33,代码来源:skinExporter_Importer_Space.py
示例14: cache
def cache(s, meshes=None):
"""
Store joints influence on objects for quick checking later
"""
if meshes:
# Cache Joints and Meshes
for mesh in meshes:
skin = mel.eval("findRelatedSkinCluster %s" % mesh)
if skin:
joints = cmds.skinPercent(skin, "%s.vtx[0]" % mesh, q=True, t=None)
for vert in range(cmds.getAttr("%s.weightList" % skin, size=True)):
for i, v in enumerate(cmds.skinPercent(skin, "%s.vtx[%s]" % (mesh, vert), q=True, v=True)):
joint = joints[i]
if 0.2 < v:
# Sort by joints
s.joints[joint] = s.joints.get(joint, [])
s.joints[joint].append("%s.vtx[%s]" % (mesh, vert))
# Sort by meshes
s.meshes[mesh] = s.meshes.get(mesh, {})
s.meshes[mesh][joint] = s.meshes[mesh].get(joint, {})
s.meshes[mesh][joint][vert] = v
# Speed up Cache
if s.joints:
s.select.ignore = True
for j in s.joints:
cmds.select(s.joints[j], r=True)
s.joints[j] = cmds.filterExpand(ex=False, sm=31)
cmds.select(clear=True)
else:
s.meshes = {}
s.joints = {}
pass
开发者ID:internetimagery,项目名称:RigTool,代码行数:32,代码来源:__init__.py
示例15: edgeLoopsToCurve
def edgeLoopsToCurve(edgeList,form=2,degree=1):
'''
Generate edge loop curves from the specified list of edges.
@param edgeList: The list of mesh edges to generate edge loop curves from.
@type edgeList: list
@param form: NURBS curve form. 0 = Periodic, 1 = Open, 2 = Best Guess.
@type form: str
@param degree: NURBS curve degree.
@type degree: str
'''
# Filter/Check Edge List
edgeList = mc.filterExpand(edgeList,ex=True,sm=32)
if not edgeList: raise Exception('Invalid edge list!')
# For Each Edge
edgeCurveList = []
for edge in edgeList:
# Get Mesh
edgeId = glTools.utils.component.index(edge)
meshShape = mc.ls(edge,o=True)[0]
mesh = mc.listRelatives(meshShape,p=True)[0]
prefix = mesh.split(':')[-1]
# To Edge Loop
mc.polySelect(mesh,edgeLoop=edgeId)
# Edge Loop to Curve
edgeCurve = mc.polyToCurve(ch=False,form=form,degree=degree)[0]
# Append List
edgeCurveList.append(edgeCurve)
# Return Result
return edgeCurveList
开发者ID:auqeyjf,项目名称:glTools,代码行数:35,代码来源:mesh.py
示例16: CreateObjects
def CreateObjects(objectlist,*args):
selCVs = cmds.ls(sl=True)
selCVs_pos = cmds.filterExpand(ex=True,sm=28)
cmds.select(cl=True)
ObjName = cmds.optionMenu(objectlist,query=True,value=True)
for num in selCVs_pos:
position = cmds.pointPosition(num,w=True)
pos_x = position[0]
pos_y = position[1]
pos_z = position[2]
if(ObjName == "Cube"):
make_obj = cmds.nurbsCube();
cmds.setAttr(make_obj[0] + ".tx",pos_x)
cmds.setAttr(make_obj[0] + ".ty",pos_y)
cmds.setAttr(make_obj[0] + ".tz",pos_z)
if(ObjName == "Circle"):
make_obj = cmds.circle();
cmds.setAttr(make_obj[0] + ".tx",pos_x)
cmds.setAttr(make_obj[0] + ".ty",pos_y)
cmds.setAttr(make_obj[0] + ".tz",pos_z)
if(ObjName == "Joint"):
make_obj = cmds.joint()
cmds.setAttr(make_obj + ".tx",pos_x)
cmds.setAttr(make_obj + ".ty",pos_y)
cmds.setAttr(make_obj + ".tz",pos_z)
开发者ID:romadave91,项目名称:MyScripts,代码行数:25,代码来源:RigToolKit.py
示例17: edgeLoopWeights
def edgeLoopWeights(edgeList):
"""
"""
# Check Edge List
if not edgeList: raise Exception('Invalid or empty edge list!')
edgeList = cmds.filterExpand(edgeList, ex=True, sm=32) or []
if not edgeList: raise Exception('Invalid edge list! List of polygon edges required...')
# Get Mesh from Edges
mesh = list(set(cmds.ls(edgeList, o=True) or []))
if len(mesh) > 1:
raise Exception('Edges from multiple mesh shapes were supplied! ' + str(mesh))
mesh = mesh[0]
for edge in edgeList:
# Get Edge ID
edgeID = glTools.utils.component.index(edge)
# Get Vertices from Edge
edgeVerts = cmds.polyListComponentConversion(edge, fe=True, tv=True)
# Get Average Vertex Weights
cmds.select(edgeVerts)
glTools.tools.copyPasteWeights.averageWeights()
# Select Edge Loop Vertices
cmds.polySelect(mesh, edgeLoop=edgeID)
loopEdges = cmds.ls(sl=1, fl=1)
loopVerts = cmds.polyListComponentConversion(loopEdges, fe=True, tv=True)
cmds.select(loopVerts)
glTools.tools.copyPasteWeights.pasteWeights()
# Return Result
return mesh
开发者ID:bennymuller,项目名称:glTools,代码行数:34,代码来源:skinCluster.py
示例18: getFaceNormals
def getFaceNormals( vertex ):
# vertex normal name
fvtx = cmds.polyListComponentConversion( vertex, fv=True, tvf=True )
allFvtx = cmds.filterExpand( fvtx, expand=True, sm=70 )
# Face index
# vtxFaces = Vertex.getFaceVertexIndex(allFvtx)
'''
# There could be duplicate tags, so the dictionary will over write data!
tempNormals = {}
for i, curFvtx in enumerate(allFvtx):
normalCoords = cmds.polyNormalPerVertex( curFvtx, q=True, xyz=True )
curFace = vtxFaces[i]
tempNormals[curFvtx] = normalCoords
return tempNormals
'''
# normals = []
normals = {}
for i, curFvtx in enumerate(allFvtx):
normalCoords = cmds.polyNormalPerVertex( curFvtx, q=True, xyz=True )
# curFace = vtxFaces[i]
normals[curFvtx] = normalCoords
# normals.append( normalCoords )
return allFvtx, normals
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:26,代码来源:export_beforeClearn.py
示例19: meshVertexConstraintList
def meshVertexConstraintList(vtxList=[],transformList=[],orient=True,prefix=''):
'''
'''
# ==========
# - Checks -
# ==========
# Vertex List
if not vtxList:
vtxList = mc.filterExpand(sm=31)
if not vtxList: raise Exception('No mesh vertex list specified for constraint!')
# Transform List
if not transformList:
transformList = ['' for vtx in vtxList]
# Vertex / Transform list length
if not len(vtxList) == len(transformList):
raise Exception('Vertex and Transform list length mis-match!')
# ======================
# - Create Constraints -
# ======================
constraintList = []
for i in range(len(vtxList)):
mc.select(cl=True)
itPrefix = prefix+'_'+str(i)
constraintList.append(meshVertexConstraint(vtxList[i],transformList[i],orient=orient,prefix=itPrefix))
# =================
# - Return Result -
# =================
return constraintList
开发者ID:auqeyjf,项目名称:glTools,代码行数:35,代码来源:autoRivet.py
示例20: averageCoord
def averageCoord(surfaceSkin,influence,controlPointList=[]):
'''
Get the averaged target surface coordinate of the specified influence for the given control points
@param surfaceSkin: surfaceSkin node to get the coordinates for
@type surfaceSkin: str
@param influence: Influence surface to query
@type influence: str
@param controlPointList: List of control points to get the target coordinate for
@type controlPointList: str
'''
# Check controlPointList
if not controlPointList: controlPointList = mc.filterExpand(sm=(28,31))
if not controlPointList: raise Exception('No components specified for average coordinate operation!!')
# Get surfacSkin utility object
ssUtil = glTools.surfaceSkin.utils.SurfaceSkinUtilities()
# Get coord average
uv = [0,0]
controlPointCnt = len(controlPointList)
# Iterate over control point list
for controlPoint in controlPointList:
# Get control point target coordinate
cpUV = getCoord(surfaceSkin,influence,controlPoint)
uv[0] += cpUV[0]
uv[1] += cpUV[1]
# Average coordinates
uv[0] /= controlPointCnt
uv[1] /= controlPointCnt
# Return result
return (uv[0],uv[1])
开发者ID:auqeyjf,项目名称:pubTool,代码行数:32,代码来源:coordinateUtilities.py
注:本文中的maya.cmds.filterExpand函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论