[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10830] trunk/blender/source/blender: == Action Editor ==
Joshua Leung
aligorith at gmail.com
Thu May 31 13:47:05 CEST 2007
Revision: 10830
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10830
Author: aligorith
Date: 2007-05-31 13:47:04 +0200 (Thu, 31 May 2007)
Log Message:
-----------
== Action Editor ==
Small Action Editor feature to hopefully make keyframing quicker. Just press the IKEY in the Action Editor. Feedback on the (annoyance factor of the) popups welcome.
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_editaction.h
trunk/blender/source/blender/src/editaction.c
trunk/blender/source/blender/src/editipo.c
Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h 2007-05-31 11:20:35 UTC (rev 10829)
+++ trunk/blender/source/blender/include/BIF_editaction.h 2007-05-31 11:47:04 UTC (rev 10830)
@@ -92,6 +92,7 @@
void mirror_action_keys(short mirror_mode);
void clean_shapekeys(struct Key *key);
void clean_actionchannels(struct bAction *act);
+void insertkey_action(void);
/* Marker Operations */
void column_select_shapekeys(struct Key *key, int mode);
Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c 2007-05-31 11:20:35 UTC (rev 10829)
+++ trunk/blender/source/blender/src/editaction.c 2007-05-31 11:47:04 UTC (rev 10830)
@@ -2568,6 +2568,9 @@
else if (key) {
set_snap_meshchannels(key, snap_mode);
}
+ else {
+ return;
+ }
BIF_undo_push(str);
allspace(REMAKEIPO, 0);
@@ -2670,6 +2673,9 @@
else if (key) {
mirror_meshchannels(key, mirror_mode);
}
+ else {
+ return;
+ }
BIF_undo_push(str);
allspace(REMAKEIPO, 0);
@@ -2678,6 +2684,71 @@
allqueue(REDRAWNLA, 0);
}
+/* This function allows the user to insert keyframes on the current
+ * frame from the Action Editor, using the current values of the channels
+ * to be keyframed.
+ */
+void insertkey_action(void)
+{
+ bAction *act;
+ Key *key;
+ IpoCurve *icu;
+ short mode;
+ float cfra, val;
+
+ /* get data */
+ act = G.saction->action;
+ key = get_action_mesh_key();
+ cfra = frame_to_float(CFRA);
+
+ if (act) {
+ bActionChannel *achan;
+ bConstraintChannel *conchan;
+
+ /* ask user what to keyframe */
+ mode = pupmenu("Insert Key%t|All Channels%x1|Only Selected Channels%x2");
+ if (mode == 0) return;
+
+ for (achan= act->chanbase.first; achan; achan=achan->next) {
+ if (EDITABLE_ACHAN(achan) && (SEL_ACHAN(achan) || (mode == 1))) {
+ for (icu= achan->ipo->curve.first; icu; icu=icu->next) {
+ val = icu->curval;
+ insert_vert_ipo(icu, cfra, val);
+ }
+
+ if (EXPANDED_ACHAN(achan) && FILTER_CON_ACHAN(achan)) {
+ for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
+ if (EDITABLE_CONCHAN(conchan) && (SEL_ACHAN(conchan) || (mode == 1))) {
+ for (icu= conchan->ipo->curve.first; icu; icu=icu->next) {
+ val = icu->curval;
+ insert_vert_ipo(icu, cfra, val);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if (key) {
+ /* ask user if they want to insert a keyframe */
+ mode = okee("Insert Keyframe?");
+ if (mode == 0) return;
+
+ if (key->ipo) {
+ for (icu= key->ipo->curve.first; icu; icu=icu->next) {
+ val = icu->curval;
+ insert_vert_ipo(icu, cfra, val);
+ }
+ }
+ }
+
+ BIF_undo_push("Insert Key");
+ allspace(REMAKEIPO, 0);
+ allqueue(REDRAWACTION, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWNLA, 0);
+}
+
static void select_all_keys_frames(bAction *act, short *mval,
short *mvalo, int selectmode)
{
@@ -2886,7 +2957,7 @@
select_func(act, mval, mvalo, SELECT_SUBTRACT);
}
- BIF_undo_push("Border select Action");
+ BIF_undo_push("Border Select Action");
}
static void clever_keyblock_names(Key *key, short* mval){
@@ -3255,7 +3326,7 @@
}
}
break;
-
+
case KKEY:
if (G.qual & LR_CTRLKEY) {
markers_selectkeys_between();
@@ -3278,8 +3349,10 @@
case MKEY:
if (G.qual & LR_SHIFTKEY) {
/* mirror keyframes */
- val = pupmenu("Mirror Keys Over%t|Current Frame%x1|Vertical Axis%x2|Horizontal Axis %x3|Selected Marker %x4");
- mirror_action_keys(val);
+ if (act || key) {
+ val = pupmenu("Mirror Keys Over%t|Current Frame%x1|Vertical Axis%x2|Horizontal Axis %x3|Selected Marker %x4");
+ mirror_action_keys(val);
+ }
}
else {
/* marker operations */
@@ -3329,8 +3402,10 @@
case SKEY:
if (mval[0]>=ACTWIDTH) {
if(G.qual & LR_SHIFTKEY) {
- val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2|Nearest Marker %x3");
- snap_keys_to_frame(val);
+ if (act || key) {
+ val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2|Nearest Marker %x3");
+ snap_keys_to_frame(val);
+ }
}
else {
if (act)
Modified: trunk/blender/source/blender/src/editipo.c
===================================================================
--- trunk/blender/source/blender/src/editipo.c 2007-05-31 11:20:35 UTC (rev 10829)
+++ trunk/blender/source/blender/src/editipo.c 2007-05-31 11:47:04 UTC (rev 10830)
@@ -2426,6 +2426,9 @@
if(curarea->spacetype==SPACE_IPO) {
insertkey_editipo();
}
+ else if(curarea->spacetype==SPACE_ACTION) {
+ insertkey_action();
+ }
else if(curarea->spacetype==SPACE_BUTS) {
if(G.buts->mainb==CONTEXT_SHADING) {
int tab= G.buts->tab[CONTEXT_SHADING];
More information about the Bf-blender-cvs
mailing list