diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-18 21:17:44 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-18 21:20:55 +0300 |
commit | 9fb59244466aa07c9addaf17bdb65192682bde87 (patch) | |
tree | 607d48fd8fe5beaebf28d529a0d15cb49af6091b /source/blender | |
parent | 176bbe346673edfac3e0aaeeba6ccfa40cd4f377 (diff) |
Fix a very nasty and sneaky bug in lib remap / static override code.
Not sure why remap call for static override reference ID pointer was put
there, probably a mistake during some merge back in the days...
But this ended up with self_id of libquery data struct still being set
to previous ID pointer, which could randomly generate crap like falsly
reporting indirect data and such, leading to lost reference datablock at
writefile time...
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/library_query.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 37b5b62b06e..f23d8720a65 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -352,10 +352,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call #define CALLBACK_INVOKE(check_id_super, cb_flag) \ FOREACH_CALLBACK_INVOKE(&data, check_id_super, cb_flag) - if (id->override_static != NULL) { - CALLBACK_INVOKE_ID(id->override_static->reference, IDWALK_CB_USER | IDWALK_CB_STATIC_OVERRIDE_REFERENCE); - } - for (; id != NULL; id = (flag & IDWALK_RECURSE) ? BLI_LINKSTACK_POP(data.ids_todo) : NULL) { data.self_id = id; data.cb_flag = ID_IS_LINKED(id) ? IDWALK_CB_INDIRECT_USAGE : 0; @@ -372,6 +368,11 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call continue; } + if (id->override_static != NULL) { + CALLBACK_INVOKE_ID(id->override_static->reference, IDWALK_CB_USER | IDWALK_CB_STATIC_OVERRIDE_REFERENCE); + CALLBACK_INVOKE_ID(id->override_static->storage, IDWALK_CB_USER | IDWALK_CB_STATIC_OVERRIDE_REFERENCE); + } + library_foreach_idproperty_ID_link(&data, id->properties, IDWALK_CB_USER); AnimData *adt = BKE_animdata_from_id(id); diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 7b9d9136629..f34a2ff7f84 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -195,8 +195,10 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id const bool skip_never_null = (id_remap_data->flag & ID_REMAP_SKIP_NEVER_NULL_USAGE) != 0; #ifdef DEBUG_PRINT - printf("In %s: Remapping %s (%p) to %s (%p) (is_indirect: %d, skip_indirect: %d)\n", - id->name, old_id->name, old_id, new_id ? new_id->name : "<NONE>", new_id, is_indirect, skip_indirect); + printf("In %s (lib %p): Remapping %s (%p) to %s (%p) " + "(is_indirect: %d, skip_indirect: %d, is_reference: %d, skip_reference: %d)\n", + id->name, id->lib, old_id->name, old_id, new_id ? new_id->name : "<NONE>", new_id, + is_indirect, skip_indirect, is_reference, skip_reference); #endif if ((id_remap_data->flag & ID_REMAP_FLAG_NEVER_NULL_USAGE) && (cb_flag & IDWALK_CB_NEVER_NULL)) { |