Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-10-17 14:49:42 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-10-17 14:49:42 +0400
commit45dc9794c1d223b70cdc585f6b31e8f9505d4d3b (patch)
tree7a19f0a81cd289e811a62a7ee4c8edb63f890132
parent7061fa7cf1f1aa3f15ce2784c2ec39d561205dad (diff)
Fix #32856, Crash in compositor due to deprecated node socket flag in old files.
Bit flag 5 has apparently been used for another purpose in old versions, then deprecated and was actually removed from DNA (this should never be done), then later it got reused for SOCK_DYNAMIC. Now a one-time check to clean up these flags is done in do_versions.
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenloader/intern/readfile.c37
2 files changed, 38 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 95d41a86239..cf67899dfb0 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 264
-#define BLENDER_SUBVERSION 3
+#define BLENDER_SUBVERSION 4
/* 262 was the last editmesh release but its has compatibility code for bmesh data,
* so set the minversion to 2.61 */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 35b6b400559..3d7c9c21eca 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7058,6 +7058,21 @@ static void do_version_ntree_tex_coord_from_dupli_264(void *UNUSED(data), ID *UN
node->flag |= NODE_OPTIONS;
}
+static void do_version_node_cleanup_dynamic_sockets_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+{
+ bNode *node;
+ bNodeSocket *sock;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (!ELEM(node->type, NODE_GROUP, CMP_NODE_IMAGE)) {
+ for (sock = node->inputs.first; sock; sock = sock->next)
+ sock->flag &= ~SOCK_DYNAMIC;
+ for (sock = node->outputs.first; sock; sock = sock->next)
+ sock->flag &= ~SOCK_DYNAMIC;
+ }
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -8110,6 +8125,28 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 4)) {
+ /* Fix for old node flags: Apparently the SOCK_DYNAMIC flag has been in use for other
+ * purposes before and then removed and later reused for SOCK_DYNAMIC. This socket should
+ * only be used by certain node types which don't use template lists, cleaning this up here.
+ */
+ bNodeTreeType *ntreetype;
+ bNodeTree *ntree;
+
+ ntreetype = ntreeGetType(NTREE_COMPOSIT);
+ if (ntreetype && ntreetype->foreach_nodetree)
+ ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+ ntreetype = ntreeGetType(NTREE_SHADER);
+ if (ntreetype && ntreetype->foreach_nodetree)
+ ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+ ntreetype = ntreeGetType(NTREE_TEXTURE);
+ if (ntreetype && ntreetype->foreach_nodetree)
+ ntreetype->foreach_nodetree(main, NULL, do_version_node_cleanup_dynamic_sockets_264);
+
+ for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+ do_version_node_cleanup_dynamic_sockets_264(NULL, NULL, ntree);
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */