== Action Editor - Major Recode ==

I've just spent two days rewriting the Action Editor to unify its code and bring it under control again (it was 107kb, now it is around 73 kb). 
* This means that there are no longer separate functions for each tool for Actions and Shapekeys in the Action Editor, and also no more missing tools for either. 
* Also, I've gotten rid of the need for those complicated, hierarchial loops used for action channels, as they were a pain to keep consistent with each other.
* Baking functions have been removed. See user-level-changes for more details.
* Reorganised and completely rewrote code in editaction.c, thus the lengthy diff.

User Level Changes:
* For the meantime, border-selecting Action Channels has been disabled
* Baking functions have been removed. As far as I have been able to find out, these were really non-functional anyway. Besides, I don't think they really belonged in editaction.c
* Editing Shapekey keyframes now yields the same feature set as for those in Action Channels.
* There shouldn't be any major bugs left, but I might have missed something.

Further Work:
* Do a cleanup like this to the Action Editor drawing code in drawaction.c
* Baking??? (harkyman seems to be doing something about this)
This commit is contained in:
2007-06-05 12:11:00 +00:00
parent 6b9fe36e0b
commit 25935dbdb1
8 changed files with 2302 additions and 3560 deletions

View File

@@ -33,21 +33,11 @@
#ifndef BIF_EDITACTION_H #ifndef BIF_EDITACTION_H
#define BIF_EDITACTION_H #define BIF_EDITACTION_H
#define SET_IPO_POPUP 0 /* some interface related sizes*/
#define SET_IPO_CONSTANT 1
#define SET_IPO_LINEAR 2
#define SET_IPO_BEZIER 3
#define SET_EXTEND_POPUP 0
#define SET_EXTEND_CONSTANT 1
#define SET_EXTEND_EXTRAPOLATION 2
#define SET_EXTEND_CYCLIC 3
#define SET_EXTEND_CYCLICEXTRAPOLATION 4
#define CHANNELHEIGHT 16 #define CHANNELHEIGHT 16
#define CHANNELSKIP 2 #define CHANNELSKIP 2
#define NAMEWIDTH 164 #define NAMEWIDTH 164
#define SLIDERWIDTH 125 #define SLIDERWIDTH 125
#define ACTWIDTH (G.saction->actwidth) #define ACTWIDTH (G.saction->actwidth)
/* Some types for easier type-testing */ /* Some types for easier type-testing */
@@ -57,6 +47,8 @@
#define ACTTYPE_ICU 3 #define ACTTYPE_ICU 3
#define ACTTYPE_FILLIPO 4 #define ACTTYPE_FILLIPO 4
#define ACTTYPE_FILLCON 5 #define ACTTYPE_FILLCON 5
#define ACTTYPE_IPO 6
#define ACTTYPE_SHAPEKEY 7
/* Macros for easier/more consistant state testing */ /* Macros for easier/more consistant state testing */
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0) #define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
@@ -72,6 +64,19 @@
#define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0) #define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0)
#define SEL_ICU(icu) (icu->flag & IPO_SELECT) #define SEL_ICU(icu) (icu->flag & IPO_SELECT)
/* constants for setting ipo-interpolation type */
#define SET_IPO_POPUP 0
#define SET_IPO_CONSTANT 1
#define SET_IPO_LINEAR 2
#define SET_IPO_BEZIER 3
/* constants for setting ipo-extrapolation type */
#define SET_EXTEND_POPUP 10
#define SET_EXTEND_CONSTANT 11
#define SET_EXTEND_EXTRAPOLATION 12
#define SET_EXTEND_CYCLIC 13
#define SET_EXTEND_CYCLICEXTRAPOLATION 14
struct bAction; struct bAction;
struct bActionChannel; struct bActionChannel;
struct bPoseChannel; struct bPoseChannel;
@@ -82,21 +87,18 @@ struct Key;
struct ListBase; struct ListBase;
/* Key operations */ /* Key operations */
void delete_meshchannel_keys(struct Key *key); void transform_action_keys(int mode, int dummy);
void delete_actionchannel_keys(void); void duplicate_action_keys(void);
void duplicate_meshchannel_keys(struct Key *key); void snap_action_keys(short mode);
void duplicate_actionchannel_keys(void); void mirror_action_keys(short mode);
void transform_actionchannel_keys(int mode, int dummy);
void transform_meshchannel_keys(char mode, struct Key *key);
void snap_keys_to_frame(int snap_mode);
void mirror_action_keys(short mirror_mode);
void clean_shapekeys(struct Key *key);
void clean_actionchannels(struct bAction *act);
void insertkey_action(void); void insertkey_action(void);
void delete_action_keys(void);
void delete_action_channels(void);
void clean_action(void);
/* Marker Operations */ /* Column/Channel Key select */
void column_select_shapekeys(struct Key *key, int mode); void column_select_action_keys(int mode);
void column_select_actionkeys(struct bAction *act, int mode); void selectall_action_keys(short mval[], short mode, short selectmode);
void markers_selectkeys_between(void); void markers_selectkeys_between(void);
/* channel/strip operations */ /* channel/strip operations */
@@ -105,20 +107,15 @@ void down_sel_action(void);
void top_sel_action(void); void top_sel_action(void);
void bottom_sel_action(void); void bottom_sel_action(void);
/* Handles */ /* IPO/Handle Types */
void sethandles_meshchannel_keys(int code, struct Key *key); void sethandles_action_keys(int code);
void sethandles_actionchannel_keys(int code); void action_set_ipo_flags(int mode);
/* Ipo type */
void set_ipotype_actionchannels(int ipotype);
void set_extendtype_actionchannels(int extendtype);
/* Select */ /* Select */
void borderselect_mesh(struct Key *key);
void borderselect_action(void); void borderselect_action(void);
void deselect_actionchannel_keys(struct bAction *act, int test, int sel); void deselect_action_keys(short test, short sel);
void deselect_actionchannels (struct bAction *act, int test); void deselect_action_channels(short test);
void deselect_meshchannel_keys (struct Key *key, int test, int sel); void deselect_actionchannels(struct bAction *act, short test);
int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode); int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode);
void select_actionchannel_by_name (struct bAction *act, char *name, int select); void select_actionchannel_by_name (struct bAction *act, char *name, int select);
@@ -128,19 +125,17 @@ int get_nearest_key_num(struct Key *key, short *mval, float *x);
void *get_nearest_act_channel(short mval[], short *ret_type); void *get_nearest_act_channel(short mval[], short *ret_type);
/* Action */ /* Action */
struct bActionChannel* get_hilighted_action_channel(struct bAction* action); struct bActionChannel *get_hilighted_action_channel(struct bAction* action);
struct bAction *add_empty_action(char *name); struct bAction *add_empty_action(char *name);
void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
/* contextual get action */
struct bAction *ob_get_action(struct Object *ob); struct bAction *ob_get_action(struct Object *ob);
void actdata_filter(ListBase *act_data, int filter_mode, void *data, short datatype);
void *get_action_context(short *datatype);
void remake_action_ipos(struct bAction *act); void remake_action_ipos(struct bAction *act);
/* this needs review badly! (ton) */ /* event handling */
struct bAction *bake_action_with_client (struct bAction *act, struct Object *arm, float tolerance); void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
void world2bonespace(float boneSpaceMat[][4], float worldSpace[][4], float restPos[][4], float armPos[][4]);
#endif #endif

