Files
test/source/blender/editors/include/ED_keyframes_draw.hh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

160 lines
6.0 KiB
C++
Raw Normal View History

/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup editors
2011-02-21 07:25:24 +00:00
*/
#pragma once
#include "BLI_sys_types.h"
#include "DNA_curve_types.h"
#include "ED_keyframes_keylist.hh"
struct AnimData;
struct ChannelDrawList;
struct FCurve;
struct MaskLayer;
struct Object;
struct Scene;
struct View2D;
struct bAction;
struct bActionGroup;
struct bAnimContext;
struct bDopeSheet;
struct bGPDlayer;
struct GreasePencil;
struct GreasePencilLayer;
struct GreasePencilLayerTreeGroup;
/**
* Draw simple diamond-shape keyframe.
*
* The caller should set up vertex format, bind #GPU_SHADER_KEYFRAME_SHAPE,
* `immBegin(GPU_PRIM_POINTS, n)`, then call this `n` times.
*/
struct KeyframeShaderBindings {
uint pos_id;
uint size_id;
uint color_id;
uint outline_color_id;
uint flags_id;
};
void draw_keyframe_shape(float x,
float y,
float size,
bool sel,
eBezTriple_KeyframeType key_type,
eKeyframeShapeDrawOpts mode,
float alpha,
const KeyframeShaderBindings *sh_bindings,
short handle_type,
short extreme_type);
/* ******************************* Methods ****************************** */
/* Channel Drawing ------------------ */
/* F-Curve */
void ED_add_fcurve_channel(ChannelDrawList *draw_list,
2023-09-13 02:25:03 +02:00
AnimData *adt,
FCurve *fcu,
float ypos,
float yscale_fac,
int saction_flag);
/* Action Group Summary */
void ED_add_action_group_channel(ChannelDrawList *draw_list,
2023-09-13 02:25:03 +02:00
AnimData *adt,
bActionGroup *agrp,
float ypos,
float yscale_fac,
int saction_flag);
Anim: merge Animation data-block into bAction The new/experimental, layered `Animation` data-block is merged with the existing `bAction` data-block. The `Animation` data-block is considerably newer than `bAction`, so the supporting code that was written for it is also more modern. When moving that code into `bAction`, I chose to keep the modernity where possible, and thus some of the old code has been updated as well. Things like preferring references over pointers. The `Animation` data-block is now gone from DNA, the main database, etc. As this was still an experimental feature, there is no versioning code to convert any of that to Actions. The DNA struct `bAction` now has a C++ wrapper `animrig::Action`, that can be obtained via `some_action->wrap()`. `animrig::Action` has functions `is_empty()`, `is_action_legacy()`, and `is_action_layered()`. They **all** return `true` when the Action is empty, as in that case none of the data that makes an action either 'legacy' or 'layered' is there. The 'animation filtering' code (for showing things in the dope sheet, graph editor, etc) that I wrote for `Animation` is intentionally kept around. These types now target 'layered actions' and the already-existing ones 'legacy actions'. A future PR may merge these two together, but given how much work it was to add something new there, I'd rather wait until the dust has settled on this commit. There are plenty of variables (and some comments) named `anim` or `animation` that now are of type `animrig::Action`. I haven't renamed them all, to keep the noise level low in this commit (it's already big enough). This can be done in a followup, non-functional PR. Related task: #121355 Pull Request: https://projects.blender.org/blender/blender/pulls/121357
2024-05-13 15:51:26 +02:00
/* Layered Action Summary.*/
void ED_add_action_layered_channel(ChannelDrawList *channel_list,
AnimData *adt,
bAction *action,
const float ypos,
const float yscale_fac,
int saction_flag);
/* Action Slot summary. */
void ED_add_action_slot_channel(ChannelDrawList *channel_list,
AnimData *adt,
blender::animrig::Action &action,
blender::animrig::Slot &slot,
float ypos,
float yscale_fac,
int saction_flag);
Anim: merge Animation data-block into bAction The new/experimental, layered `Animation` data-block is merged with the existing `bAction` data-block. The `Animation` data-block is considerably newer than `bAction`, so the supporting code that was written for it is also more modern. When moving that code into `bAction`, I chose to keep the modernity where possible, and thus some of the old code has been updated as well. Things like preferring references over pointers. The `Animation` data-block is now gone from DNA, the main database, etc. As this was still an experimental feature, there is no versioning code to convert any of that to Actions. The DNA struct `bAction` now has a C++ wrapper `animrig::Action`, that can be obtained via `some_action->wrap()`. `animrig::Action` has functions `is_empty()`, `is_action_legacy()`, and `is_action_layered()`. They **all** return `true` when the Action is empty, as in that case none of the data that makes an action either 'legacy' or 'layered' is there. The 'animation filtering' code (for showing things in the dope sheet, graph editor, etc) that I wrote for `Animation` is intentionally kept around. These types now target 'layered actions' and the already-existing ones 'legacy actions'. A future PR may merge these two together, but given how much work it was to add something new there, I'd rather wait until the dust has settled on this commit. There are plenty of variables (and some comments) named `anim` or `animation` that now are of type `animrig::Action`. I haven't renamed them all, to keep the noise level low in this commit (it's already big enough). This can be done in a followup, non-functional PR. Related task: #121355 Pull Request: https://projects.blender.org/blender/blender/pulls/121357
2024-05-13 15:51:26 +02:00
/* Legacy Action Summary */
void ED_add_action_channel(ChannelDrawList *draw_list,
2023-09-13 02:25:03 +02:00
AnimData *adt,
bAction *act,
float ypos,
float yscale_fac,
int saction_flag);
/* Object Summary */
void ED_add_object_channel(ChannelDrawList *draw_list,
2023-09-13 02:25:03 +02:00
bDopeSheet *ads,
Object *ob,
float ypos,
float yscale_fac,
int saction_flag);
/* Scene Summary */
void ED_add_scene_channel(ChannelDrawList *draw_list,
2023-09-13 02:25:03 +02:00
bDopeSheet *ads,
Scene *sce,
float ypos,
float yscale_fac,
int saction_flag);
2023-09-13 02:25:03 +02:00
/* DopeSheet Summary */
void ED_add_summary_channel(
ChannelDrawList *draw_list, bAnimContext *ac, float ypos, float yscale_fac, int saction_flag);
/* Grease Pencil cels channels */
void ED_add_grease_pencil_cels_channel(ChannelDrawList *draw_list,
2023-09-13 02:25:03 +02:00
bDopeSheet *ads,
const GreasePencilLayer *layer,
float ypos,
float yscale_fac,
int saction_flag);
/* Grease Pencil layer group channels */
void ED_add_grease_pencil_layer_group_channel(ChannelDrawList *draw_list,
2023-09-13 02:25:03 +02:00
bDopeSheet *ads,
const GreasePencilLayerTreeGroup *layer,
float ypos,
float yscale_fac,
int saction_flag);
/* Grease Pencil data channels */
void ED_add_grease_pencil_datablock_channel(ChannelDrawList *draw_list,
bAnimContext *ac,
AnimData *adt,
2023-09-13 02:25:03 +02:00
const GreasePencil *grease_pencil,
const float ypos,
const float yscale_fac,
int saction_flag);
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch) This merge-commit brings in a number of new features and workflow/UI improvements for working with Grease Pencil. While these were originally targetted at improving the workflow for creating 3D storyboards in Blender using the Grease Pencil, many of these changes should also prove useful in other workflows too. The main highlights here are: 1) It is now possible to edit Grease Pencil strokes - Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions to enter "Stroke Edit Mode". In this mode, many common editing tools will operate on Grease Pencil stroke points instead. - Tools implemented include Select, Select All/Border/Circle/Linked/More/Less, Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete. - Proportional Editing works when using the transform tools 2) Grease Pencil stroke settings can now be animated NOTE: Currently drivers don't work, but if time allows, this may still be added before the release. 3) Strokes can be drawn with "filled" interiors, using a separate set of colour/opacity settings to the ones used for the lines themselves. This makes use of OpenGL filled polys, which has the limitation of only being able to fill convex shapes. Some artifacts may be visible on concave shapes (e.g. pacman's mouth will be overdrawn) 4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing has been added which draws strokes as a series of screen-aligned discs. While this was originally a partial experimental technique at getting better quality 3D lines, the effects possible using this technique were interesting enough to warrant making this a dedicated feature. Best results when partial opacity and large stroke widths are used. 5) Improved Onion Skinning Support - Different colours can be selected for the before/after ghosts. To do so, enable the "colour wheel" toggle beside the Onion Skinning toggle, and set the colours accordingly. - Different numbers of ghosts can be shown before/after the current frame 6) Grease Pencil datablocks are now attached to the scene by default instead of the active object. - For a long time, the object-attachment has proved to be quite problematic for users to keep track of. Now that this is done at scene level, it is easier for most users to use. - An exception for old files (and for any addons which may benefit from object attachment instead), is that if the active object has a Grease Pencil datablock, that will be used instead. - It is not currently possible to choose object-attachment from the UI, but it is simple to do this from the console instead, by doing: context.active_object.grease_pencil = bpy.data.grease_pencil["blah"] 7) Various UI Cleanups - The layers UI has been cleaned up to use a list instead of the nested-panels design. Apart from saving space, this is also much nicer to look at now. - The UI code is now all defined in Python. To support this, it has been necessary to add some new context properties to make it easier to access these settings. e.g. "gpencil_data" for the datablock "active_gpencil_layer" and "active_gpencil_frame" for active data, "editable_gpencil_strokes" for the strokes that can be edited - The "stroke placement/alignment" settings (previously "Drawing Settings" at the bottom of the Grease Pencil panel in the Properties Region) is now located in the toolbar. These were more toolsettings than properties for how GPencil got drawn. - "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a suggestion for an earlier discussion on developer.blender.org - By default, the painting operator will wait for a mouse button to be pressed before it starts creating the stroke. This is to make it easier to include this operator in various toolbars/menus/etc. To get it immediately starting (as when you hold down DKEy to draw), set "wait_for_input" to False. - GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor - Toolbar panels have been added to all the other editors which support these. 8) Pie menus for quick-access to tools A set of experimental pie menus has been included for quick access to many tools and settings. It is not necessary to use these to get things done, but they have been designed to help make certain common tasks easier. - Ctrl-D = The main pie menu. Reveals tools in a context sensitive and spatially stable manner. - D Q = "Quick Settings" pie. This allows quick access to the active layer's settings. Notably, colours, thickness, and turning onion skinning on/off.
2014-12-01 01:52:06 +13:00
/* Grease Pencil Layer */
void ED_add_grease_pencil_layer_legacy_channel(ChannelDrawList *draw_list,
bDopeSheet *ads,
bGPDlayer *gpl,
float ypos,
float yscale_fac,
int saction_flag);
/* Mask Layer */
void ED_add_mask_layer_channel(ChannelDrawList *draw_list,
bDopeSheet *ads,
MaskLayer *masklay,
float ypos,
float yscale_fac,
int saction_flag);
ChannelDrawList *ED_channel_draw_list_create();
Anim: add channel groups to layered actions This PR adds channel groups (also known as fcurve groups or action groups) to layered actions. For layered actions, these groups belong to the `ChannelBag`s and can vary by bag. From a user perspective, the goal is for these to function just like channel groups from legacy actions. However, internally they are implemented a little differently: legacy actions store both channel groups and fcurves in a listbase, and groups indicate what fcurves are in them with a listbase that points directly into the larger fcurve listbase. Layered actions, on the other hand, store both fcurves and channel groups in an array, and groups indicate what fcurves are in them by indexing into the fcurve array. Despite taking this different approach, we still reuse the `bActionGroup` struct for the new channel groups, just adding the necessary fields for index-based fcurve membership as described above. This PR does not implement all of the functionality needed to reach feature parity with legacy action channel groups, but implements the main core and gets them basically working. It's easier to list the things that *haven't* been implemented yet: - Operators for letting the user manually create/remove/move channel groups. - Keyframe selection in the action/dopesheet editor on channel group rows themselves are not yet working correctly. - Handling channel groups in legacy/layered action conversion operators. - Making the legacy `action.groups` property work on single-layer-single-strip layered actions. Those are left for future PRs. Other than that, in theory everything should be working now. Pull Request: https://projects.blender.org/blender/blender/pulls/125774
2024-08-22 17:13:12 +02:00
void ED_channel_list_flush(ChannelDrawList *draw_list, View2D *v2d);
Anim: add channel groups to layered actions This PR adds channel groups (also known as fcurve groups or action groups) to layered actions. For layered actions, these groups belong to the `ChannelBag`s and can vary by bag. From a user perspective, the goal is for these to function just like channel groups from legacy actions. However, internally they are implemented a little differently: legacy actions store both channel groups and fcurves in a listbase, and groups indicate what fcurves are in them with a listbase that points directly into the larger fcurve listbase. Layered actions, on the other hand, store both fcurves and channel groups in an array, and groups indicate what fcurves are in them by indexing into the fcurve array. Despite taking this different approach, we still reuse the `bActionGroup` struct for the new channel groups, just adding the necessary fields for index-based fcurve membership as described above. This PR does not implement all of the functionality needed to reach feature parity with legacy action channel groups, but implements the main core and gets them basically working. It's easier to list the things that *haven't* been implemented yet: - Operators for letting the user manually create/remove/move channel groups. - Keyframe selection in the action/dopesheet editor on channel group rows themselves are not yet working correctly. - Handling channel groups in legacy/layered action conversion operators. - Making the legacy `action.groups` property work on single-layer-single-strip layered actions. Those are left for future PRs. Other than that, in theory everything should be working now. Pull Request: https://projects.blender.org/blender/blender/pulls/125774
2024-08-22 17:13:12 +02:00
void ED_channel_list_free(ChannelDrawList *draw_list);