diff options
author | Bastien Montagne <bastien@blender.org> | 2022-05-20 12:59:39 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-05-20 13:02:52 +0300 |
commit | a89f829f12f56214b0e463b33f24edf27228db1f (patch) | |
tree | eb313c93201a48d7b25dd842a3bec12d9f1a5783 /source/blender/blenkernel/intern | |
parent | 019681b9841d7e34bac56211d645cf0497f8e9cf (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/intern')
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 46 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_override_proxy_conversion.c | 2 |
2 files changed, 37 insertions, 11 deletions
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, |