使用3dsmax python api获取顶点权重骨骼计数

使用3dsmax python api获取顶点权重骨骼计数,3dsmax,3dsmax,我想使用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.GetMod

我想使用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.

如何修复它?

< P>你不能将PYMXS和Max加成这样,一个是Max脚本运行时引擎,另一个是围绕C++ SDK和本地对象的包装器。我的意思是,您可以传递指针和句柄,并将对象转换为指针和句柄,但只需坚持其中一个就更容易了。

您可以做的事情是:

从pymxs导入运行时为rt
导入MaxPlus
#获取选定节点(必须是网格)
mesh_node=MaxPlus.SelectionManager.GetNodes()[0]
#剥皮
skin=rt.getnodebyname(mesh\u node.Name).skin
#数一数骨头
骨骼计数=rt.skinOps.GetNumberBones(皮肤)
打印(骨量)
#获取第一个顶点权重计数
重量计数=rt.skinOps.GetVertexWeightCount(皮肤,1)
打印(重量/单位计数)

我希望它能帮助任何看到此页面的人。

格式更改