LibOverride: add more polling checks to operators not supposed to work on overrides.
This is long work, we are still likely missing a lot of cases...
This commit is contained in:
parent
03c8b048a1
commit
9db0c36af1
|
@ -348,6 +348,7 @@ bool ED_operator_console_active(struct bContext *C);
|
|||
|
||||
bool ED_operator_object_active(struct bContext *C);
|
||||
bool ED_operator_object_active_editable(struct bContext *C);
|
||||
bool ED_operator_object_active_local_editable(struct bContext *C);
|
||||
bool ED_operator_object_active_editable_mesh(struct bContext *C);
|
||||
bool ED_operator_object_active_editable_font(struct bContext *C);
|
||||
bool ED_operator_editable_mesh(struct bContext *C);
|
||||
|
|
|
@ -1683,7 +1683,7 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot)
|
|||
|
||||
/* callbacks */
|
||||
ot->exec = object_constraints_clear_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -102,7 +102,7 @@ void DPAINT_OT_surface_slot_add(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = surface_slot_add_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -151,7 +151,7 @@ void DPAINT_OT_surface_slot_remove(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = surface_slot_remove_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -203,7 +203,7 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = type_toggle_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -286,7 +286,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = output_toggle_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -538,5 +538,5 @@ void DPAINT_OT_bake(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = dynamicpaint_bake_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
|
|||
ot->description = "Add a particle system";
|
||||
|
||||
/* api callbacks */
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
ot->exec = particle_system_add_exec;
|
||||
|
||||
/* flags */
|
||||
|
@ -151,7 +151,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
|
|||
ot->description = "Remove the selected particle system";
|
||||
|
||||
/* api callbacks */
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
ot->exec = particle_system_remove_exec;
|
||||
|
||||
/* flags */
|
||||
|
@ -1210,7 +1210,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
|
|||
static bool copy_particle_systems_poll(bContext *C)
|
||||
{
|
||||
Object *ob;
|
||||
if (!ED_operator_object_active_editable(C)) {
|
||||
if (!ED_operator_object_active_local_editable(C)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ void PARTICLE_OT_copy_particle_systems(wmOperatorType *ot)
|
|||
|
||||
static bool duplicate_particle_systems_poll(bContext *C)
|
||||
{
|
||||
if (!ED_operator_object_active_editable(C)) {
|
||||
if (!ED_operator_object_active_local_editable(C)) {
|
||||
return false;
|
||||
}
|
||||
Object *ob = ED_object_active_context(C);
|
||||
|
|
|
@ -162,7 +162,7 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = material_slot_add_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
|
@ -207,7 +207,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = material_slot_remove_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
|
@ -310,7 +310,7 @@ void OBJECT_OT_material_slot_assign(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = material_slot_assign_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
|
@ -564,6 +564,7 @@ void OBJECT_OT_material_slot_move(wmOperatorType *ot)
|
|||
ot->description = "Move the active material up/down in the list";
|
||||
|
||||
/* api callbacks */
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
ot->exec = material_slot_move_exec;
|
||||
|
||||
/* flags */
|
||||
|
@ -638,7 +639,7 @@ void OBJECT_OT_material_slot_remove_unused(wmOperatorType *ot)
|
|||
|
||||
/* api callbacks */
|
||||
ot->exec = material_slot_remove_unused_exec;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -707,6 +708,7 @@ void MATERIAL_OT_new(wmOperatorType *ot)
|
|||
ot->description = "Add a new material";
|
||||
|
||||
/* api callbacks */
|
||||
ot->poll = ED_operator_object_active_local_editable;
|
||||
ot->exec = new_material_exec;
|
||||
|
||||
/* flags */
|
||||
|
|
|
@ -360,6 +360,13 @@ bool ED_operator_object_active_editable(bContext *C)
|
|||
return operator_object_active_editable_ex(ob);
|
||||
}
|
||||
|
||||
/** Object must be editable and fully local (i.e. not an override). */
|
||||
bool ED_operator_object_active_local_editable(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
return operator_object_active_editable_ex(ob) && !ID_IS_OVERRIDE_LIBRARY(ob);
|
||||
}
|
||||
|
||||
bool ED_operator_object_active_editable_mesh(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
|
|
Loading…
Reference in New Issue