UI: Use collection color tag to draw arrow in outliner #121109

Open
Pratik Borhade wants to merge 1 commits from PratikPB2123/blender:outliner-collection-arrow into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Hierarchy line already uses the collection color tag (or the collection theme
color). For consistency, also use it to draw the arrow next to collection.

Main PR
main PR
Hierarchy line already uses the collection color tag (or the collection theme color). For consistency, also use it to draw the arrow next to collection. | Main | PR | | -- | -- | | ![main](/attachments/42e3b271-0797-4621-9f0e-57cdbbd7305d) | ![PR](/attachments/a6bd2cd4-cce6-460c-98dc-906afac35cf9) |
26 KiB
26 KiB
Pratik Borhade added 1 commit 2024-04-26 09:06:40 +02:00
f461a19b4d UI: Use collection color tag to draw arrow
Hierarchy line already uses the collection color tag. For consistency,
use it to draw the arrow next to collection.
Pratik Borhade requested review from Pablo Vazquez 2024-04-26 09:08:34 +02:00
Pratik Borhade requested review from Julian Eisel 2024-04-26 09:08:35 +02:00
Pratik Borhade added the
Module
User Interface
label 2024-04-26 09:08:40 +02:00
Pratik Borhade changed title from UI: Use collection color tag to draw arrow to UI: Use collection color tag to draw arrow in outliner 2024-04-26 09:08:57 +02:00
Member

I'm not sure about coloring the arrows, they are an interactive element, like a button. If a button is fully red like one of the default collection colors, it might signal the wrong message.

For that reason the arrow should stay the same color as the text label (also an interactive element).

That being said though... I took part of your code and experimented with a (very) subtle background for the rows which I think it helps even more:

background rows

I only colored the background row where the collection is, but ideally all rows nested under the collection should have this subtle color as well. I just don't know how to implement it. Are you interested in giving this a try?

Here is the diff to test it out:

