2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2008 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spgraph
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2023-07-22 11:27:25 +10:00
|
|
|
#include <cmath>
|
|
|
|
|
#include <cstdlib>
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
#include "BLI_blenlib.h"
|
2014-01-15 13:00:03 +11:00
|
|
|
#include "BLI_math_base.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2012-12-06 05:48:51 +00:00
|
|
|
#include "BKE_global.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "UI_view2d.hh"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_anim_api.hh"
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "ED_screen.hh"
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_transform.hh"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2009-02-03 12:04:05 +00:00
|
|
|
#include "graph_intern.h"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2023-08-10 22:40:27 +02:00
|
|
|
#include "RNA_access.hh"
|
|
|
|
|
#include "RNA_define.hh"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2023-09-22 03:18:17 +02:00
|
|
|
#include "DEG_depsgraph.hh"
|
2019-06-04 16:52:48 +02:00
|
|
|
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "WM_api.hh"
|
|
|
|
|
#include "WM_types.hh"
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* ************************** view-based operators **********************************/
|
|
|
|
|
/* XXX should these really be here? */
|
|
|
|
|
|
2021-11-05 11:32:55 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Set Cursor
|
|
|
|
|
*
|
|
|
|
|
* The 'cursor' in the Graph Editor consists of two parts:
|
2018-11-14 12:53:15 +11:00
|
|
|
* 1) Current Frame Indicator (as per ANIM_OT_change_frame)
|
|
|
|
|
* 2) Value Indicator (stored per Graph Editor instance)
|
2021-11-05 11:32:55 +11:00
|
|
|
* \{ */
|
2009-06-22 04:23:06 +00:00
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool graphview_cursor_poll(bContext *C)
|
2012-12-06 05:48:51 +00:00
|
|
|
{
|
|
|
|
|
/* prevent changes during render */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (G.is_rendering) {
|
2020-09-25 10:20:33 +02:00
|
|
|
return false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2012-12-06 05:48:51 +00:00
|
|
|
|
|
|
|
|
return ED_operator_graphedit_active(C);
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* Set the new frame number */
|
|
|
|
|
static void graphview_cursor_apply(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
2012-05-08 20:18:33 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2019-02-16 10:16:16 +11:00
|
|
|
SpaceGraph *sipo = CTX_wm_space_graph(C);
|
2019-01-15 23:24:20 +11:00
|
|
|
/* this isn't technically "frame", but it'll do... */
|
|
|
|
|
float frame = RNA_float_get(op->ptr, "frame");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-10 18:26:09 +13:00
|
|
|
/* adjust the frame or the cursor x-value */
|
|
|
|
|
if (sipo->mode == SIPO_MODE_DRIVERS) {
|
|
|
|
|
/* adjust cursor x-value */
|
2015-10-26 19:29:23 +13:00
|
|
|
sipo->cursorTime = frame;
|
2015-10-10 18:26:09 +13:00
|
|
|
}
|
|
|
|
|
else {
|
2018-06-04 09:31:30 +02:00
|
|
|
/* adjust the frame
|
2015-10-10 18:26:09 +13:00
|
|
|
* NOTE: sync this part of the code with ANIM_OT_change_frame
|
|
|
|
|
*/
|
2015-10-26 19:29:23 +13:00
|
|
|
/* 1) frame is rounded to the nearest int, since frames are ints */
|
2022-06-30 18:36:42 +02:00
|
|
|
scene->r.cfra = round_fl_to_int(frame);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-26 19:29:23 +13:00
|
|
|
if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {
|
|
|
|
|
/* Clip to preview range
|
|
|
|
|
* NOTE: Preview range won't go into negative values,
|
|
|
|
|
* so only clamping once should be fine.
|
|
|
|
|
*/
|
2022-06-30 18:36:42 +02:00
|
|
|
CLAMP(scene->r.cfra, PSFRA, PEFRA);
|
2015-10-26 19:29:23 +13:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Prevent negative frames */
|
2022-06-30 18:36:42 +02:00
|
|
|
FRAMENUMBER_MIN_CLAMP(scene->r.cfra);
|
2015-10-26 19:29:23 +13:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-06-30 18:36:42 +02:00
|
|
|
scene->r.subframe = 0.0f;
|
2022-02-03 21:32:50 +11:00
|
|
|
DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE);
|
2015-10-10 18:26:09 +13:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* set the cursor value */
|
2012-05-08 20:18:33 +00:00
|
|
|
sipo->cursorVal = RNA_float_get(op->ptr, "value");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* send notifiers - notifiers for frame should force an update for both vars ok... */
|
2012-05-08 20:18:33 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2009-10-20 12:04:56 +00:00
|
|
|
}
|
2009-06-22 04:23:06 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* ... */
|
2009-06-22 04:23:06 +00:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* Non-modal callback for running operator without user input */
|
|
|
|
|
static int graphview_cursor_exec(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
graphview_cursor_apply(C, op);
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
|
|
|
|
|
/* set the operator properties from the initial event */
|
2013-03-13 09:03:46 +00:00
|
|
|
static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
2009-10-20 12:04:56 +00:00
|
|
|
float viewx, viewy;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* abort if not active region (should not really be possible) */
|
2023-07-12 13:43:00 +02:00
|
|
|
if (region == nullptr) {
|
2009-10-20 12:04:56 +00:00
|
|
|
return;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* convert from region coordinates to View2D 'tot' space */
|
2020-03-06 16:56:42 +01:00
|
|
|
UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-05-08 17:43:11 +12:00
|
|
|
/* store the values in the operator properties */
|
2015-10-26 19:29:23 +13:00
|
|
|
/* NOTE: we don't clamp frame here, as it might be used for the drivers cursor */
|
|
|
|
|
RNA_float_set(op->ptr, "frame", viewx);
|
2009-10-20 12:04:56 +00:00
|
|
|
RNA_float_set(op->ptr, "value", viewy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Modal Operator init */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int graphview_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
2015-08-07 15:39:32 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* Change to frame that mouse is over before adding modal handler,
|
|
|
|
|
* as user could click on a single frame (jump to frame) as well as
|
2015-10-26 19:29:23 +13:00
|
|
|
* click-dragging over a range (modal scrubbing). Apply this change.
|
2009-10-20 12:04:56 +00:00
|
|
|
*/
|
|
|
|
|
graphview_cursor_setprops(C, op, event);
|
|
|
|
|
graphview_cursor_apply(C, op);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-26 19:29:23 +13:00
|
|
|
/* Signal that a scrubbing operating is starting */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (screen) {
|
2015-08-07 15:39:32 +02:00
|
|
|
screen->scrubbing = true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* add temp handler */
|
|
|
|
|
WM_event_add_modal_handler(C, op);
|
|
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Modal event handling of cursor changing */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int graphview_cursor_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
2015-08-07 15:39:32 +02:00
|
|
|
bScreen *screen = CTX_wm_screen(C);
|
2015-10-26 19:29:23 +13:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* execute the events */
|
|
|
|
|
switch (event->type) {
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_ESCKEY:
|
2019-04-22 09:19:45 +10:00
|
|
|
if (screen) {
|
2015-08-07 15:39:32 +02:00
|
|
|
screen->scrubbing = false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-26 19:29:23 +13:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2009-10-20 12:04:56 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
case MOUSEMOVE:
|
|
|
|
|
/* set the new values */
|
|
|
|
|
graphview_cursor_setprops(C, op, event);
|
|
|
|
|
graphview_cursor_apply(C, op);
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
case LEFTMOUSE:
|
2009-10-20 12:04:56 +00:00
|
|
|
case RIGHTMOUSE:
|
2014-09-07 14:45:05 +02:00
|
|
|
case MIDDLEMOUSE:
|
2018-11-16 08:28:58 +11:00
|
|
|
/* We check for either mouse-button to end, to work with all user keymaps. */
|
2015-07-29 12:52:03 +02:00
|
|
|
if (event->val == KM_RELEASE) {
|
2019-04-22 09:19:45 +10:00
|
|
|
if (screen) {
|
2015-08-07 15:39:32 +02:00
|
|
|
screen->scrubbing = false;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-26 19:29:23 +13:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
2009-10-20 12:04:56 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2015-07-29 12:52:03 +02:00
|
|
|
}
|
2009-10-20 12:04:56 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
return OPERATOR_RUNNING_MODAL;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void GRAPH_OT_cursor_set(wmOperatorType *ot)
|
2009-10-20 12:04:56 +00:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->name = "Set Cursor";
|
|
|
|
|
ot->idname = "GRAPH_OT_cursor_set";
|
2015-10-10 18:26:09 +13:00
|
|
|
ot->description = "Interactively set the current frame and value cursor";
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* api callbacks */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = graphview_cursor_exec;
|
|
|
|
|
ot->invoke = graphview_cursor_invoke;
|
|
|
|
|
ot->modal = graphview_cursor_modal;
|
2012-12-06 05:48:51 +00:00
|
|
|
ot->poll = graphview_cursor_poll;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* flags */
|
2019-05-29 00:48:48 +10:00
|
|
|
ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_X | OPTYPE_UNDO;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-20 12:04:56 +00:00
|
|
|
/* rna */
|
2015-10-26 19:29:23 +13:00
|
|
|
RNA_def_float(ot->srna, "frame", 0, MINAFRAMEF, MAXFRAMEF, "Frame", "", MINAFRAMEF, MAXFRAMEF);
|
2012-08-07 19:49:38 +00:00
|
|
|
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Value", "", -100.0f, 100.0f);
|
2009-10-20 12:04:56 +00:00
|
|
|
}
|
2009-01-28 06:32:47 +00:00
|
|
|
|
2021-11-05 11:32:55 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Hide/Reveal
|
|
|
|
|
* \{ */
|
2014-11-20 02:24:42 +13:00
|
|
|
|
2014-11-20 03:07:09 +13:00
|
|
|
static int graphview_curves_hide_exec(bContext *C, wmOperator *op)
|
2014-11-20 02:24:42 +13:00
|
|
|
{
|
|
|
|
|
bAnimContext ac;
|
2023-07-12 13:43:00 +02:00
|
|
|
ListBase anim_data = {nullptr, nullptr};
|
|
|
|
|
ListBase all_data = {nullptr, nullptr};
|
2014-11-20 02:24:42 +13:00
|
|
|
int filter;
|
2014-11-20 03:07:09 +13:00
|
|
|
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* get editor data */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0) {
|
2014-11-20 02:24:42 +13:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* get list of all channels that selection may need to be flushed to
|
2014-11-20 02:24:42 +13:00
|
|
|
* - hierarchy must not affect what we have access to here...
|
|
|
|
|
*/
|
Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.
Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).
A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.
**Implemented:**
- Preview range set: now only considers selected Grease Pencil keyframes
when `onlySel` parameter is true. Not only this allows the operator to
work with grease pencil keyframes in main dopesheet, but it also fixes
the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
mixed selection. Errors are only reported when both the FCurve and
GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
unify Grease Pencil dopesheet and main dopesheet code.
- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
Clickselect: account for Grease Pencil channels within the channels
loop, no need for `ANIMFILTER_FCURVESONLY` there.
**Not Implemented:**
- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
naively added to all graph-related operators, meaning more-or-less all
operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
type change: work on Fcurve-channels only, so the
`ANIMFILTER_FCURVESONLY` filter is activated
Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.
**Dopesheet Summary Selection:**
The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.
Reviewed By: mendio, pepeland, sybren
Maniphest Tasks: T97477
Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:16:05 +02:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FCURVESONLY | ANIMFILTER_LIST_CHANNELS |
|
|
|
|
|
ANIMFILTER_NODUPLIS);
|
2023-07-12 13:43:00 +02:00
|
|
|
ANIM_animdata_filter(
|
|
|
|
|
&ac, &all_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* filter data
|
2018-06-04 09:31:30 +02:00
|
|
|
* - of the remaining visible curves, we want to hide the ones that are
|
|
|
|
|
* selected/unselected (depending on "unselected" prop)
|
2014-11-20 02:24:42 +13:00
|
|
|
*/
|
Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.
Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).
A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.
**Implemented:**
- Preview range set: now only considers selected Grease Pencil keyframes
when `onlySel` parameter is true. Not only this allows the operator to
work with grease pencil keyframes in main dopesheet, but it also fixes
the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
mixed selection. Errors are only reported when both the FCurve and
GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
unify Grease Pencil dopesheet and main dopesheet code.
- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
Clickselect: account for Grease Pencil channels within the channels
loop, no need for `ANIMFILTER_FCURVESONLY` there.
**Not Implemented:**
- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
naively added to all graph-related operators, meaning more-or-less all
operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
type change: work on Fcurve-channels only, so the
`ANIMFILTER_FCURVESONLY` filter is activated
Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.
**Dopesheet Summary Selection:**
The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.
Reviewed By: mendio, pepeland, sybren
Maniphest Tasks: T97477
Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:16:05 +02:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FCURVESONLY | ANIMFILTER_CURVE_VISIBLE |
|
|
|
|
|
ANIMFILTER_NODUPLIS);
|
2019-04-22 09:19:45 +10:00
|
|
|
if (unselected) {
|
2014-11-20 03:07:09 +13:00
|
|
|
filter |= ANIMFILTER_UNSEL;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2014-11-20 03:07:09 +13:00
|
|
|
filter |= ANIMFILTER_SEL;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-07-12 13:43:00 +02:00
|
|
|
ANIM_animdata_filter(
|
|
|
|
|
&ac, &anim_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* hack: skip object channels for now, since flushing those will always flush everything,
|
|
|
|
|
* but they are always included */
|
2014-11-20 02:24:42 +13:00
|
|
|
/* TODO: find out why this is the case, and fix that */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ale->type == ANIMTYPE_OBJECT) {
|
2014-11-20 02:24:42 +13:00
|
|
|
continue;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* change the hide setting, and unselect it... */
|
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR);
|
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_CLEAR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* now, also flush selection status up/down as appropriate */
|
2014-11-20 18:11:12 +01:00
|
|
|
ANIM_flush_setting_anim_channels(
|
|
|
|
|
&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_CLEAR);
|
2014-11-20 02:24:42 +13:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* cleanup */
|
|
|
|
|
ANIM_animdata_freelist(&anim_data);
|
|
|
|
|
BLI_freelistN(&all_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 18:11:12 +01:00
|
|
|
/* unhide selected */
|
|
|
|
|
if (unselected) {
|
|
|
|
|
/* turn off requirement for visible */
|
Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.
Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).
A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.
**Implemented:**
- Preview range set: now only considers selected Grease Pencil keyframes
when `onlySel` parameter is true. Not only this allows the operator to
work with grease pencil keyframes in main dopesheet, but it also fixes
the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
mixed selection. Errors are only reported when both the FCurve and
GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
unify Grease Pencil dopesheet and main dopesheet code.
- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
Clickselect: account for Grease Pencil channels within the channels
loop, no need for `ANIMFILTER_FCURVESONLY` there.
**Not Implemented:**
- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
naively added to all graph-related operators, meaning more-or-less all
operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
type change: work on Fcurve-channels only, so the
`ANIMFILTER_FCURVESONLY` filter is activated
Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.
**Dopesheet Summary Selection:**
The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.
Reviewed By: mendio, pepeland, sybren
Maniphest Tasks: T97477
Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:16:05 +02:00
|
|
|
filter = ANIMFILTER_SEL | ANIMFILTER_NODUPLIS | ANIMFILTER_LIST_CHANNELS |
|
|
|
|
|
ANIMFILTER_FCURVESONLY;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 18:11:12 +01:00
|
|
|
/* flushing has been done */
|
2023-07-12 13:43:00 +02:00
|
|
|
ANIM_animdata_filter(
|
|
|
|
|
&ac, &anim_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* hack: skip object channels for now, since flushing those
|
|
|
|
|
* will always flush everything, but they are always included */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 18:11:12 +01:00
|
|
|
/* TODO: find out why this is the case, and fix that */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ale->type == ANIMTYPE_OBJECT) {
|
2014-11-20 18:11:12 +01:00
|
|
|
continue;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 18:11:12 +01:00
|
|
|
/* change the hide setting, and unselect it... */
|
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
|
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_SELECT, ACHANNEL_SETFLAG_ADD);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 18:11:12 +01:00
|
|
|
/* now, also flush selection status up/down as appropriate */
|
|
|
|
|
ANIM_flush_setting_anim_channels(
|
|
|
|
|
&ac, &anim_data, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2014-11-20 18:11:12 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* send notifier that things have changed */
|
2023-07-12 13:43:00 +02:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, nullptr);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void GRAPH_OT_hide(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name = "Hide Curves";
|
|
|
|
|
ot->idname = "GRAPH_OT_hide";
|
|
|
|
|
ot->description = "Hide selected curves from Graph Editor view";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* api callbacks */
|
|
|
|
|
ot->exec = graphview_curves_hide_exec;
|
|
|
|
|
ot->poll = ED_operator_graphedit_active;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-20 03:07:09 +13:00
|
|
|
/* props */
|
|
|
|
|
RNA_def_boolean(
|
2023-07-22 11:36:59 +10:00
|
|
|
ot->srna, "unselected", false, "Unselected", "Hide unselected rather than selected curves");
|
2014-11-20 02:24:42 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ........ */
|
|
|
|
|
|
2017-11-20 02:28:07 +11:00
|
|
|
static int graphview_curves_reveal_exec(bContext *C, wmOperator *op)
|
2014-11-20 02:24:42 +13:00
|
|
|
{
|
|
|
|
|
bAnimContext ac;
|
2023-07-12 13:43:00 +02:00
|
|
|
ListBase anim_data = {nullptr, nullptr};
|
|
|
|
|
ListBase all_data = {nullptr, nullptr};
|
2014-11-20 02:24:42 +13:00
|
|
|
int filter;
|
2017-11-20 02:28:07 +11:00
|
|
|
const bool select = RNA_boolean_get(op->ptr, "select");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* get editor data */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0) {
|
2014-11-20 02:24:42 +13:00
|
|
|
return OPERATOR_CANCELLED;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* get list of all channels that selection may need to be flushed to
|
2014-11-20 02:24:42 +13:00
|
|
|
* - hierarchy must not affect what we have access to here...
|
|
|
|
|
*/
|
Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.
Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).
A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.
**Implemented:**
- Preview range set: now only considers selected Grease Pencil keyframes
when `onlySel` parameter is true. Not only this allows the operator to
work with grease pencil keyframes in main dopesheet, but it also fixes
the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
mixed selection. Errors are only reported when both the FCurve and
GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
unify Grease Pencil dopesheet and main dopesheet code.
- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
Clickselect: account for Grease Pencil channels within the channels
loop, no need for `ANIMFILTER_FCURVESONLY` there.
**Not Implemented:**
- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
naively added to all graph-related operators, meaning more-or-less all
operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
type change: work on Fcurve-channels only, so the
`ANIMFILTER_FCURVESONLY` filter is activated
Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.
**Dopesheet Summary Selection:**
The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.
Reviewed By: mendio, pepeland, sybren
Maniphest Tasks: T97477
Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:16:05 +02:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS |
|
|
|
|
|
ANIMFILTER_FCURVESONLY);
|
2023-07-12 13:43:00 +02:00
|
|
|
ANIM_animdata_filter(
|
|
|
|
|
&ac, &all_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* filter data
|
|
|
|
|
* - just go through all visible channels, ensuring that everything is set to be curve-visible
|
|
|
|
|
*/
|
Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.
Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).
A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.
**Implemented:**
- Preview range set: now only considers selected Grease Pencil keyframes
when `onlySel` parameter is true. Not only this allows the operator to
work with grease pencil keyframes in main dopesheet, but it also fixes
the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
mixed selection. Errors are only reported when both the FCurve and
GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
unify Grease Pencil dopesheet and main dopesheet code.
- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
Clickselect: account for Grease Pencil channels within the channels
loop, no need for `ANIMFILTER_FCURVESONLY` there.
**Not Implemented:**
- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
naively added to all graph-related operators, meaning more-or-less all
operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
type change: work on Fcurve-channels only, so the
`ANIMFILTER_FCURVESONLY` filter is activated
Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.
**Dopesheet Summary Selection:**
The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.
Reviewed By: mendio, pepeland, sybren
Maniphest Tasks: T97477
Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:16:05 +02:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS |
|
|
|
|
|
ANIMFILTER_FCURVESONLY);
|
2023-07-12 13:43:00 +02:00
|
|
|
ANIM_animdata_filter(
|
|
|
|
|
&ac, &anim_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* hack: skip object channels for now, since flushing those will always flush everything,
|
|
|
|
|
* but they are always included. */
|
2014-11-20 02:24:42 +13:00
|
|
|
/* TODO: find out why this is the case, and fix that */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (ale->type == ANIMTYPE_OBJECT) {
|
2014-11-20 02:24:42 +13:00
|
|
|
continue;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* select if it is not visible */
|
2017-11-20 02:28:07 +11:00
|
|
|
if (ANIM_channel_setting_get(&ac, ale, ACHANNEL_SETTING_VISIBLE) == 0) {
|
|
|
|
|
ANIM_channel_setting_set(&ac,
|
|
|
|
|
ale,
|
|
|
|
|
ACHANNEL_SETTING_SELECT,
|
|
|
|
|
select ? ACHANNEL_SETFLAG_ADD : ACHANNEL_SETFLAG_CLEAR);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* change the visibility setting */
|
|
|
|
|
ANIM_channel_setting_set(&ac, ale, ACHANNEL_SETTING_VISIBLE, ACHANNEL_SETFLAG_ADD);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* now, also flush selection status up/down as appropriate */
|
2023-07-12 13:43:00 +02:00
|
|
|
ANIM_flush_setting_anim_channels(
|
|
|
|
|
&ac, &all_data, ale, ACHANNEL_SETTING_VISIBLE, eAnimChannels_SetFlag(true));
|
2014-11-20 02:24:42 +13:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* cleanup */
|
|
|
|
|
ANIM_animdata_freelist(&anim_data);
|
|
|
|
|
BLI_freelistN(&all_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* send notifier that things have changed */
|
2023-07-12 13:43:00 +02:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, nullptr);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-19 14:35:00 +01:00
|
|
|
static void GRAPH_OT_reveal(wmOperatorType *ot)
|
2014-11-20 02:24:42 +13:00
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2014-11-19 14:35:00 +01:00
|
|
|
ot->name = "Reveal Curves";
|
|
|
|
|
ot->idname = "GRAPH_OT_reveal";
|
2014-11-20 02:24:42 +13:00
|
|
|
ot->description = "Make previously hidden curves visible again in Graph Editor view";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* api callbacks */
|
2014-11-19 14:35:00 +01:00
|
|
|
ot->exec = graphview_curves_reveal_exec;
|
2014-11-20 02:24:42 +13:00
|
|
|
ot->poll = ED_operator_graphedit_active;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
/* flags */
|
|
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2017-11-20 02:28:07 +11:00
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "select", true, "Select", "");
|
2014-11-20 02:24:42 +13:00
|
|
|
}
|
|
|
|
|
|
2021-11-05 11:32:55 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Registration: operator types
|
|
|
|
|
* \{ */
|
2009-01-26 23:18:27 +00:00
|
|
|
|
2023-07-13 09:54:02 +10:00
|
|
|
void graphedit_operatortypes()
|
2009-01-26 23:18:27 +00:00
|
|
|
{
|
2009-01-28 06:32:47 +00:00
|
|
|
/* view */
|
2009-10-20 12:04:56 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_cursor_set);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_previewrange_set);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_view_all);
|
2011-03-17 10:02:37 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_view_selected);
|
2015-04-13 14:30:17 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_view_frame);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_ghost_curves_create);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_ghost_curves_clear);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-20 02:24:42 +13:00
|
|
|
WM_operatortype_append(GRAPH_OT_hide);
|
2014-11-19 14:35:00 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_reveal);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* keyframes */
|
2012-05-08 20:18:33 +00:00
|
|
|
/* selection */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_clickselect);
|
2018-07-03 15:44:56 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_all);
|
2018-10-05 10:27:04 +10:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_box);
|
2014-03-09 16:20:04 +11:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_lasso);
|
2014-12-09 16:53:50 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_circle);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_column);
|
2010-04-05 11:47:55 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_linked);
|
2010-02-07 11:50:03 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_more);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_select_less);
|
2011-02-14 02:50:52 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_leftright);
|
2023-09-21 15:05:30 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_select_key_handles);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-08 20:18:33 +00:00
|
|
|
/* editing */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_snap);
|
2022-01-25 11:40:46 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_equalize_handles);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_mirror);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_frame_jump);
|
2023-06-08 11:02:19 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_keyframe_jump);
|
2020-10-16 16:44:06 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_snap_cursor_value);
|
2010-12-14 10:52:38 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_handle_type);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_interpolation_type);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_extrapolation_type);
|
2014-03-22 02:50:24 +13:00
|
|
|
WM_operatortype_append(GRAPH_OT_easing_type);
|
2023-09-12 09:32:18 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_bake_keys);
|
2023-09-08 14:01:47 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_keys_to_samples);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_samples_to_keys);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_sound_to_samples);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_smooth);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_clean);
|
2019-11-21 11:58:35 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_decimate);
|
2021-12-25 13:40:53 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_blend_to_neighbor);
|
2021-12-25 20:58:47 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_breakdown);
|
2023-01-05 10:11:24 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_ease);
|
2023-08-31 17:09:01 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_shear);
|
2023-09-08 13:07:30 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_scale_average);
|
2023-08-10 16:09:39 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_blend_offset);
|
2023-08-10 17:51:14 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_blend_to_ease);
|
2023-08-17 10:28:46 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_match_slope);
|
2023-09-21 15:11:16 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_time_offset);
|
2022-03-18 20:07:16 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_blend_to_default);
|
2023-09-21 12:46:27 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_push_pull);
|
2023-03-24 12:11:20 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_gaussian_smooth);
|
2023-07-13 09:10:42 +02:00
|
|
|
WM_operatortype_append(GRAPH_OT_butterworth_smooth);
|
2011-03-25 03:58:21 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_euler_filter);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_delete);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_duplicate);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_copy);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_paste);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-28 14:37:21 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_keyframe_insert);
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_click_insert);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-03-15 10:39:02 +00:00
|
|
|
/* F-Curve Modifiers */
|
2009-06-22 04:23:06 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_fmodifier_add);
|
2010-03-18 13:04:46 +00:00
|
|
|
WM_operatortype_append(GRAPH_OT_fmodifier_copy);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_fmodifier_paste);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-04-15 20:04:07 +12:00
|
|
|
/* Drivers */
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_driver_variables_copy);
|
|
|
|
|
WM_operatortype_append(GRAPH_OT_driver_variables_paste);
|
2018-01-17 12:12:37 +01:00
|
|
|
WM_operatortype_append(GRAPH_OT_driver_delete_invalid);
|
2009-01-26 23:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-07-13 09:54:02 +10:00
|
|
|
void ED_operatormacros_graph()
|
2011-03-04 16:02:42 +00:00
|
|
|
{
|
|
|
|
|
wmOperatorType *ot;
|
|
|
|
|
wmOperatorTypeMacro *otmacro;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-05 19:26:53 +00:00
|
|
|
ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move",
|
|
|
|
|
"Duplicate",
|
|
|
|
|
"Make a copy of all selected keyframes and move them",
|
2012-05-08 20:18:33 +00:00
|
|
|
OPTYPE_UNDO | OPTYPE_REGISTER);
|
2013-10-26 08:01:33 +00:00
|
|
|
WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
|
2023-06-02 00:47:53 -03:00
|
|
|
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
|
2023-09-11 14:43:35 +02:00
|
|
|
RNA_boolean_set(otmacro->ptr, "use_duplicated_keyframes", true);
|
2019-04-30 13:42:18 +10:00
|
|
|
RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
|
2011-03-04 16:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
2021-11-05 11:32:55 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Registration: Key-Maps
|
|
|
|
|
* \{ */
|
2009-01-26 23:18:27 +00: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(wmKeyConfig *keyconf)
|
2009-01-26 23:18:27 +00:00
|
|
|
{
|
2009-02-20 19:11:35 +00:00
|
|
|
/* keymap for all regions */
|
2023-09-14 13:32:42 +10:00
|
|
|
WM_keymap_ensure(keyconf, "Graph Editor Generic", SPACE_GRAPH, RGN_TYPE_WINDOW);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* channels */
|
2019-04-22 00:18:34 +10:00
|
|
|
/* Channels are not directly handled by the Graph Editor module,
|
|
|
|
|
* but are inherited from the Animation module.
|
|
|
|
|
* All the relevant operations, keymaps, drawing, etc.
|
|
|
|
|
* can therefore all be found in that module instead,
|
|
|
|
|
* as these are all used for the Graph Editor too.
|
2009-01-26 23:18:27 +00:00
|
|
|
*/
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-01-26 23:18:27 +00:00
|
|
|
/* keyframes */
|
2023-09-14 13:32:42 +10:00
|
|
|
WM_keymap_ensure(keyconf, "Graph Editor", SPACE_GRAPH, RGN_TYPE_WINDOW);
|
2009-01-26 23:18:27 +00:00
|
|
|
}
|
2021-11-05 11:32:55 +11:00
|
|
|
|
|
|
|
|
/** \} */
|