[MAYA-PYTHON] Define a custom object type



Hi, do you know if there’s a way to create custom object types without using API?

I have a class Gear which creates a polyCylinder as the base mesh.
Later, I have another window which let me edit a selected object in a scene changing it’s construction history, but I have to assert that it has been created from my class.
cmds.nodeType returns type of the shape which in this case would be polyCylinder, so I’d not be able to check any bound with my class, can I inherit polyCylinder to create a polyGear i.e and check his type through cmds.nodeType?

Is there a way to do that?

p.s. I thought about adding a customAttribute boolean to check if that’s an object created from my class, but it’s not so elegant I think.


Without jumping into API land, your best bet is to just tag the node with a custom attribute during creation.


I did it in that way, thank you!