2 * $Id: BIF_keyframing.h 17216 2008-10-29 11:20:02Z aligorith $
4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place * Suite 330, Boston, MA 02111*1307, USA.
20 * The Original Code is Copyright (C) 2008, Blender Foundation
21 * This is a new part of Blender (with some old code)
23 * Contributor(s): Joshua Leung
25 * ***** END GPL LICENSE BLOCK *****
28 #ifndef ED_KEYFRAMING_H
29 #define ED_KEYFRAMING_H
39 struct wmOperatorType;
41 /* ************ Keyframing Management **************** */
43 /* Lesser Keyframing API call:
44 * Use this when validation of necessary animation data isn't necessary as it already
45 * exists, and there is a beztriple that can be directly copied into the array.
47 int insert_bezt_fcurve(struct FCurve *fcu, struct BezTriple *bezt);
49 /* Main Keyframing API call:
50 * Use this when validation of necessary animation data isn't necessary as it
51 * already exists. It will insert a keyframe using the current value being keyframed.
53 void insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag);
57 /* Main Keyframing API calls:
58 * Use this to create any necessary animation data, and then insert a keyframe
59 * using the current value being keyframed, in the relevant place. Returns success.
61 short insertkey(struct ID *id, const char group[], const char rna_path[], int array_index, float cfra, short flag);
63 /* Main Keyframing API call:
64 * Use this to delete keyframe on current frame for relevant channel. Will perform checks just in case.
66 short deletekey(struct ID *id, const char group[], const char rna_path[], int array_index, float cfra, short flag);
69 /* Generate menu of KeyingSets */
70 char *ANIM_build_keyingsets_menu(struct ListBase *list, short for_edit);
72 /* KeyingSet Editing Operators:
73 * These can add a new KeyingSet and/or add 'destinations' to the KeyingSets,
74 * acting as a means by which they can be added outside the Outliner.
76 void ANIM_OT_keyingset_add_new(struct wmOperatorType *ot);
77 void ANIM_OT_keyingset_add_destination(struct wmOperatorType *ot);
79 /* Main Keyframe Management operators:
80 * These handle keyframes management from various spaces. They only make use of
83 void ANIM_OT_insert_keyframe(struct wmOperatorType *ot);
84 void ANIM_OT_delete_keyframe(struct wmOperatorType *ot);
86 /* Main Keyframe Management operators (legacy style):
87 * These handle keyframes management from various spaces. They will handle the menus
88 * required for each space.
90 void ANIM_OT_insert_keyframe_old(struct wmOperatorType *ot);
91 void ANIM_OT_delete_keyframe_old(struct wmOperatorType *ot);
93 /* ************ Auto-Keyframing ********************** */
95 * - All the defines for this (User-Pref settings and Per-Scene settings)
96 * are defined in DNA_userdef_types.h
97 * - Scene settings take presidence over those for userprefs, with old files
98 * inheriting userpref settings for the scene settings
99 * - "On/Off + Mode" are stored per Scene, but "settings" are currently stored
103 /* Auto-Keying macros for use by various tools */
104 /* check if auto-keyframing is enabled (per scene takes presidence) */
105 #define IS_AUTOKEY_ON(scene) ((scene) ? (scene->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
106 /* check the mode for auto-keyframing (per scene takes presidence) */
107 #define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
108 /* check if a flag is set for auto-keyframing (as userprefs only!) */
109 #define IS_AUTOKEY_FLAG(flag) (U.autokey_flag & AUTOKEY_FLAG_##flag)
111 /* ************ Keyframe Checking ******************** */
113 /* Main Keyframe Checking API call:
114 * Checks whether a keyframe exists for the given ID-block one the given frame.
115 * - It is recommended to call this method over the other keyframe-checkers directly,
116 * in case some detail of the implementation changes...
117 * - frame: the value of this is quite often result of frame_to_float(CFRA)
119 short id_frame_has_keyframe(struct ID *id, float frame, short filter);
121 /* filter flags for id_cfra_has_keyframe
123 * WARNING: do not alter order of these, as also stored in files
124 * (for v3d->keyflags)
128 ANIMFILTER_KEYS_LOCAL = (1<<0), /* only include locally available anim data */
129 ANIMFILTER_KEYS_MUTED = (1<<1), /* include muted elements */
130 ANIMFILTER_KEYS_ACTIVE = (1<<2), /* only include active-subelements */
132 /* object specific */
133 ANIMFILTER_KEYS_NOMAT = (1<<9), /* don't include material keyframes */
134 ANIMFILTER_KEYS_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */
137 #endif /* ED_KEYFRAMING_H */