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:
authorBastien Montagne <bastien@blender.org>2022-08-02 16:03:11 +0300
committerBastien Montagne <bastien@blender.org>2022-08-02 16:07:33 +0300
commit2a7e83ce18e838e12526529130ad31dd1b50cbbd (patch)
tree84a2e45133b45f59b0a3c9e9d13b2c2250529036 /source/blender/blenkernel/intern/lib_override.cc
parent78ad9ebed3a55138c0a576c4200ab0fd6d8e3712 (diff)
LibOverride: Expose in public API the utils to get actual override data.
This is useful when input ID is a 'non-override' one (like embedded IDs or shapekeys), to get override data and 'owner' ID pointer.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_override.cc')
-rw-r--r--source/blender/blenkernel/intern/lib_override.cc28
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc
index 4ad8d26cd2a..febc91716dd 100644
--- a/source/blender/blenkernel/intern/lib_override.cc
+++ b/source/blender/blenkernel/intern/lib_override.cc
@@ -91,9 +91,9 @@ 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 *lib_override_get(const Main *bmain,
- const ID *id,
- const ID **r_owner_id)
+BLI_INLINE const IDOverrideLibrary *BKE_lib_override_library_get(const Main *bmain,
+ const ID *id,
+ const ID **r_owner_id)
{
if (r_owner_id != nullptr) {
*r_owner_id = id;
@@ -114,13 +114,14 @@ BLI_INLINE const IDOverrideLibrary *lib_override_get(const Main *bmain,
return id->override_library;
}
-BLI_INLINE IDOverrideLibrary *lib_override_get(Main *bmain, ID *id, ID **r_owner_id)
+IDOverrideLibrary *BKE_lib_override_library_get(Main *bmain, ID *id, 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 *>(lib_override_get(const_cast<const Main *>(bmain),
- const_cast<const ID *>(id),
- const_cast<const ID **>(r_owner_id)));
+ return const_cast<IDOverrideLibrary *>(
+ BKE_lib_override_library_get(const_cast<const Main *>(bmain),
+ const_cast<const ID *>(id),
+ const_cast<const ID **>(r_owner_id)));
}
IDOverrideLibrary *BKE_lib_override_library_init(ID *local_id, ID *reference_id)
@@ -317,7 +318,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;
- lib_override_get(bmain, id, &override_owner_id);
+ BKE_lib_override_library_get(bmain, id, &override_owner_id);
return (override_owner_id->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED) !=
0;
}
@@ -1084,8 +1085,9 @@ static void lib_override_overrides_group_tag_recursive(LibOverrideGroupTagData *
continue;
}
- const Library *reference_lib = lib_override_get(bmain, id_owner, nullptr)->reference->lib;
- const ID *to_id_reference = lib_override_get(bmain, to_id, nullptr)->reference;
+ 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;
if (to_id_reference->lib != reference_lib) {
/* We do not override data-blocks from other libraries, nor do we process them. */
continue;
@@ -1433,7 +1435,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;
- lib_override_get(bmain, id, &id_owner);
+ BKE_lib_override_library_get(bmain, id, &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
@@ -1472,7 +1474,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;
- lib_override_get(bmain, best_root_id_candidate, &id_owner);
+ BKE_lib_override_library_get(bmain, best_root_id_candidate, &id_owner);
best_root_id_candidate = lib_override_root_find(
bmain, id_owner, curr_level + 1, &best_level_placeholder);
}
@@ -1789,7 +1791,7 @@ 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 = lib_override_get(bmain, id, nullptr);
+ IDOverrideLibrary *id_override_library = BKE_lib_override_library_get(bmain, id, nullptr);
if (id_override_library->hierarchy_root != id_root->override_library->hierarchy_root) {
continue;