top of page

Filtering Objects in Maya


Today I took my first pass at learning PyMel in Maya. I created a simple tool that takes in any objects that is selected and outputs their names and types. One of the things that gave me trouble was the getting the object's type. I was able to retrieve the name of my selection, but my object wasn't outputting a type, only the name of my object + "shape". I later found out that Maya will automatically create 3 nodes when a mesh object or nurbs curve is created: A Polycube node, a Mesh node, and a Transform node. Each node has its own properties and namespace. I didn't realize that my type function was pulling off just the mesh node's name. Maya's default setting automatically sets the mesh node to whatever the transforms node's name is + "shape." I thought I was pulling the object's type because "shape" was being outputted. After looking through Maya's nodes and figuring that out where I was getting "shape", I was able to figure out how to find the object's type and the rest was simple. All I had to do was iterate through my selection list using a foreach loop and print out each object type.


bottom of page