2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2008-12-23 11:02:39 +00:00
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-12-23 11:02:39 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2019-02-06 15:42:22 +11:00
|
|
|
/** \file \ingroup editors
|
2011-02-21 07:25:24 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __ED_KEYFRAMES_EDIT_H__
|
|
|
|
#define __ED_KEYFRAMES_EDIT_H__
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct BezTriple;
|
|
|
|
struct FCurve;
|
|
|
|
struct Scene;
|
2008-12-27 11:44:00 +00:00
|
|
|
struct bAnimContext;
|
2009-04-10 12:06:31 +00:00
|
|
|
struct bAnimListElem;
|
2011-06-30 13:56:47 +00:00
|
|
|
struct bDopeSheet;
|
2008-12-23 11:02:39 +00:00
|
|
|
|
|
|
|
/* ************************************************ */
|
|
|
|
/* Common Macros and Defines */
|
|
|
|
|
|
|
|
/* --------- 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 {
|
2016-06-23 23:16:14 +12:00
|
|
|
/* Frame range */
|
2012-05-12 20:39:39 +00:00
|
|
|
BEZT_OK_FRAME = 1,
|
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_OK_FRAMERANGE,
|
2016-06-23 23:16:14 +12:00
|
|
|
/* Selection status */
|
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_OK_SELECTED,
|
2016-06-23 23:16:14 +12:00
|
|
|
/* Values (y-val) only */
|
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_OK_VALUE,
|
2009-01-27 11:09:30 +00:00
|
|
|
BEZT_OK_VALUERANGE,
|
2016-06-23 23:16:14 +12:00
|
|
|
/* For graph editor keyframes (2D tests) */
|
2014-03-09 16:20:04 +11:00
|
|
|
BEZT_OK_REGION,
|
|
|
|
BEZT_OK_REGION_LASSO,
|
2014-12-09 16:53:50 +01:00
|
|
|
BEZT_OK_REGION_CIRCLE,
|
2016-06-23 23:16:14 +12:00
|
|
|
/* Only for keyframes a certain Dopesheet channel */
|
|
|
|
BEZT_OK_CHANNEL_LASSO,
|
|
|
|
BEZT_OK_CHANNEL_CIRCLE,
|
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 {
|
2012-05-12 20:39:39 +00:00
|
|
|
/* SELECT_SUBTRACT for all, followed by SELECT_ADD for some */
|
|
|
|
SELECT_REPLACE = (1 << 0),
|
|
|
|
/* add ok keyframes to selection */
|
|
|
|
SELECT_ADD = (1 << 1),
|
|
|
|
/* remove ok keyframes from selection */
|
|
|
|
SELECT_SUBTRACT = (1 << 2),
|
|
|
|
/* flip ok status of keyframes based on key status */
|
2019-01-15 23:57:49 +11: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 {
|
2012-05-12 20:39:39 +00:00
|
|
|
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,
|
2015-10-26 20:13:29 +13:00
|
|
|
SNAP_KEYS_VALUE,
|
|
|
|
SNAP_KEYS_TIME,
|
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,
|
2015-10-26 20:13:29 +13:00
|
|
|
MIRROR_KEYS_VALUE,
|
|
|
|
MIRROR_KEYS_TIME,
|
2008-12-27 11:44:00 +00:00
|
|
|
} eEditKeyframes_Mirror;
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2014-03-09 16:20:04 +11:00
|
|
|
/* use with BEZT_OK_REGION_LASSO */
|
2016-06-23 19:36:24 +12:00
|
|
|
typedef struct KeyframeEdit_LassoData {
|
2016-06-23 23:16:14 +12:00
|
|
|
rctf *rectf_scaled;
|
2014-03-09 16:20:04 +11:00
|
|
|
const rctf *rectf_view;
|
|
|
|
const int (*mcords)[2];
|
|
|
|
int mcords_tot;
|
2016-06-23 19:36:24 +12:00
|
|
|
} KeyframeEdit_LassoData;
|
2014-03-09 16:20:04 +11:00
|
|
|
|
2014-12-09 16:53:50 +01:00
|
|
|
/* use with BEZT_OK_REGION_CIRCLE */
|
2016-06-23 19:36:24 +12:00
|
|
|
typedef struct KeyframeEdit_CircleData {
|
2016-06-23 23:16:14 +12:00
|
|
|
rctf *rectf_scaled;
|
2014-12-09 16:53:50 +01:00
|
|
|
const rctf *rectf_view;
|
|
|
|
float mval[2];
|
|
|
|
float radius_squared;
|
2016-06-23 19:36:24 +12:00
|
|
|
} KeyframeEdit_CircleData;
|
2014-12-09 16:53:50 +01:00
|
|
|
|
2014-03-09 16:20:04 +11:00
|
|
|
|
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
|
|
|
|
2016-02-26 15:39:02 +13:00
|
|
|
/* --- Defines for 'OK' polls + KeyframeEditData Flags --------- */
|
2010-04-05 03:37:28 +00:00
|
|
|
|
|
|
|
/* which verts of a keyframe is active (after polling) */
|
|
|
|
typedef enum eKeyframeVertOk {
|
2012-05-12 20:39:39 +00:00
|
|
|
/* '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 */
|
2019-01-15 23:57:49 +11:00
|
|
|
KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY | KEYFRAME_OK_H1 | KEYFRAME_OK_H2),
|
2010-04-05 03:37:28 +00:00
|
|
|
} eKeyframeVertOk;
|
|
|
|
|
|
|
|
/* Flags for use during iteration */
|
|
|
|
typedef enum eKeyframeIterFlags {
|
2012-05-12 20:39:39 +00:00
|
|
|
/* consider handles in addition to key itself */
|
|
|
|
KEYFRAME_ITER_INCL_HANDLES = (1 << 0),
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-02-26 15:34:32 +13:00
|
|
|
/* Perform NLA time remapping (global -> strip) for the "f1" parameter
|
|
|
|
* (e.g. used for selection tools on summary tracks)
|
|
|
|
*/
|
|
|
|
KED_F1_NLA_UNMAP = (1 << 1),
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-02-26 15:34:32 +13:00
|
|
|
/* Perform NLA time remapping (global -> strip) for the "f2" parameter */
|
|
|
|
KED_F2_NLA_UNMAP = (1 << 2),
|
|
|
|
} eKeyframeIterFlags;
|
2010-04-05 03:37:28 +00:00
|
|
|
|
2016-02-26 15:39:02 +13:00
|
|
|
/* --- Generic Properties for Keyframe Edit Tools ----- */
|
|
|
|
|
|
|
|
typedef struct KeyframeEditData {
|
|
|
|
/* generic properties/data access */
|
2019-01-15 23:24:20 +11:00
|
|
|
/** temp list for storing custom list of data to check */
|
|
|
|
ListBase list;
|
|
|
|
/** pointer to current scene - many tools need access to cfra/etc. */
|
|
|
|
struct Scene *scene;
|
|
|
|
/** pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */
|
|
|
|
void *data;
|
|
|
|
/** storage of times/values as 'decimals' */
|
|
|
|
float f1, f2;
|
|
|
|
/** storage of times/values/flags as 'whole' numbers */
|
|
|
|
int i1, i2;
|
2016-02-26 15:39:02 +13:00
|
|
|
|
|
|
|
/* current iteration data */
|
2019-01-15 23:24:20 +11:00
|
|
|
/** F-Curve that is being iterated over */
|
|
|
|
struct FCurve *fcu;
|
|
|
|
/** index of current keyframe being iterated over */
|
|
|
|
int curIndex;
|
|
|
|
/** y-position of midpoint of the channel (for the dopesheet) */
|
|
|
|
float channel_y;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-02-26 15:39:02 +13:00
|
|
|
/* flags */
|
2019-01-15 23:24:20 +11:00
|
|
|
/** current flags for the keyframe we're reached in the iteration process */
|
|
|
|
eKeyframeVertOk curflags;
|
|
|
|
/** settings for iteration process */
|
|
|
|
eKeyframeIterFlags iterflags;
|
2016-02-26 15:39:02 +13:00
|
|
|
} KeyframeEditData;
|
|
|
|
|
|
|
|
/* ------- Function Pointer Typedefs ---------------- */
|
|
|
|
|
|
|
|
/* callback function that refreshes the F-Curve after use */
|
|
|
|
typedef void (*FcuEditFunc)(struct FCurve *fcu);
|
|
|
|
/* callback function that operates on the given BezTriple */
|
|
|
|
typedef short (*KeyframeEditFunc)(KeyframeEditData *ked, struct BezTriple *bezt);
|
|
|
|
|
|
|
|
|
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 {
|
2012-05-12 20:39:39 +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 {
|
2012-05-12 20:39:39 +00:00
|
|
|
/* paste keys starting at current frame */
|
2010-12-14 15:14:16 +00:00
|
|
|
KEYFRAME_PASTE_OFFSET_CFRA_START,
|
2012-05-12 20:39:39 +00:00
|
|
|
/* paste keys ending at current frame */
|
2010-12-14 15:14:16 +00:00
|
|
|
KEYFRAME_PASTE_OFFSET_CFRA_END,
|
2012-05-12 20:39:39 +00:00
|
|
|
/* paste keys relative to the current frame when copying */
|
2010-12-14 15:14:16 +00:00
|
|
|
KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE,
|
2012-05-12 20:39:39 +00:00
|
|
|
/* paste keys from original time */
|
2010-12-14 15:14:16 +00:00
|
|
|
KEYFRAME_PASTE_OFFSET_NONE
|
|
|
|
} eKeyPasteOffset;
|
|
|
|
|
|
|
|
typedef enum eKeyMergeMode {
|
2012-05-12 20:39:39 +00:00
|
|
|
/* overlay existing with new keys */
|
2010-12-14 15:14:16 +00:00
|
|
|
KEYFRAME_PASTE_MERGE_MIX,
|
2012-05-12 20:39:39 +00:00
|
|
|
/* replace entire fcurve */
|
2010-12-14 15:14:16 +00:00
|
|
|
KEYFRAME_PASTE_MERGE_OVER,
|
2012-05-12 20:39:39 +00:00
|
|
|
/* overwrite keys in pasted range */
|
2010-12-14 15:14:16 +00:00
|
|
|
KEYFRAME_PASTE_MERGE_OVER_RANGE,
|
2012-05-12 20:39:39 +00:00
|
|
|
/* overwrite keys in pasted range (use all keyframe start & end for range) */
|
2010-12-14 15:14:16 +00:00
|
|
|
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 */
|
2019-01-15 23:24:20 +11: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);
|
2012-05-12 20:39:39 +00:00
|
|
|
/* function for working with any type (i.e. one of the known types) of animation channel
|
2018-11-14 12:53:15 +11:00
|
|
|
* - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG)
|
2012-05-12 20:39:39 +00:00
|
|
|
*/
|
2011-06-30 13:56:47 +00:00
|
|
|
short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, struct bDopeSheet *ads, struct bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb);
|
2012-05-12 20:39:39 +00:00
|
|
|
/* same as above, except bAnimListElem wrapper is not needed...
|
2018-11-14 12:53:15 +11:00
|
|
|
* - keytype is eAnim_KeyType
|
2012-05-12 20:39:39 +00:00
|
|
|
*/
|
2011-06-30 13:56:47 +00:00
|
|
|
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, struct bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb);
|
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);
|
2014-03-22 02:50:24 +13:00
|
|
|
KeyframeEditFunc ANIM_editkeyframes_easing(short mode);
|
2008-12-23 11:02:39 +00:00
|
|
|
|
2010-02-07 11:50:03 +00:00
|
|
|
/* -------- BezTriple Callbacks (Selection Map) ---------- */
|
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* Get a callback to populate the selection settings map
|
2018-06-01 18:19:39 +02: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) ---------- */
|
|
|
|
|
2014-10-29 14:11:19 +01:00
|
|
|
/* used to calculate 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
|
2018-06-01 18:19:39 +02: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
|
|
|
|
2016-06-24 02:52:13 +12:00
|
|
|
/* ------ 1.5-D Region Testing Uitls (Lasso/Circle Select) ------- */
|
2019-01-15 23:24:20 +11:00
|
|
|
/* XXX: These are temporary,
|
|
|
|
* until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */
|
2016-06-24 02:52:13 +12:00
|
|
|
|
|
|
|
bool keyframe_region_lasso_test(
|
|
|
|
const KeyframeEdit_LassoData *data_lasso,
|
|
|
|
const float xy[2]);
|
|
|
|
|
|
|
|
bool keyframe_region_circle_test(
|
|
|
|
const KeyframeEdit_CircleData *data_circle,
|
|
|
|
const float xy[2]);
|
|
|
|
|
|
|
|
|
2008-12-29 01:19:25 +00:00
|
|
|
/* ************************************************ */
|
|
|
|
/* Destructive Editing API (keyframes_general.c) */
|
|
|
|
|
2014-02-03 18:55:59 +11:00
|
|
|
void delete_fcurve_key(struct FCurve *fcu, int index, bool do_recalc);
|
2013-11-25 04:55:26 +01:00
|
|
|
bool 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
|
|
|
|
2015-05-20 15:30:33 +02:00
|
|
|
void clean_fcurve(struct bAnimContext *ac, struct bAnimListElem *ale, float thresh, bool cleardefault);
|
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
|
|
|
/* ----------- */
|
|
|
|
|
2016-04-03 01:18:23 +13:00
|
|
|
void ANIM_fcurves_copybuf_free(void);
|
2009-02-24 11:18:24 +00:00
|
|
|
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,
|
2015-01-07 22:25:33 +01:00
|
|
|
const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip);
|
2009-02-24 11:18:24 +00:00
|
|
|
|
2008-12-23 11:02:39 +00:00
|
|
|
/* ************************************************ */
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __ED_KEYFRAMES_EDIT_H__ */
|