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:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tools.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 9af2ba6a82b..d9641930134 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -776,6 +776,11 @@ static void object_proxy_to_override_convert_fn(bContext *C,
typedef struct OutlinerLibOverrideData {
bool do_hierarchy;
+ /**
+ * For resync operation, force keeping newly created override IDs (or original linked IDs)
+ * instead of re-applying relevant existing ID pointer property override operations. Helps
+ * solving broken overrides while not losing *all* of your overrides. */
+ bool do_resync_hierarchy_enforce;
} OutlinerLibOverrideData;
static void id_override_library_create_fn(bContext *C,
@@ -872,10 +877,12 @@ static void id_override_library_resync_fn(bContext *C,
TreeElement *te,
TreeStoreElem *UNUSED(tsep),
TreeStoreElem *tselem,
- void *UNUSED(user_data))
+ void *user_data)
{
BLI_assert(TSE_IS_REAL_ID(tselem));
ID *id_root = tselem->id;
+ OutlinerLibOverrideData *data = user_data;
+ const bool do_hierarchy_enforce = data->do_resync_hierarchy_enforce;
if (ID_IS_OVERRIDE_LIBRARY_REAL(id_root)) {
Main *bmain = CTX_data_main(C);
@@ -893,7 +900,8 @@ static void id_override_library_resync_fn(bContext *C,
te->store_elem->id->tag |= LIB_TAG_DOIT;
}
- BKE_lib_override_library_resync(bmain, scene, CTX_data_view_layer(C), id_root);
+ BKE_lib_override_library_resync(
+ bmain, scene, CTX_data_view_layer(C), id_root, do_hierarchy_enforce);
WM_event_add_notifier(C, NC_WINDOW, NULL);
}
@@ -1710,6 +1718,7 @@ typedef enum eOutlinerIdOpTypes {
OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET,
OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY,
OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY,
+ OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE,
OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY,
OUTLINER_IDOP_SINGLE,
OUTLINER_IDOP_DELETE,
@@ -1770,6 +1779,13 @@ static const EnumPropertyItem prop_id_op_types[] = {
"Resync Library Override Hierarchy",
"Rebuild this local override from its linked reference, as well as its hierarchy of "
"dependencies"},
+ {OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE,
+ "OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE",
+ 0,
+ "Resync Library Override Hierarchy Enforce",
+ "Rebuild this local override from its linked reference, as well as its hierarchy of "
+ "dependencies, enforcing that hierarchy to match the linked data (i.e. ignoring exiting "
+ "overrides on data-blocks pointer properties)"},
{OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY,
"OVERRIDE_LIBRARY_DELETE_HIERARCHY",
0,
@@ -1831,6 +1847,7 @@ static bool outliner_id_operation_item_poll(bContext *C,
case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET:
case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY:
case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY:
+ case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE:
case OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY:
if (ID_IS_OVERRIDE_LIBRARY_REAL(tselem->id)) {
return true;
@@ -2041,6 +2058,18 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
ED_undo_push(C, "Resync Overridden Data Hierarchy");
break;
}
+ case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE: {
+ outliner_do_libdata_operation(
+ C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ id_override_library_resync_fn,
+ &(OutlinerLibOverrideData){.do_hierarchy = true, .do_resync_hierarchy_enforce = true});
+ ED_undo_push(C, "Resync Overridden Data Hierarchy");
+ break;
+ }
case OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY: {
outliner_do_libdata_operation(C,
op->reports,