View File

@@ -0,0 +1,75 @@
/**
* $Id: BIF_editaction.h 10519 2007-04-13 11:15:08Z aligorith $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): 2007, Joshua Leung (major Action Editor recode)
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef BIF_EDITACTION_TYPES_H
#define BIF_EDITACTION_TYPES_H
/******************************************************* */
/* FILTERED ACTION DATA - TYPES */
/* types of keyframe data in ActListElem */
#define ALE_NONE 0
#define ALE_IPO 1
#define ALE_ICU 2
/* This struct defines a structure used for quick access */
typedef struct bActListElem {
struct bActListElem *next, *prev;
void *data; /* source data this elem represents */
int type; /* one of the ACTTYPE_* values */
int flag; /* copy of elem's flags for quick access */
void *key_data; /* motion data - ipo or ipo-curve */
short datatype; /* type of motion data to expect */
void *owner; /* will either be an action channel or fake ipo-channel (for keys) */
short ownertype; /* type of owner */
} bActListElem;
/******************************************************* */
/* FILTER ACTION DATA - METHODS/TYPES */
/* filtering flags - under what circumstances should a channel be added */
#define ACTFILTER_VISIBLE 0x001 /* should channels be visible */
#define ACTFILTER_SEL 0x002 /* should channels be selected */
#define ACTFILTER_FOREDIT 0x004 /* does editable status matter */
#define ACTFILTER_CHANNELS 0x008 /* do we only care that it is a channel */
#define ACTFILTER_IPOKEYS 0x010 /* only channels referencing ipo's */
#define ACTFILTER_ONLYICU 0x020 /* only reference ipo-curves */
/* Action Editor - Main Data types */
#define ACTCONT_NONE 0
#define ACTCONT_ACTION 1
#define ACTCONT_SHAPEKEY 2
#endif

