[Bf-committers] Simplifying node tree do_versions

Ton Roosendaal ton at blender.org
Fri Feb 8 10:57:13 CET 2013


The macro is useful, I agree with that.

What we should keep in mind is that we should not abuse do-versions so much. It's currently being flooded with node patches, and in my perception most of these just aren't needed.

Design of .blend data can be done in a careful way, keeping for/backwards compatibility work, and just code functionality updates to be handled where this is being used.

The example I mailed yesterday (missing node->storage for translate node) is a good case, it's not depending on any versioning, it's just about upgrading the spec to always have such a struct. You can do that in direct-link, or better: in the code accessing the data.

My only objection is not the macro in itself, but by making it even easier to add version hacks. I would rather see this used with an absolute mininum.

So: before adding a versioning patch: consult at least some others to check if it's really needed, and if you can avoid it by smarter design.


Ton Roosendaal  Blender Foundation   ton at blender.org    www.blender.org
Blender Institute   Entrepotdok 57A  1018AD Amsterdam   The Netherlands

On 8 Feb, 2013, at 10:38, Lukas Tönne wrote:

> 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
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers

More information about the Bf-committers mailing list