GPv3: Include other channel selection modes #110791

Merged
Amélie Fondevilla merged 4 commits from PratikPB2123/blender:gpv3-selection-modes into main 2023-08-09 12:24:06 +02:00
Member

Support extend and extend range channel selection.

Some channeltype don't have active channel and they don't support
extend range. This is done in animchannel_has_active_of_type.
Add switch case for new GPv3 channels in above ANIM_is_active_channel
to detect active channels and support extend range

Part of #110056

Support extend and extend range channel selection. Some channeltype don't have active channel and they don't support `extend range`. This is done in `animchannel_has_active_of_type`. Add switch case for new GPv3 channels in above `ANIM_is_active_channel` to detect active channels and support `extend range` Part of #110056
Pratik Borhade added 1 commit 2023-08-04 12:40:26 +02:00
87e9daf79b GPv3: Include other channel selection modes
Support extend and extend range channel selection.
Some channeltype don't have active channel and they don't support
`extend range`. This is checked with the help of `ANIM_is_active_channel`.
Add switch case for new GPv3 channels in above funnction to detect
active channels and support `extend range`
Pratik Borhade requested review from Falk David 2023-08-04 12:40:43 +02:00
Pratik Borhade requested review from Amélie Fondevilla 2023-08-04 12:40:43 +02:00
Pratik Borhade added the
Module
Animation & Rigging
Interest
Grease Pencil
labels 2023-08-04 12:41:05 +02:00
Pratik Borhade added this to the Grease Pencil project 2023-08-04 12:41:19 +02:00
Amélie Fondevilla requested changes 2023-08-07 12:26:08 +02:00
Amélie Fondevilla left a comment
Member

Thanks for the patch. I think it would be nice if we use the API a little more to manipulate the layers' data, I've left a few comments in that direction. (Actually, this could have been in my review of the previous PR, sorry.)

Thanks for the patch. I think it would be nice if we use the API a little more to manipulate the layers' data, I've left a few comments in that direction. (Actually, this could have been in my review of the previous PR, sorry.)
@ -355,1 +355,4 @@
}
case ANIMTYPE_GREASE_PENCIL_LAYER: {
GreasePencil *grease_pencil = reinterpret_cast<GreasePencil *>(ale->id);
return grease_pencil->active_layer == ale->data;

Better to use grease_pencil->get_active_layer() == ale->data;

Better to use `grease_pencil->get_active_layer() == ale->data;`
amelief marked this conversation as resolved
@ -3636,4 +3640,3 @@
const int /*filter*/)
{
/* TODO: Implement other selection modes. */
GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ale->data);

You can use the C++ class here :

using namespace blender::bke::greasepencil;
Layer *layer = static_cast<Layer *>(ale->data);
You can use the C++ class here : ``` using namespace blender::bke::greasepencil; Layer *layer = static_cast<Layer *>(ale->data); ```
amelief marked this conversation as resolved
@ -3645,2 +3657,2 @@
layer->base.flag |= GP_LAYER_TREE_NODE_SELECT;
grease_pencil->active_layer = layer;
/* Active channel is not changed during range select. */
if (selectmode != SELECT_EXTEND_RANGE) {

if (layer->is_selected() && (selectmode != SELECT_EXTEND_RANGE))

`if (layer->is_selected() && (selectmode != SELECT_EXTEND_RANGE))`
amelief marked this conversation as resolved
@ -3646,1 +3657,3 @@
grease_pencil->active_layer = layer;
/* Active channel is not changed during range select. */
if (selectmode != SELECT_EXTEND_RANGE) {
grease_pencil->active_layer = layer;

I think it would be nice to integrate this in ANIM_set_active_channel, even if the first loop does nothing in the case of grease pencil channel, and then the second loop sets the layer as active.

Also, to set the layer as active it is better to use the API function grease_pencil->set_active_layer (just in case we change the behavior of this in the future).

I think it would be nice to integrate this in `ANIM_set_active_channel`, even if the first loop does nothing in the case of grease pencil channel, and then the second loop sets the layer as active. Also, to set the layer as active it is better to use the API function `grease_pencil->set_active_layer` (just in case we change the behavior of this in the future).
Author
Member

...and then the second loop sets the layer as active.

Actually there is no "second" loop in that function 😅
one way to use ANIM_set_active_channel is we can pass ale instead of ale->data (to get the Grease pencil object associated with that channel/layer)

> ...and then the second loop sets the layer as active. Actually there is no "second" loop in that function 😅 one way to use `ANIM_set_active_channel` is we can pass `ale` instead of `ale->data` (to get the Grease pencil object associated with that channel/layer)

Oh, yes, sorry I forgot about that. Well, forget about the first part of my comment then.
We can still use grease_pencil->set_active_layer though.

Oh, yes, sorry I forgot about that. Well, forget about the first part of my comment then. We can still use `grease_pencil->set_active_layer` though.
Author
Member

yes, set_active_layer is used now

yes, `set_active_layer` is used now
amelief marked this conversation as resolved
Pratik Borhade added 1 commit 2023-08-07 13:08:12 +02:00
Amélie Fondevilla approved these changes 2023-08-07 14:04:40 +02:00

@PratikPB2123 now we can update this with the new is_active_layer function.

@PratikPB2123 now we can update this with the new `is_active_layer` function.
Pratik Borhade added 2 commits 2023-08-08 11:46:23 +02:00
Falk David approved these changes 2023-08-09 12:22:36 +02:00
Falk David left a comment
Member

Looks good. Thank you.

Looks good. Thank you.
Amélie Fondevilla merged commit ffafc183ba into main 2023-08-09 12:24:06 +02:00
Author
Member

Thanks for merging/reviewing :)

Thanks for merging/reviewing :)
Pratik Borhade deleted branch gpv3-selection-modes 2023-08-09 12:53:18 +02:00
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#110791
No description provided.