diff options
author | Bastien Montagne <bastien@blender.org> | 2022-01-07 17:25:25 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-01-07 17:25:25 +0300 |
commit | b7ea6e9d0ef910fe668d0fa3454ac94400471804 (patch) | |
tree | f1847bab349522ae8e19c5654a09148feb99986b /source/blender/blenkernel/intern/lib_override.c | |
parent | 5560f3244717221600506866bf1c79d370e0045e (diff) |
LibOverrides: small refactor of resync main public function.
Simplify signature of `BKE_lib_override_library_resync` and make it a
shallow wrapper around new internal `lib_override_library_resync` that
can then be easily extended for other internal needs.
Not functional changes expected here.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_override.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 6fe57a0257c..38ce8ea88b9 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -376,7 +376,6 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain, * existing linked IDs usages. */ if (success) { for (todo_id_iter = todo_ids.first; todo_id_iter != NULL; todo_id_iter = todo_id_iter->next) { - ID *other_id; reference_id = todo_id_iter->data; ID *local_id = reference_id->newid; @@ -394,6 +393,7 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain, * remapped to use newly created overriding IDs, if needed. */ ID *id; FOREACH_MAIN_ID_BEGIN (bmain, id) { + ID *other_id; /* In case we created new overrides as 'no main', they are not accessible directly in this * loop, but we can get to them through their reference's `newid` pointer. */ if (do_no_main && id->lib == reference_id->lib && id->newid != NULL) { @@ -1121,14 +1121,14 @@ void BKE_lib_override_library_main_proxy_convert(Main *bmain, BlendFileReadRepor } } -bool BKE_lib_override_library_resync(Main *bmain, - Scene *scene, - ViewLayer *view_layer, - ID *id_root, - Collection *override_resync_residual_storage, - const bool do_hierarchy_enforce, - const bool do_post_process, - BlendFileReadReport *reports) +static bool lib_override_library_resync(Main *bmain, + Scene *scene, + ViewLayer *view_layer, + ID *id_root, + Collection *override_resync_residual_storage, + const bool do_hierarchy_enforce, + const bool do_post_process, + BlendFileReadReport *reports) { BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_root)); @@ -1499,6 +1499,26 @@ bool BKE_lib_override_library_resync(Main *bmain, return success; } +bool BKE_lib_override_library_resync(Main *bmain, + Scene *scene, + ViewLayer *view_layer, + ID *id_root, + Collection *override_resync_residual_storage, + const bool do_hierarchy_enforce, + BlendFileReadReport *reports) +{ + const bool success = lib_override_library_resync(bmain, + scene, + view_layer, + id_root, + override_resync_residual_storage, + do_hierarchy_enforce, + true, + reports); + + return success; +} + /* Also tag ancestors overrides for resync. * * WARNING: Expects `bmain` to have valid relation data. @@ -1763,7 +1783,7 @@ static void lib_override_library_main_resync_on_library_indirect_level( do_continue = true; CLOG_INFO(&LOG, 2, "Resyncing %s (%p)...", id->name, library); - const bool success = BKE_lib_override_library_resync( + const bool success = lib_override_library_resync( bmain, scene, view_layer, id, override_resync_residual_storage, false, false, reports); CLOG_INFO(&LOG, 2, "\tSuccess: %d", success); if (success) { |