Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-05-10 10:51:08 +0400
committerJoshua Leung <aligorith@gmail.com>2007-05-10 10:51:08 +0400
commit3c0348589cf591da6a0e23fbab5e93e52665b916 (patch)
tree9f191f194eaccdf6b91b52802c0c774a893b8d53
parent85b0997d900266cd444431df36ecd64b07efbea0 (diff)
Bugfix #6674:
Action Editor: editing of action-channel keys is impossible if shapekeys are present for that object. Also, after toggling the 'swimmer' icon in the IPO editor header,on and then off again, then trying to expand/collapse/select/deselect the 'Shape' action channel, Blender would crash. Not really a showstopper, but still nice to fix. ;-)
-rw-r--r--source/blender/src/editaction.c234
-rw-r--r--source/blender/src/editipo_mods.c8
-rw-r--r--source/blender/src/header_action.c231
3 files changed, 234 insertions, 239 deletions
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 5af14219668..ea6e65c8ce9 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -356,7 +356,7 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_
if(VISIBLE_ACHAN(achan)) {
if (clickmax < 0)
break;
- if (clickmin <= 0) {
+ if ((clickmin <= 0) && (achan->ipo)) {
/* found level - action channel */
icu= get_nearest_icu_key(achan->ipo->curve.first, selx, sel, xrange);
@@ -422,7 +422,7 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_
for (conchan= achan->constraintChannels.first; conchan; conchan=conchan->next) {
if (clickmax < 0)
break;
- if (clickmin <= 0) {
+ if ((clickmin <= 0) && (conchan->ipo)) {
/* found match - constraint channel */
icu= get_nearest_icu_key(conchan->ipo->curve.first, selx, sel, xrange);
@@ -581,8 +581,8 @@ void column_select_shapekeys(Key *key, int mode)
}
/* loop through all of the keys and select additional keyframes
- * based on the keys found to be selected above
- */
+ * based on the keys found to be selected above
+ */
for(ce= elems.first; ce; ce= ce->next) {
for (icu = key->ipo->curve.first; icu ; icu = icu->next) {
BezTriple *bezt= icu->bezt;
@@ -1703,7 +1703,7 @@ void deselect_actionchannels (bAction *act, int test)
}
if (sel) {
if (EXPANDED_ACHAN(achan)) {
- if (FILTER_IPO_ACHAN(achan)) {
+ if (FILTER_IPO_ACHAN(achan) && (achan->ipo)) {
for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
if (SEL_ICU(icu)) {
sel= 0;
@@ -1739,7 +1739,7 @@ void deselect_actionchannels (bAction *act, int test)
achan->flag &= ~ACHAN_SELECTED;
if (EXPANDED_ACHAN(achan)) {
- if (FILTER_IPO_ACHAN(achan)) {
+ if (FILTER_IPO_ACHAN(achan) && (achan->ipo)) {
for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
if (sel)
icu->flag |= IPO_SELECT;
@@ -2578,13 +2578,13 @@ void snap_keys_to_frame(int snap_mode)
}
/* snap to frame */
- if (key) {
- set_snap_meshchannels(key, snap_mode);
- }
- else if (act) {
+ if (act) {
set_snap_actionchannels(act, snap_mode);
remake_action_ipos (act);
}
+ else if (key) {
+ set_snap_meshchannels(key, snap_mode);
+ }
BIF_undo_push(str);
allspace(REMAKEIPO, 0);
@@ -2680,13 +2680,13 @@ void mirror_action_keys(short mirror_mode)
}
/* mirror */
- if (key) {
- mirror_meshchannels(key, mirror_mode);
- }
- else if (act) {
+ if (act) {
mirror_actionchannels(act, mirror_mode);
remake_action_ipos (act);
}
+ else if (key) {
+ mirror_meshchannels(key, mirror_mode);
+ }
BIF_undo_push(str);
allspace(REMAKEIPO, 0);
@@ -3064,17 +3064,20 @@ static void numbuts_action(void)
{
/* now called from action window event loop, plus reacts on mouseclick */
/* removed Hos grunts for that reason! :) (ton) */
- Key *key;
+ bAction *act;
+ Key *key;
short mval[2];
key = get_action_mesh_key();
+ act = G.saction->action;
+
getmouseco_areawin (mval);
if (mval[0] < NAMEWIDTH) {
- if (key)
- clever_keyblock_names(key, mval);
- else
+ if (act)
clever_achannel_names(mval);
+ else if (key)
+ clever_keyblock_names(key, mval);
}
}
@@ -3099,6 +3102,8 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
return;
act=saction->action;
+ key = get_action_mesh_key();
+
if (val) {
if ( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
@@ -3114,9 +3119,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
getmouseco_areawin(mval);
-
- key = get_action_mesh_key();
-
+
switch(event) {
case UI_BUT_EVENT:
do_actionbuts(val); // window itself
@@ -3127,13 +3130,17 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case AKEY:
- if (key) {
- if (mval[0]<ACTWIDTH){
- /* to do ??? */
+ if (act) {
+ if (mval[0]<NAMEWIDTH) {
+ deselect_actionchannels (act, 1);
+ allqueue (REDRAWVIEW3D, 0);
+ allqueue (REDRAWACTION, 0);
+ allqueue(REDRAWNLA, 0);
+ allqueue (REDRAWIPO, 0);
}
- else {
+ else if (mval[0]>ACTWIDTH) {
if (G.qual == LR_CTRLKEY) {
- deselect_markers(1, 0);
+ deselect_markers (1, 0);
allqueue(REDRAWTIME, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWACTION, 0);
@@ -3141,24 +3148,20 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
allqueue(REDRAWSOUND, 0);
}
else {
- deselect_meshchannel_keys(key, 1, 1);
+ deselect_actionchannel_keys (act, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
}
}
}
- else {
- if (mval[0]<NAMEWIDTH) {
- deselect_actionchannels (act, 1);
- allqueue (REDRAWVIEW3D, 0);
- allqueue (REDRAWACTION, 0);
- allqueue(REDRAWNLA, 0);
- allqueue (REDRAWIPO, 0);
+ else if (key) {
+ if (mval[0]<ACTWIDTH) {
+ /* to do ??? */
}
- else if (mval[0]>ACTWIDTH) {
+ else {
if (G.qual == LR_CTRLKEY) {
- deselect_markers (1, 0);
+ deselect_markers(1, 0);
allqueue(REDRAWTIME, 0);
allqueue(REDRAWIPO, 0);
allqueue(REDRAWACTION, 0);
@@ -3166,7 +3169,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
allqueue(REDRAWSOUND, 0);
}
else {
- deselect_actionchannel_keys (act, 1, 1);
+ deselect_meshchannel_keys(key, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
@@ -3178,25 +3181,16 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case BKEY:
if (G.qual & LR_CTRLKEY)
borderselect_markers();
- else if (key) {
- if (mval[0]<ACTWIDTH) {
- /* to do?? */
- }
- else {
- borderselect_mesh(key);
- }
- }
- else {
+ else if (act) {
/* If the border select is initiated in the
* part of the action window where the channel
* names reside, then select the channels
*/
- if (mval[0]<NAMEWIDTH){
+ if (mval[0]<NAMEWIDTH) {
borderselect_function(borderselect_actionchannels);
BIF_undo_push("Select Action");
}
- else if (mval[0]>ACTWIDTH){
-
+ else if (mval[0]>ACTWIDTH) {
/* If the border select is initiated in the
* vertical scrollbar, then (de)select all keys
* for the channels in the selection region
@@ -3212,14 +3206,21 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if (IN_2D_HORIZ_SCROLL(mval)) {
borderselect_function(select_all_keys_frames);
}
-
- /* Other wise, select the action keys
- */
+
+ /* Other wise, select the action keys */
else {
borderselect_action();
}
}
}
+ else if (key) {
+ if (mval[0]<ACTWIDTH) {
+ /* to do?? */
+ }
+ else {
+ borderselect_mesh(key);
+ }
+ }
break;
case CKEY:
@@ -3235,13 +3236,13 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
duplicate_marker();
}
else if (G.qual == LR_SHIFTKEY) {
- if (key) {
- duplicate_meshchannel_keys(key);
- }
- else if (act) {
+ if (act) {
duplicate_actionchannel_keys();
remake_action_ipos(act);
}
+ else if (key) {
+ duplicate_meshchannel_keys(key);
+ }
}
}
break;
@@ -3252,31 +3253,31 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
else {
if (mval[0]>=ACTWIDTH) {
- if (key) {
- transform_meshchannel_keys('g', key);
- }
- else if (act) {
+ if (act) {
transform_actionchannel_keys ('g', 0);
}
+ else if (key) {
+ transform_meshchannel_keys('g', key);
+ }
}
}
break;
-
+
case HKEY:
if(G.qual & LR_SHIFTKEY) {
if(okee("Set Keys to Auto Handle")) {
- if (key)
- sethandles_meshchannel_keys(HD_AUTO, key);
- else
+ if (act)
sethandles_actionchannel_keys(HD_AUTO);
+ else if (key)
+ sethandles_meshchannel_keys(HD_AUTO, key);
}
}
else {
if(okee("Toggle Keys Aligned Handle")) {
- if (key)
- sethandles_meshchannel_keys(HD_ALIGN, key);
- else
+ if (act)
sethandles_actionchannel_keys(HD_ALIGN);
+ else if (key)
+ sethandles_meshchannel_keys(HD_ALIGN, key);
}
}
break;
@@ -3288,10 +3289,10 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else {
val= (G.qual & LR_SHIFTKEY) ? 2 : 1;
- if(key)
- column_select_shapekeys(key, val);
- else if(act)
+ if (act)
column_select_actionkeys(act, val);
+ else if (key)
+ column_select_shapekeys(key, val);
}
allqueue(REDRAWTIME, 0);
@@ -3333,10 +3334,10 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case OKEY:
- if(key)
- clean_shapekeys(key);
- else if(act)
+ if(act)
clean_actionchannels(act);
+ else if(key)
+ clean_shapekeys(key);
break;
case PKEY:
@@ -3358,42 +3359,35 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
snap_keys_to_frame(val);
}
else {
- if (key)
- transform_meshchannel_keys('s', key);
- else if (act)
+ if (act)
transform_actionchannel_keys ('s', 0);
+ else if (key)
+ transform_meshchannel_keys('s', key);
}
}
break;
-
- /*** set the Ipo type ***/
+
case TKEY:
- if (key) {
- /* to do */
- }
- else {
+ if (act) {
if(G.qual & LR_SHIFTKEY)
set_ipotype_actionchannels(SET_IPO_POPUP);
else
transform_actionchannel_keys ('t', 0);
}
+ /* else if (key) {} ... todo */
break;
case VKEY:
if(okee("Set Keys to Vector Handle")) {
- if (key)
- sethandles_meshchannel_keys(HD_VECT, key);
- else
+ if (act)
sethandles_actionchannel_keys(HD_VECT);
+ else if (key)
+ sethandles_meshchannel_keys(HD_VECT, key);
}
break;
case PAGEUPKEY:
- if (key) {
- /* only jump to markers possible (key channels can't be moved yet) */
- nextprev_marker(1);
- }
- else {
+ if (act) {
if(G.qual & LR_SHIFTKEY)
top_sel_action();
else if (G.qual & LR_CTRLKEY)
@@ -3401,13 +3395,13 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else
nextprev_marker(1);
}
- break;
- case PAGEDOWNKEY:
- if (key) {
+ else if (key) {
/* only jump to markers possible (key channels can't be moved yet) */
- nextprev_marker(-1);
+ nextprev_marker(1);
}
- else {
+ break;
+ case PAGEDOWNKEY:
+ if (act) {
if(G.qual & LR_SHIFTKEY)
bottom_sel_action();
else if (G.qual & LR_CTRLKEY)
@@ -3415,19 +3409,24 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else
nextprev_marker(-1);
}
+ else if (key) {
+ /* only jump to markers possible (key channels can't be moved yet) */
+ nextprev_marker(-1);
+ }
break;
+
case DELKEY:
case XKEY:
if (okee("Erase selected")) {
- if (key) {
- delete_meshchannel_keys(key);
- }
- else {
+ if (act) {
if (mval[0]<NAMEWIDTH)
delete_actionchannels();
else
delete_actionchannel_keys();
}
+ else if (key) {
+ delete_meshchannel_keys(key);
+ }
if (mval[0] >= NAMEWIDTH)
remove_marker();
@@ -3439,6 +3438,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
allqueue(REDRAWSOUND, 0);
}
break;
+
/* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above,
* based on user preference USER_LMOUSESELECT
*/
@@ -3504,17 +3504,17 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
* selects keys and markers
*/
else {
- if (key) {
+ if (act) {
if(G.qual & LR_SHIFTKEY)
- mouse_mesh_action(SELECT_INVERT, key);
+ mouse_action(SELECT_INVERT);
else
- mouse_mesh_action(SELECT_REPLACE, key);
+ mouse_action(SELECT_REPLACE);
}
- else {
+ else if (key) {
if(G.qual & LR_SHIFTKEY)
- mouse_action(SELECT_INVERT);
+ mouse_mesh_action(SELECT_INVERT, key);
else
- mouse_action(SELECT_REPLACE);
+ mouse_mesh_action(SELECT_REPLACE, key);
}
}
}
@@ -3577,7 +3577,8 @@ Key *get_action_mesh_key(void)
return NULL;
}
-int get_nearest_key_num(Key *key, short *mval, float *x) {
+int get_nearest_key_num(Key *key, short *mval, float *x)
+{
/* returns the key num that cooresponds to the
* y value of the mouse click. Does not check
* if this is a valid keynum. Also gives the Ipo
@@ -3734,11 +3735,7 @@ void markers_selectkeys_between(void)
key = get_action_mesh_key();
/* select keys in-between */
- if (key) {
- if (key->ipo)
- borderselect_ipo_key(key->ipo, min, max, SELECT_ADD);
- }
- else if (act) {
+ if (act) {
bActionChannel *achan;
bConstraintChannel *conchan;
@@ -3771,6 +3768,10 @@ void markers_selectkeys_between(void)
}
}
}
+ else if (key) {
+ if (key->ipo)
+ borderselect_ipo_key(key->ipo, min, max, SELECT_ADD);
+ }
}
/* ************************************* Action Channel Ordering *********************************** */
@@ -3841,8 +3842,7 @@ void up_sel_action()
achan->flag = achan->flag & ~ACHAN_MOVED;
}
- /* Clean up and redraw stuff
- */
+ /* Clean up and redraw stuff */
remake_action_ipos (act);
BIF_undo_push("Up Action channel");
allspace(REMAKEIPO, 0);
@@ -3887,8 +3887,7 @@ void down_sel_action()
achan->flag = achan->flag & ~ACHAN_MOVED;
}
- /* Clean up and redraw stuff
- */
+ /* Clean up and redraw stuff */
remake_action_ipos (act);
BIF_undo_push("Down Action channel");
allspace(REMAKEIPO, 0);
@@ -3922,8 +3921,7 @@ void bottom_sel_action()
achan->flag = achan->flag & ~ACHAN_MOVED;
}
- /* Clean up and redraw stuff
- */
+ /* Clean up and redraw stuff */
remake_action_ipos (act);
BIF_undo_push("Bottom Action channel");
allspace(REMAKEIPO, 0);
@@ -3946,7 +3944,7 @@ void world2bonespace(float boneSpaceMat[][4], float worldSpace[][4], float restP
Mat4MulMat4(boneSpaceMat, restPos, t2mat);
}
-bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
+bAction *bake_action_with_client (bAction *act, Object *armob, float tolerance)
{
bArmature *arm;
bAction *result=NULL;
diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c
index 9de9016253c..fe88d2da3c0 100644
--- a/source/blender/src/editipo_mods.c
+++ b/source/blender/src/editipo_mods.c
@@ -1182,8 +1182,8 @@ void borderselect_icu_key(IpoCurve *icu, float xmin, float xmax,
void borderselect_ipo_key(Ipo *ipo, float xmin, float xmax, int selectmode)
{
/* Selects all bezier triples in each Ipocurve of the
- * Ipo between times xmin and xmax, using the selection mode.
- */
+ * Ipo between times xmin and xmax, using the selection mode.
+ */
IpoCurve *icu;
int (*select_function)(BezTriple *);
@@ -1193,8 +1193,8 @@ void borderselect_ipo_key(Ipo *ipo, float xmin, float xmax, int selectmode)
return;
/* Set the selection function based on the
- * selection mode.
- */
+ * selection mode.
+ */
switch(selectmode) {
case SELECT_ADD:
select_function = select_bezier_add;
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index a7fbbcf3969..ee2bb71d9e1 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -150,24 +150,18 @@ void do_action_buttons(unsigned short event)
switch(event){
case B_ACTBAKE:
- bake_action_with_client (G.saction->action, ob, 0.01);
+ bake_action_with_client(G.saction->action, ob, 0.01);
break;
case B_ACTHOME:
- // Find X extents
- //v2d= &(G.saction->v2d);
-
+ /* Find X extents */
G.v2d->cur.xmin = 0;
G.v2d->cur.ymin=-SCROLLB;
- if (!G.saction->action){ // here the mesh rvk?
- G.v2d->cur.xmax= -5;
- G.v2d->cur.xmax= 100;
- }
- else {
+ if (G.saction->action) {
float extra;
calc_action_range(G.saction->action, &G.v2d->cur.xmin, &G.v2d->cur.xmax, 0);
- if(G.saction->pin==0 && ob) {
+ if (G.saction->pin==0 && ob) {
G.v2d->cur.xmin= get_action_frame_inv(ob, G.v2d->cur.xmin);
G.v2d->cur.xmax= get_action_frame_inv(ob, G.v2d->cur.xmax);
}
@@ -175,11 +169,15 @@ void do_action_buttons(unsigned short event)
G.v2d->cur.xmin-= extra;
G.v2d->cur.xmax+= extra;
- if(G.v2d->cur.xmin==G.v2d->cur.xmax) {
+ if (G.v2d->cur.xmin==G.v2d->cur.xmax) {
G.v2d->cur.xmax= -5;
G.v2d->cur.xmax= 100;
}
}
+ else { /* shapekeys and/or no action */
+ G.v2d->cur.xmax= -5;
+ G.v2d->cur.xmax= 100;
+ }
G.v2d->cur.ymin= 0.0f;
G.v2d->cur.ymax= 1000.0f;
@@ -204,19 +202,17 @@ void do_action_buttons(unsigned short event)
break;
case B_ACTPIN: /* __PINFAKE */
-/* if (G.saction->flag & SACTION_PIN){
- if (G.saction->action)
- G.saction->action->id.us ++;
-
+/* if (G.saction->flag & SACTION_PIN) {
+ if (G.saction->action)
+ G.saction->action->id.us ++;
}
else {
if (G.saction->action)
G.saction->action->id.us --;
- }
+ }
*/ /* end PINFAKE */
allqueue(REDRAWACTION, 1);
break;
-
}
}
@@ -356,18 +352,20 @@ static void do_action_selectmenu_columnmenu(void *arg, int event)
bAction *act;
Key *key;
- saction= curarea->spacedata.first;
- act=saction->action;
+ saction = curarea->spacedata.first;
+ if (!saction) return;
+
+ act = saction->action;
key = get_action_mesh_key();
if (event == ACTMENU_SEL_COLUMN_MARKERSBETWEEN) {
markers_selectkeys_between();
}
else if (ELEM(event, ACTMENU_SEL_COLUMN_KEYS, ACTMENU_SEL_COLUMN_MARKERSCOLUMN)) {
- if (key)
- column_select_shapekeys(key, event);
- else if (act)
+ if (act)
column_select_actionkeys(act, event);
+ else if (key)
+ column_select_shapekeys(key, event);
}
else
return;
@@ -412,8 +410,7 @@ static void do_action_selectmenu(void *arg, int event)
Key *key;
saction = curarea->spacedata.first;
- if (!saction)
- return;
+ if (!saction) return;
act = saction->action;
key = get_action_mesh_key();
@@ -421,12 +418,12 @@ static void do_action_selectmenu(void *arg, int event)
switch(event)
{
case ACTMENU_SEL_BORDER: /* Border Select */
- if (key) {
- borderselect_mesh(key);
- }
- else {
+ if (act) {
borderselect_action();
}
+ else if (key) {
+ borderselect_mesh(key);
+ }
break;
case ACTMENU_SEL_BORDERM: /* Border Select */
@@ -434,14 +431,14 @@ static void do_action_selectmenu(void *arg, int event)
break;
case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */
- if (key) {
- deselect_meshchannel_keys(key, 1, 1);
+ if (act) {
+ deselect_actionchannel_keys (act, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
}
- else {
- deselect_actionchannel_keys (act, 1, 1);
+ else if (key) {
+ deselect_meshchannel_keys(key, 1, 1);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
@@ -449,7 +446,7 @@ static void do_action_selectmenu(void *arg, int event)
break;
case ACTMENU_SEL_ALL_CHAN: /* Select/Deselect All Channels */
- deselect_actionchannels (act, 1);
+ deselect_actionchannels(act, 1);
allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
@@ -466,14 +463,14 @@ static void do_action_selectmenu(void *arg, int event)
break;
case ACTMENU_SEL_INVERSE_KEYS: /* invert selection status of keys */
- if (key) {
- deselect_meshchannel_keys(key, 0, 2);
+ if (act) {
+ deselect_actionchannel_keys(act, 0, 2);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
}
- else {
- deselect_actionchannel_keys (act, 0, 2);
+ else if (key) {
+ deselect_meshchannel_keys(key, 0, 2);
allqueue (REDRAWACTION, 0);
allqueue(REDRAWNLA, 0);
allqueue (REDRAWIPO, 0);
@@ -562,36 +559,37 @@ static void do_action_keymenu_transformmenu(void *arg, int event)
bAction *act;
Key *key;
+ saction = curarea->spacedata.first;
+ if (!saction) return;
+
+ act = saction->action;
key = get_action_mesh_key();
- saction= curarea->spacedata.first;
- act=saction->action;
-
- switch(event)
+ switch (event)
{
case ACTMENU_KEY_TRANSFORM_MOVE:
- if (key) {
- transform_meshchannel_keys('g', key);
- }
- else if (act) {
+ if (act) {
transform_actionchannel_keys ('g', 0);
}
+ else if (key) {
+ transform_meshchannel_keys('g', key);
+ }
break;
case ACTMENU_KEY_TRANSFORM_SCALE:
- if (key) {
- transform_meshchannel_keys('s', key);
- }
- else if (act) {
+ if (act) {
transform_actionchannel_keys ('s', 0);
}
+ else if (key) {
+ transform_meshchannel_keys('s', key);
+ }
break;
case ACTMENU_KEY_TRANSFORM_SLIDE:
- if (key) {
- //transform_meshchannel_keys('t', key);
- }
- else if (act) {
+ if (act) {
transform_actionchannel_keys ('t', 0);
}
+ else if (key) {
+ //transform_meshchannel_keys('t', key);
+ }
break;
}
@@ -626,17 +624,24 @@ static uiBlock *action_keymenu_transformmenu(void *arg_unused)
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:
- if (key) {
- sethandles_meshchannel_keys(HD_AUTO, key);
- } else {
+ if (act) {
sethandles_actionchannel_keys(HD_AUTO);
}
+ else if (key) {
+ sethandles_meshchannel_keys(HD_AUTO, key);
+ }
break;
case ACTMENU_KEY_HANDLE_ALIGN:
@@ -644,19 +649,21 @@ static void do_action_keymenu_handlemenu(void *arg, int event)
/* OK, this is kinda dumb, need to fix the
* toggle crap in sethandles_ipo_keys()
*/
- if (key) {
- sethandles_meshchannel_keys(HD_ALIGN, key);
- } else {
+ if (act) {
sethandles_actionchannel_keys(HD_ALIGN);
}
+ else if (key) {
+ sethandles_meshchannel_keys(HD_ALIGN, key);
+ }
break;
case ACTMENU_KEY_HANDLE_VECTOR:
- if (key) {
- sethandles_meshchannel_keys(HD_VECT, key);
- } else {
+ if (act) {
sethandles_actionchannel_keys(HD_VECT);
}
+ else if (key) {
+ sethandles_meshchannel_keys(HD_VECT, key);
+ }
break;
}
}
@@ -694,35 +701,32 @@ static uiBlock *action_keymenu_handlemenu(void *arg_unused)
static void do_action_keymenu_intpolmenu(void *arg, int event)
{
- Key *key;
+ SpaceAction *saction;
+ bAction *act;
+ //Key *key;
+
+ saction = curarea->spacedata.first;
+ if (!saction) return;
- key = get_action_mesh_key();
+ act = saction->action;
+ //key = get_action_mesh_key();
switch(event)
{
case ACTMENU_KEY_INTERP_CONST:
- if (key) {
- /* to do */
- }
- else {
+ if (act)
set_ipotype_actionchannels(SET_IPO_CONSTANT);
- }
+ //else if (key) /* todo */
break;
case ACTMENU_KEY_INTERP_LINEAR:
- if (key) {
- /* to do */
- }
- else {
+ if (act)
set_ipotype_actionchannels(SET_IPO_LINEAR);
- }
+ //else if (key) /* todo */
break;
case ACTMENU_KEY_INTERP_BEZIER:
- if (key) {
- /* to do */
- }
- else {
+ if (act)
set_ipotype_actionchannels(SET_IPO_BEZIER);
- }
+ //else if (key) /* todo */
break;
}
@@ -759,43 +763,37 @@ static uiBlock *action_keymenu_intpolmenu(void *arg_unused)
static void do_action_keymenu_extendmenu(void *arg, int event)
{
- Key *key;
+ SpaceAction *saction;
+ bAction *act;
+ //Key *key;
+
+ saction = curarea->spacedata.first;
+ if (!saction) return;
- key = get_action_mesh_key();
+ act = saction->action;
+ //key = get_action_mesh_key();
switch(event)
{
case ACTMENU_KEY_EXTEND_CONST:
- if (key) {
- /* to do */
- }
- else {
+ if (act)
set_extendtype_actionchannels(SET_EXTEND_CONSTANT);
- }
+ //else if (key) /* todo */
break;
case ACTMENU_KEY_EXTEND_EXTRAPOLATION:
- if (key) {
- /* to do */
- }
- else {
+ if (act)
set_extendtype_actionchannels(SET_EXTEND_EXTRAPOLATION);
- }
+ //else if (key) /* todo */
break;
case ACTMENU_KEY_EXTEND_CYCLIC:
- if (key) {
- /* to do */
- }
- else {
+ if (act)
set_extendtype_actionchannels(SET_EXTEND_CYCLIC);
- }
+ //else if (key) /* todo */
break;
case ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION:
- if (key) {
- /* to do */
- }
- else {
+ if (act)
set_extendtype_actionchannels(SET_EXTEND_CYCLICEXTRAPOLATION);
- }
+ //else if (key) /* todo */
break;
}
@@ -984,9 +982,8 @@ static void do_action_keymenu(void *arg, int event)
bAction *act;
Key *key;
- saction= curarea->spacedata.first;
- if (!saction)
- return;
+ saction = curarea->spacedata.first;
+ if (!saction) return;
act = saction->action;
key = get_action_mesh_key();
@@ -994,31 +991,31 @@ static void do_action_keymenu(void *arg, int event)
switch(event)
{
case ACTMENU_KEY_DUPLICATE:
- if (key) {
- duplicate_meshchannel_keys(key);
- }
- else if (act) {
+ if (act) {
duplicate_actionchannel_keys();
remake_action_ipos(act);
}
+ else if (key) {
+ duplicate_meshchannel_keys(key);
+ }
break;
case ACTMENU_KEY_DELETE:
- if (key) {
- delete_meshchannel_keys(key);
- }
- else if (act) {
+ if (act) {
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);
+ bake_action_with_client(G.saction->action, OBACT, 0.01);
break;
case ACTMENU_KEY_CLEAN:
- if (key)
- clean_shapekeys(key);
- else if (act)
+ if (act)
clean_actionchannels(act);
+ else if (key)
+ clean_shapekeys(key);
break;
}
}