top of page

Uncommon Attribute Types

So I've talked about matrix attributes and proxy attributes on this blog before but maya actually has a much larger range of attribute types than most people realize. In fact I had asked my rigging supervisor if it was possible to have a nurbsSurfacee type input or output on a transform node, but he wasn't aware of any way to do that. But when I was checking something on the addAttr command documentation I found out that you have access to many more attribute types than Maya tells you, but unfortunately they can't be accessed through the normal "Add Attribute" menu.

Here's the new documentation:

So a lot of those attributes aren't very useful for most users but some of them open up some very interesting possibilities for what can be done in vanilla Maya.

mesh, nurbsCurve, and nurbsSurface attributes can be helpful for organizing parts of your rig in the node editor.

The stringArray attribute type lets you store string arrays within a nodes attribute. You could do this before by converting the array to a single string and storing it in a string type attribute and then breaking it apart when querying the value. Setting the value for a stringArray is different than you'd expect and unfortunately the documentation doesn't tell you this. The would need to write it like this:

cmds.setAttr('loc.strArray',3,"milk", "bread", "eggs",dt='stringArray')

cmds.setAttr('obj.attribute_name',length_of_array,"first_item", "second_item", "third_item",dt='stringArray')

float2,float3,double2, and double3 are interesting in that they allow you to store tuples (double is synonymous with integer). This is interesting but no clear use jumps out to me. You can set them like so:

cmds.setAttr('obj.float2_attr',2,3, type = 'float2') print cmds.getAttr('obj.float2_attr')

The floatArray and doubleArray attributes behave just like the stringArray attribute but store numbers instead of strings. There is also a pointArray attribute that contains an array of 4D points. I can imagine this would be helpful for taking a mesh and storing an array that contains a

There are a lot of atttribute types that are 16 and 32 forms of different numerical types that are essentially useless (at least from a users perspective, from a developers perspective they are probably very important). Other attribute types like time, char, doubleLinear and doubleAngle fall into this category.

Message attributes aren't new to maya, but you couldn't add new message type attributes in the past. It seems like they are functionally identical to string type attributes but they do display some interesting things in the attribute editor. When the attribute has an incoming connection it displays a ">" button to it's left, and when it does not it displays a "map" button next to it. These buttons are grayed out however, and I'm not sure if they can be activated, nor do I know what they do.

Compound Attributes and Multi Attributes:

We can of course make most of these attribute multi-attributes or compound attributes. Which again, is really only helpful for keeping the node editor organized.

Color Attributes:

Some attributes are designed to handle color (RGB) information and therefore must be a vector. reflectanceRGB and spectrumRGB are two such attributes.

You can actually add a color slider into the attribute editor by using the "useAsColor" flag like this:

cmds.addAttr( longName='rainbow', usedAsColor=True, attributeType='float3' )

cmds.addAttr( longName='redBow', attributeType='float', parent='rainbow' )

cmds.addAttr( longName='greenBow', attributeType='float', parent='rainbow' )

cmds.addAttr( longName='blueBow', attributeType='float', parent='rainbow' )

Not exactly a game changer but it could be useful for making a tool more user-friendly.

I designed a simple UI that allows you to add attributes of these types with ease:

If you find any interesting uses for these new attributes, let me know. I'd love to hear about it. I'm going to look into building a UI that is more user friendly for creating compound attributes, a return to pyQT perhaps?

Featured Posts
Recent Posts
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page