diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-07-09 05:14:07 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-07-09 05:14:07 +0400 |
commit | 767c7f24dd277fa1d8e97f02fcddb08cd6f25234 (patch) | |
tree | bae150226e50551730e6272c05aa414bf8bc15d1 /source/blender/editors/armature/poseobject.c | |
parent | d044ecea10f1a69e8e941f36d5e53e49dbed1446 (diff) |
Ctrl-R sets rotation mode for Pose Bones
Diffstat (limited to 'source/blender/editors/armature/poseobject.c')
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index cfd3f54c5b9..01c9839220e 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -64,6 +64,7 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "WM_api.h" #include "WM_types.h" @@ -1798,6 +1799,46 @@ void POSE_OT_autoside_names (wmOperatorType *ot) /* ********************************************** */ +static int pose_bone_rotmode_exec (bContext *C, wmOperator *op) +{ + Object *ob = CTX_data_active_object(C); + int mode = RNA_enum_get(op->ptr, "type"); + + /* set rotation mode of selected bones */ + CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones) + { + pchan->rotmode = mode; + } + CTX_DATA_END; + + /* notifiers and updates */ + DAG_id_tag_update((ID *)ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); + + return OPERATOR_FINISHED; +} + +void POSE_OT_rotation_mode_set (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Set Rotation Mode"; + ot->idname= "POSE_OT_rotation_mode_set"; + ot->description= "Set the rotation representation used by selected bones"; + + /* callbacks */ + ot->invoke= WM_menu_invoke; + ot->exec= pose_bone_rotmode_exec; + ot->poll= ED_operator_posemode; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + ot->prop= RNA_def_enum(ot->srna, "type", posebone_rotmode_items, 0, "Rotation Mode", ""); +} + +/* ********************************************** */ + /* Show all armature layers */ static int pose_armature_layers_showall_poll (bContext *C) { @@ -1884,7 +1925,7 @@ static int pose_armature_layers_exec (bContext *C, wmOperator *op) PointerRNA ptr; int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ - if(ob==NULL || ob->data==NULL) { + if (ELEM(NULL, ob, ob->data)) { return OPERATOR_CANCELLED; } |