mottosso / cmdx

Fast and persistent subset of maya.cmds
https://mottosso.com/cmdx
BSD 2-Clause "Simplified" License
193 stars 36 forks source link

Fix Node.isA bug when checking multiple types #63

Closed monkeez closed 3 years ago

monkeez commented 3 years ago

Because Maya is a big dumb dumb and errors out if you dare compare an MTypeId with anything other than another MTypeId:

node = cmdx.createNode("transform")
node.isA((cmdx.tTransform, cmdx.tMesh))
# Error: MTypeId expected
# Traceback (most recent call last):
#   File "<maya console>", line 2, in <module>
#   File "C:\Users\mitch\code\cmdx\cmdx.py", line 844, in isA
#     return self._fn.typeName in type or self._fn.typeId in type
# TypeError: MTypeId expected # 

Let me know if there;s a better way to solve this!

mottosso commented 3 years ago

Nice catch @monkeez!

monkeez commented 3 years ago

Ah recursion, I always forget to use it because it confused me when first learning Python.

mottosso commented 3 years ago

It's rarely useful.. but sometimes it is!