GPv3: Basic layer channel selection #110133

Merged
Pratik Borhade merged 10 commits from PratikPB2123/blender:gpv3-active-layer-channel into main 2023-08-02 15:17:16 +02:00
Member

PR adds support for the selection of grease pencil layers in
animation editor.

  • selection status is stored in GreasePencilLayerTreeNode
  • Existing GP_LAYER_TREE_NODE_SELECT flag is used for selection
  • selection of channel updates the active layer in object properties

Part of #110056

PR adds support for the selection of grease pencil layers in animation editor. - selection status is stored in `GreasePencilLayerTreeNode` - Existing `GP_LAYER_TREE_NODE_SELECT` flag is used for selection - selection of channel updates the active layer in object properties Part of #110056
Pratik Borhade added 1 commit 2023-07-15 12:16:57 +02:00
df60efee65 GPv3: Basic layer channel selection
PR adds support for the selection of grease pencil layers in
animation editor.
- selection status is stored in `GreasePencilLayerTreeNode`
- Existing `GP_LAYER_TREE_NODE_SELECT` flag is used for selection
- selection of channel updates the active layer in object properties
Pratik Borhade requested review from Falk David 2023-07-15 12:17:08 +02:00
Author
Member

@filedescriptor hi, changing active layer from properties tab do not change the layer selection in anim-editors. Any idea how to send notifier after execution of on_activate() function of LayerViewItem?

@filedescriptor hi, changing active layer from properties tab do not change the layer selection in anim-editors. Any idea how to send notifier after execution of `on_activate()` function of `LayerViewItem`?
Pratik Borhade added 1 commit 2023-07-15 12:31:39 +02:00
Pratik Borhade added the
Module
Grease Pencil
label 2023-07-17 12:00:20 +02:00
Amélie Fondevilla added this to the Grease Pencil project 2023-07-17 17:55:55 +02:00
Falk David requested changes 2023-07-18 11:17:07 +02:00
Falk David left a comment
Member

Thank you for the patch :) Some comments about the GP_LAYER_TREE_NODE_ACTIVE flag.

