GPv3: Show and hide layers operators #114348

Merged
Falk David merged 6 commits from mendio/blender:GPv3_Show_Hide_Layers into main 2023-12-01 12:55:39 +01:00
  • New Operator: GREASE_PENCIL_OT_layer_hide
  • New Operator: GREASE_PENCIL_OT_layer_reveal
  • Added menus to Edit and Draw Modes
  • Added Keymap via _template_items_hide_reveal_actions()

Note: Operator names were changed for consistency with other layers operators that use layer on their names

- New Operator: GREASE_PENCIL_OT_layer_hide - New Operator: GREASE_PENCIL_OT_layer_reveal - Added menus to Edit and Draw Modes - Added Keymap via _template_items_hide_reveal_actions() Note: Operator names were changed for consistency with other layers operators that use _layer_ on their names
Matias Mendiola added 1 commit 2023-11-01 00:39:29 +01:00
7bd5f790f9 GPv3: Show and hide layers operators
- New Operator: GREASE_PENCIL_OT_layer_hide
- New Operator: GREASE_PENCIL_OT_layer_reveal
- Added menus to Edit and Draw Modes
- Added Keymap via _template_items_hide_reveal_actions()

Note: Operator names were changed for consistency with other layers operators that use _layer_ on their names
Matias Mendiola added the
Module
Grease Pencil
label 2023-11-01 00:39:51 +01:00
Matias Mendiola added this to the Grease Pencil project 2023-11-01 00:40:09 +01:00
Matias Mendiola requested review from Antonio Vazquez 2023-11-01 00:40:39 +01:00
Matias Mendiola requested review from Falk David 2023-11-01 00:40:40 +01:00
Matias Mendiola removed the
Module
Grease Pencil
label 2023-11-01 00:41:07 +01:00
Pratik Borhade requested changes 2023-11-04 07:47:20 +01:00
Pratik Borhade left a comment
Member

Hi, thanks for the PR.

Hi, thanks for the PR.
@ -247,0 +315,4 @@
for (Layer *layer : grease_pencil.layers_for_write()) {
layer->set_visible(true);
if (select) {
layer->set_selected(true);
Member

select property should select points of revealed layers.
As far as I understand,set_selected() selects the layer, which is wrong.

`select` property should select points of revealed layers. As far as I understand,`set_selected()` selects the layer, which is wrong.
Author
Member

You are right, in GPv2 the behaviour is that when you unhide a Layer all the strokes of the unhided Layer are selected. But this is destructive of all the selections you had in the Layer before it was hidden, IMO we should follow what meshes do and mantain selections.

You are right, in GPv2 the behaviour is that when you unhide a Layer all the strokes of the unhided Layer are selected. But this is destructive of all the selections you had in the Layer before it was hidden, IMO we should follow what meshes do and mantain selections.
Author
Member

I removed Layer selection after unhide the layer

I removed Layer selection after unhide the layer
mendio marked this conversation as resolved
Matias Mendiola added 1 commit 2023-11-04 17:54:13 +01:00
Matias Mendiola added 1 commit 2023-11-04 17:56:25 +01:00
Pratik Borhade reviewed 2023-11-05 04:53:50 +01:00
Pratik Borhade left a comment
Member

But select is false by default. So the selection prior of hiding is always preserved even after unhiding the layer.
I'm not aware about the use cases of "selecting all points of unhidden layer" (you guys know better about it :) )

If plan is to not use select property for GPv3, I'd suggest to remove following code.

But `select` is false by default. So the selection prior of hiding is always preserved even after unhiding the layer. I'm not aware about the use cases of "selecting all points of unhidden layer" (you guys know better about it :) ) If plan is to not use `select` property for GPv3, I'd suggest to remove following code.
@ -247,0 +306,4 @@
using namespace blender::bke::greasepencil;
Object *object = CTX_data_active_object(C);
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(object->data);
const bool select = RNA_boolean_get(op->ptr, "select");
Member

this is unused now. We can remove it

this is unused now. We can remove it
mendio marked this conversation as resolved
@ -247,0 +338,4 @@
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
PropertyRNA *prop = RNA_def_boolean(
Member

same here

same here
mendio marked this conversation as resolved
Matias Mendiola added 1 commit 2023-11-06 12:35:59 +01:00
Pratik Borhade approved these changes 2023-11-07 13:02:54 +01:00
Pratik Borhade left a comment
Member

Looks correct to me 🙂

Looks correct to me 🙂
Antonio Vazquez approved these changes 2023-11-08 15:39:56 +01:00
Antonio Vazquez left a comment
Member

LGTM

As a side note, IMHO the unselected name of the parameter is not the best name because really means if you hide de active or the others, but in any case this parameter is hidden, so the name is not used in any other place.

LGTM As a side note, IMHO the `unselected` name of the parameter is not the best name because really means if you hide de active or the others, but in any case this parameter is hidden, so the name is not used in any other place.
Author
Member

LGTM

As a side note, IMHO the unselected name of the parameter is not the best name because really means if you hide de active or the others, but in any case this parameter is hidden, so the name is not used in any other place.

I used the GPv2 name for the property but I can change that. In GPv2 selected and active layer is the same, but maybe this will change for GPv3 allowing multiple layers selection?

> LGTM > > As a side note, IMHO the `unselected` name of the parameter is not the best name because really means if you hide de active or the others, but in any case this parameter is hidden, so the name is not used in any other place. I used the GPv2 name for the property but I can change that. In GPv2 selected and active layer is the same, but maybe this will change for GPv3 allowing multiple layers selection?
Falk David requested changes 2023-11-30 14:15:32 +01:00
Falk David left a comment
Member

One comment from me. Otherwise looks good 👍

One comment from me. Otherwise looks good 👍
@ -247,0 +258,4 @@
if (unselected) {
/* hide unselected */
for (Layer *layer : grease_pencil.layers_for_write()) {
if (layer != grease_pencil.active_layer) {
Member

We can remove the if/else here and replace it:

const bool is_active = grease_pencil.is_layer_active(layer);
layer->set_visible(is_active);
We can remove the `if/else` here and replace it: ``` const bool is_active = grease_pencil.is_layer_active(layer); layer->set_visible(is_active); ```
mendio marked this conversation as resolved
Matias Mendiola added 1 commit 2023-11-30 15:23:56 +01:00
buildbot/vexp-code-patch-coordinator Build done. Details
2ac1835f90
if/else code simplification
Falk David approved these changes 2023-11-30 15:28:55 +01:00
Member

@blender-bot build

Doing a quick build and then I'll merge this.

@blender-bot build Doing a quick build and then I'll merge this.
Member

Looks like some recent merges of other PRs lead to conflics here. So this needs a merge with main.

Looks like some recent merges of other PRs lead to conflics here. So this needs a merge with `main`.
Matias Mendiola added 1 commit 2023-12-01 12:48:47 +01:00
Falk David merged commit b8a785b65b into main 2023-12-01 12:55:39 +01:00
Matias Mendiola deleted branch GPv3_Show_Hide_Layers 2023-12-01 13:12:53 +01: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
4 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#114348
No description provided.