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-05-20 12:59:39 +0300
committerBastien Montagne <bastien@blender.org>2022-05-20 13:02:52 +0300
commita89f829f12f56214b0e463b33f24edf27228db1f (patch)
treeeb313c93201a48d7b25dd842a3bec12d9f1a5783 /source/blender/blenkernel
parent019681b9841d7e34bac56211d645cf0497f8e9cf (diff)
LibOverride: Add option to Hierarchy Creation to get all data user-editable by default.
Avoids having to manually enable data-blocks for user-edition when you do not care about what should be edited by whom. Similar to default behavior before introduction of system overrides (aka non-user-editable overrides).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_lib_override.h10
-rw-r--r--source/blender/blenkernel/intern/lib_override.c46
-rw-r--r--source/blender/blenkernel/intern/lib_override_proxy_conversion.c2
3 files changed, 45 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h
index dfb2b900b10..38de4bebdbd 100644
--- a/source/blender/blenkernel/BKE_lib_override.h
+++ b/source/blender/blenkernel/BKE_lib_override.h
@@ -116,6 +116,8 @@ struct ID *BKE_lib_override_library_create_from_id(struct Main *bmain,
* \param do_no_main: Create the new override data outside of Main database.
* Used for resyncing of linked overrides.
*
+ * \param do_fully_editable: if true, tag all created overrides as user-editable by default.
+ *
* \return \a true on success, \a false otherwise.
*/
bool BKE_lib_override_library_create_from_tag(struct Main *bmain,
@@ -123,7 +125,8 @@ bool BKE_lib_override_library_create_from_tag(struct Main *bmain,
const struct ID *id_root_reference,
struct ID *id_hierarchy_root,
const struct ID *id_hierarchy_root_reference,
- bool do_no_main);
+ bool do_no_main,
+ const bool do_fully_editable);
/**
* Advanced 'smart' function to create fully functional overrides.
*
@@ -154,6 +157,8 @@ bool BKE_lib_override_library_create_from_tag(struct Main *bmain,
*
* \param r_id_root_override: if not NULL, the override generated for the given \a id_root.
*
+ * \param do_fully_editable: if true, tag all created overrides as user-editable by default.
+ *
* \return true if override was successfully created.
*/
bool BKE_lib_override_library_create(struct Main *bmain,
@@ -163,7 +168,8 @@ bool BKE_lib_override_library_create(struct Main *bmain,
struct ID *id_root_reference,
struct ID *id_hierarchy_root_reference,
struct ID *id_instance_hint,
- struct ID **r_id_root_override);
+ struct ID **r_id_root_override,
+ const bool do_fully_editable);
/**
* Create a library override template.
*/
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 6dd13952413..50c9514e810 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -398,7 +398,8 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain,
const ID *id_root_reference,
ID *id_hierarchy_root,
const ID *id_hierarchy_root_reference,
- const bool do_no_main)
+ const bool do_no_main,
+ const bool do_fully_editable)
{
BLI_assert(id_root_reference != NULL && ID_IS_LINKED(id_root_reference));
/* If we do not have any hierarchy root given, then the root reference must be tagged for
@@ -464,6 +465,9 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain,
success = false;
break;
}
+ if (do_fully_editable) {
+ reference_id->newid->override_library->flag &= ~IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED;
+ }
}
/* We also tag the new IDs so that in next step we can remap their pointers too. */
reference_id->newid->tag |= LIB_TAG_DOIT;
@@ -993,7 +997,8 @@ static bool lib_override_library_create_do(Main *bmain,
Scene *scene,
Library *owner_library,
ID *id_root_reference,
- ID *id_hierarchy_root_reference)
+ ID *id_hierarchy_root_reference,
+ const bool do_fully_editable)
{
BKE_main_relations_create(bmain, 0);
LibOverrideGroupTagData data = {.bmain = bmain,
@@ -1017,12 +1022,22 @@ static bool lib_override_library_create_do(Main *bmain,
BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_hierarchy_root_reference));
BLI_assert(id_hierarchy_root_reference->override_library->reference->lib ==
id_root_reference->lib);
- success = BKE_lib_override_library_create_from_tag(
- bmain, owner_library, id_root_reference, id_hierarchy_root_reference, NULL, false);
+ success = BKE_lib_override_library_create_from_tag(bmain,
+ owner_library,
+ id_root_reference,
+ id_hierarchy_root_reference,
+ NULL,
+ false,
+ do_fully_editable);
}
else {
- success = BKE_lib_override_library_create_from_tag(
- bmain, owner_library, id_root_reference, NULL, id_hierarchy_root_reference, false);
+ success = BKE_lib_override_library_create_from_tag(bmain,
+ owner_library,
+ id_root_reference,
+ NULL,
+ id_hierarchy_root_reference,
+ false,
+ do_fully_editable);
}
return success;
@@ -1180,7 +1195,8 @@ bool BKE_lib_override_library_create(Main *bmain,
ID *id_root_reference,
ID *id_hierarchy_root_reference,
ID *id_instance_hint,
- ID **r_id_root_override)
+ ID **r_id_root_override,
+ const bool do_fully_editable)
{
if (r_id_root_override != NULL) {
*r_id_root_override = NULL;
@@ -1190,8 +1206,12 @@ bool BKE_lib_override_library_create(Main *bmain,
id_hierarchy_root_reference = id_root_reference;
}
- const bool success = lib_override_library_create_do(
- bmain, scene, owner_library, id_root_reference, id_hierarchy_root_reference);
+ const bool success = lib_override_library_create_do(bmain,
+ scene,
+ owner_library,
+ id_root_reference,
+ id_hierarchy_root_reference,
+ do_fully_editable);
if (!success) {
return success;
@@ -1680,7 +1700,13 @@ static bool lib_override_library_resync(Main *bmain,
* override IDs (including within the old overrides themselves, since those are tagged too
* above). */
const bool success = BKE_lib_override_library_create_from_tag(
- bmain, NULL, id_root_reference, id_root->override_library->hierarchy_root, NULL, true);
+ bmain,
+ NULL,
+ id_root_reference,
+ id_root->override_library->hierarchy_root,
+ NULL,
+ true,
+ false);
if (!success) {
BLI_ghash_free(linkedref_to_old_override, NULL, NULL);
diff --git a/source/blender/blenkernel/intern/lib_override_proxy_conversion.c b/source/blender/blenkernel/intern/lib_override_proxy_conversion.c
index 5e9d8e8c4d0..3d4ccf5f426 100644
--- a/source/blender/blenkernel/intern/lib_override_proxy_conversion.c
+++ b/source/blender/blenkernel/intern/lib_override_proxy_conversion.c
@@ -82,7 +82,7 @@ bool BKE_lib_override_library_proxy_convert(Main *bmain,
FOREACH_MAIN_ID_END;
return BKE_lib_override_library_create(
- bmain, scene, view_layer, ob_proxy->id.lib, id_root, id_root, id_instance_hint, NULL);
+ bmain, scene, view_layer, ob_proxy->id.lib, id_root, id_root, id_instance_hint, NULL, false);
}
static void lib_override_library_proxy_convert_do(Main *bmain,