[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17226] branches/animsys2/source/blender: AnimSys2: Ctrl R displays menu to set rotation mode
Joshua Leung
aligorith at gmail.com
Thu Oct 30 08:22:12 CET 2008
Revision: 17226
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17226
Author: aligorith
Date: 2008-10-30 08:22:11 +0100 (Thu, 30 Oct 2008)
Log Message:
-----------
AnimSys2: Ctrl R displays menu to set rotation mode
This hotkey allows the rotation of multiple (selected and visible) bones to be set at a time.
Modified Paths:
--------------
branches/animsys2/source/blender/include/BIF_poseobject.h
branches/animsys2/source/blender/src/header_view3d.c
branches/animsys2/source/blender/src/poseobject.c
branches/animsys2/source/blender/src/space.c
Modified: branches/animsys2/source/blender/include/BIF_poseobject.h
===================================================================
--- branches/animsys2/source/blender/include/BIF_poseobject.h 2008-10-30 06:04:03 UTC (rev 17225)
+++ branches/animsys2/source/blender/include/BIF_poseobject.h 2008-10-30 07:22:11 UTC (rev 17226)
@@ -51,6 +51,7 @@
void pose_clear_IK(void);
void pose_clear_constraints(void);
void pose_copy_menu(void);
+void pose_rotmode_menu(void);
void free_posebuf(void);
void copy_posebuf (void);
Modified: branches/animsys2/source/blender/src/header_view3d.c
===================================================================
--- branches/animsys2/source/blender/src/header_view3d.c 2008-10-30 06:04:03 UTC (rev 17225)
+++ branches/animsys2/source/blender/src/header_view3d.c 2008-10-30 07:22:11 UTC (rev 17226)
@@ -4426,6 +4426,9 @@
case 20: /* delete keyframe */
common_deletekey();
break;
+ case 21: /* set rotation mode */
+ pose_rotmode_menu();
+ break;
}
allqueue(REDRAWVIEW3D, 0);
@@ -4443,6 +4446,7 @@
uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_pose_armature_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Clear Transform", 0, yco-=20, 120, 19, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Envelope Distance|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Rotation Mode|Ctrl R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
Modified: branches/animsys2/source/blender/src/poseobject.c
===================================================================
--- branches/animsys2/source/blender/src/poseobject.c 2008-10-30 06:04:03 UTC (rev 17225)
+++ branches/animsys2/source/blender/src/poseobject.c 2008-10-30 07:22:11 UTC (rev 17226)
@@ -871,6 +871,51 @@
}
+void pose_rotmode_menu(void)
+{
+ Object *ob= OBACT;
+ bArmature *arm= ob->data;
+ bPoseChannel *pchan;
+ short nr=0;
+
+ /* paranoia checks */
+ if (ELEM(NULL, ob, ob->pose)) return;
+ if ((ob==G.obedit) || (ob->flag & OB_POSEMODE)==0) return;
+
+ /* FIXME: proxy protected bones can't get this set */
+ if (pose_has_protected_selected(ob, 1, 1))
+ return;
+
+ /* show and process menu */
+ nr= pupmenu("Bone Rotation Mode%t|Quaternion %x1|Euler %x2");
+ if (nr <= 0) return;
+
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if ((arm->layer & pchan->bone->layer) && (pchan->bone->flag & BONE_SELECTED))
+ {
+ const short old_rotmode= pchan->rotmode;
+
+ /* all values for menu are 1 higher than the actual values should be */
+ pchan->rotmode= nr - 1;
+
+ /* do conversions if necessary */
+ if (old_rotmode != pchan->rotmode) {
+ if (old_rotmode)
+ EulToQuat(pchan->eul, pchan->quat);
+ else
+ QuatToEul(pchan->quat, pchan->eul);
+ }
+ }
+ }
+
+
+ DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
+
+ allqueue(REDRAWVIEW3D, 0);
+
+ BIF_undo_push("Set Rotation Mode");
+}
+
/* ******************** copy/paste pose ********************** */
static bPose *g_posebuf=NULL;
Modified: branches/animsys2/source/blender/src/space.c
===================================================================
--- branches/animsys2/source/blender/src/space.c 2008-10-30 06:04:03 UTC (rev 17225)
+++ branches/animsys2/source/blender/src/space.c 2008-10-30 07:22:11 UTC (rev 17226)
@@ -2563,6 +2563,10 @@
Transform();
}
}
+ else if(G.qual==LR_CTRLKEY) {
+ if((ob && ob->pose) && (ob->flag & OB_POSEMODE))
+ pose_rotmode_menu();
+ }
else if((G.qual==0)) {
initTransform(TFM_ROTATION, CTX_NONE);
Transform();
More information about the Bf-blender-cvs
mailing list