Maya python打开属性编辑器的另一个实例 [英] Maya python open another instance of the attribute editor

查看:215
本文介绍了Maya python打开属性编辑器的另一个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Maya 2018中,使用Python,如何检查属性编辑器是否打开,如果没有打开,则将其打开.另外,您可以打开属性编辑器的多个实例,最好显示不同节点的属性吗?

In Maya 2018, using Python, how can you check if the attribute editor is open, and if it is not, open it. Also, can you open multiple instances of the attribute editor, preferably showing the attributes of different nodes?

推荐答案

如果您希望查看某些代码,建议您打开"echo all命令". 打开属性编辑器会给您回声:

I advise you to turn on "echo all command" if your looking to some code. Opening the Attribute Editor will give you in echo :

attributeEditorVisibilityStateChange(`workspaceControl -q -visible AttributeEditor`, "");

在此命令中,您已经可以猜到:

In this command you can already guess that :

`workspaceControl -q -visible AttributeEditor`

这是查询属性编辑器可见性的部分,在python中是一个简单的翻译:

it is the part to query the visibility of the attribute editor, in python a simple translation :

cmds.workspaceControl('AttributeEditor', q=1, visible=1)

然后您具有此mel功能:

Then you have this mel function :

attributeEditorVisibilityStateChange

在Mel中,您可以使用此命令查找该过程所属的位置:

In Mel you can use this command to find where the procedure belong :

whatIs attributeEditorVisibilityStateChange;
// Result: Mel procedure found in: D:\maya_path\scripts\startup\initAttributeEditor.mel // 

打开文件并阅读第一个proc,您已经发现:showAttributeEditor

Opening the file and reading the first proc, you find already : showAttributeEditor

此函数被评论为过时,建议使用:ToggleAttributeEditor

This function is commented as obsolet and advise to use : ToggleAttributeEditor

快速进行操作,我发现这是一个运行时命令(因此应立即使用):

Making a quick whatIs, i find out it was a runtime command (so it should be use straight away):

cmds.ToggleAttributeEditor()

您应该有打开答案,并检查atrribute编辑器是否仍然存在,如果该命令不是您想要的命令,因为您可能需要某种对接功能,那么使用whatIs可以读取更多的MEL;和文件中的第二个proc.

You should have your answer for opening and check if the atrribute editor still exists, if the command is not the one you want because you want maybe some docking ability, there is lots more MEL to read using whatIs; and the second proc in the file.

现在,我已经向您解释了查找python命令的方法,我认为您可以使用相同的技术为属性编辑器的复制选项卡"创建函数!

And now that I've explained you the method to find python command, I think you can use the same technique to create a function for the "copy tab" of the attribute editor !

如果您发现这很烦人(maya有时有很多嵌套代码,并且可能很麻烦),则可以使用:

If you find it is to annoying (maya has sometimes lots of nested code, and it can be tidious), you can use :

import maya.mel
mel.eval('attributeEditorVisibilityStateChange(`workspaceControl -q -visible AttributeEditor`, "");')

它将在python内部执行mel代码.您可以使用python格式插入参数... etc,因为它必须以字符串形式求值.

it will execute mel code inside python. you can use python format to insert arguments...etc as it must be evaluated as a string.

这篇关于Maya python打开属性编辑器的另一个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