Fix (unreported) remapping code wrongly skipping UI data when it should not.
Issue was that, when UI-related code _is_ requested in foreach_id processing, `ID_SCR` screen ID type can actually use any kind of ID (through e.g. the Outliner space). So `BKE_library_id_can_use_filter_id` had to be updated with a new parameter (whether UI-related data should be taken into account or not).
This commit is contained in:
parent
ade83b21d1
commit
de21a0c901
|
@ -269,7 +269,7 @@ bool BKE_library_id_can_use_idtype(struct ID *id_owner, short id_type_used);
|
|||
/**
|
||||
* Given the id_owner return the type of id_types it can use as a filter_id.
|
||||
*/
|
||||
uint64_t BKE_library_id_can_use_filter_id(const struct ID *id_owner);
|
||||
uint64_t BKE_library_id_can_use_filter_id(const struct ID *id_owner, const bool include_ui);
|
||||
|
||||
/**
|
||||
* Check whether given ID is used locally (i.e. by another non-linked ID).
|
||||
|
|
|
@ -374,7 +374,7 @@ void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, const int cb_flag)
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t BKE_library_id_can_use_filter_id(const ID *id_owner)
|
||||
uint64_t BKE_library_id_can_use_filter_id(const ID *id_owner, const bool include_ui)
|
||||
{
|
||||
/* any type of ID can be used in custom props. */
|
||||
if (id_owner->properties) {
|
||||
|
@ -387,6 +387,11 @@ uint64_t BKE_library_id_can_use_filter_id(const ID *id_owner)
|
|||
return FILTER_ID_ALL;
|
||||
}
|
||||
|
||||
/* Screen UI IDs can also link to virtually any ID (through e.g. the Outliner). */
|
||||
if (include_ui && id_type_owner == ID_SCR) {
|
||||
return FILTER_ID_ALL;
|
||||
}
|
||||
|
||||
/* Casting to non const.
|
||||
* TODO(jbakker): We should introduce a ntree_id_has_tree function as we are actually not
|
||||
* interested in the result. */
|
||||
|
@ -510,7 +515,7 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used)
|
|||
}
|
||||
|
||||
const uint64_t filter_id_type_used = BKE_idtype_idcode_to_idfilter(id_type_used);
|
||||
const uint64_t can_be_used = BKE_library_id_can_use_filter_id(id_owner);
|
||||
const uint64_t can_be_used = BKE_library_id_can_use_filter_id(id_owner, false);
|
||||
return (can_be_used & filter_id_type_used) != 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -482,13 +482,14 @@ static void libblock_remap_data(Main *bmain,
|
|||
const int remap_flags)
|
||||
{
|
||||
IDRemap id_remap_data = {0};
|
||||
const int foreach_id_flags =
|
||||
(((remap_flags & ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS) != 0 ?
|
||||
IDWALK_DO_INTERNAL_RUNTIME_POINTERS :
|
||||
IDWALK_NOP) |
|
||||
((remap_flags & ID_REMAP_FORCE_UI_POINTERS) != 0 ? IDWALK_INCLUDE_UI : IDWALK_NOP) |
|
||||
((remap_flags & ID_REMAP_NO_ORIG_POINTERS_ACCESS) != 0 ? IDWALK_NO_ORIG_POINTERS_ACCESS :
|
||||
IDWALK_NOP));
|
||||
const bool include_ui = (remap_flags & ID_REMAP_FORCE_UI_POINTERS) != 0;
|
||||
const int foreach_id_flags = (((remap_flags & ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS) != 0 ?
|
||||
IDWALK_DO_INTERNAL_RUNTIME_POINTERS :
|
||||
IDWALK_NOP) |
|
||||
(include_ui ? IDWALK_INCLUDE_UI : IDWALK_NOP) |
|
||||
((remap_flags & ID_REMAP_NO_ORIG_POINTERS_ACCESS) != 0 ?
|
||||
IDWALK_NO_ORIG_POINTERS_ACCESS :
|
||||
IDWALK_NOP));
|
||||
|
||||
id_remap_data.id_remapper = id_remapper;
|
||||
id_remap_data.type = remap_type;
|
||||
|
@ -514,7 +515,7 @@ static void libblock_remap_data(Main *bmain,
|
|||
ID *id_curr;
|
||||
|
||||
FOREACH_MAIN_ID_BEGIN (bmain, id_curr) {
|
||||
const uint64_t can_use_filter_id = BKE_library_id_can_use_filter_id(id_curr);
|
||||
const uint64_t can_use_filter_id = BKE_library_id_can_use_filter_id(id_curr, include_ui);
|
||||
const bool has_mapping = BKE_id_remapper_has_mapping_for(id_remapper, can_use_filter_id);
|
||||
|
||||
/* Continue when id_remapper doesn't have any mappings that can be used by id_curr. */
|
||||
|
|
Loading…
Reference in New Issue