Message 1 of 3
How to improve the performance when I set attribute for a huge amount of nodes?

Not applicable
07-19-2018
07:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have the following function which comsumes a huge mount of time in my plugin:
def setAttr(node_list, visibility): for node in node_list: cmds.setAttr('%s.visibility'%node, visibility)
And I'm wondering how to improve the performance of this function.
I know that python and C++ have many ways to create multi-threads, and C++ code can also resort to OpenMP. But I'm not sure whether these methods are avaiable to Maya. I mean, I'm not sure whether Maya allows these methods to evaluate (e.g. set attribute or get attribute) parallelly.
Could anyone give me any suggetion? Both Python solution and C++ solution are OK, and Python solution is preferred.
Cheers
Yao