2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung. All rights reserved.
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup edanimation
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* System includes ----------------------------------------------------- */
|
|
|
|
|
|
2023-07-22 11:27:25 +10:00
|
|
|
#include <cfloat>
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2021-08-11 16:18:52 +02:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2023-08-10 13:55:14 +02:00
|
|
|
#include "BKE_grease_pencil.hh"
|
|
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
#include "BLI_dlrbTree.h"
|
2020-04-03 17:38:58 +02:00
|
|
|
#include "BLI_listbase.h"
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
#include "BLI_rect.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2009-01-20 11:07:42 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2023-03-13 10:42:51 +01:00
|
|
|
#include "DNA_gpencil_legacy_types.h"
|
2023-07-12 10:32:09 +02:00
|
|
|
#include "DNA_grease_pencil_types.h"
|
2012-06-04 16:42:58 +00:00
|
|
|
#include "DNA_mask_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
#include "GPU_immediate.h"
|
2023-02-12 20:53:42 +01:00
|
|
|
#include "GPU_shader_shared.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "UI_interface.hh"
|
|
|
|
|
#include "UI_resources.hh"
|
|
|
|
|
#include "UI_view2d.hh"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_anim_api.hh"
|
|
|
|
|
#include "ED_keyframes_draw.hh"
|
|
|
|
|
#include "ED_keyframes_keylist.hh"
|
2011-03-24 03:19:30 +00:00
|
|
|
|
2009-07-17 00:17:37 +00:00
|
|
|
/* *************************** Keyframe Drawing *************************** */
|
|
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
void draw_keyframe_shape(float x,
|
|
|
|
|
float y,
|
|
|
|
|
float size,
|
|
|
|
|
bool sel,
|
|
|
|
|
short key_type,
|
|
|
|
|
short mode,
|
|
|
|
|
float alpha,
|
2021-08-13 09:37:38 +02:00
|
|
|
const KeyframeShaderBindings *sh_bindings,
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
short handle_type,
|
|
|
|
|
short extreme_type)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2017-02-11 00:24:59 -05:00
|
|
|
bool draw_fill = ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH);
|
|
|
|
|
bool draw_outline = ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-28 01:21:27 -05:00
|
|
|
BLI_assert(draw_fill || draw_outline);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
/* tweak size of keyframe shape according to type of keyframe
|
2012-10-23 03:38:26 +00:00
|
|
|
* - 'proper' keyframes have key_type = 0, so get drawn at full size
|
2009-09-04 02:44:56 +00:00
|
|
|
*/
|
2016-07-07 23:37:15 +12:00
|
|
|
switch (key_type) {
|
|
|
|
|
case BEZT_KEYTYPE_KEYFRAME: /* must be full size */
|
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
case BEZT_KEYTYPE_BREAKDOWN: /* slightly smaller than normal keyframe */
|
2017-02-11 00:24:59 -05:00
|
|
|
size *= 0.85f;
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-18 07:21:26 +02:00
|
|
|
case BEZT_KEYTYPE_MOVEHOLD: /* Slightly smaller than normal keyframes
|
|
|
|
|
* (but by less than for breakdowns). */
|
2017-02-28 01:21:27 -05:00
|
|
|
size *= 0.925f;
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
case BEZT_KEYTYPE_EXTREME: /* slightly larger */
|
2017-02-11 00:24:59 -05:00
|
|
|
size *= 1.2f;
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
default:
|
2017-08-03 01:25:55 +12:00
|
|
|
size -= 0.8f * key_type;
|
2016-07-07 23:37:15 +12:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar fill_col[4];
|
|
|
|
|
uchar outline_col[4];
|
|
|
|
|
uint flags = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-07-10 00:32:13 +00:00
|
|
|
/* draw! */
|
2017-02-11 00:24:59 -05:00
|
|
|
if (draw_fill) {
|
2014-01-16 23:56:40 +13:00
|
|
|
/* get interior colors from theme (for selected and unselected only) */
|
2009-09-04 02:44:56 +00:00
|
|
|
switch (key_type) {
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames (default theme) */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_BREAKDOWN_SELECT : TH_KEYTYPE_BREAKDOWN, fill_col);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_EXTREME: /* reddish frames (default theme) */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_EXTREME_SELECT : TH_KEYTYPE_EXTREME, fill_col);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_JITTER: /* greenish frames (default theme) */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_JITTER_SELECT : TH_KEYTYPE_JITTER, fill_col);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2016-07-07 23:37:15 +12:00
|
|
|
case BEZT_KEYTYPE_MOVEHOLD: /* similar to traditional keyframes, but different... */
|
2018-10-18 23:48:06 +03:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_MOVEHOLD_SELECT : TH_KEYTYPE_MOVEHOLD, fill_col);
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames (default theme) */
|
2009-09-04 02:44:56 +00:00
|
|
|
default:
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_KEYFRAME_SELECT : TH_KEYTYPE_KEYFRAME, fill_col);
|
2009-09-04 02:44:56 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* NOTE: we don't use the straight alpha from the theme, or else effects such as
|
2015-03-19 14:14:48 +11:00
|
|
|
* graying out protected/muted channels doesn't work correctly!
|
2014-01-16 23:56:40 +13:00
|
|
|
*/
|
2017-02-11 00:24:59 -05:00
|
|
|
fill_col[3] *= alpha;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
if (!draw_outline) {
|
|
|
|
|
/* force outline color to match */
|
|
|
|
|
outline_col[0] = fill_col[0];
|
|
|
|
|
outline_col[1] = fill_col[1];
|
|
|
|
|
outline_col[2] = fill_col[2];
|
|
|
|
|
outline_col[3] = fill_col[3];
|
|
|
|
|
}
|
2009-07-10 00:32:13 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
if (draw_outline) {
|
2009-07-10 00:32:13 +00:00
|
|
|
/* exterior - black frame */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYBORDER_SELECT : TH_KEYBORDER, outline_col);
|
|
|
|
|
outline_col[3] *= alpha;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
if (!draw_fill) {
|
|
|
|
|
/* fill color needs to be (outline.rgb, 0) */
|
|
|
|
|
fill_col[0] = outline_col[0];
|
|
|
|
|
fill_col[1] = outline_col[1];
|
|
|
|
|
fill_col[2] = outline_col[2];
|
|
|
|
|
fill_col[3] = 0;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
/* Handle type to outline shape. */
|
|
|
|
|
switch (handle_type) {
|
|
|
|
|
case KEYFRAME_HANDLE_AUTO_CLAMP:
|
2021-09-23 15:53:38 +02:00
|
|
|
flags = GPU_KEYFRAME_SHAPE_CIRCLE;
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
break; /* circle */
|
|
|
|
|
case KEYFRAME_HANDLE_AUTO:
|
2021-09-23 15:53:38 +02:00
|
|
|
flags = GPU_KEYFRAME_SHAPE_CIRCLE | GPU_KEYFRAME_SHAPE_INNER_DOT;
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
break; /* circle with dot */
|
|
|
|
|
case KEYFRAME_HANDLE_VECTOR:
|
2021-09-23 15:53:38 +02:00
|
|
|
flags = GPU_KEYFRAME_SHAPE_SQUARE;
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
break; /* square */
|
|
|
|
|
case KEYFRAME_HANDLE_ALIGNED:
|
2021-09-23 15:53:38 +02:00
|
|
|
flags = GPU_KEYFRAME_SHAPE_DIAMOND | GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL;
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
break; /* clipped diamond */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
case KEYFRAME_HANDLE_FREE:
|
|
|
|
|
default:
|
2021-09-23 15:53:38 +02:00
|
|
|
flags = GPU_KEYFRAME_SHAPE_DIAMOND; /* diamond */
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
/* Extreme type to arrow-like shading. */
|
|
|
|
|
if (extreme_type & KEYFRAME_EXTREME_MAX) {
|
2021-09-23 15:53:38 +02:00
|
|
|
flags |= GPU_KEYFRAME_SHAPE_ARROW_END_MAX;
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
}
|
|
|
|
|
if (extreme_type & KEYFRAME_EXTREME_MIN) {
|
2021-09-23 15:53:38 +02:00
|
|
|
flags |= GPU_KEYFRAME_SHAPE_ARROW_END_MIN;
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
}
|
2021-09-23 15:53:38 +02:00
|
|
|
if (extreme_type & GPU_KEYFRAME_SHAPE_ARROW_END_MIXED) {
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
flags |= 0x400;
|
2009-07-10 00:32:13 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
2021-08-13 09:37:38 +02:00
|
|
|
immAttr1f(sh_bindings->size_id, size);
|
|
|
|
|
immAttr4ubv(sh_bindings->color_id, fill_col);
|
|
|
|
|
immAttr4ubv(sh_bindings->outline_color_id, outline_col);
|
|
|
|
|
immAttr1u(sh_bindings->flags_id, flags);
|
|
|
|
|
immVertex2f(sh_bindings->pos_id, x, y);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2021-08-11 13:34:11 +02:00
|
|
|
/* Common attributes shared between the draw calls. */
|
2023-06-26 11:27:25 +02:00
|
|
|
struct DrawKeylistUIData {
|
2021-08-11 13:34:11 +02:00
|
|
|
float alpha;
|
2022-05-11 13:37:10 +10:00
|
|
|
float icon_size;
|
|
|
|
|
float half_icon_size;
|
|
|
|
|
float smaller_size;
|
|
|
|
|
float ipo_size;
|
|
|
|
|
float gpencil_size;
|
2021-08-11 13:34:11 +02:00
|
|
|
float screenspace_margin;
|
|
|
|
|
float sel_color[4];
|
|
|
|
|
float unsel_color[4];
|
|
|
|
|
float sel_mhcol[4];
|
|
|
|
|
float unsel_mhcol[4];
|
|
|
|
|
float ipo_color[4];
|
|
|
|
|
float ipo_color_mix[4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-08-11 13:34:11 +02:00
|
|
|
/* Show interpolation and handle type? */
|
|
|
|
|
bool show_ipo;
|
2023-06-26 11:27:25 +02:00
|
|
|
};
|
2021-08-11 13:34:11 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void channel_ui_data_init(DrawKeylistUIData *ctx,
|
|
|
|
|
View2D *v2d,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
bool channel_locked,
|
|
|
|
|
eSAction_Flag saction_flag)
|
2021-08-11 13:34:11 +02:00
|
|
|
{
|
2014-01-17 00:00:40 +13:00
|
|
|
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
|
|
|
|
|
/* TODO: allow this opacity factor to be themed? */
|
2021-08-11 13:34:11 +02:00
|
|
|
ctx->alpha = channel_locked ? 0.25f : 1.0f;
|
|
|
|
|
|
2022-05-11 13:37:10 +10:00
|
|
|
ctx->icon_size = U.widget_unit * 0.5f * yscale_fac;
|
|
|
|
|
ctx->half_icon_size = 0.5f * ctx->icon_size;
|
|
|
|
|
ctx->smaller_size = 0.35f * ctx->icon_size;
|
|
|
|
|
ctx->ipo_size = 0.1f * ctx->icon_size;
|
|
|
|
|
ctx->gpencil_size = ctx->smaller_size * 0.8f;
|
2023-07-14 12:23:37 +10:00
|
|
|
ctx->screenspace_margin = (0.35f * float(UI_UNIT_X)) / UI_view2d_scale_get_x(v2d);
|
2021-08-11 13:34:11 +02:00
|
|
|
|
|
|
|
|
ctx->show_ipo = (saction_flag & SACTION_SHOW_INTERPOLATION) != 0;
|
|
|
|
|
|
|
|
|
|
UI_GetThemeColor4fv(TH_STRIP_SELECT, ctx->sel_color);
|
|
|
|
|
UI_GetThemeColor4fv(TH_STRIP, ctx->unsel_color);
|
|
|
|
|
UI_GetThemeColor4fv(TH_DOPESHEET_IPOLINE, ctx->ipo_color);
|
|
|
|
|
|
|
|
|
|
ctx->sel_color[3] *= ctx->alpha;
|
|
|
|
|
ctx->unsel_color[3] *= ctx->alpha;
|
|
|
|
|
ctx->ipo_color[3] *= ctx->alpha;
|
|
|
|
|
|
|
|
|
|
copy_v4_v4(ctx->sel_mhcol, ctx->sel_color);
|
|
|
|
|
ctx->sel_mhcol[3] *= 0.8f;
|
|
|
|
|
copy_v4_v4(ctx->unsel_mhcol, ctx->unsel_color);
|
|
|
|
|
ctx->unsel_mhcol[3] *= 0.8f;
|
|
|
|
|
copy_v4_v4(ctx->ipo_color_mix, ctx->ipo_color);
|
|
|
|
|
ctx->ipo_color_mix[3] *= 0.5f;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-08-11 13:34:11 +02:00
|
|
|
static void draw_keylist_block_gpencil(const DrawKeylistUIData *ctx,
|
|
|
|
|
const ActKeyColumn *ab,
|
|
|
|
|
float ypos)
|
|
|
|
|
{
|
|
|
|
|
UI_draw_roundbox_corner_set(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
|
|
|
|
|
float size = 1.0f;
|
|
|
|
|
switch (ab->next->key_type) {
|
|
|
|
|
case BEZT_KEYTYPE_BREAKDOWN:
|
|
|
|
|
case BEZT_KEYTYPE_MOVEHOLD:
|
|
|
|
|
case BEZT_KEYTYPE_JITTER:
|
|
|
|
|
size *= 0.5f;
|
|
|
|
|
break;
|
|
|
|
|
case BEZT_KEYTYPE_KEYFRAME:
|
|
|
|
|
size *= 0.8f;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-06-26 11:27:25 +02:00
|
|
|
|
|
|
|
|
rctf box;
|
|
|
|
|
box.xmin = ab->cfra;
|
|
|
|
|
box.xmax = min_ff(ab->next->cfra - (ctx->screenspace_margin * size), ab->next->cfra);
|
|
|
|
|
box.ymin = ypos - ctx->gpencil_size;
|
|
|
|
|
box.ymax = ypos + ctx->gpencil_size;
|
|
|
|
|
|
2021-08-11 13:34:11 +02:00
|
|
|
UI_draw_roundbox_4fv(
|
2023-07-14 12:23:37 +10:00
|
|
|
&box, true, 0.25f * float(UI_UNIT_X), (ab->block.sel) ? ctx->sel_mhcol : ctx->unsel_mhcol);
|
2021-08-11 13:34:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void draw_keylist_block_moving_hold(const DrawKeylistUIData *ctx,
|
|
|
|
|
const ActKeyColumn *ab,
|
|
|
|
|
float ypos)
|
|
|
|
|
{
|
2023-06-26 11:27:25 +02:00
|
|
|
rctf box;
|
|
|
|
|
box.xmin = ab->cfra;
|
|
|
|
|
box.xmax = ab->next->cfra;
|
|
|
|
|
box.ymin = ypos - ctx->smaller_size;
|
|
|
|
|
box.ymax = ypos + ctx->smaller_size;
|
2021-08-11 13:34:11 +02:00
|
|
|
|
2023-06-26 11:27:25 +02:00
|
|
|
UI_draw_roundbox_4fv(&box, true, 3.0f, (ab->block.sel) ? ctx->sel_mhcol : ctx->unsel_mhcol);
|
2021-08-11 13:34:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void draw_keylist_block_standard(const DrawKeylistUIData *ctx,
|
|
|
|
|
const ActKeyColumn *ab,
|
|
|
|
|
float ypos)
|
|
|
|
|
{
|
2023-06-26 11:27:25 +02:00
|
|
|
rctf box;
|
|
|
|
|
box.xmin = ab->cfra;
|
|
|
|
|
box.xmax = ab->next->cfra;
|
|
|
|
|
box.ymin = ypos - ctx->half_icon_size;
|
|
|
|
|
box.ymax = ypos + ctx->half_icon_size;
|
|
|
|
|
|
|
|
|
|
UI_draw_roundbox_4fv(&box, true, 3.0f, (ab->block.sel) ? ctx->sel_color : ctx->unsel_color);
|
2021-08-11 13:34:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void draw_keylist_block_interpolation_line(const DrawKeylistUIData *ctx,
|
|
|
|
|
const ActKeyColumn *ab,
|
|
|
|
|
float ypos)
|
|
|
|
|
{
|
2023-06-26 11:27:25 +02:00
|
|
|
rctf box;
|
|
|
|
|
box.xmin = ab->cfra;
|
|
|
|
|
box.xmax = ab->next->cfra;
|
|
|
|
|
box.ymin = ypos - ctx->ipo_size;
|
|
|
|
|
box.ymax = ypos + ctx->ipo_size;
|
|
|
|
|
|
|
|
|
|
UI_draw_roundbox_4fv(&box,
|
|
|
|
|
true,
|
|
|
|
|
3.0f,
|
|
|
|
|
(ab->block.conflict & ACTKEYBLOCK_FLAG_NON_BEZIER) ? ctx->ipo_color_mix :
|
|
|
|
|
ctx->ipo_color);
|
2021-08-11 13:34:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void draw_keylist_block(const DrawKeylistUIData *ctx, const ActKeyColumn *ab, float ypos)
|
|
|
|
|
{
|
|
|
|
|
/* Draw grease pencil bars between keyframes. */
|
2023-06-26 11:27:25 +02:00
|
|
|
if ((ab->next != nullptr) && (ab->block.flag & ACTKEYBLOCK_FLAG_GPENCIL)) {
|
2021-08-11 13:34:11 +02:00
|
|
|
draw_keylist_block_gpencil(ctx, ab, ypos);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Draw other types. */
|
|
|
|
|
UI_draw_roundbox_corner_set(UI_CNR_NONE);
|
|
|
|
|
|
|
|
|
|
int valid_hold = actkeyblock_get_valid_hold(ab);
|
|
|
|
|
if (valid_hold != 0) {
|
|
|
|
|
if ((valid_hold & ACTKEYBLOCK_FLAG_STATIC_HOLD) == 0) {
|
|
|
|
|
/* draw "moving hold" long-keyframe block - slightly smaller */
|
|
|
|
|
draw_keylist_block_moving_hold(ctx, ab, ypos);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2021-08-11 13:34:11 +02:00
|
|
|
else {
|
|
|
|
|
/* draw standard long-keyframe block */
|
|
|
|
|
draw_keylist_block_standard(ctx, ab, ypos);
|
2021-03-17 12:45:57 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2021-08-11 13:34:11 +02:00
|
|
|
if (ctx->show_ipo && actkeyblock_is_valid(ab) &&
|
|
|
|
|
(ab->block.flag & ACTKEYBLOCK_FLAG_NON_BEZIER)) {
|
|
|
|
|
/* draw an interpolation line */
|
|
|
|
|
draw_keylist_block_interpolation_line(ctx, ab, ypos);
|
|
|
|
|
}
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2021-08-11 13:34:11 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-08-11 13:34:11 +02:00
|
|
|
static void draw_keylist_blocks(const DrawKeylistUIData *ctx,
|
2021-09-10 13:27:26 +02:00
|
|
|
const ActKeyColumn *keys,
|
|
|
|
|
const int key_len,
|
2021-08-11 13:34:11 +02:00
|
|
|
float ypos)
|
|
|
|
|
{
|
2021-09-10 13:27:26 +02:00
|
|
|
for (int i = 0; i < key_len; i++) {
|
|
|
|
|
const ActKeyColumn *ab = &keys[i];
|
2021-08-11 13:34:11 +02:00
|
|
|
draw_keylist_block(ctx, ab, ypos);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool draw_keylist_is_visible_key(const View2D *v2d, const ActKeyColumn *ak)
|
|
|
|
|
{
|
|
|
|
|
return IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax);
|
|
|
|
|
}
|
2021-03-17 12:45:57 +01:00
|
|
|
|
2021-08-11 13:34:11 +02:00
|
|
|
static void draw_keylist_keys(const DrawKeylistUIData *ctx,
|
|
|
|
|
View2D *v2d,
|
2021-08-13 09:37:38 +02:00
|
|
|
const KeyframeShaderBindings *sh_bindings,
|
2021-09-10 13:27:26 +02:00
|
|
|
const ActKeyColumn *keys,
|
|
|
|
|
const int key_len,
|
2021-08-11 13:34:11 +02:00
|
|
|
float ypos,
|
|
|
|
|
eSAction_Flag saction_flag)
|
|
|
|
|
{
|
2021-08-13 09:37:38 +02:00
|
|
|
short handle_type = KEYFRAME_HANDLE_NONE, extreme_type = KEYFRAME_EXTREME_NONE;
|
|
|
|
|
|
2021-09-10 13:27:26 +02:00
|
|
|
for (int i = 0; i < key_len; i++) {
|
|
|
|
|
const ActKeyColumn *ak = &keys[i];
|
2021-08-13 09:37:38 +02:00
|
|
|
if (draw_keylist_is_visible_key(v2d, ak)) {
|
|
|
|
|
if (ctx->show_ipo) {
|
|
|
|
|
handle_type = ak->handle_type;
|
|
|
|
|
}
|
|
|
|
|
if (saction_flag & SACTION_SHOW_EXTREMES) {
|
|
|
|
|
extreme_type = ak->extreme_type;
|
2021-03-17 12:45:57 +01:00
|
|
|
}
|
|
|
|
|
|
2021-08-13 09:37:38 +02:00
|
|
|
draw_keyframe_shape(ak->cfra,
|
|
|
|
|
ypos,
|
2022-05-11 13:37:10 +10:00
|
|
|
ctx->icon_size,
|
2021-08-13 09:37:38 +02:00
|
|
|
(ak->sel & SELECT),
|
|
|
|
|
ak->key_type,
|
|
|
|
|
KEYFRAME_SHAPE_BOTH,
|
|
|
|
|
ctx->alpha,
|
|
|
|
|
sh_bindings,
|
|
|
|
|
handle_type,
|
|
|
|
|
extreme_type);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2021-08-11 13:34:11 +02:00
|
|
|
}
|
|
|
|
|
|
2021-08-11 16:18:52 +02:00
|
|
|
/* *************************** Drawing Stack *************************** */
|
2023-09-12 16:08:16 +02:00
|
|
|
enum class ChannelType {
|
|
|
|
|
SUMMARY,
|
|
|
|
|
SCENE,
|
|
|
|
|
OBJECT,
|
|
|
|
|
FCURVE,
|
|
|
|
|
ACTION,
|
|
|
|
|
ACTION_GROUP,
|
|
|
|
|
GREASE_PENCIL_CELS,
|
|
|
|
|
GREASE_PENCIL_GROUP,
|
|
|
|
|
GREASE_PENCIL_DATA,
|
|
|
|
|
GREASE_PENCIL_LAYER,
|
|
|
|
|
MASK_LAYER,
|
2023-06-26 11:27:25 +02:00
|
|
|
};
|
2021-08-11 16:18:52 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
struct ChannelListElement {
|
|
|
|
|
ChannelListElement *next, *prev;
|
2023-07-20 11:30:25 +10:00
|
|
|
AnimKeylist *keylist;
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelType type;
|
2021-08-11 16:18:52 +02:00
|
|
|
|
|
|
|
|
float yscale_fac;
|
|
|
|
|
float ypos;
|
|
|
|
|
eSAction_Flag saction_flag;
|
|
|
|
|
bool channel_locked;
|
|
|
|
|
|
|
|
|
|
bAnimContext *ac;
|
|
|
|
|
bDopeSheet *ads;
|
|
|
|
|
Scene *sce;
|
|
|
|
|
Object *ob;
|
|
|
|
|
AnimData *adt;
|
|
|
|
|
FCurve *fcu;
|
|
|
|
|
bAction *act;
|
|
|
|
|
bActionGroup *agrp;
|
|
|
|
|
bGPDlayer *gpl;
|
2023-08-09 17:07:31 +02:00
|
|
|
const GreasePencilLayer *grease_pencil_layer;
|
2023-08-21 10:51:00 +02:00
|
|
|
const GreasePencilLayerTreeGroup *grease_pencil_layer_group;
|
2023-08-09 17:07:31 +02:00
|
|
|
const GreasePencil *grease_pencil;
|
2021-08-11 16:18:52 +02:00
|
|
|
MaskLayer *masklay;
|
2023-06-26 11:27:25 +02:00
|
|
|
};
|
2021-08-11 16:18:52 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void build_channel_keylist(ChannelListElement *elem)
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
|
|
|
|
switch (elem->type) {
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::SUMMARY: {
|
2021-08-11 16:18:52 +02:00
|
|
|
summary_to_keylist(elem->ac, elem->keylist, elem->saction_flag);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::SCENE: {
|
2021-08-11 16:18:52 +02:00
|
|
|
scene_to_keylist(elem->ads, elem->sce, elem->keylist, elem->saction_flag);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::OBJECT: {
|
2021-08-11 16:18:52 +02:00
|
|
|
ob_to_keylist(elem->ads, elem->ob, elem->keylist, elem->saction_flag);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::FCURVE: {
|
2021-08-11 16:18:52 +02:00
|
|
|
fcurve_to_keylist(elem->adt, elem->fcu, elem->keylist, elem->saction_flag);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::ACTION: {
|
2021-08-11 16:18:52 +02:00
|
|
|
action_to_keylist(elem->adt, elem->act, elem->keylist, elem->saction_flag);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::ACTION_GROUP: {
|
|
|
|
|
action_group_to_keylist(elem->adt, elem->agrp, elem->keylist, elem->saction_flag);
|
2021-08-11 16:18:52 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::GREASE_PENCIL_CELS: {
|
2023-07-12 10:32:09 +02:00
|
|
|
grease_pencil_cels_to_keylist(
|
|
|
|
|
elem->adt, elem->grease_pencil_layer, elem->keylist, elem->saction_flag);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::GREASE_PENCIL_GROUP: {
|
2023-08-21 10:51:00 +02:00
|
|
|
grease_pencil_layer_group_to_keylist(
|
|
|
|
|
elem->adt, elem->grease_pencil_layer_group, elem->keylist, elem->saction_flag);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::GREASE_PENCIL_DATA: {
|
2023-08-09 17:07:31 +02:00
|
|
|
grease_pencil_data_block_to_keylist(
|
2023-09-11 12:31:08 +02:00
|
|
|
elem->adt, elem->grease_pencil, elem->keylist, elem->saction_flag, false);
|
2023-08-09 17:07:31 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::GREASE_PENCIL_LAYER: {
|
2021-08-11 16:18:52 +02:00
|
|
|
gpl_to_keylist(elem->ads, elem->gpl, elem->keylist);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
case ChannelType::MASK_LAYER: {
|
2021-08-11 16:18:52 +02:00
|
|
|
mask_to_keylist(elem->ads, elem->masklay, elem->keylist);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-12-22 10:15:02 +00:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void draw_channel_blocks(ChannelListElement *elem, View2D *v2d)
|
2009-10-13 11:21:02 +00:00
|
|
|
{
|
2021-08-13 09:37:38 +02:00
|
|
|
DrawKeylistUIData ctx;
|
2023-09-12 16:08:16 +02:00
|
|
|
channel_ui_data_init(&ctx, v2d, elem->yscale_fac, elem->channel_locked, elem->saction_flag);
|
2021-08-13 09:37:38 +02:00
|
|
|
|
2021-09-10 13:27:26 +02:00
|
|
|
const int key_len = ED_keylist_array_len(elem->keylist);
|
|
|
|
|
const ActKeyColumn *keys = ED_keylist_array(elem->keylist);
|
|
|
|
|
draw_keylist_blocks(&ctx, keys, key_len, elem->ypos);
|
2021-08-13 09:37:38 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void draw_channel_keys(ChannelListElement *elem,
|
|
|
|
|
View2D *v2d,
|
|
|
|
|
const KeyframeShaderBindings *sh_bindings)
|
2021-08-13 09:37:38 +02:00
|
|
|
{
|
|
|
|
|
DrawKeylistUIData ctx;
|
2023-09-12 16:08:16 +02:00
|
|
|
channel_ui_data_init(&ctx, v2d, elem->yscale_fac, elem->channel_locked, elem->saction_flag);
|
2021-09-10 13:27:26 +02:00
|
|
|
|
|
|
|
|
const int key_len = ED_keylist_array_len(elem->keylist);
|
|
|
|
|
const ActKeyColumn *keys = ED_keylist_array(elem->keylist);
|
|
|
|
|
draw_keylist_keys(&ctx, v2d, sh_bindings, keys, key_len, elem->ypos, elem->saction_flag);
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void prepare_channel_for_drawing(ChannelListElement *elem)
|
2021-09-10 13:27:26 +02:00
|
|
|
{
|
|
|
|
|
ED_keylist_prepare_for_direct_access(elem->keylist);
|
2021-08-11 16:18:52 +02:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
/* List of channels that are actually drawn because they are in view. */
|
|
|
|
|
struct ChannelDrawList {
|
|
|
|
|
ListBase /*ChannelListElement*/ channels;
|
2023-06-26 11:27:25 +02:00
|
|
|
};
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelDrawList *ED_channel_draw_list_create()
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
return static_cast<ChannelDrawList *>(MEM_callocN(sizeof(ChannelDrawList), __func__));
|
2021-08-11 16:18:52 +02:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void channel_list_build_keylists(ChannelDrawList *channel_list)
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
LISTBASE_FOREACH (ChannelListElement *, elem, &channel_list->channels) {
|
|
|
|
|
build_channel_keylist(elem);
|
|
|
|
|
prepare_channel_for_drawing(elem);
|
2021-11-01 15:08:25 +01:00
|
|
|
}
|
2021-08-11 16:18:52 +02:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void channel_list_draw_blocks(ChannelDrawList *channel_list, View2D *v2d)
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
LISTBASE_FOREACH (ChannelListElement *, elem, &channel_list->channels) {
|
|
|
|
|
draw_channel_blocks(elem, v2d);
|
2021-08-11 16:18:52 +02:00
|
|
|
}
|
2009-10-13 11:21:02 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static int channel_visible_key_len(const View2D *v2d, const ListBase * /*ActKeyColumn*/ keys)
|
2021-08-13 09:37:38 +02:00
|
|
|
{
|
|
|
|
|
/* count keys */
|
|
|
|
|
uint len = 0;
|
|
|
|
|
|
|
|
|
|
LISTBASE_FOREACH (ActKeyColumn *, ak, keys) {
|
|
|
|
|
/* Optimization: if keyframe doesn't appear within 5 units (screenspace)
|
|
|
|
|
* in visible area, don't draw.
|
|
|
|
|
* This might give some improvements,
|
|
|
|
|
* since we current have to flip between view/region matrices.
|
|
|
|
|
*/
|
|
|
|
|
if (draw_keylist_is_visible_key(v2d, ak)) {
|
|
|
|
|
len++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static int channel_list_visible_key_len(const ChannelDrawList *channel_list, const View2D *v2d)
|
2021-08-13 09:37:38 +02:00
|
|
|
{
|
|
|
|
|
uint len = 0;
|
2023-09-12 16:08:16 +02:00
|
|
|
LISTBASE_FOREACH (ChannelListElement *, elem, &channel_list->channels) {
|
2021-08-13 09:37:38 +02:00
|
|
|
const ListBase *keys = ED_keylist_listbase(elem->keylist);
|
2023-09-12 16:08:16 +02:00
|
|
|
len += channel_visible_key_len(v2d, keys);
|
2021-08-13 09:37:38 +02:00
|
|
|
}
|
|
|
|
|
return len;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void channel_list_draw_keys(ChannelDrawList *channel_list, View2D *v2d)
|
2021-08-13 09:37:38 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
const int visible_key_len = channel_list_visible_key_len(channel_list, v2d);
|
2021-08-13 09:37:38 +02:00
|
|
|
if (visible_key_len == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
|
|
|
|
|
|
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
KeyframeShaderBindings sh_bindings;
|
|
|
|
|
|
|
|
|
|
sh_bindings.pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
sh_bindings.size_id = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
|
|
|
|
|
sh_bindings.color_id = GPU_vertformat_attr_add(
|
|
|
|
|
format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
|
|
|
|
sh_bindings.outline_color_id = GPU_vertformat_attr_add(
|
|
|
|
|
format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
|
|
|
|
sh_bindings.flags_id = GPU_vertformat_attr_add(format, "flags", GPU_COMP_U32, 1, GPU_FETCH_INT);
|
|
|
|
|
|
|
|
|
|
GPU_program_point_size(true);
|
2021-09-23 15:53:38 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_SHAPE);
|
2021-08-13 09:37:38 +02:00
|
|
|
immUniform1f("outline_scale", 1.0f);
|
|
|
|
|
immUniform2f("ViewportSize", BLI_rcti_size_x(&v2d->mask) + 1, BLI_rcti_size_y(&v2d->mask) + 1);
|
|
|
|
|
immBegin(GPU_PRIM_POINTS, visible_key_len);
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
LISTBASE_FOREACH (ChannelListElement *, elem, &channel_list->channels) {
|
|
|
|
|
draw_channel_keys(elem, v2d, &sh_bindings);
|
2021-08-13 09:37:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
immEnd();
|
|
|
|
|
GPU_program_point_size(false);
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
|
|
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static void channel_list_draw(ChannelDrawList *channel_list, View2D *v2d)
|
2021-08-13 09:37:38 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
channel_list_draw_blocks(channel_list, v2d);
|
|
|
|
|
channel_list_draw_keys(channel_list, v2d);
|
2021-08-13 09:37:38 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_channel_list_flush(ChannelDrawList *channel_list, View2D *v2d)
|
2009-02-13 06:33:07 +00:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
channel_list_build_keylists(channel_list);
|
|
|
|
|
channel_list_draw(channel_list, v2d);
|
2021-08-11 16:18:52 +02:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_channel_list_free(ChannelDrawList *channel_list)
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
LISTBASE_FOREACH (ChannelListElement *, elem, &channel_list->channels) {
|
2021-08-11 16:18:52 +02:00
|
|
|
ED_keylist_free(elem->keylist);
|
|
|
|
|
}
|
2023-09-12 16:08:16 +02:00
|
|
|
BLI_freelistN(&channel_list->channels);
|
|
|
|
|
MEM_freeN(channel_list);
|
2021-08-11 16:18:52 +02:00
|
|
|
}
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
static ChannelListElement *channel_list_add_element(ChannelDrawList *channel_list,
|
|
|
|
|
ChannelType elem_type,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
eSAction_Flag saction_flag)
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = static_cast<ChannelListElement *>(
|
|
|
|
|
MEM_callocN(sizeof(ChannelListElement), __func__));
|
|
|
|
|
BLI_addtail(&channel_list->channels, draw_elem);
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->type = elem_type;
|
|
|
|
|
draw_elem->keylist = ED_keylist_create();
|
|
|
|
|
draw_elem->ypos = ypos;
|
|
|
|
|
draw_elem->yscale_fac = yscale_fac;
|
|
|
|
|
draw_elem->saction_flag = saction_flag;
|
|
|
|
|
return draw_elem;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2022-09-19 14:47:27 +10:00
|
|
|
/* *************************** Channel Drawing Functions *************************** */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_summary_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bAnimContext *ac,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
|
|
|
|
saction_flag &= ~SACTION_SHOW_EXTREMES;
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(
|
|
|
|
|
channel_list, ChannelType::SUMMARY, ypos, yscale_fac, eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->ac = ac;
|
2009-02-13 06:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_scene_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bDopeSheet *ads,
|
|
|
|
|
Scene *sce,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
saction_flag &= ~SACTION_SHOW_EXTREMES;
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(
|
|
|
|
|
channel_list, ChannelType::SCENE, ypos, yscale_fac, eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->ads = ads;
|
|
|
|
|
draw_elem->sce = sce;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_object_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bDopeSheet *ads,
|
|
|
|
|
Object *ob,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2021-08-11 16:18:52 +02:00
|
|
|
saction_flag &= ~SACTION_SHOW_EXTREMES;
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(
|
|
|
|
|
channel_list, ChannelType::OBJECT, ypos, yscale_fac, eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->ads = ads;
|
|
|
|
|
draw_elem->ob = ob;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_fcurve_channel(ChannelDrawList *channel_list,
|
|
|
|
|
AnimData *adt,
|
|
|
|
|
FCurve *fcu,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2021-08-11 16:18:52 +02:00
|
|
|
const bool locked = (fcu->flag & FCURVE_PROTECTED) ||
|
|
|
|
|
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
|
2022-03-28 17:34:36 +02:00
|
|
|
((adt && adt->action) &&
|
|
|
|
|
(ID_IS_LINKED(adt->action) || ID_IS_OVERRIDE_LIBRARY(adt->action)));
|
2021-08-11 16:18:52 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(
|
|
|
|
|
channel_list, ChannelType::FCURVE, ypos, yscale_fac, eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->adt = adt;
|
|
|
|
|
draw_elem->fcu = fcu;
|
|
|
|
|
draw_elem->channel_locked = locked;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_action_group_channel(ChannelDrawList *channel_list,
|
|
|
|
|
AnimData *adt,
|
|
|
|
|
bActionGroup *agrp,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2021-08-11 16:18:52 +02:00
|
|
|
{
|
2016-07-03 03:42:28 +12:00
|
|
|
bool locked = (agrp->flag & AGRP_PROTECTED) ||
|
2022-03-28 17:34:36 +02:00
|
|
|
((adt && adt->action) &&
|
|
|
|
|
(ID_IS_LINKED(adt->action) || ID_IS_OVERRIDE_LIBRARY(adt->action)));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(
|
|
|
|
|
channel_list, ChannelType::ACTION_GROUP, ypos, yscale_fac, eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->adt = adt;
|
|
|
|
|
draw_elem->agrp = agrp;
|
|
|
|
|
draw_elem->channel_locked = locked;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_action_channel(ChannelDrawList *channel_list,
|
|
|
|
|
AnimData *adt,
|
|
|
|
|
bAction *act,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2022-03-28 17:34:36 +02:00
|
|
|
const bool locked = (act && (ID_IS_LINKED(act) || ID_IS_OVERRIDE_LIBRARY(act)));
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
saction_flag &= ~SACTION_SHOW_EXTREMES;
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(
|
|
|
|
|
channel_list, ChannelType::ACTION, ypos, yscale_fac, eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->adt = adt;
|
|
|
|
|
draw_elem->act = act;
|
|
|
|
|
draw_elem->channel_locked = locked;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_grease_pencil_datablock_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bDopeSheet * /*ads*/,
|
|
|
|
|
const GreasePencil *grease_pencil,
|
|
|
|
|
const float ypos,
|
|
|
|
|
const float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2023-08-09 17:07:31 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(channel_list,
|
|
|
|
|
ChannelType::GREASE_PENCIL_DATA,
|
|
|
|
|
ypos,
|
|
|
|
|
yscale_fac,
|
|
|
|
|
eSAction_Flag(saction_flag));
|
2023-08-09 17:07:31 +02:00
|
|
|
draw_elem->grease_pencil = grease_pencil;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_grease_pencil_cels_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bDopeSheet *ads,
|
|
|
|
|
const GreasePencilLayer *layer,
|
|
|
|
|
const float ypos,
|
|
|
|
|
const float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2023-07-12 10:32:09 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(channel_list,
|
|
|
|
|
ChannelType::GREASE_PENCIL_CELS,
|
|
|
|
|
ypos,
|
|
|
|
|
yscale_fac,
|
|
|
|
|
eSAction_Flag(saction_flag));
|
2023-08-10 13:55:14 +02:00
|
|
|
draw_elem->ads = ads;
|
2023-07-12 10:32:09 +02:00
|
|
|
draw_elem->grease_pencil_layer = layer;
|
2023-08-10 13:55:14 +02:00
|
|
|
draw_elem->channel_locked = layer->wrap().is_locked();
|
2023-07-12 10:32:09 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_grease_pencil_layer_group_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bDopeSheet *ads,
|
|
|
|
|
const GreasePencilLayerTreeGroup *layer_group,
|
|
|
|
|
const float ypos,
|
|
|
|
|
const float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2023-08-21 10:51:00 +02:00
|
|
|
{
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(channel_list,
|
|
|
|
|
ChannelType::GREASE_PENCIL_GROUP,
|
|
|
|
|
ypos,
|
|
|
|
|
yscale_fac,
|
|
|
|
|
eSAction_Flag(saction_flag));
|
2023-08-21 10:51:00 +02:00
|
|
|
draw_elem->ads = ads;
|
|
|
|
|
draw_elem->grease_pencil_layer_group = layer_group;
|
|
|
|
|
draw_elem->channel_locked = layer_group->wrap().is_locked();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_grease_pencil_layer_legacy_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bDopeSheet *ads,
|
|
|
|
|
bGPDlayer *gpl,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2016-07-03 03:42:28 +12:00
|
|
|
bool locked = (gpl->flag & GP_LAYER_LOCKED) != 0;
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(channel_list,
|
|
|
|
|
ChannelType::GREASE_PENCIL_LAYER,
|
|
|
|
|
ypos,
|
|
|
|
|
yscale_fac,
|
|
|
|
|
eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->ads = ads;
|
|
|
|
|
draw_elem->gpl = gpl;
|
|
|
|
|
draw_elem->channel_locked = locked;
|
2012-06-08 14:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 16:08:16 +02:00
|
|
|
void ED_add_mask_layer_channel(ChannelDrawList *channel_list,
|
|
|
|
|
bDopeSheet *ads,
|
|
|
|
|
MaskLayer *masklay,
|
|
|
|
|
float ypos,
|
|
|
|
|
float yscale_fac,
|
|
|
|
|
int saction_flag)
|
2012-06-08 14:31:38 +00:00
|
|
|
{
|
2016-07-03 03:42:28 +12:00
|
|
|
bool locked = (masklay->flag & MASK_LAYERFLAG_LOCKED) != 0;
|
2023-09-12 16:08:16 +02:00
|
|
|
ChannelListElement *draw_elem = channel_list_add_element(
|
|
|
|
|
channel_list, ChannelType::MASK_LAYER, ypos, yscale_fac, eSAction_Flag(saction_flag));
|
2021-08-11 16:18:52 +02:00
|
|
|
draw_elem->ads = ads;
|
|
|
|
|
draw_elem->masklay = masklay;
|
|
|
|
|
draw_elem->channel_locked = locked;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|