diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-05-07 13:42:38 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-05-07 13:46:30 +0400 |
commit | 79c345acc21b2b82dfdfe6cf4c8606a07c90e434 (patch) | |
tree | e9b8455aa34913a9cb0093020ba9d318aa46e4ac /source | |
parent | a8dddca0fe33e37c4af95e7944f66535d183aedf (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |