Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-05-13 15:58:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-05-13 16:14:01 +0300
commit54ea3562406c633dc69f59697cca3cd1cded3bcd (patch)
tree0fced922ada772aeda5df94d354cdb0fe02b0003 /source
parent4e32398668cfea8d6e4e42003d10b524d829d3b8 (diff)
Cleanup: remove redundant active object NULL check & poll
This was from 66da2f537ae80 but never did anything, as a NULL object always exited at the beginning of the operator.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/object/object_edit.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 5506895613b..6929930c26c 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1391,35 +1391,20 @@ static const EnumPropertyItem *object_mode_set_itemsf(bContext *C,
return item;
}
-static bool object_mode_set_poll(bContext *C)
-{
- /* Since Grease Pencil editmode is also handled here,
- * we have a special exception for allowing this operator
- * to still work in that case when there's no active object
- * so that users can exit editmode this way as per normal.
- */
- if (ED_operator_object_active_editable(C)) {
- return true;
- }
- else {
- return (CTX_data_gpencil_data(C) != NULL);
- }
-}
-
static int object_mode_set_exec(bContext *C, wmOperator *op)
{
bool use_submode = STREQ(op->idname, "OBJECT_OT_mode_set_with_submode");
Object *ob = CTX_data_active_object(C);
eObjectMode mode = RNA_enum_get(op->ptr, "mode");
- eObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT;
+ eObjectMode restore_mode = ob->mode;
const bool toggle = RNA_boolean_get(op->ptr, "toggle");
/* by default the operator assume is a mesh, but if gp object change mode */
- if ((ob != NULL) && (ob->type == OB_GPENCIL) && (mode == OB_MODE_EDIT)) {
+ if ((ob->type == OB_GPENCIL) && (mode == OB_MODE_EDIT)) {
mode = OB_MODE_EDIT_GPENCIL;
}
- if (!ob || !ED_object_mode_compat_test(ob, mode)) {
+ if (!ED_object_mode_compat_test(ob, mode)) {
return OPERATOR_PASS_THROUGH;
}
@@ -1450,7 +1435,7 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
}
/* if type is OB_GPENCIL, set cursor mode */
- if ((ob) && (ob->type == OB_GPENCIL)) {
+ if (ob->type == OB_GPENCIL) {
if (ob->data) {
bGPdata *gpd = (bGPdata *)ob->data;
ED_gpencil_setup_modes(C, gpd, ob->mode);
@@ -1485,8 +1470,7 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
/* api callbacks */
ot->exec = object_mode_set_exec;
-
- ot->poll = object_mode_set_poll; // ED_operator_object_active_editable;
+ ot->poll = ED_operator_object_active_editable;
/* flags */
ot->flag = 0; /* no register/undo here, leave it to operators being called */