使用玛雅.cmds,我想选择y=0以下的所有顶点,以便删除它们。我该如何实现这一点?另外,我正在处理大量的.obj网格,因此我需要迭代每个网格并执行相同的操作。要遍历每个文件,我应该使用什么技术?在
import maya.cmds as cmds
import maya.api.OpenMaya as om2
# Select all objects
selection = cmds.select(all = True)
# Rotate -90 degrees on the x axis
# cmds.rotate(-90)
def vertexOm2():
"""
Using Maya Python API 2.0
"""
#___________Selection___________
# 1 # Query the selection list
selectionLs = om2.MGlobal.getActiveSelectionList()
# 2 # Get the dag path of the first item in the selection list
selObj = selectionLs.getDagPath(0)
#___________Query vertex position ___________
# create a Mesh functionset from our dag object
mfnObject = om2.MFnMesh(selObj)
return mfnObject.getPoints()
vertexOm2()
返回“TypeError:item不是DAG路径”
或使用命令:
^{pr2}$我都是从here那里得到的。在
如果你想得到答案,你至少应该发布一段代码。 你的问题:
只是:执行for循环来遍历对象。在
xform和createMayaRanges函数用于回答此问题,但您可能会调查maya API
手动执行,或在maya会话或最后一个解决方案内执行循环,使用mayapy,但这需要大量的工作。 有关批处理maya文件的详细信息:
http://www.toadstorm.com/blog/?p=136
相关问题 更多 >
编程相关推荐