diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-09-14 08:32:17 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-09-14 08:32:17 +0400 |
commit | 0f1a1a159ff70cd2bd9c1762ecd167439683b2ba (patch) | |
tree | 26b0df32a1001b6e87a46e2a16dd0fe321828896 /source/blender/include | |
parent | d111983064296dc9dd2c1b3f1735efd38f95c9d1 (diff) |
== Keyframing - Cleanup of API ==
* Moved all keyframing functions to their own file (keyframing.c)
* Merged all the different keyframing options (needed, visual, fast) into a single API call. The direct benefit of this is that it allows them to be used in conjunction with each other. Also, this means that when using the IKEY, autokeying settings for these are respected too.
* Implemented 'keyingsets' system (instead of directly calling insertkey on relevant channels), which is easier to maintain and cleaner. A keyingset basically defines all the channels that can be keyframed together. This paves the way for custom keyingsets sometime down the track (and also for quick-insert keyframes for previously used keyingset).
Menus for choosing the keying set to use are generated automatically from the definitions.
Diffstat (limited to 'source/blender/include')
-rw-r--r-- | source/blender/include/BIF_keyframing.h | 99 | ||||
-rw-r--r-- | source/blender/include/BSE_editipo.h | 9 |
2 files changed, 100 insertions, 8 deletions
diff --git a/source/blender/include/BIF_keyframing.h b/source/blender/include/BIF_keyframing.h new file mode 100644 index 00000000000..9ade4f74b92 --- /dev/null +++ b/source/blender/include/BIF_keyframing.h @@ -0,0 +1,99 @@ +/** + * $Id: BDR_gpencil.h 14444 2008*04*16 22:40:48Z aligorith $ + * + * ***** BEGIN GPL 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. + * + * 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) 2008, Blender Foundation + * This is a new part of Blender (with some old code) + * + * Contributor(s): Joshua Leung + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BIF_KEYFRAMING_H +#define BIF_KEYFRAMING_H + +struct ListBase; +struct ID; + +struct IpoCurve; +struct BezTriple; + +/* ************ Keyframing Management **************** */ + +/* Lesser Keyframing API call: + * Use this when validation of necessary animation data isn't necessary as it already + * exists, and there is a beztriple that can be directly copied into the array. + */ +int insert_bezt_icu(struct IpoCurve *icu, struct BezTriple *bezt); + +/* Main Keyframing API call: + * Use this when validation of necessary animation data isn't necessary as it + * already exists. It will insert a keyframe using the current value being keyframed. + */ +void insert_vert_icu(struct IpoCurve *icu, float x, float y, short flag); + + +/* flags for use in insert_key(), and insert_vert_icu() */ +enum { + INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */ + INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */ + INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */ + INSERTKEY_FASTR = (1<<3), /* don't realloc mem (or increase count, as array has already been set out) */ + INSERTKEY_REPLACE = (1<<4), /* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */ +} eInsertKeyFlags; + +/* -------- */ + +/* Main Keyframing API calls: + * Use this to create any necessary animation data,, and then insert a keyframe + * using the current value being keyframed, in the relevant place. Returns success. + */ + // TODO: adapt this for new data-api -> this blocktype, etc. stuff is evil! +short insertkey(struct ID *id, int blocktype, char *actname, char *constname, int adrcode, short flag); + +/* Main Keyframing API call: + * Use this to delete keyframe on current frame for relevant channel. Will perform checks just in case. + */ +short deletekey(struct ID *id, int blocktype, char *actname, char *constname, int adrcode, short flag); + + +/* Main Keyframe Management calls: + * These handle keyframes management from various spaces. They will handle the menus + * required for each space. + */ +void common_insertkey(void); +void common_deletekey(void); + +/* ************ Keyframe Checking ******************** */ + +/* Checks whether a keyframe exists for the given ID-block one the given frame */ +short id_cfra_has_keyframe(struct ID *id, short filter); + +/* filter flags fr id_cfra_has_keyframe */ +enum { + /* general */ + ANIMFILTER_ALL = 0, /* include all available animation data */ + ANIMFILTER_LOCAL = (1<<0), /* only include locally available anim data */ + + /* object specific */ + ANIMFILTER_MAT = (1<<1), /* include material keyframes too */ + ANIMFILTER_SKEY = (1<<2), /* shape keys (for geometry) */ +} eAnimFilterFlags; + +#endif /* BIF_KEYFRAMING_H */ diff --git a/source/blender/include/BSE_editipo.h b/source/blender/include/BSE_editipo.h index e7445efc63e..b7b19a373aa 100644 --- a/source/blender/include/BSE_editipo.h +++ b/source/blender/include/BSE_editipo.h @@ -90,9 +90,6 @@ struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, int struct Ipo *verify_ipo(struct ID *, short, char *, char *, char *); int texchannel_to_adrcode(int channel); -int insert_bezt_icu(struct IpoCurve *icu, struct BezTriple *bezt); -void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast); -void add_vert_ipo(void); void add_duplicate_editipo(void); void remove_doubles_ipo(void); @@ -121,10 +118,8 @@ void paste_editipo(void); void set_exprap_ipo(int mode); void set_speed_editipo(float speed); -void insertkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, short fast); -void insertkey_smarter(ID *id, int blocktype, char *actname, char *constname, int adrcode); void insertkey_editipo(void); -void common_insertkey(void); +void add_vert_ipo(void); void free_ipokey(struct ListBase *lb); void add_to_ipokey(struct ListBase *lb, struct BezTriple *bezt, int nr, int len); void make_ipokey(void); @@ -163,8 +158,6 @@ void duplicate_ipo_keys(struct Ipo *ipo); void borderselect_ipo_key(struct Ipo *ipo, float xmin, float xmax, int val); void borderselect_icu_key(struct IpoCurve *icu, float xmin, float xmax, int (*select_function)(struct BezTriple *)); -int insertmatrixkey(ID *id, int blocktype, char *actname, char *constname, int adrcode); -void insertfloatkey(ID *id, int blocktype, char *actname, char *constname, int adrcode, float floatkey); void select_ipo_key(struct Ipo *ipo, float selx, int sel); void select_icu_key(struct IpoCurve *icu, float selx, int selectmode); void setexprap_ipoloop(struct Ipo *ipo, int code); |