本文整理汇总了Python中ngSkinTools.utils.Utils.mIter方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.mIter方法的具体用法?Python Utils.mIter怎么用?Python Utils.mIter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ngSkinTools.utils.Utils
的用法示例。
在下文中一共展示了Utils.mIter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseSelectionList
# 需要导入模块: from ngSkinTools.utils import Utils [as 别名]
# 或者: from ngSkinTools.utils.Utils import mIter [as 别名]
def parseSelectionList(self,selectionList):
'''
calculates compacted internal selection list from the MSelectionList
'''
selection = []
if selectionList is None or selectionList.isEmpty():
return selection
#compact selection list first
mergedList = om.MSelectionList()
mergedList.merge(selectionList,om.MSelectionList.kMergeNormal)
for i in Utils.mIter(om.MItSelectionList(mergedList)):
# read selection item
path = om.MDagPath()
compSelection = om.MObject()
i.getDagPath(path,compSelection)
if not i.hasComponents() or not compSelection.hasFn(self.componentType):
continue
# create selection entry and fill it with components
selEntry = MeshSelectEntry(path)
for c in Utils.mIter(om.MItMeshVertex(path,compSelection)):
selEntry.components.append(c.index())
selection.append(selEntry)
return selection
示例2: getSelectionDagPaths
# 需要导入模块: from ngSkinTools.utils import Utils [as 别名]
# 或者: from ngSkinTools.utils.Utils import mIter [as 别名]
def getSelectionDagPaths(hilite):
"""
similar functionality to cmds.ls, but returns transform nodes where shapes might be selected,
and does not return components.
"""
from maya import OpenMaya as om
selection = om.MSelectionList()
if hilite:
om.MGlobal.getHiliteList(selection)
else:
om.MGlobal.getActiveSelectionList(selection)
result = []
for i in Utils.mIter(om.MItSelectionList(selection)):
path = om.MDagPath()
i.getDagPath(path)
selectionPath = path.fullPathName()
# if it's a shape node, extend upwards
if path.node().hasFn(om.MFn.kShape):
parentPath = om.MDagPath()
om.MFnDagNode(om.MFnDagNode(path).parent(0)).getPath(parentPath)
selectionPath = parentPath.fullPathName()
if not selectionPath in result:
result.append(selectionPath)
return result
示例3: export
# 需要导入模块: from ngSkinTools.utils import Utils [as 别名]
# 或者: from ngSkinTools.utils.Utils import mIter [as 别名]
def export(self):
'''
returns mesh triangles: first vertex list, then vertex ID list for each triangle;
meshTransform (supplied as transform node name) is required to transform
each vertex to world-space
'''
# get triangles for the mesh
fnMesh = om.MFnMesh(self.meshMObject)
counts = om.MIntArray()
vertices = om.MIntArray()
fnMesh.getTriangles(counts,vertices)
idList = [i for i in Utils.mIter(vertices)]
# get point values
points = om.MPointArray()
fnMesh.getPoints(points)
pointList = []
for p in Utils.mIter(points):
p = p*self.transformMatrix
pointList.extend((p.x,p.y,p.z))
# return point values, id values
return pointList,idList