GPv3: Add initial dopesheet support #108807
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#108807
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "filedescriptor/blender:gpv3-initial-dopesheet-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds basic support for viewing layers and keyframes (cels) in the grease pencil dopsheet for the new grease pencil data-type.
Resolves #108508
WIP: GPv3: Add initial dopesheet support.to WIP: GPv3: Add initial dopesheet supportChannels are currently showing up in the dopesheet, but their names are not displayed, and nothing else is implemented yet.
@filedescriptor We need to add new enum types or structures, in order to integrate the grease pencil layers as channels. So far I've got these name changes :
Should we set specific rules ? For example, should we put
_legacy
at the end of each legacy-related type ?Also, I am not sure in which case we should refer to
cel
. For now, it's only for key type, but we could also haveANIMTYPE_CEL
(for the channel type), since there isANIMTYPE_FCURVE
.@amelief I think just having the keytype be
ALE_CEL
makes sense to me. Technically the whole channel are zero or morecels
so usingcel
for that (singular) would feel off.I agree with the renaming you did. Don't bother with renaming too much to
_legacy
now. As long as there are no name conflicts, I would just do that at a later point and keep it to a minimum now.WIP: GPv3: Add initial dopesheet supportto GPv3: Add initial dopesheet support@blender-bot build
The layers are now subchannels of the grease pencil datablock, and expansion is fixed.
Some code style and naming remarks.
@ -3454,3 +3489,3 @@
short *r_type)
{
bGPdata *gpd = (bGPdata *)ale->data;
GreasePencil *gpd = (GreasePencil *)ale->data;
I like to be explicit and use
grease_pencil
as a variable name for the data-block.@ -3550,0 +3636,4 @@
/* name for grease pencil layer entries */
static void acf_gpl_name(bAnimListElem *ale, char *name)
{
GreasePencilLayer *gpl = (GreasePencilLayer *)ale->data;
gpl
->layer
@ -3550,0 +3639,4 @@
GreasePencilLayer *gpl = (GreasePencilLayer *)ale->data;
if (gpl && name) {
BLI_strncpy(name, gpl->base.name, ANIM_CHAN_NAME_SIZE);
Instead of directly accessing the name pointer, here I would do
layer->wrap().name()
. (might also need to add.c_str()
)@ -3553,3 +3662,3 @@
short *r_type)
{
bGPDlayer *gpl = (bGPDlayer *)ale->data;
GreasePencilLayer *gpl = (GreasePencilLayer *)ale->data;
gpl
->layer
@ -975,2 +977,4 @@
break;
}
case ANIMTYPE_GREASE_PENCIL_LAYER: {
GreasePencilLayer *gpl = (GreasePencilLayer *)data;
gpl
->layer
@ -1788,0 +1805,4 @@
{
size_t items = 0;
using namespace blender;
This should be at the top of the function.
@ -1788,0 +1807,4 @@
using namespace blender;
/* add data block container */
->
/* Add data block container. */
Comments should be capitalized and ending in a period :)
Also check other comments.
@ -700,1 +707,4 @@
void draw_cels_channel(AnimKeylistDrawList *draw_list,
bDopeSheet */*ads*/,
GreasePencilLayer *gpl,
gpl
->layer
@ -504,0 +533,4 @@
/* Node updater callback used for building ActKeyColumns from GPencil frames */
static void nupdate_ak_cel(ActKeyColumn *ak, void * /*data*/)
{
// TODO : Cel *cel = static_cast<Cel *> data;
Commented out code should be removed.
Maybe add a TODO comment for updating the selection.
@ -1113,0 +1167,4 @@
using namespace blender::bke::greasepencil;
const Layer &layer = gpl->wrap();
for (auto item : layer.frames().items()) {
Cel cel{item.key, item.value};
We tend to initialize structs explicitly in other areas. More like this:
@ -94,0 +96,4 @@
/* Cel-framed channels */
void draw_cels_channel(struct AnimKeylistDrawList *draw_list,
struct bDopeSheet *ads,
struct GreasePencilLayer *gpl,
gpl
->layer
@ -181,0 +182,4 @@
/* Cels */
void cels_to_keylist(struct AnimData *adt,
struct GreasePencilLayer *gpl,
gpl
->layer
The code looks decent to me, left a few minor notes inline.
As for the functionality, how do I add a GPv3 object? With GPv3 disabled in the experimental features I can add a regular GP object and animate it, and then I see the keys in the dopesheet. But when I enable GPv3 in the prefs, then create a new object, and then try to animate it, I don't see any keys. Not sure if I'm testing wrong or whether there's something wrong in the code, hence my questions ;-)
@ -1109,3 +1120,3 @@
/* Check for selected nodes. */
if (fcu->rna_path &&
BLI_str_quoted_substr(fcu->rna_path, "nodes[", node_name, sizeof(node_name))) {
BLI_str_quoted_substr(fcu->rna_path, "nodes[", node_name, sizeof(node_name)))
Please keep formatting changes out of a functional PR.
@ -3505,2 +3595,2 @@
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items = animdata_filter_gpencil(ac, anim_data, data, filter_mode);
if (U.experimental.use_grease_pencil_version3) {
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
What is the reason to repeat the same condition inside both clauses of the
if (U.experimental....)
? Wouldn't it make more sense to swap those and remove the duplication?@ -318,2 +319,3 @@
if (ctx->show_ipo && actkeyblock_is_valid(ab) &&
(ab->block.flag & ACTKEYBLOCK_FLAG_NON_BEZIER)) {
(ab->block.flag & ACTKEYBLOCK_FLAG_NON_BEZIER))
{
Same as above, keep out formatting changes.
@ -54,6 +55,12 @@ BLI_INLINE bool is_cfra_lt(const float a, const float b)
/* --------------- */
/* Just for GreasePencil for now. */
Better to explain what it is first, rather than where it's used. The fact that it has a
GreasePencilFrame
in there already hints at that this is for GP.@ -504,0 +533,4 @@
/* Node updater callback used for building ActKeyColumns from GPencil frames */
static void nupdate_ak_cel(ActKeyColumn *ak, void * /*data*/)
{
// TODO : Update cel selection
Is this to be done in a future commit? Or will this PR be expanded for this?
It's planned for a future commit, I guess, as we do not have cel selection at all right now.
Actually, don't mind my last comment, we do have selection and type, I am just gonna do these TODOs in this PR :)
@ -1113,0 +1158,4 @@
using namespace blender::bke::greasepencil;
const Layer &layer = gpl->wrap();
for (auto item : layer.frames().items()) {
Cel cel;
It might be a good idea to use
Cel cel = {};
or something along those lines. That way if there's ever a new field added to the struct, it'll be initialised to zero. Alternatively add a constructor that simply takes the two arguments; then the addition of a field will simply break the build in places where it's forgotten.286a055938
to266f63e7a0
99de7b9176
to08a50d3dfb
For me this code crashes as soon as I try and draw something with GP. This might have something to do with it:
This is with the GP3 experimental flag enabled, restarted Blender, created a new '2D Animation' file, and dragged in the viewport.
@dr.sybren The 2D Animation template does not convert the legacy grease pencil object to a grease pencil 3 object yet. The versioning is just not implemented since it's still experimental. You'll have to create a new file and the object yourself (with
Shift + A > Grease Pencil > ...
).Or you can create a GP2 object, then enable the flag and then manually convert it to GP3 with
Object > Convert > Grease Pencil
.LGTM, just two remarks that can be handled when landing.
@ -3460,0 +3508,4 @@
return GREASE_PENCIL_ANIM_CHANNEL_EXPANDED;
default:
/* This shouldn't happen */
In that case, maybe a
BLI_assert_msg()
would be in order?@ -3571,0 +3646,4 @@
/* Name property for grease pencil layer entries */
static bool acf_gpl_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
{
if (ale->data) {
I think it'll be simpler to invert the condition & return early.
@ -967,3 +969,3 @@
}
case ANIMTYPE_GPLAYER: {
bGPDlayer *gpl = (bGPDlayer *)data;
bGPDlayer *layer = (bGPDlayer *)data;
I like how this got renamed as well, so that there is not two
gpl
variables with different semantics.I like that you pointed out this specific spot, because I renamed the legacy one, when I should have renamed the gpv3 one instead. 😅 I will change that, and check all the other renamed variables. You remark is still valid though, and I agree.
@ -701,0 +711,4 @@
GreasePencilLayer *layer,
float ypos,
float yscale_fac,
int saction_flag)
the
float
andint
params can beconst
I think.4ef3c56ead
to60130d7f03