2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2010-03-21 01:14:04 +00:00
|
|
|
* $Id$
|
2008-12-23 11:02:39 +00:00
|
|
|
*
|
|
|
|
* ***** 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-23 11:02:39 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Joshua Leung
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-21 07:25:24 +00:00
|
|
|
/** \file ED_keyframes_edit.h
|
|
|
|
* \ingroup editors
|
|
|
|
*/
|
|
|
|
|
2008-12-23 11:02:39 +00:00
|
|
|
#ifndef ED_KEYFRAMES_EDIT_H
|
|
|
|
#define ED_KEYFRAMES_EDIT_H
|
|
|
|
|
2008-12-27 11:44:00 +00:00
|
|
|
struct bAnimContext;
|
2009-04-10 12:06:31 +00:00
|
|
|
struct bAnimListElem;
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
struct FCurve;
|
2008-12-23 11:02:39 +00:00
|
|
|
struct BezTriple;
|
|
|
|
struct Scene;
|
|
|
|
|
|
|
|
/* ************************************************ */
|
|
|
|
/* Common Macros and Defines */
|
|
|
|
|
|
|
|
/* --------- BezTriple Selection ------------- */
|
|
|
|
|
|
|
|
#define BEZ_SEL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; }
|
|
|
|
#define BEZ_DESEL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; }
|
|
|
|
#define BEZ_INVSEL(bezt) { (bezt)->f1 ^= SELECT; (bezt)->f2 ^= SELECT; (bezt)->f3 ^= SELECT; }
|
|
|
|
|
|
|
|
/* --------- Tool Flags ------------ */
|
|
|
|
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
/* bezt validation */
|
|
|
|
typedef enum eEditKeyframes_Validate {
|
|
|
|
BEZT_OK_FRAME = 1,
|
|
|
|
BEZT_OK_FRAMERANGE,
|
|
|
|
BEZT_OK_SELECTED,
|
|
|
|
BEZT_OK_VALUE,
|
2009-01-27 11:09:30 +00:00
|
|
|
BEZT_OK_VALUERANGE,
|
2010-12-03 01:52:28 +00:00
|
|
|
BEZT_OK_REGION
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
} eEditKeyframes_Validate;
|
|
|
|
|
|
|
|
/* ------------ */
|
|
|
|
|
2010-02-07 11:50:03 +00:00
|
|
|
/* select modes */
|
2008-12-23 11:02:39 +00:00
|
|
|
typedef enum eEditKeyframes_Select {
|
2010-04-05 03:37:28 +00:00
|
|
|
/* SELECT_SUBTRACT for all, followed by SELECT_ADD for some */
|
2008-12-23 11:02:39 +00:00
|
|
|
SELECT_REPLACE = (1<<0),
|
2010-04-05 03:37:28 +00:00
|
|
|
/* add ok keyframes to selection */
|
2008-12-23 11:02:39 +00:00
|
|
|
SELECT_ADD = (1<<1),
|
2010-04-05 03:37:28 +00:00
|
|
|
/* remove ok keyframes from selection */
|
2008-12-23 11:02:39 +00:00
|
|
|
SELECT_SUBTRACT = (1<<2),
|
2010-04-05 03:37:28 +00:00
|
|
|
/* flip ok status of keyframes based on key status */
|
2010-12-03 01:52:28 +00:00
|
|
|
SELECT_INVERT = (1<<3)
|
2008-12-23 11:02:39 +00:00
|
|
|
} eEditKeyframes_Select;
|
|
|
|
|
2010-02-07 11:50:03 +00:00
|
|
|
/* "selection map" building modes */
|
|
|
|
typedef enum eEditKeyframes_SelMap {
|
|
|
|
SELMAP_MORE = 0,
|
2010-12-03 01:52:28 +00:00
|
|
|
SELMAP_LESS
|
2010-02-07 11:50:03 +00:00
|
|
|
} eEditKeyframes_SelMap;
|
|
|
|
|
2008-12-23 11:02:39 +00:00
|
|
|
/* snapping tools */
|
|
|
|
typedef enum eEditKeyframes_Snap {
|
2008-12-27 11:44:00 +00:00
|
|
|
SNAP_KEYS_CURFRAME = 1,
|
|
|
|
SNAP_KEYS_NEARFRAME,
|
2008-12-23 11:02:39 +00:00
|
|
|
SNAP_KEYS_NEARSEC,
|
2008-12-27 11:44:00 +00:00
|
|
|
SNAP_KEYS_NEARMARKER,
|
2009-01-28 06:32:47 +00:00
|
|
|
SNAP_KEYS_HORIZONTAL,
|
2010-12-03 01:52:28 +00:00
|
|
|
SNAP_KEYS_VALUE
|
2008-12-23 11:02:39 +00:00
|
|
|
} eEditKeyframes_Snap;
|
|
|
|
|
|
|
|
/* mirroring tools */
|
2008-12-27 11:44:00 +00:00
|
|
|
typedef enum eEditKeyframes_Mirror {
|
|
|
|
MIRROR_KEYS_CURFRAME = 1,
|
|
|
|
MIRROR_KEYS_YAXIS,
|
|
|
|
MIRROR_KEYS_XAXIS,
|
|
|
|
MIRROR_KEYS_MARKER,
|
2010-12-03 01:52:28 +00:00
|
|
|
MIRROR_KEYS_VALUE
|
2008-12-27 11:44:00 +00:00
|
|
|
} eEditKeyframes_Mirror;
|
2008-12-23 11:02:39 +00:00
|
|
|
|
|
|
|
/* ************************************************ */
|
2008-12-29 01:19:25 +00:00
|
|
|
/* Non-Destuctive Editing API (keyframes_edit.c) */
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2010-04-05 03:37:28 +00:00
|
|
|
/* --- Generic Properties for Keyframe Edit Tools ----- */
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
|
2010-04-02 12:02:39 +00:00
|
|
|
typedef struct KeyframeEditData {
|
2010-02-07 11:50:03 +00:00
|
|
|
/* generic properties/data access */
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
ListBase list; /* temp list for storing custom list of data to check */
|
|
|
|
struct Scene *scene; /* pointer to current scene - many tools need access to cfra/etc. */
|
2009-01-27 11:09:30 +00:00
|
|
|
void *data; /* pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
float f1, f2; /* storage of times/values as 'decimals' */
|
2009-01-03 06:01:11 +00:00
|
|
|
int i1, i2; /* storage of times/values/flags as 'whole' numbers */
|
2010-02-07 11:50:03 +00:00
|
|
|
|
|
|
|
/* current iteration data */
|
|
|
|
struct FCurve *fcu; /* F-Curve that is being iterated over */
|
|
|
|
int curIndex; /* index of current keyframe being iterated over */
|
2010-04-05 03:37:28 +00:00
|
|
|
|
|
|
|
/* flags */
|
|
|
|
short curflags; /* current flags for the keyframe we're reached in the iteration process */
|
|
|
|
short iterflags; /* settings for iteration process */ // XXX: unused...
|
2010-04-02 12:02:39 +00:00
|
|
|
} KeyframeEditData;
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
|
2008-12-27 11:44:00 +00:00
|
|
|
/* ------- Function Pointer Typedefs ---------------- */
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2009-12-22 10:14:13 +00:00
|
|
|
/* callback function that refreshes the F-Curve after use */
|
2009-01-20 11:07:42 +00:00
|
|
|
typedef void (*FcuEditFunc)(struct FCurve *fcu);
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
/* callback function that operates on the given BezTriple */
|
2010-04-02 12:02:39 +00:00
|
|
|
typedef short (*KeyframeEditFunc)(KeyframeEditData *ked, struct BezTriple *bezt);
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2010-04-05 03:37:28 +00:00
|
|
|
/* ---------- Defines for 'OK' polls ----------------- */
|
|
|
|
|
|
|
|
/* which verts of a keyframe is active (after polling) */
|
|
|
|
typedef enum eKeyframeVertOk {
|
|
|
|
/* 'key' itself is ok */
|
|
|
|
KEYFRAME_OK_KEY = (1<<0),
|
|
|
|
/* 'handle 1' is ok */
|
|
|
|
KEYFRAME_OK_H1 = (1<<1),
|
|
|
|
/* 'handle 2' is ok */
|
|
|
|
KEYFRAME_OK_H2 = (1<<2),
|
|
|
|
/* all flags */
|
|
|
|
KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY|KEYFRAME_OK_H1|KEYFRAME_OK_H2)
|
|
|
|
} eKeyframeVertOk;
|
|
|
|
|
|
|
|
/* Flags for use during iteration */
|
|
|
|
typedef enum eKeyframeIterFlags {
|
|
|
|
/* consider handles in addition to key itself */
|
|
|
|
KEYFRAME_ITER_INCL_HANDLES = (1<<0),
|
|
|
|
} eKeyframeIterFlags;
|
|
|
|
|
2009-12-22 10:14:13 +00:00
|
|
|
/* ------- Custom Data Type Defines ------------------ */
|
|
|
|
|
|
|
|
/* Custom data for remapping one range to another in a fixed way */
|
2010-04-05 03:37:28 +00:00
|
|
|
typedef struct KeyframeEditCD_Remap {
|
2009-12-22 10:14:13 +00:00
|
|
|
float oldMin, oldMax; /* old range */
|
|
|
|
float newMin, newMax; /* new range */
|
2010-04-05 03:37:28 +00:00
|
|
|
} KeyframeEditCD_Remap;
|
2009-12-22 10:14:13 +00:00
|
|
|
|
2010-12-14 15:14:16 +00:00
|
|
|
/* Paste options */
|
|
|
|
typedef enum eKeyPasteOffset {
|
|
|
|
/* paste keys starting at current frame */
|
|
|
|
KEYFRAME_PASTE_OFFSET_CFRA_START,
|
|
|
|
/* paste keys ending at current frame */
|
|
|
|
KEYFRAME_PASTE_OFFSET_CFRA_END,
|
|
|
|
/* paste keys relative to the current frame when copying */
|
|
|
|
KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE,
|
|
|
|
/* paste keys from original time */
|
|
|
|
KEYFRAME_PASTE_OFFSET_NONE
|
|
|
|
} eKeyPasteOffset;
|
|
|
|
|
|
|
|
typedef enum eKeyMergeMode {
|
|
|
|
/* overlay existing with new keys */
|
|
|
|
KEYFRAME_PASTE_MERGE_MIX,
|
|
|
|
/* replace entire fcurve */
|
|
|
|
KEYFRAME_PASTE_MERGE_OVER,
|
|
|
|
/* overwrite keys in pasted range */
|
|
|
|
KEYFRAME_PASTE_MERGE_OVER_RANGE,
|
|
|
|
/* overwrite keys in pasted range (use all keyframe start & end for range) */
|
|
|
|
KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL
|
|
|
|
} eKeyMergeMode;
|
|
|
|
|
2008-12-27 11:44:00 +00:00
|
|
|
/* ---------------- Looping API --------------------- */
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2008-12-27 11:44:00 +00:00
|
|
|
/* functions for looping over keyframes */
|
2009-04-10 12:06:31 +00:00
|
|
|
/* function for working with F-Curve data only (i.e. when filters have been chosen to explicitly use this) */
|
2010-04-05 03:37:28 +00:00
|
|
|
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb);
|
2009-04-10 12:06:31 +00:00
|
|
|
/* function for working with any type (i.e. one of the known types) of animation channel
|
|
|
|
* - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG)
|
|
|
|
*/
|
2010-04-05 03:37:28 +00:00
|
|
|
short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, struct bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag);
|
2009-04-15 01:10:36 +00:00
|
|
|
/* same as above, except bAnimListElem wrapper is not needed...
|
|
|
|
* - keytype is eAnim_KeyType
|
|
|
|
*/
|
2010-04-05 03:37:28 +00:00
|
|
|
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag);
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2008-12-27 11:44:00 +00:00
|
|
|
/* functions for making sure all keyframes are in good order */
|
|
|
|
void ANIM_editkeyframes_refresh(struct bAnimContext *ac);
|
|
|
|
|
|
|
|
/* ----------- BezTriple Callback Getters ---------- */
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
/* accessories */
|
2010-04-02 12:02:39 +00:00
|
|
|
KeyframeEditFunc ANIM_editkeyframes_ok(short mode);
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
|
|
|
|
/* edit */
|
2010-04-02 12:02:39 +00:00
|
|
|
KeyframeEditFunc ANIM_editkeyframes_snap(short mode);
|
|
|
|
KeyframeEditFunc ANIM_editkeyframes_mirror(short mode);
|
|
|
|
KeyframeEditFunc ANIM_editkeyframes_select(short mode);
|
|
|
|
KeyframeEditFunc ANIM_editkeyframes_handles(short mode);
|
|
|
|
KeyframeEditFunc ANIM_editkeyframes_ipo(short mode);
|
|
|
|
KeyframeEditFunc ANIM_editkeyframes_keytype(short mode);
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2010-02-07 11:50:03 +00:00
|
|
|
/* -------- BezTriple Callbacks (Selection Map) ---------- */
|
|
|
|
|
|
|
|
/* Get a callback to populate the selection settings map
|
2010-04-02 12:02:39 +00:00
|
|
|
* requires: ked->custom = char[] of length fcurve->totvert
|
2010-02-07 11:50:03 +00:00
|
|
|
*/
|
2010-04-02 12:02:39 +00:00
|
|
|
KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode);
|
2010-02-07 11:50:03 +00:00
|
|
|
|
|
|
|
/* Change the selection status of the keyframe based on the map entry for this vert
|
2010-04-02 12:02:39 +00:00
|
|
|
* requires: ked->custom = char[] of length fcurve->totvert
|
2010-02-07 11:50:03 +00:00
|
|
|
*/
|
2010-04-02 12:02:39 +00:00
|
|
|
short bezt_selmap_flush(KeyframeEditData *ked, struct BezTriple *bezt);
|
2010-02-07 11:50:03 +00:00
|
|
|
|
2009-04-12 06:47:25 +00:00
|
|
|
/* ----------- BezTriple Callback (Assorted Utilities) ---------- */
|
|
|
|
|
2009-12-22 10:14:13 +00:00
|
|
|
/* used to calculate the the average location of all relevant BezTriples by summing their locations */
|
2010-04-02 12:02:39 +00:00
|
|
|
short bezt_calc_average(KeyframeEditData *ked, struct BezTriple *bezt);
|
2009-12-22 10:14:13 +00:00
|
|
|
|
|
|
|
/* used to extract a set of cfra-elems from the keyframes */
|
2010-04-02 12:02:39 +00:00
|
|
|
short bezt_to_cfraelem(KeyframeEditData *ked, struct BezTriple *bezt);
|
2009-04-12 06:47:25 +00:00
|
|
|
|
2009-12-22 10:14:13 +00:00
|
|
|
/* used to remap times from one range to another
|
2010-04-05 03:37:28 +00:00
|
|
|
* requires: ked->custom = KeyframeEditCD_Remap
|
2009-12-22 10:14:13 +00:00
|
|
|
*/
|
2010-04-02 12:02:39 +00:00
|
|
|
void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt);
|
2009-12-22 10:14:13 +00:00
|
|
|
|
2008-12-29 01:19:25 +00:00
|
|
|
/* ************************************************ */
|
|
|
|
/* Destructive Editing API (keyframes_general.c) */
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc);
|
2009-01-20 11:07:42 +00:00
|
|
|
void delete_fcurve_keys(struct FCurve *fcu);
|
2010-12-14 15:14:16 +00:00
|
|
|
void clear_fcurve_keys(struct FCurve *fcu);
|
2009-01-27 11:09:30 +00:00
|
|
|
void duplicate_fcurve_keys(struct FCurve *fcu);
|
2008-12-29 01:19:25 +00:00
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
void clean_fcurve(struct FCurve *fcu, float thresh);
|
2009-01-28 09:55:36 +00:00
|
|
|
void smooth_fcurve(struct FCurve *fcu);
|
2009-09-04 04:27:06 +00:00
|
|
|
void sample_fcurve(struct FCurve *fcu);
|
2008-12-29 01:19:25 +00:00
|
|
|
|
2009-02-24 11:18:24 +00:00
|
|
|
/* ----------- */
|
|
|
|
|
|
|
|
void free_anim_copybuf(void);
|
|
|
|
short copy_animedit_keys(struct bAnimContext *ac, ListBase *anim_data);
|
2010-12-14 15:14:16 +00:00
|
|
|
short paste_animedit_keys(struct bAnimContext *ac, ListBase *anim_data,
|
|
|
|
const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode);
|
2009-02-24 11:18:24 +00:00
|
|
|
|
2008-12-23 11:02:39 +00:00
|
|
|
/* ************************************************ */
|
|
|
|
|
|
|
|
#endif /* ED_KEYFRAMES_EDIT_H */
|