convert a string back to a pymel class

40 views
Skip to first unread message

Totally Zen

unread,
Jul 16, 2021, 7:40:44 PM7/16/21
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 AM9/17/21
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')

Marcelo Vieira

unread,
Sep 28, 2021, 3:52:46 PM9/28/21
to Python Programming for Autodesk Maya
Humm!!!!
I didn't mess with this code anymore, but I'll leave it down and thank you very much, Neil Roche! 
Reply all
Reply to author
Forward
0 new messages