UI: Configurable Layout Separators #117310
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117310
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Harley/blender:VerticalSeparator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ability to create vertical bar separators in horizontal layouts,
horizontal lines in popovers, and vertical (non-line) spacers in menus.
It was brought up in the UI Module meeting that we might want vertical bar section separators for horizontal layouts like headers. I've tried to make this as unobtrusive as possible. Current uses of
layout.separator()
continue to work exactly as they do now.Currently the separator type is inferred from the button type. It makes a horizontal line if in a menu, or just horizontal space if not. To keep this behavior the same, I've added a
type
argument which has a default value ofAUTO
which retains this same behavior. So existing uses of separator are unchanged.However, you can force a different separator if you wish, by using either
SPACE
orLINE
. When usingLINE
the direction of the line is inferred from the layout direction. This works since I can't find a situation where this doesn't work.Here are two useless examples of
LINE
, one on the TopBar and another on the 3D View header:Following is a before and after comparison of the use of the horizontal rule as a separator between title and content on props dialogs:
The
factor
argument remains and works as you expect. For horizontal lines this still gives expanded or reduced vertical spacing. For vertical bars it does so for horizontal space, with the bar in the middle of it.WIP: UI: Vertical Bar Separatorto UI: Vertical Bar SeparatorThis looks nice. I don't feel like I can answer where we would use this by default (maybe Pablo can!) but having the option seems reasonable.
One big picture question is whether we actually need
LayoutSeparatorType
. Maybe using the layout's direction would always be enough. That would definitely simplify some things.@ -1501,6 +1501,12 @@ enum eButProgressType {
UI_BUT_PROGRESS_TYPE_RING = 1,
};
enum eLayoutSeparatorType {
How about this for some stronger type safety and prettier code?
Then you refer to it like
LayoutSeparatorType::Space
elsewhere, and it can be forward declared likeenum class LayoutSeparatorType : int8_t;
I'd also try representing the "Auto" state with
std::optional
. But maybe that wouldn't be better@ -3458,1 +3457,3 @@
space *= factor;
bool is_vertical = (layout->w > 0);
int width = (is_vertical) ? int(UI_UNIT_X) : int(0.3f * UI_UNIT_X * factor);
Parentheses around
is_vertical
are unnecessary@ -3459,0 +3460,4 @@
int height = (is_vertical) ? int(0.35f * UI_UNIT_X * factor) : int(UI_UNIT_Y);
eButType but_type = UI_BTYPE_SEPR;
if (type == UI_LAYOUT_SEPARATOR_LINE) {
Can this be a switch statement?
@ -3470,3 +3482,2 @@
0.0,
0.0,
0,
0.0, (is_vertical_bar) ? 1.0f : 0.0f,
Clang format
@ -3344,2 +3344,2 @@
/** Separator for menus. */
static void ui_draw_separator(const rcti *rect, const uiWidgetColors *wcol)
/** Separator line. */
static void ui_draw_separator(const rcti *rect, const uiWidgetColors *wcol, bool vertical)
Got to say it feels weird to pass the combination of
rect
and `vertical here. I seems like we only end up needing two points. Maybe it would be clearer to pass those here.First off, thank you so much for this! I can't tell you how much time I've tried creating hacky horizontal lines in my addons using repeating hyphens or asterisks.
Second, if done in a normal panel would it make a vertical line in a
layout.row.separator(type="LINE")
and a horizontal line in alayout.column.separator(type="OINE")
? What aboutlayout.grid
?Are you able to give me a scenario to test? Maybe a sample script to run and describing the expected result? Or maybe describe a change to an existing script?
No, sorry I don't have anything in mind. I was mainly asking about the row/column thing and grid just popped in my mind and was curious.
UI: Vertical Bar Separatorto UI: Configurable Layout SeparatorsI don't think we'd need it often. But the following is an example where I would do so, with props dialogs to separate the title from the rest:
I'm not sure that is possible, but maybe you are thinking of something that I have not considered correctly?
With a layout that has a vertical direction, like in dialogs and popups, we currently only have the option of a separator comprising only vertical space. But this PR would allow us to have both spacers and horizontal rules.
I think the only way to get rid of the need for LayoutSeparatorType would be replace all our current usages of layout.separator with a label when it is used to just used to make a vertical gap. Then we could change separator to always be a line for vertical layouts. But we use separator for vertical spaces all over the place and probably in many addons.
Or were you thinking of some other way or not needing LayoutSeparatorType ?
@pablovazquez
Can you look at the following image and consider the brightness of the horizontal rule on the right? It looks a bit too dim to me but I've been staring at it too long now and need a fresh opinion:
Ah, my bad, I misunderstood what
LayoutSeparatorType
was doing here. Somehow I thought it was controlling the vertical/horizontal choice. Maybe I was asleep. Anyway, this change looks good to me.@ -3449,3 +3449,3 @@
}
void uiItemS_ex(uiLayout *layout, float factor)
void uiItemS_ex(uiLayout *layout, float factor, LayoutSeparatorType type)
const LayoutSeparatorType
@blender-bot build
Need this into main early, to help with #117304