[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10877] trunk/blender/source/blender: == Action Editor - Major Recode ==
Joshua Leung
aligorith at gmail.com
Tue Jun 5 14:11:00 CEST 2007
Revision: 10877
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10877
Author: aligorith
Date: 2007-06-05 14:11:00 +0200 (Tue, 05 Jun 2007)
Log Message:
-----------
== 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)
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_editaction.h
trunk/blender/source/blender/include/BSE_editipo.h
trunk/blender/source/blender/src/drawaction.c
trunk/blender/source/blender/src/editaction.c
trunk/blender/source/blender/src/editipo_mods.c
trunk/blender/source/blender/src/editnla.c
trunk/blender/source/blender/src/header_action.c
Added Paths:
-----------
trunk/blender/source/blender/include/BSE_editaction_types.h
Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h 2007-06-05 08:26:18 UTC (rev 10876)
+++ trunk/blender/source/blender/include/BIF_editaction.h 2007-06-05 12:11:00 UTC (rev 10877)
@@ -33,21 +33,11 @@
#ifndef BIF_EDITACTION_H
#define BIF_EDITACTION_H
-#define SET_IPO_POPUP 0
-#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
-
+/* some interface related sizes*/
#define CHANNELHEIGHT 16
#define CHANNELSKIP 2
-#define NAMEWIDTH 164
-#define SLIDERWIDTH 125
+#define NAMEWIDTH 164
+#define SLIDERWIDTH 125
#define ACTWIDTH (G.saction->actwidth)
/* Some types for easier type-testing */
@@ -57,6 +47,8 @@
#define ACTTYPE_ICU 3
#define ACTTYPE_FILLIPO 4
#define ACTTYPE_FILLCON 5
+#define ACTTYPE_IPO 6
+#define ACTTYPE_SHAPEKEY 7
/* Macros for easier/more consistant state testing */
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
@@ -72,6 +64,19 @@
#define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0)
#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 bActionChannel;
struct bPoseChannel;
@@ -82,21 +87,18 @@
struct ListBase;
/* Key operations */
-void delete_meshchannel_keys(struct Key *key);
-void delete_actionchannel_keys(void);
-void duplicate_meshchannel_keys(struct Key *key);
-void duplicate_actionchannel_keys(void);
-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 transform_action_keys(int mode, int dummy);
+void duplicate_action_keys(void);
+void snap_action_keys(short mode);
+void mirror_action_keys(short mode);
void insertkey_action(void);
+void delete_action_keys(void);
+void delete_action_channels(void);
+void clean_action(void);
-/* Marker Operations */
-void column_select_shapekeys(struct Key *key, int mode);
-void column_select_actionkeys(struct bAction *act, int mode);
+/* Column/Channel Key select */
+void column_select_action_keys(int mode);
+void selectall_action_keys(short mval[], short mode, short selectmode);
void markers_selectkeys_between(void);
/* channel/strip operations */
@@ -105,20 +107,15 @@
void top_sel_action(void);
void bottom_sel_action(void);
-/* Handles */
-void sethandles_meshchannel_keys(int code, struct Key *key);
-void sethandles_actionchannel_keys(int code);
+/* IPO/Handle Types */
+void sethandles_action_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 */
-void borderselect_mesh(struct Key *key);
void borderselect_action(void);
-void deselect_actionchannel_keys(struct bAction *act, int test, int sel);
-void deselect_actionchannels (struct bAction *act, int test);
-void deselect_meshchannel_keys (struct Key *key, int test, int sel);
+void deselect_action_keys(short test, short sel);
+void deselect_action_channels(short test);
+void deselect_actionchannels(struct bAction *act, short test);
int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode);
void select_actionchannel_by_name (struct bAction *act, char *name, int select);
@@ -128,19 +125,17 @@
void *get_nearest_act_channel(short mval[], short *ret_type);
/* 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);
-
-void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
-
-/* contextual get action */
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);
-/* this needs review badly! (ton) */
-struct bAction *bake_action_with_client (struct bAction *act, struct Object *arm, float tolerance);
-void world2bonespace(float boneSpaceMat[][4], float worldSpace[][4], float restPos[][4], float armPos[][4]);
+/* event handling */
+void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
#endif
Added: trunk/blender/source/blender/include/BSE_editaction_types.h
===================================================================
--- trunk/blender/source/blender/include/BSE_editaction_types.h (rev 0)
+++ trunk/blender/source/blender/include/BSE_editaction_types.h 2007-06-05 12:11:00 UTC (rev 10877)
@@ -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
Modified: trunk/blender/source/blender/include/BSE_editipo.h
===================================================================
--- trunk/blender/source/blender/include/BSE_editipo.h 2007-06-05 08:26:18 UTC (rev 10876)
+++ trunk/blender/source/blender/include/BSE_editipo.h 2007-06-05 12:11:00 UTC (rev 10877)
@@ -107,6 +107,7 @@
void mouse_select_ipo(void);
void sethandles_ipo(int code);
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 borderselect_ipo(void);
void del_ipo(int need_check);
Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c 2007-06-05 08:26:18 UTC (rev 10876)
+++ trunk/blender/source/blender/src/drawaction.c 2007-06-05 12:11:00 UTC (rev 10877)
@@ -110,14 +110,14 @@
* correctly *grumble*
*/
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);
block= uiNewBlock (&curarea->uiblocks, str,
UI_EMBOSS, UI_HELV, curarea->win);
x = NAMEWIDTH + 1;
- y = key->totkey*(CHANNELHEIGHT+CHANNELSKIP) + CHANNELHEIGHT/2 - G.v2d->cur.ymin;
+ y = CHANNELHEIGHT/2;
/* make the little 'open the sliders' widget */
BIF_ThemeColor(TH_FACE); // this slot was open...
@@ -534,7 +534,7 @@
KeyBlock *kb;
x = 0.0;
- y= key->totkey*(CHANNELHEIGHT+CHANNELSKIP);
+ y= 0.0;
kb= key->block.first;
@@ -846,7 +846,7 @@
scr_rct.ymax= saction->area->winrct.ymin + saction->v2d.mask.ymax;
di= glaBegin2DDraw(&scr_rct, &G.v2d->cur);
- ybase = key->totkey*(CHANNELHEIGHT+CHANNELSKIP);
+ ybase = 0;
for (icu = key->ipo->curve.first; icu ; icu = icu->next) {
int frame1_x, channel_y;
@@ -959,7 +959,7 @@
if (G.v2d->cur.ymin < -CHANNELHEIGHT)
G.v2d->cur.ymin = -CHANNELHEIGHT;
- maxymin = key->totkey*(CHANNELHEIGHT+CHANNELSKIP);
+ maxymin = -(key->totkey*(CHANNELHEIGHT+CHANNELSKIP));
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list