maya python脚本转成不可编辑的_Maya 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?

解决方案

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`

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

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

Then you have this mel function :

attributeEditorVisibilityStateChange

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 //

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

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()

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.

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 !

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`, "");')

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值