From 79c345acc21b2b82dfdfe6cf4c8606a07c90e434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Wed, 7 May 2014 11:42:38 +0200 Subject: [PATCH] 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. --- source/blender/blenkernel/intern/node.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 38dd36b9e6a..3e64868e447 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;