pymel virtual classes

42 views
Skip to first unread message

Luke Harris

unread,
Jul 7, 2017, 10:00:59 AM7/7/17
to Python Programming for Autodesk Maya
I'm trying to use pymel's virtualClasses to make my own Transform node (basically just some extra attrs and functionality, formatted in a nice way in AE template). I'm hitting a few snags but I'm not sure if that is just how they are expected to work.

Cannot createNode of given type
pm.createNode(MyTransform)
# Result: nt.Transform(u'transform1') # <- wrong type, I want a MyTransform


ls -type / exactType also returns nodes the 'inherited' type
pm.ls(type=MyTransform)
# Result: [nt.Transform(u'front'), # <- dont want these
 nt
.Transform(u'persp'),           # <- dont want these
 nt
.Transform(u'side'),            # <- dont want these
 nt
.Transform(u'top'),             # <- dont want these
 nt
.MyTransform(u'transform1')]    # <- Only want this :)


nodeType doesn't returns original type
my_node.nodeType()
# Result: u'transform'             # <- want MyTransform


I also wanted to customize the AE for my virtual type. But AETemplateCustomContent callback doesn't respect the difference between the virtual type and inherited type. Rather the AE modifications are added to both MyTransform and Transform nodes.

I'm guessing all these points are related, and I'm just over expecting what virtual classes can do. I wanted to use them rather than define my own custom node plugin because:
  1. A custom node doesn't survive the round trip from alembic
  2. Python api 2.0 doesn't seem to support subclassing MPxTransform
Reply all
Reply to author
Forward
0 new messages