Page MenuHome

Add batch update to nodetree_link_api
AbandonedPublic

Authored by Ray Molenkamp (LazyDodo) on May 27 2017, 10:18 PM.

Details

Summary

I'm having some severe performance issues with adding a large amount of links to a cycles node-graph. (seems to get exponentially worse) to the point where creating large graph from a script locks up blender for minutes (for some of my larger graphs 20+ minutes even) on end.

This patch adds 2 calls to the nodetree_link_api to begin and end a batch update.

when in batch update mode ntreeUpdateTree is prevented from firing on every single update to the list.

once you end your batch ntreeUpdateTree is called once and order is restored.

Bringing the total creation time of my graph down from 20+ minutes to mere seconds.

Diff Detail

Event Timeline

Sergey Sharybin (sergey) requested changes to this revision.May 27 2017, 10:36 PM

Don't think this is the way to go. This is a more general problem in Blender (as in, exists for lots of various operations) and if any of API is needed to solve such problems those must be more generic and non-conflicting.

Also, here i'm not even sure any explicit batch-update-thingies are needed. This is more about moving node tree validation/update to dependency graph. That way any updates will tag node tree for update, and actual update will happen later on (just similar to object updates). This isn't too hard for the new dependency graph, but quite non-doable for the old one. So might want to implement this in 2.8 branch.

This revision now requires changes to proceed.May 27 2017, 10:36 PM

While it solved my problem, i agree a generic solution beats a quick hack.