[Maya]Rigging 05 - Attributes
Keywords: Maya Rigging, Control, Curve, Attributes
Maya Rigging series of articles:
- [Maya]Rigging Overview
- [Maya]Rigging 01 - Joint
- [Maya]Rigging 02 - Skinning
- [Maya]Rigging 03 - Visualization
- [Maya]Rigging 04 - Controller
- [Maya]Rigging 05 - Attributes
- [Maya]Rigging 06 - IK & FK (WIP)
- [Maya]Rigging 07 - Keyframe (WIP)
- [Maya]Rigging 08 - Common Tricks (WIP)
Create Attribute: Display Only
Select target node (Group, Curve etc.), Modify -> Add Attributes.
Edit Attribute’s arguments.
You will see two default enum values: Green, Blue.
Because we’re looking forward to make a display only attribute, so we just retain one enum.
Finally you will see the self-customized attribute.
At last, lock the attribute (means it can’t be deleted) and Make Selected Nonkeyable.
There’s a gray flag when attribute was locked.
Create Attribute: Keyable Enum
Create Attribute: Keyable Float
Script to Create Attribute
import maya.cmds as cmds
selected = cmds.ls(sl=True, dag=False, leaf=False)
for elem in selected:
cmds.addAttr(elem, ln='controlDivider', nn="++++++++++", at="enum", en='CONTROLS:')
cmds.setAttr(elem + '.controlDivider', channelBox=True, lock=True)
cmds.addAttr(elem, ln='Arm', at="enum", en='Hide:Show:')
cmds.setAttr(elem + '.Arm', keyable=True)
cmds.addAttr(elem, ln='Leg', at="enum", en='Hide:Show:')
cmds.setAttr(elem + '.Leg', keyable=True)
cmds.addAttr(elem, ln='IK_FK_Switch', at="double", min=0.0, max=1.0, dv=0.0)
cmds.setAttr(elem + '.IK_FK_Switch', keyable=True)
Keyword:
channelBox=True
: The Attribute is displayable, but it isn’t keyable;lock=True
: The Attribute’s value was not editable, can the Attribute can’t be deleted;
Attribute Proxy
If want to create an attribute that driven by another attribute, you can create a proxy attribute.
When the proxy attribute was changed, the attributes that followed it will change automatically.
Python:
import maya.cmds as cmds
for elem in cmds.ls(sl=True, dag=False, leaf=False):
cmds.addAttr(elem, ln='IK_FK_Switch', proxy="rig_ctrls.IK_FK_Switch")
MEL:
addAttr -ln "IK_FK_Switch" -proxy "rig_ctrls.IK_FK_Switch"
Attribute Connection
Usually there are many controls in a character and they are grouped in a hierarchy. As shown in the following image.
And there are many attributes in these controls, sometimes we want to tweak these attributes in batch, at this point we can use Attribute Connection.
Windows -> Connection Editor.
This’s the initial window of Connection Editor.
What we need to do is: load the parent attributes in the left, then load the child attributes in the right.
Then click the parent attribute (left side) first, then click the child attributes (right side) to make the connection.
You can also filter the attributes using display options.
Now you can change the attribute value in batch.
When the attribute was connected by another attribute, it will show a yellow flag, means the value can’t be changed directly.
References
Realtime Creature Rigging Workshop (8 / 19) : Hierarchy and attributes
https://www.youtube.com/watch?v=9Ku3fiUSGGs
紫光阁名录:阿玉锡
阿玉锡(满语:ᠠᠶᡡᠰᡳ,穆麟德转写:Ayūsi),生卒年不详,号喀喇巴图尔,蒙古准噶尔部人,清代卫拉特蒙古准噶尔部勇士。原准噶尔属司牧臣,其法获罪应锉臂。雍正十一年投清。乾隆二十年五月十四,阿玉锡以夜斫营奏功。乾隆帝赞其勇,作阿玉锡歌,制纪功碑文,勒石山岩,授散秩大臣,图形紫光阁