Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/lib_override.cc')
-rw-r--r--source/blender/blenkernel/intern/lib_override.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc
index 758a317e415..05a00fb54fd 100644
--- a/source/blender/blenkernel/intern/lib_override.cc
+++ b/source/blender/blenkernel/intern/lib_override.cc
@@ -94,6 +94,7 @@ BLI_INLINE void lib_override_object_posemode_transfer(ID *id_dst, ID *id_src)
/** Get override data for a given ID. Needed because of our beloved shape keys snowflake. */
BLI_INLINE const IDOverrideLibrary *BKE_lib_override_library_get(const Main *bmain,
const ID *id,
+ const ID *owner_id_hint,
const ID **r_owner_id)
{
if (r_owner_id != nullptr) {
@@ -104,7 +105,8 @@ BLI_INLINE const IDOverrideLibrary *BKE_lib_override_library_get(const Main *bma
if (id_type->owner_get != nullptr) {
/* The #IDTypeInfo::owner_get callback should not modify the arguments, so casting away const
* is okay. */
- const ID *owner_id = id_type->owner_get(const_cast<Main *>(bmain), const_cast<ID *>(id));
+ const ID *owner_id = id_type->owner_get(
+ const_cast<Main *>(bmain), const_cast<ID *>(id), const_cast<ID *>(owner_id_hint));
if (r_owner_id != nullptr) {
*r_owner_id = owner_id;
}
@@ -115,13 +117,17 @@ BLI_INLINE const IDOverrideLibrary *BKE_lib_override_library_get(const Main *bma
return id->override_library;
}
-IDOverrideLibrary *BKE_lib_override_library_get(Main *bmain, ID *id, ID **r_owner_id)
+IDOverrideLibrary *BKE_lib_override_library_get(Main *bmain,
+ ID *id,
+ ID *owner_id_hint,
+ ID **r_owner_id)
{
/* Reuse the implementation of the const access function, which does not change the arguments.
* Add const explicitly to make it clear to the compiler to avoid just calling this function. */
return const_cast<IDOverrideLibrary *>(
BKE_lib_override_library_get(const_cast<const Main *>(bmain),
const_cast<const ID *>(id),
+ const_cast<const ID *>(owner_id_hint),
const_cast<const ID **>(r_owner_id)));
}
@@ -319,7 +325,7 @@ bool BKE_lib_override_library_is_system_defined(const Main *bmain, const ID *id)
{
if (ID_IS_OVERRIDE_LIBRARY(id)) {
const ID *override_owner_id;
- BKE_lib_override_library_get(bmain, id, &override_owner_id);
+ BKE_lib_override_library_get(bmain, id, nullptr, &override_owner_id);
return (override_owner_id->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED) !=
0;
}
@@ -1087,8 +1093,9 @@ static void lib_override_overrides_group_tag_recursive(LibOverrideGroupTagData *
}
const Library *reference_lib =
- BKE_lib_override_library_get(bmain, id_owner, nullptr)->reference->lib;
- const ID *to_id_reference = BKE_lib_override_library_get(bmain, to_id, nullptr)->reference;
+ BKE_lib_override_library_get(bmain, id_owner, nullptr, nullptr)->reference->lib;
+ const ID *to_id_reference =
+ BKE_lib_override_library_get(bmain, to_id, nullptr, nullptr)->reference;
if (to_id_reference->lib != reference_lib) {
/* We do not override data-blocks from other libraries, nor do we process them. */
continue;
@@ -1439,7 +1446,7 @@ static ID *lib_override_root_find(Main *bmain, ID *id, const int curr_level, int
BLI_assert(id->flag & LIB_EMBEDDED_DATA_LIB_OVERRIDE);
ID *id_owner;
int best_level_placeholder = 0;
- BKE_lib_override_library_get(bmain, id, &id_owner);
+ BKE_lib_override_library_get(bmain, id, nullptr, &id_owner);
return lib_override_root_find(bmain, id_owner, curr_level + 1, &best_level_placeholder);
}
/* This way we won't process again that ID, should we encounter it again through another
@@ -1478,7 +1485,7 @@ static ID *lib_override_root_find(Main *bmain, ID *id, const int curr_level, int
BLI_assert(id->flag & LIB_EMBEDDED_DATA_LIB_OVERRIDE);
ID *id_owner;
int best_level_placeholder = 0;
- BKE_lib_override_library_get(bmain, best_root_id_candidate, &id_owner);
+ BKE_lib_override_library_get(bmain, best_root_id_candidate, nullptr, &id_owner);
best_root_id_candidate = lib_override_root_find(
bmain, id_owner, curr_level + 1, &best_level_placeholder);
}
@@ -1795,7 +1802,8 @@ static bool lib_override_library_resync(Main *bmain,
/* While this should not happen in typical cases (and won't be properly supported here),
* user is free to do all kind of very bad things, including having different local
* overrides of a same linked ID in a same hierarchy. */
- IDOverrideLibrary *id_override_library = BKE_lib_override_library_get(bmain, id, nullptr);
+ IDOverrideLibrary *id_override_library = BKE_lib_override_library_get(
+ bmain, id, nullptr, nullptr);
if (id_override_library->hierarchy_root != id_root->override_library->hierarchy_root) {
continue;
@@ -2177,7 +2185,7 @@ static ID *lib_override_library_main_resync_root_get(Main *bmain, ID *id)
if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
if (id_type->owner_get != nullptr) {
- id = id_type->owner_get(bmain, id);
+ id = id_type->owner_get(bmain, id, nullptr);
}
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id));
}