[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11782] trunk/blender/source/blender: Bugfix #7083:
Joshua Leung
aligorith at gmail.com
Wed Aug 22 10:52:57 CEST 2007
Revision: 11782
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11782
Author: aligorith
Date: 2007-08-22 10:52:57 +0200 (Wed, 22 Aug 2007)
Log Message:
-----------
Bugfix #7083:
The menu entries for changing Interpolation and Extrapolation modes in the Action Editor weren't working properly (at all).
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_editaction.h
trunk/blender/source/blender/src/editaction.c
trunk/blender/source/blender/src/editipo_mods.c
trunk/blender/source/blender/src/header_action.c
Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h 2007-08-22 06:26:37 UTC (rev 11781)
+++ trunk/blender/source/blender/include/BIF_editaction.h 2007-08-22 08:52:57 UTC (rev 11782)
@@ -25,7 +25,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): 2007, Joshua Leung, Action Editor Recode
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -41,14 +41,16 @@
#define ACTWIDTH (G.saction->actwidth)
/* Some types for easier type-testing */
-#define ACTTYPE_NONE 0
-#define ACTTYPE_ACHAN 1
-#define ACTTYPE_CONCHAN 2
-#define ACTTYPE_ICU 3
-#define ACTTYPE_FILLIPO 4
-#define ACTTYPE_FILLCON 5
-#define ACTTYPE_IPO 6
-#define ACTTYPE_SHAPEKEY 7
+enum {
+ ACTTYPE_NONE= 0,
+ ACTTYPE_ACHAN,
+ ACTTYPE_CONCHAN,
+ ACTTYPE_ICU,
+ ACTTYPE_FILLIPO,
+ ACTTYPE_FILLCON,
+ ACTTYPE_IPO,
+ ACTTYPE_SHAPEKEY
+};
/* Macros for easier/more consistant state testing */
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
@@ -68,17 +70,27 @@
#define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname)
/* 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
+enum {
+ SET_IPO_MENU = -1,
+ SET_IPO_POPUP = 0,
+
+ SET_IPO_CONSTANT,
+ SET_IPO_LINEAR,
+ SET_IPO_BEZIER,
+};
+
/* 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
+enum {
+
+ SET_EXTEND_MENU = 9,
+ SET_EXTEND_POPUP = 10,
+
+ SET_EXTEND_CONSTANT,
+ SET_EXTEND_EXTRAPOLATION,
+ SET_EXTEND_CYCLIC,
+ SET_EXTEND_CYCLICEXTRAPOLATION
+};
struct bAction;
struct bActionChannel;
@@ -112,7 +124,7 @@
/* IPO/Handle Types */
void sethandles_action_keys(int code);
-void action_set_ipo_flags(int mode);
+void action_set_ipo_flags(short mode, short event);
/* Select */
void borderselect_action(void);
@@ -122,7 +134,7 @@
int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode);
void select_actionchannel_by_name (struct bAction *act, char *name, int select);
-/* */
+/* ShapeKey stuff */
struct Key *get_action_mesh_key(void);
int get_nearest_key_num(struct Key *key, short *mval, float *x);
void *get_nearest_act_channel(short mval[], short *ret_type);
Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c 2007-08-22 06:26:37 UTC (rev 11781)
+++ trunk/blender/source/blender/src/editaction.c 2007-08-22 08:52:57 UTC (rev 11782)
@@ -1507,13 +1507,13 @@
/* this function combines several features related to setting
* various ipo extrapolation/interpolation
*/
-void action_set_ipo_flags (int mode)
+void action_set_ipo_flags (short mode, short event)
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
void *data;
short datatype;
- int filter, event;
+ int filter;
/* determine what type of data we are operating on */
data = get_action_context(&datatype);
@@ -1530,7 +1530,7 @@
"Extrapolation %x12|"
"Cyclic %x13|"
"Cyclic extrapolation %x14");
- if(event < 1) return;
+ if (event < 1) return;
}
break;
case SET_IPO_POPUP:
@@ -1541,16 +1541,20 @@
"Constant %x1|"
"Linear %x2|"
"Bezier %x3");
- if(event < 1) return;
+ if (event < 1) return;
}
break;
+ case SET_IPO_MENU: /* called from menus */
+ case SET_EXTEND_MENU:
+ break;
+
default: /* weird, unhandled case */
return;
}
/* filter data */
- filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
+ filter= (ACTFILTER_VISIBLE | ACTFILTER_SEL | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
actdata_filter(&act_data, filter, data, datatype);
/* loop through setting flags */
@@ -1560,6 +1564,7 @@
/* depending on the mode */
switch (mode) {
case SET_EXTEND_POPUP: /* extrapolation */
+ case SET_EXTEND_MENU:
{
switch (event) {
case SET_EXTEND_CONSTANT:
@@ -1578,6 +1583,7 @@
}
break;
case SET_IPO_POPUP: /* interpolation */
+ case SET_IPO_MENU:
{
setipotype_ipo(ipo, event);
}
@@ -2824,7 +2830,7 @@
short val= evt->val;
short mousebut = L_MOUSE;
- if(curarea->win==0) return;
+ if (curarea->win==0) return;
saction= curarea->spacedata.first;
if (!saction)
@@ -3020,7 +3026,7 @@
case TKEY:
if (G.qual & LR_SHIFTKEY)
- action_set_ipo_flags(SET_IPO_POPUP);
+ action_set_ipo_flags(SET_IPO_POPUP, 0);
else if (G.qual & LR_CTRLKEY) {
val= pupmenu("Time value%t|Frames %x1|Seconds%x2");
Modified: trunk/blender/source/blender/src/editipo_mods.c
===================================================================
--- trunk/blender/source/blender/src/editipo_mods.c 2007-08-22 06:26:37 UTC (rev 11781)
+++ trunk/blender/source/blender/src/editipo_mods.c 2007-08-22 08:52:57 UTC (rev 11782)
@@ -872,9 +872,8 @@
void setexprap_ipoloop(Ipo *ipo, int code)
{
IpoCurve *icu;
-
- /* Loop through each curve in the Ipo
- */
+
+ /* Loop through each curve in the Ipo */
for (icu=ipo->curve.first; icu; icu=icu->next)
icu->extrap= code;
}
Modified: trunk/blender/source/blender/src/header_action.c
===================================================================
--- trunk/blender/source/blender/src/header_action.c 2007-08-22 06:26:37 UTC (rev 11781)
+++ trunk/blender/source/blender/src/header_action.c 2007-08-22 08:52:57 UTC (rev 11782)
@@ -682,13 +682,13 @@
switch(event)
{
case ACTMENU_KEY_INTERP_CONST:
- action_set_ipo_flags(SET_IPO_CONSTANT);
+ action_set_ipo_flags(SET_IPO_MENU, SET_IPO_CONSTANT);
break;
case ACTMENU_KEY_INTERP_LINEAR:
- action_set_ipo_flags(SET_IPO_LINEAR);
+ action_set_ipo_flags(SET_IPO_MENU, SET_IPO_LINEAR);
break;
case ACTMENU_KEY_INTERP_BEZIER:
- action_set_ipo_flags(SET_IPO_BEZIER);
+ action_set_ipo_flags(SET_IPO_MENU, SET_IPO_BEZIER);
break;
}
@@ -705,15 +705,15 @@
uiBlockSetButmFunc(block, do_action_keymenu_intpolmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Constant", 0, yco-=20,
+ "Constant|Shift T, 1", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_KEY_INTERP_CONST, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Linear", 0, yco-=20,
+ "Linear|Shift T, 2", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_KEY_INTERP_LINEAR, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
- "Bezier", 0, yco-=20,
+ "Bezier|Shift T, 3", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 0,
ACTMENU_KEY_INTERP_BEZIER, "");
@@ -728,16 +728,16 @@
switch(event)
{
case ACTMENU_KEY_EXTEND_CONST:
- action_set_ipo_flags(SET_EXTEND_CONSTANT);
+ action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CONSTANT);
break;
case ACTMENU_KEY_EXTEND_EXTRAPOLATION:
- action_set_ipo_flags(SET_EXTEND_EXTRAPOLATION);
+ action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_EXTRAPOLATION);
break;
case ACTMENU_KEY_EXTEND_CYCLIC:
- action_set_ipo_flags(SET_EXTEND_CYCLIC);
+ action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLIC);
break;
case ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION:
- action_set_ipo_flags(SET_EXTEND_CYCLICEXTRAPOLATION);
+ action_set_ipo_flags(SET_EXTEND_MENU, SET_EXTEND_CYCLICEXTRAPOLATION);
break;
}
More information about the Bf-blender-cvs
mailing list