Maxscript Python 添加修改器

Maxscript Python addModifier

我在 python 中编写 maxscript,以下代码抛出类型错误:

import MaxPlus

res = MaxPlus.Core.GetRootNode()
#This is just as example that I use the first child.
child = MaxPlus.INode.GetChild(res,0)

morpherFP = MaxPlus.FPValue()
MaxPlus.Core.EvalMAXScript("Morpher()", morpherFP)
morpher = MaxPlus.FPValue.Get(morpherFP)

MaxPlus.INode.AddModifier(child, morpher)

我总是从 MaxScript Listener 收到以下错误:

type 'exceptions.TypeError' in method 'INode_AddModifier', argument 2 of type 'Autodesk::Max::Modifier'"

而morpher的类型是Animatable(Morpher),Animatable是Modifier的子类。有人可以帮我解决这个问题吗?

提前致谢

我想我找到了一个可能的解决方案(我唯一知道的是 MaxScript Listener 不会抛出错误):

import MaxPlus

res = MaxPlus.Core.GetRootNode()
#I use the first child as example
child = MaxPlus.INode.GetChild(res,0)
morpher = MaxPlus.Factory.CreateObjectModifier(MaxPlus.ClassIds.Morpher)
MaxPlus.INode.AddModifier(child, morpher) 
# the following also seems to work aka it does not throw any errors
child.InsertModifier(morpher,1)

如果不正确或有更简单或更易理解的方法,请告诉我。