convert a string back to a pymel class

16 views
Skip to first unread message

Totally Zen

unread,
Jul 16, 2021, 7:40:44 PMJul 16
to Python Programming for Autodesk Maya
I've
animal_RIG_A001_v001:body_Fur01Shape
Which is of type : <class 'pymel.core.nodetypes.PgYetiMaya'>
I converted it to a string and it looked like this:
'animal_RIG_A001_v001:body_Fur01Shape' type 'str'

Now I need to get this string and go back to the type:
<class 'pymel.core.nodetypes.PgYetiMaya'>


How do I make it come back after I made it to a string?

Neil Roche

unread,
Sep 17, 2021, 5:07:39 AM (10 days ago) Sep 17
to Python Programming for Autodesk Maya
You should just pass it back into a PyNode which should instance it back to a class.

import pymel.core as pm

my_class_node = pm.PyNode('animal_RIG_A001_v001:body_Fur01Shape')
Reply all
Reply to author
Forward
0 new messages