Label alignment in top bar #61558

Closed
opened 2019-02-15 00:20:24 +01:00 by William Reynish · 22 comments

The labels in the top bar are visually disconnected from the items they belong to, making it difficult to see which element each label is connected to.
image.png

The labels in the top bar are visually disconnected from the items they belong to, making it difficult to see which element each label is connected to. ![image.png](https://archive.blender.org/developer/F6613489/image.png)
Added subscribers: @WilliamReynish, @antoniov, @CharlieJolly, @schweppie, @Hexbob6, @freemind, @PierreSchiller, @SteffenD, @remotecrab131, @Thane5, @orvb, @brezdo, @iss, @0o00o0oo, @ideasman42, @RamiroCantu, @Regnas

Added subscriber: @luisbg

Added subscriber: @luisbg

This looks like a great first task to get my feet wet in Blender coding again.

Can I get this assigned to me? I will start looking into it very soon.

This looks like a great first task to get my feet wet in Blender coding again. Can I get this assigned to me? I will start looking into it very soon.
Luis de Bethencourt Guimera self-assigned this 2019-08-01 21:08:02 +02:00

I was recommended in IRC to just assign it to myself. "Be bold!"

I was recommended in IRC to just assign it to myself. "Be bold!"
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

And i stand by that statement! However if you feel like this isn't gonna work out, and bail on it, be sure to un-assign your self so someone else can have a go at this one

And i stand by that statement! However if you feel like this isn't gonna work out, and bail on it, be sure to un-assign your self so someone else can have a go at this one
Member

Added subscriber: @Harley

Added subscriber: @Harley
Member

Be bold. But don't be discouraged if you get bogged down in weeds. If so, there are lots of fun and easy things to do to get your feet wet. Don't want you running away in frustration.

It is possible that particular problem might look simple (just move some bits over) but could involve more that it seems. It's been a while since I looked around there, but I think those things are defined in Python and then are drawn with our layout engine that primarily puts things like that in vertical columns, not horizontal rows (hence the funny alignment). So this might be about communicating this intention to put things in a single horizontal row to Layout so that it can align things differently there.

Be bold. But don't be discouraged if you get bogged down in weeds. If so, there are lots of fun and easy things to do to get your feet wet. Don't want you running away in frustration. It is possible that particular problem might look simple (just move some bits over) but could involve more that it seems. It's been a while since I looked around there, but I think those things are defined in Python and then are drawn with our layout engine that primarily puts things like that in vertical columns, not horizontal rows (hence the funny alignment). So this might be about communicating this intention to put things in a single horizontal row to Layout so that it can align things differently there.

Thanks @LazyDodo and @harley. I will read around this code and see how much work it entails to fix this.

If I get stuck or overwhelmed I will let you guys know so we can decide what to do.

Thanks @LazyDodo and @harley. I will read around this code and see how much work it entails to fix this. If I get stuck or overwhelmed I will let you guys know so we can decide what to do.

Added subscriber: @JonathanLampel-4

Added subscriber: @JonathanLampel-4
Member

No worries. And feel free to ask questions. Here or [here ]] or [ https:*blender.chat/channel/blender-coders | here .

But again, if it seems impossibly complex don't assume it is you being dumb or that the source is somehow bad. It just might not be something good while learning the codebase. We have plenty of things that could look trivial but require some experience and other things that might seem tough but would just need a single word changed. But anything you do is appreciated and should be fun.

Cheers.

No worries. And feel free to ask questions. Here or [here ]] or [[ https:*blender.chat/channel/blender-coders | here ](https:*devtalk.blender.org/c/blender). But again, if it seems impossibly complex don't assume it is you being dumb or that the source is somehow bad. It just might not be something good while learning the codebase. We have plenty of things that could look trivial but require some experience and other things that might seem tough but would just need a single word changed. But anything you do is appreciated and should be fun. Cheers.

Sounds good. I have time tomorrow to start exploring the code around this and then I will report back.

In the meantime, if you find something that is the opposite: looks tough but would just need a simple change. Throw it my way. I want to learn and contribute.

Sounds good. I have time tomorrow to start exploring the code around this and then I will report back. In the meantime, if you find something that is the opposite: looks tough but would just need a simple change. Throw it my way. I want to learn and contribute.

It's been a week so I wanted to give an update.

I have spent around 4 hours diving into the Blender code base with the purpose of finding how the alignment in the top bar works. I got sidetracked looking at what DNA and RNA are, and a bit of how they work, since the UI elements are generated in pre-processing (source/blender/makesrna/intern/rna_scene.c). I will continue learning.

I prefer figuring things out to learn than being spoon-fed the answers. But is there anybody who can help me with some particular doubts/questions I have? Maybe somebody who is already mentoring a GSOC student?

It's been a week so I wanted to give an update. I have spent around 4 hours diving into the Blender code base with the purpose of finding how the alignment in the top bar works. I got sidetracked looking at what DNA and RNA are, and a bit of how they work, since the UI elements are generated in pre-processing (source/blender/makesrna/intern/rna_scene.c). I will continue learning. I prefer figuring things out to learn than being spoon-fed the answers. But is there anybody who can help me with some particular doubts/questions I have? Maybe somebody who is already mentoring a GSOC student?

Ray answered a few of my questions about the relationship between DNA, RNA and Python. Now things are much clearer to me. Including that I should look at Python files in release/scripts/startup/bl_ui.

I will continue my research there and report soon.

Ray answered a few of my questions about the relationship between DNA, RNA and Python. Now things are much clearer to me. Including that I should look at Python files in `release/scripts/startup/bl_ui`. I will continue my research there and report soon.

I think I have found the problem: when we calculate the width of the UI Item (as part of setting RNA callbacks to calculate the x, y, width, height in wm_draw_window_offscreen()) we are giving it too much margin.

https://git.blender.org/gitweb/gitweb.cgi/blender.git/blob/HEAD:/source/blender/editors/interface/interface_layout.c#l287
ui_text_icon_width() has a margin of 1.5, if I bring it down manually to 0.5 the label becomes flush with what it belongs to. For example "Orientation:" and the drop down enum.

This margin makes sense for disjointed items but not for labels.

I'm not sure what is the best approach to fix this though. Any ideas/hints? I don't see anything in Python code that describes VIEW3D_GGT_xform_gizmo that I could set. Or any flag in the PropertyNRA I could try to set either. Maybe I'm looking in the wrong place.

It has been fun reading how a the layout code for WM_main() works. 😄

I think I have found the problem: when we calculate the width of the UI Item (as part of setting RNA callbacks to calculate the x, y, width, height in `wm_draw_window_offscreen()`) we are giving it too much margin. https://git.blender.org/gitweb/gitweb.cgi/blender.git/blob/HEAD:/source/blender/editors/interface/interface_layout.c#l287 `ui_text_icon_width()` has a margin of 1.5, if I bring it down manually to 0.5 the label becomes flush with what it belongs to. For example "Orientation:" and the drop down enum. This margin makes sense for disjointed items but not for labels. I'm not sure what is the best approach to fix this though. Any ideas/hints? I don't see anything in Python code that describes `VIEW3D_GGT_xform_gizmo` that I could set. Or any flag in the `PropertyNRA` I could try to set either. Maybe I'm looking in the wrong place. It has been fun reading how a the layout code for `WM_main()` works. :smile:
Member

@luisbg - reducing the amount at that location would tighten that margin, but it is probably not where you would want to do so.

If you examine what other functions are calling ui_text_icon_width() you'll see that it is the starting point for the width of UI elements and then that value is added to, or subtracted from, depending on what kind of thing it is. So right there would probably be more of a blunt hammer to it than you want. It could be part of an approach though, depending on how much else you discover. But the trick is to not just watch what your changes do in that top bar, but also how your changes affect everything else, like in the Properties panels. The fundamental root of this issue is the assumption that these things are show in vertical columns, not a horizontal strip. But I think we do have enough information, in thatLayout has concept of direction with flags such as UI_LAYOUT_HORIZONTAL.

@luisbg - reducing the amount at that location would tighten that margin, but it is probably not where you would want to do so. If you examine what other functions are calling ui_text_icon_width() you'll see that it is the *starting point* for the width of UI elements and then that value is added to, or subtracted from, depending on what kind of thing it is. So right there would probably be more of a blunt hammer to it than you want. It could be part of an approach though, depending on how much else you discover. But the trick is to not just watch what your changes do in that top bar, but also how your changes affect everything else, like in the Properties panels. The fundamental root of this issue is the assumption that these things are show in vertical columns, not a horizontal strip. But I think we do have enough information, in that*Layout* has concept of direction with flags such as UI_LAYOUT_HORIZONTAL.

@Harley Thanks for the quick and informative response. I will read the other functions that call ui_text_icon_width() and see if I can come up with a better approach.

I arrived to this place because I saw when ui_item_layout() iterates over all elements of the top panel UI block, these already come with the item->w set and it just sets the x coordinates by iterating like for (i = item.first; i; i->next) { x += i->w }. So at that point each item follows the next without a gap and it is too late to change widths.

I will let you know how it goes. I will keep investigating this one and get it closer to delivery, but I'm starting to feel tempted to also get an easier get-your-feet-wet bug to feel like I'm progressing and contributing. Any suggestions?

@Harley Thanks for the quick and informative response. I will read the other functions that call `ui_text_icon_width()` and see if I can come up with a better approach. I arrived to this place because I saw when `ui_item_layout()` iterates over all elements of the top panel UI block, these already come with the `item->w` set and it just sets the x coordinates by iterating like `for (i = item.first; i; i->next) { x += i->w }`. So at that point each item follows the next without a gap and it is too late to change widths. I will let you know how it goes. I will keep investigating this one and get it closer to delivery, but I'm starting to feel tempted to also get an easier get-your-feet-wet bug to feel like I'm progressing and contributing. Any suggestions?

Removed subscriber: @brezdo

Removed subscriber: @brezdo
Luis de Bethencourt Guimera was unassigned by Hans Goudey 2020-05-28 06:08:07 +02:00

Removed subscriber: @antoniov

Removed subscriber: @antoniov

Removed subscriber: @Thane5

Removed subscriber: @Thane5

This issue was referenced by 301fac5ded

This issue was referenced by 301fac5ded7de3ec8e43fa789a526c4d324f2e23
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Aaron Carlisle self-assigned this 2022-03-13 22:39:27 +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
10 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#61558
No description provided.