【发布时间】:2019-03-06 21:00:07
【问题描述】:
我有一个应用蒙皮修改器的 3DS Max 场景对象。我想把它转换成蒙皮修改器,然后在堆栈中直接删除它下面的蒙皮包裹。
所以我应该通过它的堆栈号简单地删除修饰符吗? 哎呀,我什至有一个打印行来标识它在堆栈中的编号。
我为 python 和 EvalMAXScript 之间的来回道歉,我不是程序员,只是一个难以理解的人。
# setup =======================================================
import MaxPlus as mp
from pymxs import runtime as rt
mySel = rt.selection
max = mp.Core.EvalMAXScript
box = mp.Factory.CreateGeomObject(mp.ClassIds.Box)
sphere = mp.Factory.CreateGeomObject(mp.ClassIds.Sphere)
cyl = mp.Factory.CreateGeomObject(mp.ClassIds.Cylinder)
node = MaxPlus.Factory.CreateNode
node(box)
node(sphere)
node(cyl)
#setup =======================================================
max("select #($Sphere001, $Cylinder001)")
# =============================================
rt.addModifier (mySel[0], rt.Skin())
max("select $Sphere001")
max("skinOps.addBone $.modifiers[#Skin] $Cylinder001 1")
# =============================================
max("select $Box001")
rt.addModifier (mySel[0], rt.Skin_Wrap())
max("append $" + str(mySel[0].name) +".modifiers[#Skin_Wrap].meshList $Sphere001")
mySel[0].modifiers[0].meshDeformOps.convertToSkin (False)
print mySel[0].modifiers[0].name + " <----- ZERO"
print mySel[0].modifiers[1].name + " <----- ONE!!!!"
#print mySel[0].modifiers[2].name #<----- will say IndexError: Index out of range <--- This makes sense
rt.deleteModifier (mySel[0], 2) #<------------------ I want to delete the SKIN WRAP modifier SO WHY 2???
但是为什么删除蒙皮修饰符需要在 deleteModifer arg 中使用“2”?
打印出修改器的名称时,3Ds Max 的编号顺序与删除时的编号顺序不同吗?
这是否与 python 计数/迭代从 0 而不是 1 开始这一事实有关?
有人可以将我/或任何想在 max 中使用 python 学习脚本的人指向我可以获取有关此类信息的文档吗?因为我想像输入正确索引号这样常见的东西应该在一些基本文档中的某个地方(我显然没能找到)。
请原谅我的焦虑。我花了好几个小时试图弄清楚为什么这不起作用,直到我不小心偶然发现了一个超出范围的索引号。
谢谢。
【问题讨论】: