attributes based on prefix

35 views
Skip to first unread message

Kenneth Polonski

unread,
Aug 8, 2014, 5:32:54 PM8/8/14
to python_in...@googlegroups.com
So I'm currently trying to find a nice fast way to export some user added attributes and values to a json file, based on their prefix of 'mtoa_' or 'mol_' in the attribute name. I actually have all this working just fine, but it takes quite some time to complete. The reason is that I'm currently iterating through all the shape nodes of a scene (2500+ shapes) and then for each node iterating through the attributes to see if the name contains the prefix. There must be a better way. It would be super cool if the pm.PyNode().hasAttr() method supported wildcards, which does not seem to be the case.

Does anyone have any suggestions for a better way to go about this?

Thanks!

-Kenny

Justin Israel

unread,
Aug 9, 2014, 5:19:55 AM8/9/14
to python_in...@googlegroups.com

Have you tried this approach through the Maya API to see if you get any better performance?

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c841473a-fdf1-4232-83eb-aabc45224b06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kenneth Polonski

unread,
Aug 11, 2014, 10:33:09 AM8/11/14
to python_in...@googlegroups.com
Have you tried this approach through the Maya API to see if you get any better performance? 

I have not but this seems like an excellent idea since I've never had to use the maya API before. Good learning opportunity! Thanks Justin

Marcus Ottosson

unread,
Aug 11, 2014, 10:36:27 AM8/11/14
to python_in...@googlegroups.com
Were you originally using PyMEL for this? Have a go with maya.cmds too, it's probably much faster when iterating through nodes and attributes.


On 11 August 2014 16:33, Kenneth Polonski <kpol...@gmail.com> wrote:
Have you tried this approach through the Maya API to see if you get any better performance? 

I have not but this seems like an excellent idea since I've never had to use the maya API before. Good learning opportunity! Thanks Justin

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Kenneth Polonski

unread,
Aug 11, 2014, 2:53:20 PM8/11/14
to python_in...@googlegroups.com
Yeah I was using pymel. Thanks for the suggestion! I'll give it a whirl with maya.cmds


On Monday, August 11, 2014 10:36:27 AM UTC-4, Marcus Ottosson wrote:
Were you originally using PyMEL for this? Have a go with maya.cmds too, it's probably much faster when iterating through nodes and attributes.
On 11 August 2014 16:33, Kenneth Polonski <kpol...@gmail.com> wrote:
Have you tried this approach through the Maya API to see if you get any better performance? 

I have not but this seems like an excellent idea since I've never had to use the maya API before. Good learning opportunity! Thanks Justin

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.



--
Marcus Ottosson
konstr...@gmail.com

Reply all
Reply to author
Forward
0 new messages