From 2117e46e5b85ac9e2e99afa7ddc305f81da1dffe Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 18 Apr 2018 11:38:38 +0200 Subject: [PATCH] Disable auto-override for all but active object in group case. I.E. only enable auto-override for 'active' selected object when making an override of a linked group. This will ease on auto-override creation, and you typically do not want to auto-override most objects in the group anyway (in proxy system, you could only proxyfy one object of the group anyaway!). --- source/blender/blenkernel/BKE_library_override.h | 4 ++-- .../blender/blenkernel/intern/library_override.c | 14 ++++++++------ source/blender/blenkernel/intern/undo_system.c | 2 +- source/blender/editors/object/object_relations.c | 6 ++++++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/source/blender/blenkernel/BKE_library_override.h b/source/blender/blenkernel/BKE_library_override.h index 35672cb5ded..6f32d565562 100644 --- a/source/blender/blenkernel/BKE_library_override.h +++ b/source/blender/blenkernel/BKE_library_override.h @@ -65,8 +65,8 @@ void BKE_override_static_property_operation_delete( bool BKE_override_static_status_check_local(struct ID *local); bool BKE_override_static_status_check_reference(struct ID *local); -bool BKE_override_static_operations_create(struct ID *local); -void BKE_main_override_static_operations_create(struct Main *bmain); +bool BKE_override_static_operations_create(struct ID *local, const bool force_auto); +void BKE_main_override_static_operations_create(struct Main *bmain, const bool force_auto); void BKE_override_static_update(struct Main *bmain, struct ID *local); void BKE_main_override_static_update(struct Main *bmain); diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c index a90a7196aad..653a590e7f2 100644 --- a/source/blender/blenkernel/intern/library_override.c +++ b/source/blender/blenkernel/intern/library_override.c @@ -511,13 +511,13 @@ bool BKE_override_static_status_check_reference(ID *local) * are much cheaper. * * \return true is new overriding op was created, or some local data was reset. */ -bool BKE_override_static_operations_create(ID *local) +bool BKE_override_static_operations_create(ID *local, const bool force_auto) { BLI_assert(local->override_static != NULL); const bool is_template = (local->override_static->reference == NULL); bool ret = false; - if (!is_template && local->flag & LIB_OVERRIDE_STATIC_AUTO) { + if (!is_template && (force_auto || local->flag & LIB_OVERRIDE_STATIC_AUTO)) { PointerRNA rnaptr_local, rnaptr_reference; RNA_id_pointer_create(local, &rnaptr_local); RNA_id_pointer_create(local->override_static->reference, &rnaptr_reference); @@ -545,7 +545,7 @@ bool BKE_override_static_operations_create(ID *local) } /** Check all overrides from given \a bmain and create/update overriding operations as needed. */ -void BKE_main_override_static_operations_create(Main *bmain) +void BKE_main_override_static_operations_create(Main *bmain, const bool force_auto) { ListBase *lbarray[MAX_LIBARRAY]; int base_count, i; @@ -557,8 +557,10 @@ void BKE_main_override_static_operations_create(Main *bmain) ID *id; for (id = lb->first; id; id = id->next) { - if (ID_IS_STATIC_OVERRIDE_AUTO(id) && (id->tag & LIB_TAG_OVERRIDESTATIC_AUTOREFRESH)) { - BKE_override_static_operations_create(id); + if (force_auto || + (ID_IS_STATIC_OVERRIDE_AUTO(id) && (id->tag & LIB_TAG_OVERRIDESTATIC_AUTOREFRESH))) + { + BKE_override_static_operations_create(id, force_auto); id->tag &= ~LIB_TAG_OVERRIDESTATIC_AUTOREFRESH; } } @@ -686,7 +688,7 @@ ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_s } /* Forcefully ensure we know about all needed override operations. */ - BKE_override_static_operations_create(local); + BKE_override_static_operations_create(local, false); ID *storage_id; #ifdef DEBUG_OVERRIDE_TIMEIT diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index fd62650e898..cab675ccd2e 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -395,7 +395,7 @@ bool BKE_undosys_step_push_with_type(UndoStack *ustack, bContext *C, const char /* Might not be final place for this to be called - probably only want to call it from some * undo handlers, not all of them? */ - BKE_main_override_static_operations_create(CTX_data_main(C)); + BKE_main_override_static_operations_create(CTX_data_main(C), false); /* Remove all undos after (also when 'ustack->step_active == NULL'). */ while (ustack->steps.last != ustack->step_active) { diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 0e0f2784936..3cef80db032 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2437,6 +2437,12 @@ static int make_override_static_exec(bContext *C, wmOperator *op) base = BKE_view_layer_base_find(view_layer, new_ob); BKE_view_layer_base_select(view_layer, base); } + else { + /* Disable auto-override tags for non-active objects, will help with performaces... */ + new_ob->id.flag &= ~LIB_OVERRIDE_STATIC_AUTO; + } + /* We still want to store all objects' current override status (i.e. change of parent). */ + BKE_override_static_operations_create(&new_ob->id, true); } } FOREACH_GROUP_OBJECT_END;