diff --git forkSrcPrefix/source/blender/editors/space_outliner/outliner_draw.cc forkDstPrefix/source/blender/editors/space_outliner/outliner_draw.cc
index 20c77f25b8ffb0a05c627e94274ba42f0f0d1bf8..568945ffe9daf2c3fe8500f3aaf1543b638f1558 100644
--- forkSrcPrefix/source/blender/editors/space_outliner/outliner_draw.cc
+++ forkDstPrefix/source/blender/editors/space_outliner/outliner_draw.cc
@@ -3750,6 +3750,7 @@ static void outliner_draw_highlights(uint pos,
                                      const float col_active[4],
                                      const float col_highlight[4],
                                      const float col_searchmatch[4],
+                                     uchar col_collection[4],
                                      int start_x,
                                      int *io_start_y)
 {
@@ -3761,6 +3762,20 @@ static void outliner_draw_highlights(uint pos,
     const TreeStoreElem *tselem = TREESTORE(te);
     const int start_y = *io_start_y;
 
+    Collection *collection = nullptr;
+    bTheme *btheme = UI_GetTheme();
+    if (outliner_is_collection_tree_element(te)) {
+      collection = outliner_collection_from_tree_element(te);
+      col_collection = (collection && collection->color_tag != COLLECTION_COLOR_NONE) ?
+                                btheme->collection_color[collection->color_tag].color :
+                                btheme->space_outliner.back;
+      col_collection[3] = 25;
+
+      /* Collection color. */
+      immUniformColor4ubv(col_collection);
+      immRecti(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y);
+    }
+
     /* Selection status. */
     if ((tselem->flag & TSE_ACTIVE) && (tselem->flag & TSE_SELECTED)) {
       immUniformColor4fv(col_active);
@@ -3823,6 +3838,7 @@ static void outliner_draw_highlights(ARegion *region,
 {
   const float col_highlight[4] = {1.0f, 1.0f, 1.0f, 0.13f};
   float col_selection[4], col_active[4], col_searchmatch[4];
+  uchar col_collection[4];
 
   UI_GetThemeColor3fv(TH_SELECT_HIGHLIGHT, col_selection);
   col_selection[3] = 1.0f; /* No alpha. */
@@ -3842,6 +3858,7 @@ static void outliner_draw_highlights(ARegion *region,
                            col_active,
                            col_highlight,
                            col_searchmatch,
+                           col_collection,
                            startx,
                            starty);
   immUnbindProgram();

Thanks for the prototype!

I'm not sure about coloring the arrows, they are an interactive element, like a button. If a button is fully red like one of the default collection colors, it might signal the wrong message. For that reason the arrow should stay the same color as the text label (also an interactive element). That being said though... I took part of your code and experimented with a (very) subtle background for the rows which I think it helps even more: ![background rows](/attachments/8c7a1e46-fa7b-4b4d-8113-9a6d8fa84519) <video src="/attachments/d5d3f962-bab3-4d44-8d8c-3383af69d851" title="outliner_collection_color_background.mov" controls></video> I only colored the background row where the collection is, but ideally all rows nested under the collection should have this subtle color as well. I just don't know how to implement it. Are you interested in giving this a try? Here is the diff to test it out: ```diff diff --git forkSrcPrefix/source/blender/editors/space_outliner/outliner_draw.cc forkDstPrefix/source/blender/editors/space_outliner/outliner_draw.cc index 20c77f25b8ffb0a05c627e94274ba42f0f0d1bf8..568945ffe9daf2c3fe8500f3aaf1543b638f1558 100644 --- forkSrcPrefix/source/blender/editors/space_outliner/outliner_draw.cc +++ forkDstPrefix/source/blender/editors/space_outliner/outliner_draw.cc @@ -3750,6 +3750,7 @@ static void outliner_draw_highlights(uint pos, const float col_active[4], const float col_highlight[4], const float col_searchmatch[4], + uchar col_collection[4], int start_x, int *io_start_y) { @@ -3761,6 +3762,20 @@ static void outliner_draw_highlights(uint pos, const TreeStoreElem *tselem = TREESTORE(te); const int start_y = *io_start_y; + Collection *collection = nullptr; + bTheme *btheme = UI_GetTheme(); + if (outliner_is_collection_tree_element(te)) { + collection = outliner_collection_from_tree_element(te); + col_collection = (collection && collection->color_tag != COLLECTION_COLOR_NONE) ? + btheme->collection_color[collection->color_tag].color : + btheme->space_outliner.back; + col_collection[3] = 25; + + /* Collection color. */ + immUniformColor4ubv(col_collection); + immRecti(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y); + } + /* Selection status. */ if ((tselem->flag & TSE_ACTIVE) && (tselem->flag & TSE_SELECTED)) { immUniformColor4fv(col_active); @@ -3823,6 +3838,7 @@ static void outliner_draw_highlights(ARegion *region, { const float col_highlight[4] = {1.0f, 1.0f, 1.0f, 0.13f}; float col_selection[4], col_active[4], col_searchmatch[4]; + uchar col_collection[4]; UI_GetThemeColor3fv(TH_SELECT_HIGHLIGHT, col_selection); col_selection[3] = 1.0f; /* No alpha. */ @@ -3842,6 +3858,7 @@ static void outliner_draw_highlights(ARegion *region, col_active, col_highlight, col_searchmatch, + col_collection, startx, starty); immUnbindProgram(); ``` Thanks for the prototype!
Author
Member

Hi, thanks for checking. I can take a look to color rows "below the collection" but I fear outliner will look way too colorful 😅

Understood your point about the "arrow", make sense to some extent to keep color as it is

Hi, thanks for checking. I can take a look to color rows "below the collection" but I fear outliner will look way too colorful 😅 Understood your point about the "arrow", make sense to some extent to keep color as it is
Member

I'm also not sure on the arrow coloring since this makes the visual weight of the arrows differ. I don't mind this much on the lines since they are such a secondary feature, but I'd rather the arrows look alike.

I only colored the background row where the collection is, but ideally all rows nested under the collection should have this subtle color as well.

I worry a bit that this would not only remove the benefit of the current zebra striping but also be visually competitive with hover and selected states. In the top example "Essentials" and "Lighting" both look highlighted, but it doesn't look immediately obvious why. I think I'd need to see a mockup that includes hover, active, multiple-item selection, along with this coloring.

I'm also not sure on the arrow coloring since this makes the visual weight of the arrows differ. I don't mind this much on the lines since they are such a secondary feature, but I'd rather the arrows look alike. > I only colored the background row where the collection is, but ideally all rows nested under the collection should have this subtle color as well. I worry a bit that this would not only remove the benefit of the current zebra striping but also be visually competitive with hover and selected states. In the top example "Essentials" and "Lighting" both look highlighted, but it doesn't look immediately obvious why. I think I'd need to see a mockup that includes hover, active, multiple-item selection, along with this coloring.
Member

Background colors are already used to signal selection status, zebra stripes and so on. Adding colors to it seems too much distraction.

About the arrows, only relying on vertical position can be difficult to read in some cases, at least I found it difficult to calculate if an arrow is perfectly on top of one or another line.

Coloring the arrows visually connects them to the vertical hierarchy line, while still looking clean. Without this it can signal that the arrow does not belong to the same hierarchy representation (visually any arrow could be related to any hierarchy line)

Background colors are already used to signal selection status, zebra stripes and so on. Adding colors to it seems too much distraction. About the arrows, only relying on vertical position can be difficult to read in some cases, at least I found it difficult to calculate if an arrow is perfectly on top of one or another line. Coloring the arrows visually connects them to the vertical hierarchy line, while still looking clean. Without this it can signal that the arrow does not belong to the same hierarchy representation (visually any arrow could be related to any hierarchy line)
Member

The capture in the first comment only shows the arrows open (facing down). Is it proposed that they also have the collection color when closed? I think that would look odd. And also odd to have them change from white to a color as they open.

The capture in the first comment only shows the arrows open (facing down). Is it proposed that they also have the collection color when closed? I think that would look odd. And also odd to have them change from white to a color as they open.
Author
Member

The capture in the first comment only shows the arrows open (facing down). Is it proposed that they also have the collection color when closed?

@Harley hi, yes, both closed and open arrows are colored in this PR :)

> The capture in the first comment only shows the arrows open (facing down). Is it proposed that they also have the collection color when closed? @Harley hi, yes, both closed and open arrows are colored in this PR :)
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u outliner-collection-arrow:PratikPB2123-outliner-collection-arrow
git checkout PratikPB2123-outliner-collection-arrow
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#121109
No description provided.