GPv3: Layergroup color tag #122873

Merged
Falk David merged 5 commits from PratikPB2123/blender:gpv3-layergroup-colortag into main 2024-06-11 18:25:14 +02:00
Member

Reused the collection color theme option for the layer group.
Introduced new operator change the icon color it can be accessed from
layer group context menu.

Part of #121390

Reused the collection color theme option for the layer group. Introduced new operator change the icon color it can be accessed from layer group context menu. Part of #121390 <video src="/attachments/2cce335f-f334-4fa5-800a-0e46b93ad27f" title="gpv3-layergroup-colortag.mp4" controls></video>
Pratik Borhade added 1 commit 2024-06-07 12:36:18 +02:00
Contributor

Is that just changing color? I see layers don't have custom channel color property itself.
I strongly advise using these collection colors in Dope Sheet instead of them. Managing channel colors per-layer is absolute pain. (or at least add ability to override with collection color)

Is that just changing color? I see layers don't have custom channel color property itself. I strongly advise using these collection colors in Dope Sheet instead of them. Managing channel colors per-layer is absolute pain. (or at least add ability to override with collection color)
Pratik Borhade added 1 commit 2024-06-07 12:48:00 +02:00
Author
Member

@nickberckley hi, not sure what you're expecting here 🙂
As discussed with Falk in #121390 , idea was to change group icon color just like "collection icon in outliner"

I strongly advise using these collection colors in Dope Sheet instead of them

why? 🤔

@nickberckley hi, not sure what you're expecting here 🙂 As discussed with Falk in #121390 , idea was to change group icon color just like "collection icon in outliner" > I strongly advise using these collection colors in Dope Sheet instead of them why? 🤔
Pratik Borhade added this to the Grease Pencil project 2024-06-07 12:57:50 +02:00
Pratik Borhade requested review from Falk David 2024-06-07 12:57:57 +02:00
Contributor

When you have multiple layers and want to change color for all of them its a hustle. Collection-centric workflow like rest of Blender would be much more convimient

When you have multiple layers and want to change color for all of them its a hustle. Collection-centric workflow like rest of Blender would be much more convimient
Member

@nickberckley Layers don't have color tags. This is just for layer groups.

@nickberckley Layers don't have color tags. This is just for layer groups.
Contributor

Yes what I'm proposing is using this color tags for dope sheet channel colors as well

Yes what I'm proposing is using this color tags for dope sheet channel colors as well
Member

I see, yea that would make sense. I don't think this PR needs to change all of that though. For now, just introducing a way to set a color for a layer group is fine. There are more ideas on where to use those colors, but we'll have to discuss this with the module.

I see, yea that would make sense. I don't think this PR needs to change all of that though. For now, just introducing a way to set a color for a layer group is fine. There are more ideas on where to use those colors, but we'll have to discuss this with the module.
Falk David requested changes 2024-06-07 14:07:33 +02:00
Dismissed
Falk David left a comment
Member

Did a quick pass on the code. Still need to test this locally.

Did a quick pass on the code. Still need to test this locally.
@ -612,6 +612,7 @@ class LayerGroup : public ::GreasePencilLayerTreeGroup {
LayerGroup &operator=(const LayerGroup &other);
public:
int color_icon;
Member

These classes can't store data, they can only contain functions.

You need to add this to DNA:

diff --git a/source/blender/makesdna/DNA_grease_pencil_types.h b/source/blender/makesdna/DNA_grease_pencil_types.h
index ea7083a52dd..7492d58023c 100644
--- a/source/blender/makesdna/DNA_grease_pencil_types.h
+++ b/source/blender/makesdna/DNA_grease_pencil_types.h
@@ -331,6 +331,11 @@ typedef struct GreasePencilLayerTreeGroup {
    * List of `GreasePencilLayerTreeNode`.
    */
   ListBase children;
+  /**
+   * Icon color tag.
+   */
+  int8_t color_tag;
+  char _pad[7];
   /**
    * Runtime struct pointer.
    */

(I should add some static asserts to the wrapper classes of the DNA structs to ensure this doesn't compile)

These classes can't store data, they can only contain functions. You need to add this to DNA: ```diff diff --git a/source/blender/makesdna/DNA_grease_pencil_types.h b/source/blender/makesdna/DNA_grease_pencil_types.h index ea7083a52dd..7492d58023c 100644 --- a/source/blender/makesdna/DNA_grease_pencil_types.h +++ b/source/blender/makesdna/DNA_grease_pencil_types.h @@ -331,6 +331,11 @@ typedef struct GreasePencilLayerTreeGroup { * List of `GreasePencilLayerTreeNode`. */ ListBase children; + /** + * Icon color tag. + */ + int8_t color_tag; + char _pad[7]; /** * Runtime struct pointer. */ ``` (I should add some static asserts to the wrapper classes of the DNA structs to ensure this doesn't compile)
Member

I should add some static asserts to the wrapper classes of the DNA structs to ensure this doesn't compile

Done. e65981b999

> I should add some static asserts to the wrapper classes of the DNA structs to ensure this doesn't compile Done. https://projects.blender.org/blender/blender/commit/e65981b999b63c3db5e6796b00aaf02d111110cd
Author
Member

Thanks, will update.
Actually, I added new member to struct but wasn't compiling after that. Didn't know _pad is required there 😅

Thanks, will update. Actually, I added new member to struct but wasn't compiling after that. Didn't know `_pad` is required there 😅
Pratik Borhade added 1 commit 2024-06-08 12:59:52 +02:00
Pratik Borhade added 1 commit 2024-06-08 13:02:50 +02:00
Falk David requested changes 2024-06-11 11:48:02 +02:00
Dismissed
@ -259,6 +260,7 @@ static int grease_pencil_layer_group_add_exec(bContext *C, wmOperator *op)
}();
LayerGroup &new_group = grease_pencil.add_layer_group(parent_group, new_layer_group_name);
new_group.color_tag = -1;
Member

This can be moved into LayerGroup::LayerGroup() I think since it should be the starting value always. Also use LAYERGROUP_COLOR_NONE.

LayerGroup::LayerGroup()
{
  ...
  BLI_listbase_clear(&this->children);
  this->color_tag = LAYERGROUP_COLOR_NONE;
This can be moved into `LayerGroup::LayerGroup()` I think since it should be the starting value always. Also use `LAYERGROUP_COLOR_NONE`. ``` LayerGroup::LayerGroup() { ... BLI_listbase_clear(&this->children); this->color_tag = LAYERGROUP_COLOR_NONE; ```
@ -386,1 +386,3 @@
uiBut *but = uiItemL_ex(&row, group_.name().c_str(), ICON_FILE_FOLDER, false, false);
short icon = ICON_FILE_FOLDER;
if (group_.color_tag != -1) {
Member

Use LAYERGROUP_COLOR_NONE.

Use `LAYERGROUP_COLOR_NONE`.
Pratik Borhade added 1 commit 2024-06-11 15:02:33 +02:00
Use LAYERGROUP_COLOR_NONE
All checks were successful
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
e58400032f
Falk David approved these changes 2024-06-11 15:57:09 +02:00
Member

@blender-bot build

@blender-bot build
Falk David merged commit cea18e62c5 into main 2024-06-11 18:25:14 +02:00
Author
Member

Ah, merged already, thanks for reviewing :)

Ah, merged already, thanks for reviewing :)
Pratik Borhade deleted branch gpv3-layergroup-colortag 2024-06-14 12:50:49 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
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
Core
Module
Development Management
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
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
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#122873
No description provided.