[MAYA-PYTHON] Define a custom object type

maya
python

#1

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

Example.
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.
Thanks


#2

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


#3

I did it in that way, thank you!