diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-18 10:04:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-18 10:07:23 +0300 |
commit | 2a3797b1091d65dac352ebb37f4ec58dde703397 (patch) | |
tree | f1c076dea8ee6217f305ba024387fb84ea107778 /source/blender/editors/screen/screen_ops.c | |
parent | ff144edd8c20645f8064035d7257d637d0ff333e (diff) |
Cleanup: remove NULL checks from object mode switching take #2
Re-apply changes from 54ea3562406c633dc69f59697cca3cd1cded3bcd,
with a poll function that uses the same active object as the operator,
matching other mode switching functions.
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 20fcff340d4..655e6d8da71 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -339,7 +339,7 @@ bool ED_operator_console_active(bContext *C) return ed_spacetype_test(C, SPACE_CONSOLE); } -static bool ed_object_hidden(Object *ob) +static bool ed_object_hidden(const Object *ob) { /* if hidden but in edit mode, we still display, can happen with animation */ return ((ob->restrictflag & OB_RESTRICT_VIEWPORT) && !(ob->mode & OB_MODE_EDIT)); @@ -351,10 +351,15 @@ bool ED_operator_object_active(bContext *C) return ((ob != NULL) && !ed_object_hidden(ob)); } +bool ED_operator_object_active_editable_ex(bContext *C, const Object *ob) +{ + return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob)); +} + bool ED_operator_object_active_editable(bContext *C) { Object *ob = ED_object_active_context(C); - return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob)); + return ED_operator_object_active_editable_ex(C, ob); } bool ED_operator_object_active_editable_mesh(bContext *C) |