I propose to introduce a C macro for use in readfile.c to clean up the frequent node tree do_versions mess. Currently whenever we need to iterate over all node trees in the library data we have to either make a number of repetitive bloated loops and/or use callbacks outside the actual do_versions function. Here's an example of one of my own fixes:
http://www.pasteall.org/39515/c As you can see the loops in do_versions and the actual fix in the callback are spaced far apart and to figure out what is going on you have to jump around in this monster file quite a lot. Furthermore since we have node trees in 6 different ID data blocks currently it requires looping over all these blocks to iterate all potential node trees. This macro would help make the code localized to just a few lines like most of the other do_versions code and keep things much more readable: http://www.pasteall.org/39514/c The macro automatically loops over all existing node trees with a single inner code block, so you don't have to repeat the same code over and over. If necessary it can be filtered easily by checking the node tree type. A minor overhead for looping over unused node trees would be added, but that should be nowhere near significant. Using it for the example above boils it down to: http://www.pasteall.org/39516/c _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