View File

@@ -107,6 +107,7 @@ void ipo_mirror(short event);
void mouse_select_ipo(void); void mouse_select_ipo(void);
void sethandles_ipo(int code); void sethandles_ipo(int code);
void select_ipo_bezier_keys(struct Ipo *ipo, int selectmode); void select_ipo_bezier_keys(struct Ipo *ipo, int selectmode);
void select_icu_bezier_keys(struct IpoCurve *icu, int selectmode);
void set_ipotype(void); void set_ipotype(void);
void borderselect_ipo(void); void borderselect_ipo(void);
void del_ipo(int need_check); void del_ipo(int need_check);

View File

@@ -110,14 +110,14 @@ static void meshactionbuts(SpaceAction *saction, Object *ob, Key *key)
* correctly *grumble* * correctly *grumble*
*/ */
mywinset(curarea->win); mywinset(curarea->win);
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375); myortho2(-0.375, curarea->winx-0.375, G.v2d->cur.ymin, G.v2d->cur.ymax);
sprintf(str, "actionbuttonswin %d", curarea->win); sprintf(str, "actionbuttonswin %d", curarea->win);
block= uiNewBlock (&curarea->uiblocks, str, block= uiNewBlock (&curarea->uiblocks, str,
UI_EMBOSS, UI_HELV, curarea->win); UI_EMBOSS, UI_HELV, curarea->win);
x = NAMEWIDTH + 1; x = NAMEWIDTH + 1;
y = key->totkey*(CHANNELHEIGHT+CHANNELSKIP) + CHANNELHEIGHT/2 - G.v2d->cur.ymin; y = CHANNELHEIGHT/2;
/* make the little 'open the sliders' widget */ /* make the little 'open the sliders' widget */
BIF_ThemeColor(TH_FACE); // this slot was open... BIF_ThemeColor(TH_FACE); // this slot was open...
@@ -534,7 +534,7 @@ static void draw_action_mesh_names(Key *key)
KeyBlock *kb; KeyBlock *kb;
x = 0.0; x = 0.0;
y= key->totkey*(CHANNELHEIGHT+CHANNELSKIP); y= 0.0;
kb= key->block.first; kb= key->block.first;
@@ -846,7 +846,7 @@ static void draw_mesh_strips(SpaceAction *saction, Key *key)
scr_rct.ymax= saction->area->winrct.ymin + saction->v2d.mask.ymax; scr_rct.ymax= saction->area->winrct.ymin + saction->v2d.mask.ymax;
di= glaBegin2DDraw(&scr_rct, &G.v2d->cur); di= glaBegin2DDraw(&scr_rct, &G.v2d->cur);
ybase = key->totkey*(CHANNELHEIGHT+CHANNELSKIP); ybase = 0;
for (icu = key->ipo->curve.first; icu ; icu = icu->next) { for (icu = key->ipo->curve.first; icu ; icu = icu->next) {
int frame1_x, channel_y; int frame1_x, channel_y;
@@ -959,7 +959,7 @@ void drawactionspace(ScrArea *sa, void *spacedata)
if (G.v2d->cur.ymin < -CHANNELHEIGHT) if (G.v2d->cur.ymin < -CHANNELHEIGHT)
G.v2d->cur.ymin = -CHANNELHEIGHT; G.v2d->cur.ymin = -CHANNELHEIGHT;
maxymin = key->totkey*(CHANNELHEIGHT+CHANNELSKIP); maxymin = -(key->totkey*(CHANNELHEIGHT+CHANNELSKIP));
if (G.v2d->cur.ymin > maxymin) G.v2d->cur.ymin = maxymin; if (G.v2d->cur.ymin > maxymin) G.v2d->cur.ymin = maxymin;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -496,21 +496,40 @@ static int vis_edit_icu_bez(EditIpo *ei)
void select_ipo_bezier_keys(Ipo *ipo, int selectmode) void select_ipo_bezier_keys(Ipo *ipo, int selectmode)
{ {
/* Select all of the beziers in all /* Select all of the beziers in all
* of the Ipo curves belonging to the * of the Ipo curves belonging to the
* Ipo, using the selection mode. * Ipo, using the selection mode.
*/ */
switch (selectmode) { switch (selectmode) {
case SELECT_ADD: case SELECT_ADD:
ipo_keys_bezier_loop(ipo, select_bezier_add, NULL); ipo_keys_bezier_loop(ipo, select_bezier_add, NULL);
break; break;
case SELECT_SUBTRACT: case SELECT_SUBTRACT:
ipo_keys_bezier_loop(ipo, select_bezier_subtract, NULL); ipo_keys_bezier_loop(ipo, select_bezier_subtract, NULL);
break; break;
case SELECT_INVERT: case SELECT_INVERT:
ipo_keys_bezier_loop(ipo, select_bezier_invert, NULL); ipo_keys_bezier_loop(ipo, select_bezier_invert, NULL);
break; break;
} }
}
void select_icu_bezier_keys(IpoCurve *icu, int selectmode)
{
/* Select all of the beziers in all
* of the Ipo curves belonging to the
* Ipo, using the selection mode.
*/
switch (selectmode) {
case SELECT_ADD:
icu_keys_bezier_loop(icu, select_bezier_add, NULL);
break;
case SELECT_SUBTRACT:
icu_keys_bezier_loop(icu, select_bezier_subtract, NULL);
break;
case SELECT_INVERT:
icu_keys_bezier_loop(icu, select_bezier_invert, NULL);
break;
}
} }
void sethandles_ipo_keys(Ipo *ipo, int code) void sethandles_ipo_keys(Ipo *ipo, int code)

View File

@@ -2199,7 +2199,8 @@ void bake_all_to_action(void)
ob = get_object_from_active_strip(); ob = get_object_from_active_strip();
if (ob) { if (ob) {
if (ob->flag&OB_ARMATURE) { if (ob->flag&OB_ARMATURE) {
newAction = bake_obIPO_to_action(ob); //newAction = bake_obIPO_to_action(ob);
newAction = NULL;
if (newAction) { if (newAction) {
/* unlink the object's IPO */ /* unlink the object's IPO */
ipo=ob->ipo; ipo=ob->ipo;

View File

@@ -149,10 +149,7 @@ void do_action_buttons(unsigned short event)
{ {
Object *ob= OBACT; Object *ob= OBACT;
switch(event){ switch(event) {
case B_ACTBAKE:
bake_action_with_client(G.saction->action, ob, 0.01);
break;
case B_ACTHOME: case B_ACTHOME:
/* Find X extents */ /* Find X extents */
G.v2d->cur.xmin = 0; G.v2d->cur.xmin = 0;
@@ -362,6 +359,7 @@ static void do_action_selectmenu_columnmenu(void *arg, int event)
act = saction->action; act = saction->action;
key = get_action_mesh_key(); key = get_action_mesh_key();
#if 0 // actionrewite
if (event == ACTMENU_SEL_COLUMN_MARKERSBETWEEN) { if (event == ACTMENU_SEL_COLUMN_MARKERSBETWEEN) {
markers_selectkeys_between(); markers_selectkeys_between();
} }
@@ -373,6 +371,7 @@ static void do_action_selectmenu_columnmenu(void *arg, int event)
} }
else else
return; return;
#endif // actionrewite
allqueue(REDRAWTIME, 0); allqueue(REDRAWTIME, 0);
allqueue(REDRAWIPO, 0); allqueue(REDRAWIPO, 0);
@@ -422,12 +421,7 @@ static void do_action_selectmenu(void *arg, int event)
switch(event) switch(event)
{ {
case ACTMENU_SEL_BORDER: /* Border Select */ case ACTMENU_SEL_BORDER: /* Border Select */
if (act) { borderselect_action();
borderselect_action();
}
else if (key) {
borderselect_mesh(key);
}
break; break;
case ACTMENU_SEL_BORDERM: /* Border Select */ case ACTMENU_SEL_BORDERM: /* Border Select */
@@ -435,22 +429,14 @@ static void do_action_selectmenu(void *arg, int event)
break; break;
case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */ case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */
if (act) { deselect_action_keys(1, 1);
deselect_actionchannel_keys (act, 1, 1); allqueue (REDRAWACTION, 0);
allqueue (REDRAWACTION, 0); allqueue(REDRAWNLA, 0);
allqueue(REDRAWNLA, 0); allqueue (REDRAWIPO, 0);
allqueue (REDRAWIPO, 0);
}
else if (key) {
deselect_meshchannel_keys(key, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
}
break; break;
case ACTMENU_SEL_ALL_CHAN: /* Select/Deselect All Channels */ case ACTMENU_SEL_ALL_CHAN: /* Select/Deselect All Channels */
deselect_actionchannels(act, 1); deselect_action_channels(1);
allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWACTION, 0); allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
@@ -467,18 +453,10 @@ static void do_action_selectmenu(void *arg, int event)
break; break;
case ACTMENU_SEL_INVERSE_KEYS: /* invert selection status of keys */ case ACTMENU_SEL_INVERSE_KEYS: /* invert selection status of keys */
if (act) { deselect_action_keys(0, 2);
deselect_actionchannel_keys(act, 0, 2); allqueue (REDRAWACTION, 0);
allqueue (REDRAWACTION, 0); allqueue(REDRAWNLA, 0);
allqueue(REDRAWNLA, 0); allqueue (REDRAWIPO, 0);
allqueue (REDRAWIPO, 0);
}
else if (key) {
deselect_meshchannel_keys(key, 0, 2);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
}
break; break;
case ACTMENU_SEL_INVERSE_MARKERS: /* invert selection of markers */ case ACTMENU_SEL_INVERSE_MARKERS: /* invert selection of markers */
@@ -558,42 +536,17 @@ static uiBlock *action_selectmenu(void *arg_unused)
} }
static void do_action_keymenu_transformmenu(void *arg, int event) static void do_action_keymenu_transformmenu(void *arg, int event)
{ {
SpaceAction *saction;
bAction *act;
Key *key;
saction = curarea->spacedata.first;
if (!saction) return;
act = saction->action;
key = get_action_mesh_key();
switch (event) switch (event)
{ {
case ACTMENU_KEY_TRANSFORM_MOVE: case ACTMENU_KEY_TRANSFORM_MOVE:
if (act) { transform_action_keys('g', 0);
transform_actionchannel_keys ('g', 0);
}
else if (key) {
transform_meshchannel_keys('g', key);
}
break; break;
case ACTMENU_KEY_TRANSFORM_SCALE: case ACTMENU_KEY_TRANSFORM_SCALE:
if (act) { transform_action_keys ('s', 0);
transform_actionchannel_keys ('s', 0);
}
else if (key) {
transform_meshchannel_keys('s', key);
}
break; break;
case ACTMENU_KEY_TRANSFORM_SLIDE: case ACTMENU_KEY_TRANSFORM_SLIDE:
if (act) { transform_action_keys ('t', 0);
transform_actionchannel_keys ('t', 0);
}
else if (key) {
//transform_meshchannel_keys('t', key);
}
break; break;
} }
@@ -628,24 +581,9 @@ static uiBlock *action_keymenu_transformmenu(void *arg_unused)
static void do_action_keymenu_handlemenu(void *arg, int event) static void do_action_keymenu_handlemenu(void *arg, int event)
{ {
SpaceAction *saction;
bAction *act;
Key *key;
saction = curarea->spacedata.first;
if (!saction) return;
act = saction->action;
key = get_action_mesh_key();
switch (event) { switch (event) {
case ACTMENU_KEY_HANDLE_AUTO: case ACTMENU_KEY_HANDLE_AUTO:
if (act) { sethandles_action_keys(HD_AUTO);
sethandles_actionchannel_keys(HD_AUTO);
}
else if (key) {
sethandles_meshchannel_keys(HD_AUTO, key);
}
break; break;
case ACTMENU_KEY_HANDLE_ALIGN: case ACTMENU_KEY_HANDLE_ALIGN:
@@ -653,21 +591,11 @@ static void do_action_keymenu_handlemenu(void *arg, int event)
/* OK, this is kinda dumb, need to fix the /* OK, this is kinda dumb, need to fix the
* toggle crap in sethandles_ipo_keys() * toggle crap in sethandles_ipo_keys()
*/ */
if (act) { sethandles_action_keys(HD_ALIGN);
sethandles_actionchannel_keys(HD_ALIGN);
}
else if (key) {
sethandles_meshchannel_keys(HD_ALIGN, key);
}
break; break;
case ACTMENU_KEY_HANDLE_VECTOR: case ACTMENU_KEY_HANDLE_VECTOR:
if (act) { sethandles_action_keys(HD_VECT);
sethandles_actionchannel_keys(HD_VECT);
}
else if (key) {
sethandles_meshchannel_keys(HD_VECT, key);
}
break; break;
} }
} }
@@ -705,32 +633,16 @@ static uiBlock *action_keymenu_handlemenu(void *arg_unused)
static void do_action_keymenu_intpolmenu(void *arg, int event) static void do_action_keymenu_intpolmenu(void *arg, int event)
{ {
SpaceAction *saction;
bAction *act;
//Key *key;
saction = curarea->spacedata.first;
if (!saction) return;
act = saction->action;
//key = get_action_mesh_key();
switch(event) switch(event)
{ {
case ACTMENU_KEY_INTERP_CONST: case ACTMENU_KEY_INTERP_CONST:
if (act) action_set_ipo_flags(SET_IPO_CONSTANT);
set_ipotype_actionchannels(SET_IPO_CONSTANT);
//else if (key) /* todo */
break; break;
case ACTMENU_KEY_INTERP_LINEAR: case ACTMENU_KEY_INTERP_LINEAR:
if (act) action_set_ipo_flags(SET_IPO_LINEAR);
set_ipotype_actionchannels(SET_IPO_LINEAR);
//else if (key) /* todo */
break; break;
case ACTMENU_KEY_INTERP_BEZIER: case ACTMENU_KEY_INTERP_BEZIER:
if (act) action_set_ipo_flags(SET_IPO_BEZIER);
set_ipotype_actionchannels(SET_IPO_BEZIER);
//else if (key) /* todo */
break; break;
} }
@@ -767,37 +679,19 @@ static uiBlock *action_keymenu_intpolmenu(void *arg_unused)
static void do_action_keymenu_extendmenu(void *arg, int event) static void do_action_keymenu_extendmenu(void *arg, int event)
{ {
SpaceAction *saction;
bAction *act;
//Key *key;
saction = curarea->spacedata.first;
if (!saction) return;
act = saction->action;
//key = get_action_mesh_key();
switch(event) switch(event)
{ {
case ACTMENU_KEY_EXTEND_CONST: case ACTMENU_KEY_EXTEND_CONST:
if (act) action_set_ipo_flags(SET_EXTEND_CONSTANT);
set_extendtype_actionchannels(SET_EXTEND_CONSTANT);
//else if (key) /* todo */
break; break;
case ACTMENU_KEY_EXTEND_EXTRAPOLATION: case ACTMENU_KEY_EXTEND_EXTRAPOLATION:
if (act) action_set_ipo_flags(SET_EXTEND_EXTRAPOLATION);
set_extendtype_actionchannels(SET_EXTEND_EXTRAPOLATION);
//else if (key) /* todo */
break; break;
case ACTMENU_KEY_EXTEND_CYCLIC: case ACTMENU_KEY_EXTEND_CYCLIC:
if (act) action_set_ipo_flags(SET_EXTEND_CYCLIC);
set_extendtype_actionchannels(SET_EXTEND_CYCLIC);
//else if (key) /* todo */
break; break;
case ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION: case ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION:
if (act) action_set_ipo_flags(SET_EXTEND_CYCLICEXTRAPOLATION);
set_extendtype_actionchannels(SET_EXTEND_CYCLICEXTRAPOLATION);
//else if (key) /* todo */
break; break;
} }
@@ -900,7 +794,7 @@ static void do_action_keymenu_snapmenu(void *arg, int event)
case ACTMENU_KEY_SNAP_NEARFRAME: case ACTMENU_KEY_SNAP_NEARFRAME:
case ACTMENU_KEY_SNAP_CURFRAME: case ACTMENU_KEY_SNAP_CURFRAME:
case ACTMENU_KEY_SNAP_NEARMARK: case ACTMENU_KEY_SNAP_NEARMARK:
snap_keys_to_frame(event); snap_action_keys(event);
break; break;
} }
@@ -995,31 +889,13 @@ static void do_action_keymenu(void *arg, int event)
switch(event) switch(event)
{ {
case ACTMENU_KEY_DUPLICATE: case ACTMENU_KEY_DUPLICATE:
if (act) { duplicate_action_keys();
duplicate_actionchannel_keys();
remake_action_ipos(act);
}
else if (key) {
duplicate_meshchannel_keys(key);
}
break; break;
case ACTMENU_KEY_DELETE: case ACTMENU_KEY_DELETE:
if (act) { delete_action_keys ();
delete_actionchannel_keys ();
}
else if (key) {
delete_meshchannel_keys(key);
}
break;
case ACTMENU_KEY_BAKE:
bake_action_with_client(G.saction->action, OBACT, 0.01);
break; break;
case ACTMENU_KEY_CLEAN: case ACTMENU_KEY_CLEAN:
if (act) clean_action();
clean_actionchannels(act);
else if (key)
clean_shapekeys(key);
break; break;
} }
} }
@@ -1062,11 +938,6 @@ static uiBlock *action_keymenu(void *arg_unused)
"Clean Action|O", 0, yco-=20, "Clean Action|O", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0, menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_KEY_CLEAN, ""); ACTMENU_KEY_CLEAN, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Bake Action to Ipo Keys", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_KEY_BAKE, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, uiDefBut(block, SEPR, 0, "", 0, yco-=6,
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -1261,16 +1132,6 @@ void action_buttons(void)
from, &(G.saction->actnr), B_ACTALONE, from, &(G.saction->actnr), B_ACTALONE,
B_ACTLOCAL, B_ACTIONDELETE, 0, 0); B_ACTLOCAL, B_ACTIONDELETE, 0, 0);
/* Draw action baker */
xco+= 8;
uiDefBut(block, BUT, B_ACTBAKE,
"Bake", xco, 0, 64, YIC, 0, 0, 0, 0, 0,
"Create an action with the constraint effects "
"converted into Ipo keys");
xco+=64;
uiClearButLock(); uiClearButLock();
/* draw AUTOSNAP */ /* draw AUTOSNAP */