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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-06-18 10:23:50 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-18 10:23:50 +0400
commit24c7adde0fb922d802b817edb0508c770e1681e0 (patch)
tree8e55e00b2c5ac2acd81d105ed50cfd0bbc343629 /source/blender/editors/object/object_edit.c
parent52a71c9db397145179b5fc54fb853d060e590a14 (diff)
Code cleanup: de-duplicate flag check in ED_object_toggle_modes
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r--source/blender/editors/object/object_edit.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 002bec4ef0b..62a31a3fb5a 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1669,24 +1669,12 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
void ED_object_toggle_modes(bContext *C, int mode)
{
- /* Couldn't we use object_mode_op_string() here?
- * Also, if several bits are set in mode, several toggle ops will be called, is this expected?
- * If so, would be nice to explain why. ;) --mont29
- */
- if (mode & OB_MODE_SCULPT)
- WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if (mode & OB_MODE_VERTEX_PAINT)
- WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if (mode & OB_MODE_WEIGHT_PAINT)
- WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if (mode & OB_MODE_TEXTURE_PAINT)
- WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if (mode & OB_MODE_PARTICLE_EDIT)
- WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if (mode & OB_MODE_POSE)
- WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if (mode & OB_MODE_EDIT)
- WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
+ if (mode != OB_MODE_OBJECT) {
+ const char *opstring = object_mode_op_string(mode);
+ if (opstring) {
+ WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, NULL);
+ }
+ }
}
/************************ Game Properties ***********************/