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:
authorNicholas Bishop <nicholasbishop@gmail.com>2009-08-20 09:13:07 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2009-08-20 09:13:07 +0400
commit7dfc1317acc63aea67d4ebd5db8d64c5bef4b8c8 (patch)
tree237369f278ba522425356ccf1b2082c911493582 /source/blender/editors/object/object_edit.c
parent2878eed1c125d07bcfc893eb04d1307c6aa19e3a (diff)
2.5/Paint:
* Converted vertex paint to use the new stroke system. Now supports the same smooth stroke and stroke spacing as sculpt mode. * Refactored the paint cursor a bit, just sculpt for now but other modes soon. * A couple warning fixes
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r--source/blender/editors/object/object_edit.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index f8d969d2462..39fd6433548 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -7073,6 +7073,25 @@ static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *ptr, in
return item;
}
+static const char *object_mode_op_string(int mode)
+{
+ if(mode == OB_MODE_EDIT)
+ return "OBJECT_OT_editmode_toggle";
+ if(mode == OB_MODE_SCULPT)
+ return "SCULPT_OT_sculptmode_toggle";
+ if(mode == OB_MODE_VERTEX_PAINT)
+ return "PAINT_OT_vertex_paint_toggle";
+ if(mode == OB_MODE_WEIGHT_PAINT)
+ return "PAINT_OT_weight_paint_toggle";
+ if(mode == OB_MODE_TEXTURE_PAINT)
+ return "PAINT_OT_texture_paint_toggle";
+ if(mode == OB_MODE_PARTICLE_EDIT)
+ return "PARTICLE_OT_particle_edit_toggle";
+ if(mode == OB_MODE_POSE)
+ return "OBJECT_OT_posemode_toggle";
+ return NULL;
+}
+
static int object_mode_set_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
@@ -7081,20 +7100,13 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
if(!ob)
return OPERATOR_CANCELLED;
- if((mode == OB_MODE_EDIT) == !(ob->mode & OB_MODE_EDIT))
- WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
- if((mode == OB_MODE_SCULPT) == !(ob->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) == !(ob->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) == !(ob->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) == !(ob->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) == !(ob->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) == !(ob->mode & OB_MODE_POSE))
- WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
+ /* Exit off current mode */
+ if(ob->mode != OB_MODE_OBJECT)
+ WM_operator_name_call(C, object_mode_op_string(ob->mode), WM_OP_EXEC_REGION_WIN, NULL);
+
+ /* Enter new mode */
+ if(mode != OB_MODE_OBJECT)
+ WM_operator_name_call(C, object_mode_op_string(mode), WM_OP_EXEC_REGION_WIN, NULL);
return OPERATOR_FINISHED;
}