2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2008 Blender Foundation. All rights reserved. */
|
2011-02-27 20:29:51 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spgraph
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2.5 Branch
==========
* Changed wmOperatorType, removing init/exit callbacks and adding cancel
callback, removed default storage in favor of properties. Defined return
values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
handlers. Now it frees based on return values from callbacks, and just
keeps a wmOperator on the heap. Also it now registers after the operator
is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
otherwise, gives more readable code in my opinion. Added OP_verify_*
functions to quickly check if the property is available and set if it's
not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
which takes a function pointer instead of a list, avoids macro's and
duplicating code.
* Fix a crash where the handler would still be used while it was freed by
the operator.
* Spacetypes now have operatortypes() and keymap() callbacks to abstract
them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
leaving that context, instead of leaving the pointers there.
* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
give link errors.
* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
the frame.
2008-06-11 10:10:31 +00:00
|
|
|
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
struct ARegion;
|
2009-05-19 17:13:33 +00:00
|
|
|
struct ARegionType;
|
2019-02-16 10:16:16 +11:00
|
|
|
struct SpaceGraph;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bAnimContext;
|
|
|
|
|
struct bAnimListElem;
|
|
|
|
|
struct bContext;
|
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
|
|
|
|
2008-12-12 18:47:12 +00:00
|
|
|
/* internal exports only */
|
2008-01-01 18:29:19 +00:00
|
|
|
|
2009-01-27 05:04:23 +00:00
|
|
|
/* ***************************************** */
|
2009-02-21 10:38:58 +00:00
|
|
|
/* graph_draw.c */
|
2022-04-04 13:17:03 +10:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Left hand part.
|
|
|
|
|
*/
|
2020-03-06 16:56:42 +01:00
|
|
|
void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region);
|
2009-04-08 01:07:46 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* This is called twice from space_graph.c -> graph_main_region_draw()
|
|
|
|
|
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
|
|
|
|
|
*/
|
2019-02-16 10:16:16 +11:00
|
|
|
void graph_draw_curves(struct bAnimContext *ac,
|
|
|
|
|
struct SpaceGraph *sipo,
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region,
|
2019-02-16 10:16:16 +11:00
|
|
|
short sel);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
|
|
|
|
|
* \note unit mapping has already been applied to the values, so do not try and apply again.
|
|
|
|
|
*/
|
2020-03-06 16:56:42 +01:00
|
|
|
void graph_draw_ghost_curves(struct bAnimContext *ac,
|
|
|
|
|
struct SpaceGraph *sipo,
|
|
|
|
|
struct ARegion *region);
|
2008-01-01 18:29:19 +00:00
|
|
|
|
2009-01-27 05:04:23 +00:00
|
|
|
/* ***************************************** */
|
2009-02-20 19:11:35 +00:00
|
|
|
/* graph_select.c */
|
2009-01-27 05:04:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Deselects keyframes in the Graph Editor
|
|
|
|
|
* - This is called by the deselect all operator, as well as other ones!
|
|
|
|
|
*
|
|
|
|
|
* - test: check if select or deselect all
|
|
|
|
|
* - sel: how to select keyframes
|
|
|
|
|
* 0 = deselect
|
|
|
|
|
* 1 = select
|
|
|
|
|
* 2 = invert
|
|
|
|
|
* - do_channels: whether to affect selection status of channels
|
|
|
|
|
*/
|
2016-05-09 16:58:12 +12:00
|
|
|
void deselect_graph_keys(struct bAnimContext *ac, bool test, short sel, bool do_channels);
|
|
|
|
|
|
2018-07-03 15:44:56 +02:00
|
|
|
void GRAPH_OT_select_all(struct wmOperatorType *ot);
|
2018-10-05 10:27:04 +10:00
|
|
|
void GRAPH_OT_select_box(struct wmOperatorType *ot);
|
2014-03-09 16:20:04 +11:00
|
|
|
void GRAPH_OT_select_lasso(struct wmOperatorType *ot);
|
2014-12-09 16:53:50 +01:00
|
|
|
void GRAPH_OT_select_circle(struct wmOperatorType *ot);
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_select_column(struct wmOperatorType *ot);
|
2010-04-05 11:47:55 +00:00
|
|
|
void GRAPH_OT_select_linked(struct wmOperatorType *ot);
|
2010-02-07 11:50:03 +00:00
|
|
|
void GRAPH_OT_select_more(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_select_less(struct wmOperatorType *ot);
|
2011-02-14 02:50:52 +00:00
|
|
|
void GRAPH_OT_select_leftright(struct wmOperatorType *ot);
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_clickselect(struct wmOperatorType *ot);
|
2009-01-27 05:04:23 +00:00
|
|
|
|
|
|
|
|
/* defines for left-right select tool */
|
2013-03-22 05:46:39 +00:00
|
|
|
enum eGraphKeys_LeftRightSelect_Mode {
|
2012-05-08 20:18:33 +00:00
|
|
|
GRAPHKEYS_LRSEL_TEST = 0,
|
2009-01-27 05:04:23 +00:00
|
|
|
GRAPHKEYS_LRSEL_LEFT,
|
2019-02-03 14:01:45 +11:00
|
|
|
GRAPHKEYS_LRSEL_RIGHT,
|
2013-03-22 05:46:39 +00:00
|
|
|
};
|
2009-01-27 05:04:23 +00:00
|
|
|
|
|
|
|
|
/* defines for column-select mode */
|
2013-03-22 05:46:39 +00:00
|
|
|
enum eGraphKeys_ColumnSelect_Mode {
|
2012-05-08 20:18:33 +00:00
|
|
|
GRAPHKEYS_COLUMNSEL_KEYS = 0,
|
2009-01-27 05:04:23 +00:00
|
|
|
GRAPHKEYS_COLUMNSEL_CFRA,
|
|
|
|
|
GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN,
|
|
|
|
|
GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN,
|
2013-03-22 05:46:39 +00:00
|
|
|
};
|
2009-01-27 05:04:23 +00:00
|
|
|
|
|
|
|
|
/* ***************************************** */
|
2009-02-20 19:11:35 +00:00
|
|
|
/* graph_edit.c */
|
2009-01-27 05:04:23 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get the min/max keyframes.
|
|
|
|
|
* \note it should return total bound-box, filter for selection only can be argument.
|
|
|
|
|
*/
|
2018-06-04 09:31:30 +02:00
|
|
|
void get_graph_keyframe_extents(struct bAnimContext *ac,
|
|
|
|
|
float *xmin,
|
|
|
|
|
float *xmax,
|
|
|
|
|
float *ymin,
|
|
|
|
|
float *ymax,
|
2022-01-06 11:37:31 +01:00
|
|
|
bool do_sel_only,
|
|
|
|
|
bool include_handles);
|
2009-07-02 18:12:46 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_previewrange_set(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_view_all(struct wmOperatorType *ot);
|
2011-03-17 10:02:37 +00:00
|
|
|
void GRAPH_OT_view_selected(struct wmOperatorType *ot);
|
2015-04-13 14:30:17 +02:00
|
|
|
void GRAPH_OT_view_frame(struct wmOperatorType *ot);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_click_insert(struct wmOperatorType *ot);
|
2009-11-28 14:37:21 +00:00
|
|
|
void GRAPH_OT_keyframe_insert(struct wmOperatorType *ot);
|
2009-04-06 12:07:33 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_copy(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_paste(struct wmOperatorType *ot);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_duplicate(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_delete(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_clean(struct wmOperatorType *ot);
|
2021-12-25 13:40:53 +01:00
|
|
|
void GRAPH_OT_blend_to_neighbor(struct wmOperatorType *ot);
|
2021-12-25 20:58:47 +01:00
|
|
|
void GRAPH_OT_breakdown(struct wmOperatorType *ot);
|
2019-11-21 11:58:35 +01:00
|
|
|
void GRAPH_OT_decimate(struct wmOperatorType *ot);
|
2022-03-18 20:07:16 +01:00
|
|
|
void GRAPH_OT_blend_to_default(struct wmOperatorType *ot);
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_sample(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_bake(struct wmOperatorType *ot);
|
2020-10-28 11:45:24 +01:00
|
|
|
void GRAPH_OT_unbake(struct wmOperatorType *ot);
|
2010-01-01 05:09:30 +00:00
|
|
|
void GRAPH_OT_sound_bake(struct wmOperatorType *ot);
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_smooth(struct wmOperatorType *ot);
|
2011-03-25 03:58:21 +00:00
|
|
|
void GRAPH_OT_euler_filter(struct wmOperatorType *ot);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2010-12-14 10:52:38 +00:00
|
|
|
void GRAPH_OT_handle_type(struct wmOperatorType *ot);
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_interpolation_type(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_extrapolation_type(struct wmOperatorType *ot);
|
2014-03-22 02:50:24 +13:00
|
|
|
void GRAPH_OT_easing_type(struct wmOperatorType *ot);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_frame_jump(struct wmOperatorType *ot);
|
2020-10-16 16:44:06 +02:00
|
|
|
void GRAPH_OT_snap_cursor_value(struct wmOperatorType *ot);
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_snap(struct wmOperatorType *ot);
|
2022-01-25 11:40:46 +01:00
|
|
|
void GRAPH_OT_equalize_handles(struct wmOperatorType *ot);
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_mirror(struct wmOperatorType *ot);
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* defines for snap keyframes
|
2009-01-28 06:32:47 +00:00
|
|
|
* NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
|
|
|
|
|
*/
|
2013-03-22 05:46:39 +00:00
|
|
|
enum eGraphKeys_Snap_Mode {
|
2009-01-28 06:32:47 +00:00
|
|
|
GRAPHKEYS_SNAP_CFRA = 1,
|
|
|
|
|
GRAPHKEYS_SNAP_NEAREST_FRAME,
|
|
|
|
|
GRAPHKEYS_SNAP_NEAREST_SECOND,
|
2012-10-21 05:46:41 +00:00
|
|
|
GRAPHKEYS_SNAP_NEAREST_MARKER,
|
2009-01-28 06:32:47 +00:00
|
|
|
GRAPHKEYS_SNAP_HORIZONTAL,
|
2009-10-20 12:04:56 +00:00
|
|
|
GRAPHKEYS_SNAP_VALUE,
|
2013-03-22 05:46:39 +00:00
|
|
|
};
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2022-01-25 11:40:46 +01:00
|
|
|
/* Defines for equalize keyframe handles.
|
|
|
|
|
* NOTE: Keep in sync with eEditKeyframes_Equalize (in ED_keyframes_edit.h).
|
|
|
|
|
*/
|
|
|
|
|
enum eGraphKeys_Equalize_Mode {
|
|
|
|
|
GRAPHKEYS_EQUALIZE_LEFT = 1,
|
|
|
|
|
GRAPHKEYS_EQUALIZE_RIGHT,
|
|
|
|
|
GRAPHKEYS_EQUALIZE_BOTH,
|
|
|
|
|
};
|
|
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* defines for mirror keyframes
|
2009-01-28 06:32:47 +00:00
|
|
|
* NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
|
|
|
|
|
*/
|
2013-03-22 05:46:39 +00:00
|
|
|
enum eGraphKeys_Mirror_Mode {
|
2009-01-28 06:32:47 +00:00
|
|
|
GRAPHKEYS_MIRROR_CFRA = 1,
|
|
|
|
|
GRAPHKEYS_MIRROR_YAXIS,
|
|
|
|
|
GRAPHKEYS_MIRROR_XAXIS,
|
|
|
|
|
GRAPHKEYS_MIRROR_MARKER,
|
2009-10-22 09:07:19 +00:00
|
|
|
GRAPHKEYS_MIRROR_VALUE,
|
2013-03-22 05:46:39 +00:00
|
|
|
};
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* ----------- */
|
|
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_fmodifier_add(struct wmOperatorType *ot);
|
2010-03-18 13:04:46 +00:00
|
|
|
void GRAPH_OT_fmodifier_copy(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_fmodifier_paste(struct wmOperatorType *ot);
|
2009-03-15 10:39:02 +00:00
|
|
|
|
2009-04-08 01:07:46 +00:00
|
|
|
/* ----------- */
|
|
|
|
|
|
2016-04-15 20:04:07 +12:00
|
|
|
void GRAPH_OT_driver_variables_copy(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_driver_variables_paste(struct wmOperatorType *ot);
|
2018-01-17 12:12:37 +01:00
|
|
|
void GRAPH_OT_driver_delete_invalid(struct wmOperatorType *ot);
|
2016-04-15 20:04:07 +12:00
|
|
|
|
|
|
|
|
/* ----------- */
|
|
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
void GRAPH_OT_ghost_curves_create(struct wmOperatorType *ot);
|
|
|
|
|
void GRAPH_OT_ghost_curves_clear(struct wmOperatorType *ot);
|
2009-04-08 01:07:46 +00:00
|
|
|
|
2009-01-27 05:04:23 +00:00
|
|
|
/* ***************************************** */
|
2009-02-20 19:11:35 +00:00
|
|
|
/* graph_buttons.c */
|
2010-04-05 11:47:55 +00:00
|
|
|
|
2009-05-19 17:13:33 +00:00
|
|
|
void graph_buttons_register(struct ARegionType *art);
|
2009-02-20 19:11:35 +00:00
|
|
|
|
2009-07-02 01:01:18 +00:00
|
|
|
/* ***************************************** */
|
|
|
|
|
/* graph_utils.c */
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Find 'active' F-Curve.
|
|
|
|
|
* It must be editable, since that's the purpose of these buttons (subject to change).
|
|
|
|
|
* We return the 'wrapper' since it contains valuable context info (about hierarchy),
|
|
|
|
|
* which will need to be freed when the caller is done with it.
|
|
|
|
|
*
|
|
|
|
|
* \note curve-visible flag isn't included,
|
|
|
|
|
* otherwise selecting a curve via list to edit is too cumbersome.
|
|
|
|
|
*/
|
2009-03-15 10:39:02 +00:00
|
|
|
struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Check if there are any visible keyframes (for selection tools).
|
|
|
|
|
*/
|
2018-07-02 11:47:00 +02:00
|
|
|
bool graphop_visible_keyframes_poll(struct bContext *C);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Check if there are any visible + editable keyframes (for editing tools).
|
|
|
|
|
*/
|
2018-07-02 11:47:00 +02:00
|
|
|
bool graphop_editable_keyframes_poll(struct bContext *C);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Has active F-Curve that's editable.
|
|
|
|
|
*/
|
2018-07-02 11:47:00 +02:00
|
|
|
bool graphop_active_fcurve_poll(struct bContext *C);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Has active F-Curve in the context that's editable.
|
|
|
|
|
*/
|
2019-06-16 13:32:50 +03:00
|
|
|
bool graphop_active_editable_fcurve_ctx_poll(struct bContext *C);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Has selected F-Curve that's editable.
|
|
|
|
|
*/
|
2018-07-02 11:47:00 +02:00
|
|
|
bool graphop_selected_fcurve_poll(struct bContext *C);
|
2009-07-02 01:01:18 +00:00
|
|
|
|
2009-02-20 19:11:35 +00:00
|
|
|
/* ***************************************** */
|
|
|
|
|
/* graph_ops.c */
|
2022-04-04 13:17:03 +10:00
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void graphedit_keymap(struct wmKeyConfig *keyconf);
|
2009-01-26 23:18:27 +00:00
|
|
|
void graphedit_operatortypes(void);
|