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:
authorBastien Montagne <montagne29@wanadoo.fr>2016-11-19 00:36:52 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-11-19 00:44:05 +0300
commit884693b42ae1d630349727519f6868b94f448643 (patch)
tree55cc94248e4456a75fbab713683278dec15889c8 /source/blender/editors/space_node/space_node.c
parentb6c0edcb0932d7001968dccfa94fce4e71876b06 (diff)
Fix Node space ID remap callback not handling node trees.
Yep. Kinda ridiculous, but forgot to handle the very node trees data-blocks in that editor! Related (but not fixing) to T49991.
Diffstat (limited to 'source/blender/editors/space_node/space_node.c')
-rw-r--r--source/blender/editors/space_node/space_node.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 4ef703c8994..bbdf6feef01 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -855,6 +855,42 @@ static void node_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID
id_us_plus(new_id);
}
}
+ else if (GS(old_id->name) == ID_NT) {
+ bNodeTreePath *path, *path_next;
+
+ for (path = snode->treepath.first; path; path = path->next) {
+ if ((ID *)path->nodetree == old_id) {
+ path->nodetree = (bNodeTree *)new_id;
+ id_us_min(old_id);
+ id_us_plus(new_id);
+ }
+ if (path == snode->treepath.first) {
+ /* first nodetree in path is same as snode->nodetree */
+ snode->nodetree = path->nodetree;
+ }
+ if (path->nodetree == NULL) {
+ break;
+ }
+ }
+
+ /* remaining path entries are invalid, remove */
+ for (; path; path = path_next) {
+ path_next = path->next;
+
+ BLI_remlink(&snode->treepath, path);
+ MEM_freeN(path);
+ }
+
+ /* edittree is just the last in the path,
+ * set this directly since the path may have been shortened above */
+ if (snode->treepath.last) {
+ path = snode->treepath.last;
+ snode->edittree = path->nodetree;
+ }
+ else {
+ snode->edittree = NULL;
+ }
+ }
}
/* only called once, from space/spacetypes.c */