Thank you for the patch :) Some comments about the `GP_LAYER_TREE_NODE_ACTIVE` flag.
@ -299,1 +305,3 @@
case ANIMTYPE_GREASE_PENCIL_LAYER: {
GreasePencilLayer *layer = (GreasePencilLayer *)channel_data;
layer->base.flag |= GP_LAYER_TREE_NODE_ACTIVE;
Member

Instead of setting a flag here, this needs to set the active_layer pointer.

Instead of setting a flag here, this needs to set the `active_layer` pointer.
Author
Member

Hi, thanks for the review.
Right now this is done in click_select_channel_grease_pencil_layer

But if we want this change in ANIM_set_active_channel() function, I think we'd need to pass bAnimListElem instead of ale->data (otherwise GreasePencil can not be obtained in this function)

Hi, thanks for the review. Right now this is done in `click_select_channel_grease_pencil_layer` But if we want this change in `ANIM_set_active_channel()` function, I think we'd need to pass `bAnimListElem` instead of `ale->data` (otherwise GreasePencil can not be obtained in this function)
Member

Can you check if ale->id is the right data here? Maybe that works.

Can you check if `ale->id` is the right data here? Maybe that works.
Author
Member

No. ale itself is null here.
because we first iterate over all the present/visible channels to clear active flag
Then after exiting for loop (from here), ale is null

No. `ale` itself is null here. because we first iterate over all the present/visible channels to clear active flag Then after exiting for loop ([from here](https://projects.blender.org/blender/blender/src/branch/main/source/blender/editors/animation/anim_channels_edit.cc#L246)), `ale` is null
Member

Right, maybe this is actually not needed for grease pencil then. Since changing the pointer to another layer does not require any change in all the other layers.

Right, maybe this is actually not needed for grease pencil then. Since changing the pointer to another layer does not require any change in all the other layers.
@ -234,6 +234,7 @@ typedef enum GreasePencilLayerTreeNodeFlag {
GP_LAYER_TREE_NODE_MUTE = (1 << 3),
GP_LAYER_TREE_NODE_USE_LIGHTS = (1 << 4),
GP_LAYER_TREE_NODE_USE_ONION_SKINNING = (1 << 5),
GP_LAYER_TREE_NODE_ACTIVE = (1 << 6),
Member

I don't think this flag is needed. We should just check the active_layer pointer in the grease pencil data.

I don't think this flag is needed. We should just check the `active_layer` pointer in the grease pencil data.
Author
Member

Make sense. I thought this might be helpful for further selection operations (extend, invert, range select).

Make sense. I thought this might be helpful for further selection operations (extend, invert, range select).
Member

@PratikPB2123 I think the active layer is now changed directly. Instead, the properties panel should call an operator or Python API function to change the active layer. That will both handle undo and also sending notifiers.

@PratikPB2123 I think the active layer is now changed directly. Instead, the properties panel should call an operator or Python API function to change the active layer. That will both handle undo and also sending notifiers.
Pratik Borhade added 1 commit 2023-07-18 15:45:28 +02:00
Author
Member

@PratikPB2123 I think the active layer is now changed directly. Instead, the properties panel should call an operator or Python API function to change the active layer. That will both handle undo and also sending notifiers.

Done here: #110378

> @PratikPB2123 I think the active layer is now changed directly. Instead, the properties panel should call an operator or Python API function to change the active layer. That will both handle undo and also sending notifiers. Done here: https://projects.blender.org/blender/blender/pulls/110378
Pratik Borhade added 3 commits 2023-07-27 13:17:35 +02:00
Falk David requested review from Amélie Fondevilla 2023-07-27 14:08:43 +02:00
Falk David requested changes 2023-07-27 14:10:13 +02:00
Falk David left a comment
Member

Comment about casts.

Comment about casts.
@ -3653,0 +3656,4 @@
const short /* eEditKeyframes_Select or -1 */ selectmode,
const int filter)
{
GreasePencilLayer *layer = (GreasePencilLayer *)ale->data;
Member

Use static_cast for newly added code.

Use `static_cast` for newly added code.
Pratik Borhade added 1 commit 2023-07-27 14:57:48 +02:00
Falk David requested changes 2023-08-01 18:12:09 +02:00
Falk David left a comment
Member

Another comment. This PR should also be rebase on top of main.

Another comment. This PR should also be rebase on top of `main`.
@ -3653,0 +3653,4 @@
bContext *C,
bAnimContext *ac,
bAnimListElem *ale,
const short /* eEditKeyframes_Select or -1 */ selectmode,
Member

I'm getting some warnings about selectmode and filter being unused.
I think selectmode should be used. The different selection modes like shift+select and ctrl+select should work.

I'm getting some warnings about `selectmode` and `filter` being unused. I think `selectmode` should be used. The different selection modes like shift+select and ctrl+select should work.
Author
Member

selectmode and filter is for future use (for other channel selection operations)
I don't think extend and extend range selection should be part of this PR (because this PR only changes the active channel and syncs it with layer in object properties panel)

Let me know if you want it within this PR or separate PR.

`selectmode` and `filter` is for future use (for other channel selection operations) I don't think extend and extend range selection should be part of this PR (because this PR only changes the active channel and syncs it with layer in object properties panel) Let me know if you want it within this PR or separate PR.
Member

Ok I'm ok with this coming in a later PR. But in this case the parameters need to be commented out e.g. const short /*selectmode*/, const int /*filter*/ and there should be a TODO comment in this function stating that the selection modes need to be implemented.

Ok I'm ok with this coming in a later PR. But in this case the parameters need to be commented out e.g. `const short /*selectmode*/, const int /*filter*/` and there should be a `TODO` comment in this function stating that the selection modes need to be implemented.
Pratik Borhade added 1 commit 2023-08-02 10:52:12 +02:00
Pratik Borhade added 1 commit 2023-08-02 10:52:45 +02:00
Falk David reviewed 2023-08-02 11:39:23 +02:00
@ -3653,0 +3652,4 @@
static int click_select_channel_grease_pencil_layer(bContext *C,
bAnimContext *ac,
bAnimListElem *ale,
const short /* selectmode */,
Member

Formatting looks off. Make sure to run clang-format.

Formatting looks off. Make sure to run `clang-format`.
Author
Member

clang-format itself changed this alignment (Visual studio formats the code after saving particular file) 😅

clang-format itself changed this alignment (Visual studio formats the code after saving particular file) 😅
Member

Hm there shouldn't be any spaces around selectmode. Does make format lead to a different result?

Hm there shouldn't be any spaces around `selectmode`. Does `make format` lead to a different result?
Author
Member

no difference with make format.
Will change comment style manually

no difference with `make format`. Will change comment style manually
Pratik Borhade added 1 commit 2023-08-02 12:07:44 +02:00
Falk David approved these changes 2023-08-02 12:11:39 +02:00
Falk David left a comment
Member

Looks good. Thanks :)

Looks good. Thanks :)
Amélie Fondevilla approved these changes 2023-08-02 15:02:06 +02:00
Amélie Fondevilla left a comment
Member

Looks good to me.

Looks good to me.
Pratik Borhade merged commit 56832ed59a into main 2023-08-02 15:17:16 +02:00
Pratik Borhade deleted branch gpv3-active-layer-channel 2023-08-02 15:17:17 +02:00
Author
Member

Merged, thanks for reviewing :)

Merged, thanks for reviewing :)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
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, Assets & 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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#110133
No description provided.