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!).
This commit is contained in:
Bastien Montagne 2018-04-18 11:38:38 +02:00
parent 10ce4719d4
commit 2117e46e5b
4 changed files with 17 additions and 9 deletions

View File

@ -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);

View File

@ -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

View File

@ -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) {

View File

@ -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;