diff options
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5c6c55e956b..1752f48990d 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -3717,6 +3717,42 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot) /* *************************** */ +static int posemode_exec(bContext *C, wmOperator *op) +{ + Base *base= CTX_data_active_base(C); + + if(base->object->type==OB_ARMATURE) { + if(base->object==CTX_data_edit_object(C)) { + ED_object_exit_editmode(C, EM_FREEDATA); + ED_armature_enter_posemode(C, base); + } + else if(base->object->flag & OB_POSEMODE) + ED_armature_exit_posemode(C, base); + else + ED_armature_enter_posemode(C, base); + + return OPERATOR_FINISHED; + } + + return OPERATOR_PASS_THROUGH; +} + +void OBJECT_OT_posemode_toggle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Toggle Pose Mode"; + ot->idname= "OBJECT_OT_posemode_toggle"; + ot->description= "Enables or disables posing/selecting bones"; + + /* api callbacks */ + ot->exec= posemode_exec; + ot->poll= ED_operator_object_active; + + /* flag */ + ot->flag= OPTYPE_REGISTER; +} + +/* *********************** */ void check_editmode(int type) { |