[Bf-blender-cvs] [79c345a] master: Fix T40033: Jumping between versions can lead to loss of node storage data.

Lukas Tönne noreply at git.blender.org
Wed May 7 11:53:27 CEST 2014


Commit: 79c345acc21b2b82dfdfe6cf4c8606a07c90e434
Author: Lukas Tönne
Date:   Wed May 7 11:42:38 2014 +0200
https://developer.blender.org/rB79c345acc21b2b82dfdfe6cf4c8606a07c90e434

Fix T40033: Jumping between versions can lead to loss of node storage
data.

Saving a file with a new blender node that uses bNode->storage data and
then loading that in an older version will make the node undefined, but
still retain the original type identifier (in case it is defined later).

If the file is then saved over and loaded again in the newer version,
where the node type is defined, it won't have a valid storage struct.
To handle such cases gracefully, check if storage data is expected but
doesn't exist when initializing node types. User then at least get a
chance of fixing the problem manually.

Suggested fix by @brecht.

===================================================================

M	source/blender/blenkernel/intern/node.c

===================================================================

diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 38dd36b..3e64868 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -172,6 +172,12 @@ static void ntree_set_typeinfo(bNodeTree *ntree, bNodeTreeType *typeinfo)
 
 static void node_set_typeinfo(const struct bContext *C, bNodeTree *ntree, bNode *node, bNodeType *typeinfo)
 {
+	/* for nodes saved in older versions storage can get lost, make undefined then */
+	if (node->flag & NODE_INIT) {
+		if (typeinfo->storagename[0] && !node->storage)
+			typeinfo = NULL;
+	}
+	
 	if (typeinfo) {
 		node->typeinfo = typeinfo;




More information about the Bf-blender-cvs mailing list