Posts

Showing posts from September 17, 2016

PyMel: Creating and Accessing the Notes Attribute in an Object

Today I find myself wondering how I can access the 'notes' section of a Maya object using script. I searched the internet and found out that to access the notes in an object are stored in an attribute called 'notes'. No surprises. What surprised me, was when I went through the attributes of a newly created Maya object, I could not find that attribute! So I do the following experiment. Consider myObject which is a newly created object in the scene (an empty group). from pymel.core import * myObject = group(empty=True) At this point, it does not contain the attribute 'notes'. The following list comprehension looks through each of myObject's attributes, and only includes attributes with 'notes' in its name  in the resulting list : [x for x in myObject.listAttr() if 'notes' in x.lower()] This returned an empty list. It means that the attribute does not exist. # Result: [] # However, if I enter something into t