如何访问 Maya 中对象的注释字段
是否可以通过 Maya 脚本接口访问对象的“注释”字段?我试图让它在 Python 中工作,但我假设任何指向我需要在 API 中使用的类/函数的正确方向的指针都会帮助我。
Is it possible to access the 'notes' field of an object through the Maya scripting interface? I'm trying to get it to work inside Python, but I assume any pointer into the right direction of which class/function I need to use in the API will help me out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您在属性编辑器中的注释字段中键入内容时,名为“notes”的属性会动态添加到节点。因此,要检查该值,您可以检查节点上是否存在名为“notes”的属性,然后检索该值。
Maya UI 用于创建和设置 Notes 属性的 mel 过程称为
其中长名称为
"notes"
,短名称为"nts"
,类型为 <代码>“字符串”。An attribute called
"notes"
is added dynamically to nodes when you type in the notes field in the attribute editor. So, to check the value you can check if an attribute called "notes" exists on the node, then retrieve the value.The mel procedure that the maya UI uses to create and set the notes attribute is called
Where the long name is
"notes"
, short name is"nts"
, type is"string"
.由于现在每个人都在使用 PyMEL,因此以下是如何使用 PyMEL 获取它:
假设您已经在属性编辑器的“注释”字段中添加了一些内容。如上所述,注释 attr 仅在那时创建。
如果您从代码中运行所有内容并且不知道注释 attr 是否已创建,您可以像这样检查是否存在:
考虑使用 PyMEL,它就像 maya.cmds,只是更 Pythonic。
Since everyone is using PyMEL these days, here's how to get it using PyMEL:
This is assuming you've already added something to the Notes field in the attribute editor. As mentioned above the notes attr only gets created then.
If you're running all from code and you don't know if the notes attr has been created, you can check for existence like so:
Consider using PyMEL, it's like maya.cmds, only more Pythonic.