本文整理汇总了Python中maya.cmds.polyListComponentConversion函数的典型用法代码示例。如果您正苦于以下问题:Python polyListComponentConversion函数的具体用法?Python polyListComponentConversion怎么用?Python polyListComponentConversion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了polyListComponentConversion函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run():
start = time.clock()
selectedNodes = cmds.ls(sl = True, l = True)
checkSelection(selectedNodes)
srcPolygons = cmds.ls(cmds.polyListComponentConversion(selectedNodes[0], tf = True), l = True, fl = True)
tgtPolygons = cmds.ls(cmds.polyListComponentConversion(selectedNodes[1], tf = True), l = True, fl = True)
sourcePolygons = [Polygon(poly) for poly in srcPolygons]
targetPolygons = [Polygon(poly) for poly in tgtPolygons]
polygonsToDelete = []
for sPoly in sourcePolygons:
for tPoly in targetPolygons:
if sPoly.isEqualToPolygon(tPoly):
polygonsToDelete.append(tPoly.path)
break
if not len(polygonsToDelete):
cmds.select(selectedNodes[1])
raise Exception("There is no same polygons in these 2 objects.")
else:
cmds.delete(polygonsToDelete)
cmds.select(selectedNodes[1])
print("time consumed: " + str(time.clock() - start))
开发者ID:theetcher,项目名称:mayaExtensionsOld,代码行数:29,代码来源:fx_deleteSamePolys.py
示例2: unfoldBandUVs
def unfoldBandUVs(object, divisions=1, history=True):
"""
This definition unfolds object band UVs.
:param object: Object. ( String )
:param divisions: Extrusion divisions. ( Integer )
:param history: Keep construction history. ( Boolean )
"""
edgesCount = cmds.polyEvaluate(object, edge=True)
edges = cmds.ls(object + ".e[0:" + str(edgesCount - 1) + "]", fl=True, l=True)
cmds.select(object)
cmds.polySelectConstraint(m=3, t=0x8000, w=1)
cmds.polySelectConstraint(m=0)
for i in range(divisions):
mel.eval("GrowPolygonSelectionRegion();")
bandEdges = cmds.ls(sl=True, fl=True, l=True)
bandFaces = cmds.ls(cmds.polyListComponentConversion(bandEdges, fe=True, tf=True), fl=True)
cmds.select(bandFaces)
cmds.polyForceUV(unitize=True)
cmds.polySelectConstraint(m=3, t=0x8000, sm=1)
seamsEdges = cmds.ls(sl=True, fl=True, l=True)
weldEdges = list(set(bandEdges).difference(set(seamsEdges)))
cmds.polyMapSewMove(weldEdges)
cmds.polyLayoutUV(bandFaces, scale=1, rotateForBestFit=0, layout=1)
uvs = cmds.polyListComponentConversion(bandFaces, toUV=1)
cmds.polyEditUV(uvs, u=1, v=0)
not history and cmds.delete(object, ch=True)
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:30,代码来源:unfoldBand.py
示例3: makePlanar
def makePlanar(components):
"""
This definition planarizes the given Components.
:param components: Components to planarizes. ( List )
"""
object = cmds.ls(components, o=True)
if object:
transform = getTransform(object)
vertices = cmds.ls(cmds.polyListComponentConversion(components, toVertex=True), fl=True)
barycenters = cmds.xform(vertices, q=True, t=True, ws=True)
barycenter = getAverageVector([(barycenters[i], barycenters[i + 1], barycenters[i + 2]) for i in range(0, len(barycenters), 3)])
normals = [float(normal) for data in cmds.polyInfo(cmds.polyListComponentConversion(components, toFace=True), faceNormals=True) for normal in data.split()[2:5]]
normals = [(normals[i], normals[i + 1], normals[i + 2]) for i in range(0, len(normals), 3)]
averageNormal = vectorMatrixMultiplication(normalize(getAverageVector(normals)), cmds.xform(transform, query=True, matrix=True, worldSpace=True))
offset = -dot(averageNormal, barycenter)
for vertex in vertices:
position = cmds.xform(vertex, q=True, t=True, ws=True)
distance = -(dot(averageNormal, position) + offset)
cmds.xform(vertex, r=True, t=(averageNormal[0] * distance, averageNormal[1] * distance, averageNormal[2] * distance))
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:25,代码来源:makePlanar.py
示例4: polySelectTraverse
def polySelectTraverse(traversal=1):
"""
Grow polyComponent selection
:param traversal: 0 = Off.
1 = More : will add current selection border to current selection.
2 = Less : will remove current selection border from current selection.
3 = Border : will keep only current selection border.
4 = Contiguous Edges : Add edges aligned with the current edges selected
:type traversal: int
"""
#--- Vertex ---#
result = mc.polyListComponentConversion(fv=True, tv=True)
if result:
mc.polySelectConstraint(pp=traversal, t=0x0001)
else:
#--- Edge ---#
result = mc.polyListComponentConversion(fe=True, te=True)
if result:
mc.polySelectConstraint(pp=traversal, t=0x8000)
else:
#--- Face ---#
result = mc.polyListComponentConversion(ff=True, tf=True)
if result:
mc.polySelectConstraint(pp=traversal, t=0x0008)
else:
#--- Uv ---#
result = mc.polyListComponentConversion(fuv=True, tuv=True)
if result:
mc.polySelectConstraint(pp=traversal, t=0x0010)
开发者ID:snaress,项目名称:studio_dev,代码行数:30,代码来源:pScene.py
示例5: skinWeights
def skinWeights(x=None, export=None, f=None, fileName=None):
# Import/export skin weights from/to a file
# x/export: 0 for import, 1 for export
# f/fileName: filename under default project directory
x = x or export
if not (f or fileName):
raise Exception, "Missing argument: fileName"
if fileName:
f = fileName
obj = cmds.ls(sl=1)
if not obj:
raise Exception, "No object selected"
obj = obj[0]
node = None
for n in cmds.listHistory(obj, f=0, bf=1):
if cmds.nodeType(n) == 'skinCluster':
node = n
break
if not node:
raise Exception, "no skin cluster found"
mode = "r"
if x:
mode = "w"
f = open(cmds.internalVar(uwd=1) + f, mode)
allTransforms = cmds.skinPercent(node, cmds.ls(cmds.polyListComponentConversion(obj, tv=1), fl=1), q=1, t=None)
for vertex in cmds.ls(cmds.polyListComponentConversion(obj,tv=1), fl=1):
if x:
transforms = cmds.skinPercent(node, vertex, ib=1e-010, q=1, t=None)
weights = cmds.skinPercent(node, vertex, ib=1e-010, q=1, v=1)
s = ""
for i in range(len(transforms)):
s += str(weights[i])+"@"+transforms[i]+" "
f.write(s+"\n")
else:
weights = {}
for t in allTransforms:
weights[t] = float(0)
readWeights = f.readline().strip().split(" ")
for i in readWeights:
w = i.split("@")
if w[1] in weights:
weights[w[1]] = float(w[0])
w = []
for i in weights.iteritems():
w.append(i)
cmds.skinPercent(node, vertex, tv=w)
f.close()
开发者ID:cgriders,项目名称:jcScripts,代码行数:60,代码来源:character.py
示例6: autoEyebrowGuidePosition
def autoEyebrowGuidePosition(side = None, guideName = None):
objectName = side + "_" + guideName
sel = cmds.ls(os = 1, flatten = 1)
pos = []
cluster = []
# check which type of component is selected and store the position
for t in sel:
i = t
selType = t.split(".")[1][0]
if selType == "e":
vtx = cmds.polyListComponentConversion(i, fe = 1, tv = 1)
cmds.select(vtx)
cls = cmds.cluster()
clsPos = cmds.xform(cls, query = 1, rotatePivot = 1, worldSpace = 1)
pos.append(clsPos)
cluster.append(cls)
elif selType == "f":
vtx = cmds.polyListComponentConversion(i, ff = 1, tv = 1)
cmds.select(vtx)
cls = cmds.cluster()
clsPos = cmds.xform(cls, query = 1, rotatePivot = 1, worldSpace = 1)
pos.append(clsPos)
cluster.append(cls)
elif selType == "v":
cmds.warning("Select in another component mode! We are out of verts dude!!!")
else:
cmds.warning("No components selected dude!!!")
# check if guide group exists
if cluster:
if cmds.objExists(objectName + "_TRN"):
cmds.delete(objectName + "_TRN")
# create the guides
guides = defGuideCmds.defGuideCrv()
guides.__init__(nSpans = len(cluster)-1, curveDegree = 1, offset =.2, offsetVector = [1,0,0], side = side, name = guideName, startPosition = [0,0,0], ctlSize = 10)
cmds.delete("C_curve_TRN")
# delete the cluster
for c in cluster:
cmds.delete(c)
# list all the guides inside the guideName group except the curve
loc = cmds.listRelatives(objectName + "_TRN", allDescendents = 1, type = "transform")[:-1]
# reposition the guides at the vertices place
for i, p in zip(loc, pos):
cmds.xform(i, translation = p, worldSpace = 1)
# mirror the guides
cmds.select(loc)
guides.createMirror()
开发者ID:jonntd,项目名称:Public,代码行数:60,代码来源:tools_list.py
示例7: highlightPolys
def highlightPolys(self, trisOnly=False, ngonsOnly=False, quadsOnly=False):
import math, sys, os
import maya.cmds as cmds
import maya.mel as mel
faceWarningList = [];
triWarningList = [];
ngonWarningList = [];
quadWarningList = [];
originalObject = cmds.ls(selection=True)
##Convert selection to faces
selectedFaces = (cmds.polyListComponentConversion( (cmds.ls (sl=1, flatten=1)), tf=True))
#print(selectedFaces)
cmds.select (selectedFaces)
#make list of selected faces
selectedItems = (cmds.ls (flatten=True, selection=True))
lengthOfList = len(selectedItems)
#print ("***Number of items in list " + str(lengthOfList))
#print(selectedItems)
for i in xrange(len(selectedItems)):
tempFace = selectedItems[i]
cmds.select (tempFace)
#print(tempFace)
originalSelection = cmds.ls (sl=1, flatten=1)
#print(type(originalSelection))
faceVertices = (cmds.polyListComponentConversion( originalSelection, tv=True) )
cmds.select( faceVertices )
faceVerticesFlat = cmds.ls(faceVertices, flatten = True)
cmds.select( originalSelection )
#print (faceVerticesFlat)
#print (selectedVertices)
noOfVertices = 0
for j in xrange(len(faceVerticesFlat)):
noOfVertices = 1 + noOfVertices
#print(noOfVertices)
if (noOfVertices != 4):
faceWarningList.append(selectedItems[i])
if (noOfVertices == 3):
triWarningList.append(selectedItems[i])
if (noOfVertices == 4):
quadWarningList.append(selectedItems[i])
if (noOfVertices > 4):
ngonWarningList.append(selectedItems[i])
#DisplayResult
print("Number of Non-Quad Faces Found: " + str(len(faceWarningList)))
try:
self.ui.triFace.setValue(len(triWarningList))
self.ui.ngonFace.setValue(len(ngonWarningList))
except Exception, e: ##This will happen if there is no UI
print( e )
print("Number of trianges: " + str( len(triWarningList) ) )
print("Number of ngons: " + str( len(ngonWarningList) ) )
print("Number of quads: " + str( len(quadWarningList) ) )
开发者ID:joetainment,项目名称:mmmmtools,代码行数:60,代码来源:ModelerSelector.py
示例8: expandVertexSelection
def expandVertexSelection(vtxSel,useFace=False):
'''
Expand the specified vertex selection list.
@param vtxSel: Vertex selection list to expand.
@type vtxSel: list
@param useFace: Expand the selection using face connection instead of edge connection.
@type useFace: bool
'''
# ==========
# - Checks -
# ==========
# Check Vertex Selection
vtxSel = mc.filterExpand(vtxSel,sm=31)
if not vtxSel: raise Exception('Invalid vertex selection!')
# ====================
# - Expand Selection -
# ====================
conSel = []
if useFace:
# Convert To Faces
conSel = mc.polyListComponentConversion(vtxSel,fv=True,tf=True,internal=False)
else:
# Convert To Faces
conSel = mc.polyListComponentConversion(vtxSel,fv=True,te=True,internal=False)
# Convert To Vertex
newSel = mc.polyListComponentConversion(conSel,ff=True,fe=True,tv=True,internal=False)
# =================
# - Return Result -
# =================
return newSel
开发者ID:auqeyjf,项目名称:glTools,代码行数:35,代码来源:component.py
示例9: flatten_marvelous_shells
def flatten_marvelous_shells(shells):
"""
Usage:
flatten_marvelous_shells(mc.ls(sl=True))
"""
for obj in shells:
start_vert, end_vert = mc.ls(
mc.polyListComponentConversion(cmds.ls(obj + ".e[0]")[0], fe=True, tv=True), fl=True
)
start_scale = distance.euclidean(
mc.xform(start_vert, q=True, t=True, ws=True), mc.xform(end_vert, q=True, t=True, ws=True)
)
for uv in cmds.ls(obj + ".map[:]", fl=True):
uv_pos = mc.polyEditUV(uv, q=True)
uv_index = re.findall("\[([0-9]+)\]", uv)[0]
vertex = mc.polyListComponentConversion(uv, fuv=True, tv=True)[0]
mc.xform(vertex, t=[uv_pos[0]] + [0] + [uv_pos[1]], ws=True)
# Finally, scale it
end_scale = distance.euclidean(
mc.xform(start_vert, q=True, t=True, ws=True), mc.xform(end_vert, q=True, t=True, ws=True)
)
scale_by = start_scale / end_scale
mc.xform(mc.ls(obj + ".vtx[:]"), s=[scale_by, scale_by, scale_by], ws=True)
开发者ID:AndresMWeber,项目名称:aw,代码行数:27,代码来源:aw_marevelous_flatten.py
示例10: 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
示例11: shortestPath
def shortestPath(self):
"Returns a list of adjacent vertices defining the shortest path from vertA to vertB."
vertA=str(self[0])
vertB=str(self[1])
del self[2:]# make sure there are only two vertices in the list
vertPath=list([vertA])
vert=str(vertA)
distanceList=self.distanceList(vertB,vertA)
sizeList=len(distanceList)
for i in range(1,sizeList):
tempList=distanceList[ sizeList-i-1 ]
tempList=mc.ls( tempList, fl=True )
vertices=mc.polyListComponentConversion( vert, te=True )
vertices=mc.polyListComponentConversion( vertices, tv=True )
vertices=mc.ls( vertices, fl=True )
tempA=list([vert])
vertices=removeAll(tempA,vertices)
intersectorSet=Set(vertices)
intersectorSet.intersection_update(tempList)
vertTempArray=list(intersectorSet)
vert=str(vertTempArray[0])
vertPath.append( vert )
vertPath.append( vertB )
return vertPath
开发者ID:jonntd,项目名称:zentools,代码行数:34,代码来源:polyVertexList.py
示例12: getUVs
def getUVs(self):
# Getting current uvset
currUVSet = cmds.polyUVSet( self.name, q=True, currentUVSet=True )[0]
for i, uvSet in enumerate(self.uvSets):
self.uvs[uvSet] = []
# Setting uvSet temp
cmds.polyUVSet( self.name, currentUVSet=True, uvSet=uvSet )
# Get uv maps
uvMaps = cmds.polyListComponentConversion( self.name, ff=1, tuv=1 )
# verts = PolyFace.findWindingOrder(self.name)
# print(self.vtxFaceNames)
# cmds.polyListComponentConversion('pPlane2.vtxFace[2][1]', tuv=1 )
if( uvMaps ):
# uvMaps = cmds.filterExpand( uvMaps, expand=True, sm=35 )
uvMaps = [cmds.polyListComponentConversion(vtxFace, tuv=1 ) for vtxFace in self.vtxFaceNames ]
# Check to make sure there are uv's on this face.
for uvMap in uvMaps:
# Get my uvValues
uvCoords = cmds.polyEditUV( uvMap, q=True )
self.uvs[uvSet].append(uvCoords)
# Returning to orginal uvSet
cmds.polyUVSet( self.name, currentUVSet=True, uvSet=currUVSet)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:29,代码来源:export_uv.py
示例13: select_inside_loop
def select_inside_loop():
# get selected face loop and one inner face, convert to edges
get_sel = cmds.ls(os=1,fl=1)
if _cmds().is_component(get_sel) == "face":
mesh = cmds.ls(sl=1,fl=1,o=1)
edge_from_face = cmds.ls(cmds.polyListComponentConversion(get_sel[:-1],te=1,bo=1),fl=1)
# create temp uvset for uv projection
current_uvset = cmds.polyUVSet(mesh,q=1,cuv=1)[0]
for uvset in cmds.polyUVSet(mesh,q=1,auv=1):
if uvset == "af_tmp_select_uvset":
cmds.polyUVSet(mesh,delete=1,uvSet="af_tmp_select_uvset")
cmds.polyUVSet(mesh,create=1,uvSet="af_tmp_select_uvset")
cmds.polyUVSet(mesh,e=1,cuv=1,uvSet="af_tmp_select_uvset")
else:
cmds.polyUVSet(mesh,create=1,uvSet="af_tmp_select_uvset")
cmds.polyUVSet(mesh,e=1,cuv=1,uvSet="af_tmp_select_uvset")
cmds.polyProjection(mesh,ch=0,type="Planar",ibd=1,md="y")
cmds.polyMapCut(edge_from_face,e=0)
# get inner selection
cmds.select(cmds.polyListComponentConversion(get_sel[-1],tuv=1),r=1)
mm.eval("polySelectBorderShell 0;ConvertSelectionToFaces;")
inner = cmds.ls(sl=1,fl=1)
# cleanup
cmds.polyUVSet(mesh,e=1,cuv=1,uvSet=current_uvset)
cmds.polyUVSet(mesh,delete=1,uvSet="af_tmp_select_uvset")
cmds.delete(mesh,ch=1)
# select fill
cmds.select((inner+get_sel[:-1]),r=1)
开发者ID:aaronfang,项目名称:afModEx,代码行数:33,代码来源:afSelectInsideLoop.py
示例14: shell_border_edges_to_hard
def shell_border_edges_to_hard():
"""
Sets uv border edges on a mesh has hard, and everythign else as soft.
"""
objList = cmds.ls(sl=True, o=True)
finalBorder = []
for subObj in objList:
cmds.select(subObj, r=True)
cmds.polyNormalPerVertex(ufn=True)
cmds.polySoftEdge(subObj, a=180, ch=1)
cmds.select(subObj + '.map[*]', r=True)
polySelectBorderShell(borderOnly=True)
uvBorder = cmds.polyListComponentConversion(te=True, internal=True)
uvBorder = cmds.ls(uvBorder, fl=True)
for curEdge in uvBorder:
edgeUVs = cmds.polyListComponentConversion(curEdge, tuv=True)
edgeUVs = cmds.ls(edgeUVs, fl=True)
if len(edgeUVs) > 2:
finalBorder.append(curEdge)
cmds.polySoftEdge(finalBorder, a=0, ch=1)
cmds.select(objList)
开发者ID:arubertoson,项目名称:maya-mamuvs,代码行数:28,代码来源:utils.py
示例15: findFacesInVolume
def findFacesInVolume(meshes, volume, contained=False):
"""
returns a dict containing the of faces within a given volume. if contained is True, then only faces wholly contained
by the volume are returned
"""
meshVertsWithin = findVertsInVolume(meshes, volume)
meshFacesWithin = {}
for mesh, verts in meshVertsWithin.iteritems():
if not verts:
continue
meshFacesWithin[mesh] = []
vertNames = ["%s.vtx[%d]" % (mesh, v.id) for v in verts]
if contained:
faces = set(cmd.ls(cmd.polyListComponentConversion(vertNames, toFace=True), fl=True))
[
faces.remove(f)
for f in cmd.ls(cmd.polyListComponentConversion(vertNames, toFace=True, border=True), fl=True)
]
meshFacesWithin[mesh] = [f.split(".")[1] for f in faces]
else:
faces = cmd.ls(cmd.polyListComponentConversion(vertNames, toFace=True), fl=True)
meshFacesWithin[mesh] = [f.split(".")[1] for f in faces]
return meshFacesWithin
开发者ID:BGCX261,项目名称:zootoolbox-svn-to-git,代码行数:25,代码来源:meshUtils.py
示例16: _optimizeComponentList
def _optimizeComponentList(mesh, componentList):
"""
Given the specified mesh and its list of components, return a list that
represents the most optimized representation of the components.
ex. ['vtx[10]','vtx[11]'] optimizes to ['vtx[10:11]']
"""
vertices = []
faces = []
edges = []
for comp in componentList:
if comp.startswith("f["):
toAdd = faces
elif comp.startswith("vtx["):
toAdd = vertices
elif comp.startswith("e["):
toAdd = edges
else:
mel.eval('warning "Unsupported component type: %s"' % comp)
continue
toAdd.append("%s.%s" % (mesh, comp))
newCompList = []
if len(vertices):
newComps = cmds.polyListComponentConversion(vertices, tv=True)
if newComps is not None:
newCompList.extend(newComps)
if len(faces):
newComps = cmds.polyListComponentConversion(faces, tf=True)
if newComps is not None:
newCompList.extend(newComps)
if len(edges):
newComps = cmds.polyListComponentConversion(edges, te=True)
if newComps is not None:
newCompList.extend(newComps)
return [x.split(".")[-1] for x in newCompList]
开发者ID:digitaldestructo,项目名称:DDConvexHull,代码行数:34,代码来源:DDConvexHullUtils.py
示例17: cleanupHierarchicalSubdivisionConversion
def cleanupHierarchicalSubdivisionConversion(object):
"""
This definition cleans Maya hierarchical polygonal conversion.
:param object: Object to cleanup. ( String )
"""
cmds.select(object)
cmds.polySelectConstraint(m=3, t=8, sz=3)
cmds.polySelectConstraint(dis=True)
nsidesFaces = cmds.ls(sl=True, l=True, fl=True)
cmds.select(nsidesFaces)
cmds.polySelectConstraint(m=3, t=1, order=True, orb=(3, 3))
cmds.polySelectConstraint(dis=True)
nsideVertices = cmds.ls(sl=True, l=True, fl=True)
offendingEdges = []
for vertice in nsideVertices:
faces = cmds.ls(cmds.polyListComponentConversion(vertice, fv=True, tf=True), fl=True, l=True)
faces = [face for face in faces if not face in nsidesFaces]
if len(faces) == 2:
faceEdgesA = cmds.ls(cmds.polyListComponentConversion(faces[0], ff=True, te=True), fl=True, l=True)
faceEdgesB = cmds.ls(cmds.polyListComponentConversion(faces[1], ff=True, te=True), fl=True, l=True)
sharedEdge = list(set(faceEdgesA).intersection(faceEdgesB))
offendingEdges.append(sharedEdge[0])
cmds.polySelectSp(offendingEdges, loop=True)
cmds.polyDelEdge(cmds.ls(sl=True), cv=True, ch=True)
cmds.select(object)
开发者ID:maximveksler,项目名称:Snippets,代码行数:27,代码来源:cleanupHierarchicalSubdivisionConversion.py
示例18: shrinkVertexSelection
def shrinkVertexSelection(vtxSel):
'''
Shrink the specified vertex selection list.
@param vtxSel: Vertex selection list to expand.
@type vtxSel: list
'''
# ==========
# - Checks -
# ==========
# Check Vertex Selection
vtxSel = mc.filterExpand(vtxSel,sm=31)
if not vtxSel: raise Exception('Invalid vertex selection!')
# ====================
# - Shrink Selection -
# ====================
# Convert To Faces
conSel = mc.polyListComponentConversion(vtxSel,fv=True,tf=True,internal=True)
# Convert To Vertex
newSel = mc.polyListComponentConversion(conSel,ff=True,fe=True,tv=True,internal=True)
# =================
# - Return Result -
# =================
return newSel
开发者ID:auqeyjf,项目名称:glTools,代码行数:28,代码来源:component.py
示例19: 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
示例20: vertNeighbors
def vertNeighbors(vert, vertLoop):
#find the verticles connected to this vertex by edges
connectedEdges = cmds.polyListComponentConversion(vert, toEdge=True)
connectedVerts = cmds.polyListComponentConversion(connectedEdges, toVertex = True)
#select the connected verticles, then deselect the verticles on the loop
cmds.select(connectedVerts, replace = True)
cmds.select(vertLoop, deselect = True)
开发者ID:echofourpapa,项目名称:edgeLord.py,代码行数:8,代码来源:edgeLord.py
注:本文中的maya.cmds.polyListComponentConversion函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论