我想使用3dsmax python api来获取骨架模式是这样的顶点权重骨骼数:
from pymxs import runtime as rt
import MaxPlus
max_root = MaxPlus.Core.GetRootNode()
#get the mesh node
mesh_node = max_root.GetChild(0)
#there is only one modifier the skin modifier
mod = mesh_node.GetModifier(0)
#get the first vertex weight count
weight_count = rt.skinOps.GetVertexWeightCount(mod, 0)
我收到此错误:
Unable to convert: Animatable(Skin) to type: Modifier.
任何想法如何解决?
答案 0 :(得分:1)
您可以做的是:
from pymxs import runtime as rt
import MaxPlus
# Get the selected node (must be a mesh)
mesh_node = MaxPlus.SelectionManager.GetNodes()[0]
# Get the skin
skin = rt.getnodebyname(mesh_node.Name).skin
# Get the bone count
bone_count = rt.skinOps.GetNumberBones(skin)
print(bone_count)
# Get the first vertex weight count
weight_count = rt.skinOps.GetVertexWeightCount(skin, 1)
print(weight_count)
我希望它能对访问此页面的所有人有所帮助。
答案 1 :(得分:0)
您不能以这种方式组合pymx和MaxPlus,一个是MAXScript运行时引擎,另一个是C ++ SDK和本机对象的包装器。我的意思是,你可以传递指针和手柄,并将对象转换为这些对象,但更容易坚持其中之一。