diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-09-23 02:40:19 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-09-23 02:40:19 +0300 |
commit | 1dfb89d229304c302b8849756aa0ddd7e8d96488 (patch) | |
tree | db7a2ed403101788b2cb308538d73a99c95621d6 /source/blender/blenkernel/intern/library_remap.c | |
parent | 4a1feaa5558ed60388fd3be41db74fbc54f2ab08 (diff) | |
parent | 1b2b7cfa2007172e07d78324bb941d0160b59c42 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/ghost/intern/GHOST_ContextCGL.mm
intern/ghost/intern/GHOST_WindowCocoa.mm
source/blender/makesrna/intern/rna_main.c
Diffstat (limited to 'source/blender/blenkernel/intern/library_remap.c')
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index bdfe951a501..69b52c92c3f 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -132,6 +132,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. */ @@ -211,7 +212,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); @@ -385,15 +386,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; @@ -403,6 +404,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; @@ -610,7 +612,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? |