[Bf-blender-cvs] [ab09a80] master: Fix T49425: Freestyle in viewport keeps updating over and over.

Bastien Montagne noreply at git.blender.org
Thu Sep 22 14:59:37 CEST 2016


Commit: ab09a80d33ece770f0b722e8f4c329f558cc9896
Author: Bastien Montagne
Date:   Thu Sep 22 14:57:16 2016 +0200
Branches: master
https://developer.blender.org/rBab09a80d33ece770f0b722e8f4c329f558cc9896

Fix T49425: Freestyle in viewport keeps updating over and over.

Regression caused by rBb27ba26, we would always tag datablocks to update in G.main,
ignoring given bmain, now always use this one instead.

To be backported to 2.78.

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

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 442c407..f456364 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -133,6 +133,7 @@ void BKE_library_callback_remap_editor_id_reference_set(BKE_library_remap_editor
 }
 
 typedef struct IDRemap {
+	Main *bmain;  /* Only used to trigger depsgraph updates in the right bmain. */
 	ID *old_id;
 	ID *new_id;
 	ID *id;  /* The ID in which we are replacing old_id by new_id usages. */
@@ -212,7 +213,7 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
 		else {
 			if (!is_never_null) {
 				*id_p = new_id;
-				DAG_id_tag_update(id_self, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+				DAG_id_tag_update_ex(id_remap_data->bmain, id_self, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
 			}
 			if (cb_flag & IDWALK_USER) {
 				id_us_min(old_id);
@@ -386,15 +387,15 @@ static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), O
  * - \a id is non-NULL:
  *   + If \a old_id is NULL, \a new_id must also be NULL, and all ID pointers from \a id are cleared (i.e. \a id
  *     does not references any other datablock anymore).
- *   + If \a old_id is non-NULL, behavior is as with a NULL \a id, but only for given \a id.
+ *   + If \a old_id is non-NULL, behavior is as with a NULL \a id, but only within given \a id.
  *
- * \param bmain: the Main data storage to operate on (can be NULL if \a id is non-NULL).
- * \param id: the datablock to operate on (can be NULL if \a bmain is non-NULL).
+ * \param bmain: the Main data storage to operate on (must never be NULL).
+ * \param id: the datablock to operate on (can be NULL, in which case we operate over all IDs from given bmain).
  * \param old_id: the datablock to dereference (may be NULL if \a id is non-NULL).
  * \param new_id: the new datablock to replace \a old_id references with (may be NULL).
  * \param r_id_remap_data: if non-NULL, the IDRemap struct to use (uselful to retrieve info about remapping process).
  */
-static void libblock_remap_data(
+ATTR_NONNULL(1) static void libblock_remap_data(
         Main *bmain, ID *id, ID *old_id, ID *new_id, const short remap_flags, IDRemap *r_id_remap_data)
 {
 	IDRemap id_remap_data;
@@ -404,6 +405,7 @@ static void libblock_remap_data(
 	if (r_id_remap_data == NULL) {
 		r_id_remap_data = &id_remap_data;
 	}
+	r_id_remap_data->bmain = bmain;
 	r_id_remap_data->old_id = old_id;
 	r_id_remap_data->new_id = new_id;
 	r_id_remap_data->id = NULL;
@@ -611,7 +613,7 @@ void BKE_libblock_relink_ex(
 		BLI_assert(new_id == NULL);
 	}
 
-	libblock_remap_data(NULL, id, old_id, new_id, remap_flags, NULL);
+	libblock_remap_data(bmain, id, old_id, new_id, remap_flags, NULL);
 
 	/* Some after-process updates.
 	 * This is a bit ugly, but cannot see a way to avoid it. Maybe we should do a per-ID callback for this instead?




More information about the Bf-blender-cvs mailing list