我试图确定一组网格节点当前是否可见。使用pymel和isVisible()可以工作,但这是一个巨大的性能成功。纵观这些文档,我找到了一些(希望)解决我的问题的东西,即命令testVisibility上的标志隐藏。
根据文档,标志命令将返回一个值,该值告诉我指定的节点是否可见。
问题是那个旗子根本不存在。
import maya.cmds as cmds
cmds.sphere(name='testsphere')
cmds.hide('testsphere', testVisibility = True)给出错误
# Error: Invalid flag 'testVisibility'
# Traceback (most recent call last):
# File "<maya console>", line 4, in <module>
# TypeError: Invalid flag 'testVisibility' # 标志"tv“的短名称也是一样的,同时在MEL:hide -testVisibility;中也是如此。
这些文件包括自2016年玛雅以来的这面旗帜。这也是我目前使用的玛雅版本(更具体地说,玛雅2016 SP5)。使用到python文档的内置链接,我得到了与我上面发布的文档相同的文档。纵观SP6的变化,它也没有提到任何东西,所以我认为它不会解决我的问题。
我在玛雅2017年尝试过同样的命令,结果成功了。但这对我没有多大帮助,因为这不是我们团队目前使用的玛雅版本。
我不能联系Autodesk支持,因为我不是订阅者(谢谢autodesk,很好的帮助)。
所以我的问题是:
- is there a way to check if a command has a flag, without try-catching it?
- any workarounds that are not as performance draining as the pymel route I mentioned above?
发布于 2017-10-06 06:49:31
你是对的。我还为tv命令尝试了hide标志,但它肯定不起作用。
尝试setter/getter:
import maya.cmds as cmds
cmds.sphere(name="testsphere")
cmds.setAttr("testsphere.visibility", False)
cmds.getAttr("testsphere.visibility")我在Maya 2016/2018年进行了测试。
# Result: False # https://stackoverflow.com/questions/46599243
复制相似问题