Fix crash calling "Set Active Modifier" without an active object
This commit is contained in:
@@ -583,6 +583,8 @@ bool ED_operator_nla_active(bContext *C);
|
||||
bool ED_operator_info_active(bContext *C);
|
||||
bool ED_operator_console_active(bContext *C);
|
||||
|
||||
/** Only check there is an active object (no visibility check). */
|
||||
bool ED_operator_object_active_only(bContext *C);
|
||||
bool ED_operator_object_active(bContext *C);
|
||||
bool ED_operator_object_active_editable_ex(bContext *C, const Object *ob);
|
||||
bool ED_operator_object_active_editable(bContext *C);
|
||||
|
||||
@@ -2606,6 +2606,7 @@ void OBJECT_OT_modifier_set_active(wmOperatorType *ot)
|
||||
|
||||
ot->invoke = modifier_set_active_invoke;
|
||||
ot->exec = modifier_set_active_exec;
|
||||
ot->poll = ED_operator_object_active_only;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
edit_modifier_properties(ot);
|
||||
|
||||
@@ -408,6 +408,12 @@ static bool ed_object_hidden(const Object *ob)
|
||||
return ((ob->visibility_flag & OB_HIDE_VIEWPORT) && !(ob->mode & OB_MODE_EDIT));
|
||||
}
|
||||
|
||||
bool ED_operator_object_active_only(bContext *C)
|
||||
{
|
||||
Object *ob = blender::ed::object::context_active_object(C);
|
||||
return (ob != nullptr);
|
||||
}
|
||||
|
||||
bool ED_operator_object_active(bContext *C)
|
||||
{
|
||||
Object *ob = blender::ed::object::context_active_object(C);
|
||||
|
||||
Reference in New Issue
Block a user