[Bf-blender-cvs] [369872a] master: Fix T49991: reloading librairies doesn't update node groups.

Bastien Montagne noreply at git.blender.org
Sat Nov 19 14:58:08 CET 2016


Commit: 369872a2c50e95eee822512018cc282ef5fcfdd1
Author: Bastien Montagne
Date:   Sat Nov 19 12:20:29 2016 +0100
Branches: master
https://developer.blender.org/rB369872a2c50e95eee822512018cc282ef5fcfdd1

Fix T49991: reloading librairies doesn't update node groups.

We need to check node tree links are still valid, after we remapped
some NodeGroup.

Note: In fact, we have to run that for *all* ID types, since nodes may
use any kind of data-block (in theory)... :/

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

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

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

diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 4044103..62f5983 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -378,6 +378,18 @@ static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), O
 	}
 }
 
+static void libblock_remap_data_postprocess_nodetree_update(Main *bmain, ID *new_id)
+{
+	/* Verify all nodetree user nodes. */
+	ntreeVerifyNodes(bmain, new_id);
+
+	/* Update node trees as necessary. */
+	FOREACH_NODETREE(bmain, ntree, id) {
+		/* make an update call for the tree */
+		ntreeUpdateTree(bmain, ntree);
+	} FOREACH_NODETREE_END
+}
+
 /**
  * Execute the 'data' part of the remapping (that is, all ID pointers from other ID datablocks).
  *
@@ -551,6 +563,8 @@ void BKE_libblock_remap_locked(
 		default:
 			break;
 	}
+	/* Node trees may virtually use any kind of data-block... */
+	libblock_remap_data_postprocess_nodetree_update(bmain, new_id);
 
 	/* Full rebuild of DAG! */
 	DAG_relations_tag_update(bmain);




More information about the Bf-blender-cvs mailing list