1

我正在 maxscript 中编写插件助手,需要获取作为对象的节点。听起来很简单吧?哈哈!“this”返回插件类的实例,我认为..也可能是类本身..谁知道,文档并不完全针对这个..或任何东西。我已经求助于猜测正确的单词组合可能是什么(比如“this.node”或只是“node”),没有运气。

我可以生成一个选择对话框并自己选择节点,但这太愚蠢了。有什么线索吗?

4

1 回答 1

1

一般来说,您不想为对象中的数据引用节点。如果节点依赖于对象,而对象依赖于节点,你可以看到这会导致很多问题。另一个问题是您的插件是否被实例化。然后 2 个节点指向一个对象 - 哪个是正确的?

理想情况下,您应该以不需要节点指针的方式设计您的插件(即,创建一个WSModifier,或者改为作为实用程序工作)。如果您需要节点转换,那么您可以在没有指向节点的指针的情况下获得它: http ://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__files_GUID_461915FA_31A2_49CE_84AF_2544B782ACA3_htm

The delegate local variable in a scripted plug-in that creates a scene object does not contain the node itself, but a the BaseObject of that node. As such, you can not access the node level properties of the object being created. An exception to this is the node’s transform, which is exposed to the scripted plug-in through a local variable called nodeTM . This variable is described in the applicable scripted plug-in type topics. 

尽管如此,如果您决定直接与节点对话,那么您可以获得依赖于您的类的所有类的列表

refs.dependents

http://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__files_GUID_95453E22_A022_4543_B31C_A052CECD3598_htm

这将获得所有依赖项的列表,包括您的节点。遍历列表并使用找到的第一个节点。

于 2015-02-17T22:45:46.250 回答