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 | |
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')
-rw-r--r-- | source/blender/blenkernel/BKE_lib_override.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 40 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 1 |
3 files changed, 31 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h index afffa98fe3d..16156824f8e 100644 --- a/source/blender/blenkernel/BKE_lib_override.h +++ b/source/blender/blenkernel/BKE_lib_override.h @@ -164,9 +164,9 @@ void BKE_lib_override_library_main_proxy_convert(struct Main *bmain, * Advanced 'smart' function to resync, re-create fully functional overrides up-to-date with linked * data, from an existing override hierarchy. * - * \param id_root: The root liboverride ID to resync from. * \param view_layer: the active view layer to search instantiated collections in, can be NULL (in * which case \a scene's master collection children hierarchy is used instead). + * \param id_root: The root liboverride ID to resync from. * \return true if override was successfully resynced. */ bool BKE_lib_override_library_resync(struct Main *bmain, @@ -175,7 +175,6 @@ bool BKE_lib_override_library_resync(struct Main *bmain, struct ID *id_root, struct Collection *override_resync_residual_storage, bool do_hierarchy_enforce, - bool do_post_process, struct BlendFileReadReport *reports); /** * Detect and handle required resync of overrides data, when relations between reference linked IDs 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) { diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index bcd455de9a4..4849da16685 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -959,7 +959,6 @@ static void id_override_library_resync_fn(bContext *C, id_root, NULL, do_hierarchy_enforce, - true, &(struct BlendFileReadReport){.reports = reports}); WM_event_add_notifier(C, NC_WINDOW, NULL); |