GPv3: Hide Others operator #115038

Merged
Antonio Vazquez merged 8 commits from antoniov/blender:GPV3_hide_others into main 2023-11-23 16:03:39 +01:00

This operators hide all materials except active one.

There is a parameter to hide only active as it was in GPv2.

Related to #114997

This operators hide all materials except active one. There is a parameter to hide only active as it was in GPv2. Related to #114997
Antonio Vazquez added 1 commit 2023-11-17 11:07:19 +01:00
9160424928 GPv3: Hide Others operator
This operators hide all materials except active one.

There is a parameter to hide only active as it was in GPv2.
Antonio Vazquez requested review from Hans Goudey 2023-11-17 11:08:11 +01:00
Antonio Vazquez requested review from Falk David 2023-11-17 11:08:17 +01:00
Antonio Vazquez added this to the Grease Pencil project 2023-11-17 11:08:23 +01:00
Falk David requested changes 2023-11-17 11:32:42 +01:00
Falk David left a comment
Member

Some comments

Some comments
@ -66,0 +85,4 @@
if (!unselected && i != object->actcol - 1) {
continue;
}
if (Material *ma = BKE_gpencil_material(object, i + 1)) {
Member

I think this should use BKE_object_material_get. It doesn't seem correct to change the default material in case BKE_object_material_get returns nullptr.

I think this should use `BKE_object_material_get`. It doesn't seem correct to change the default material in case `BKE_object_material_get` returns `nullptr`.
antoniov marked this conversation as resolved
@ -66,0 +86,4 @@
continue;
}
if (Material *ma = BKE_gpencil_material(object, i + 1)) {
MaterialGPencilStyle *gp_style = ma->gp_style;
Member

Since this should not be nullptr there should be an BLI_assert(gp_style != nullptr) here.

Since this should not be `nullptr` there should be an `BLI_assert(gp_style != nullptr)` here.
antoniov marked this conversation as resolved
@ -66,0 +104,4 @@
static void GREASE_PENCIL_OT_material_hide(wmOperatorType *ot)
{
/* Identifiers. */
ot->name = "Show All Materials";
Member

This seems like a copy-paste error.

This seems like a copy-paste error.
antoniov marked this conversation as resolved
@ -66,0 +106,4 @@
/* Identifiers. */
ot->name = "Show All Materials";
ot->idname = "GREASE_PENCIL_OT_material_hide";
ot->description = "Hide selected/unselected Grease Pencil materials";
Member

The operator description seems to suggest that only selected/unselected materials get hidden, but the code hides the active material. That's counter intuitive to me. Maybe this should just say "Hide active/inactive Grease Pencil material(s)" ?

The operator description seems to suggest that only selected/unselected materials get hidden, but the code hides the active material. That's counter intuitive to me. Maybe this should just say "Hide active/inactive Grease Pencil material(s)" ?
antoniov marked this conversation as resolved
@ -66,0 +116,4 @@
/* props */
RNA_def_boolean(
ot->srna, "unselected", false, "Unselected", "Hide unselected rather than selected colors");
Member

Maybe "invert" would work better ? And "Hide inactive materials instead of the active one" ?

Maybe "invert" would work better ? And "Hide inactive materials instead of the active one" ?
antoniov marked this conversation as resolved
Antonio Vazquez added 1 commit 2023-11-17 12:45:15 +01:00
e40a749d60 GPv3: Changes after review
* Rename parameter
* Cleanup style
* Fix description error
Antonio Vazquez added 2 commits 2023-11-20 10:09:43 +01:00
Antonio Vazquez added 2 commits 2023-11-21 16:01:58 +01:00
Falk David approved these changes 2023-11-22 17:28:39 +01:00
Antonio Vazquez added 1 commit 2023-11-23 15:39:44 +01:00
2b05ec9ec9 Merge branch 'main' into GPV3_hide_others
Conflicts:
	scripts/startup/bl_ui/properties_material_gpencil.py
	source/blender/editors/grease_pencil/intern/grease_pencil_material.cc
Hans Goudey approved these changes 2023-11-23 15:42:44 +01:00
@ -66,0 +82,4 @@
if (invert && i == object->actcol - 1) {
continue;
}
if (!invert && i != object->actcol - 1) {
Member

Putting object->actcol - 1 in a variable would make this look a little simpler.

Putting `object->actcol - 1` in a variable would make this look a little simpler.
antoniov marked this conversation as resolved
Antonio Vazquez added 1 commit 2023-11-23 16:02:58 +01:00
Antonio Vazquez merged commit 9d8283d113 into main 2023-11-23 16:03:39 +01:00
Antonio Vazquez deleted branch GPV3_hide_others 2023-11-23 16:03:41 +01:00
Som1Lse referenced this issue from a commit 2023-11-27 18:49:09 +01:00
Sign in to join this conversation.
No reviewers
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#115038
No description provided.