Avoid clipping data-block name in data-block menu because of library name #84188

Open
opened 2020-12-27 23:09:47 +01:00 by Julian Eisel · 21 comments
Member

The grayed out, right aligned library .blend name in the menu can cause space problems when the data-block name and/or the library name are long. E.g. from #77929: bug.jpg

A few things we could do:

    • Increase the menu width.
    • Hide the .blend suffix.
    • Hide the square brackets.
    • Show the full data-block and library name in the tooltip.
    • Clip the middle of the data-block name, not the end.
    • Clip the library path name.
    • (Dynamically enlarge the menu width based on the item name widths.)
The grayed out, right aligned library .blend name in the menu can cause space problems when the data-block name and/or the library name are long. E.g. from #77929: ![bug.jpg](https://archive.blender.org/developer/F8626313/bug.jpg) A few things we could do: * - [ ] Increase the menu width. * - [ ] Hide the `.blend` suffix. * - [ ] Hide the square brackets. * - [x] Show the full data-block and library name in the tooltip. * - [x] Clip the middle of the data-block name, not the end. * - [x] Clip the library path name. * - [ ] (Dynamically enlarge the menu width based on the item name widths.)
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel

#84795 was marked as duplicate of this issue

#84795 was marked as duplicate of this issue
Author
Member

This is both a design and a To-Do task. Would be good to address this before the release, since it's a recently introduced issue.

This is both a design and a To-Do task. Would be good to address this before the release, since it's a recently introduced issue.
Author
Member

Also note the multiple reports about this in #78012.

Also note the multiple reports about this in #78012.
Author
Member

Added subscribers: @VanessaE, @lichtwerk

Added subscribers: @VanessaE, @lichtwerk
Author
Member

Changed how the clipping is done to fix the regression for the release, 77f73a9284.

Changed how the clipping is done to fix the regression for the release, 77f73a9284.
Contributor

Added subscriber: @Rawalanche

Added subscriber: @Rawalanche
Contributor

This comment was removed by @Rawalanche

*This comment was removed by @Rawalanche*
Contributor

Making the width datablock search popover UI element dynamic or at least much wider is the way to go. The days when the fixed width value was decided were most likely the days when 640x480 was dominant screen resolution.

Right now, the horizontal space is on modern resolutions is ridiculously underutilized (vertical too):
image.png

The current screenshot of 2.83 is still shows really poor result. I am really confused why multiple changes to the clipping and formatting of the text were done prior to increasing the width, which is the actual, proper way to address it.

It really confuses me why in the list of "A few things we could do", are the things done in the order from those which have the least useful impact to solving the problem to the ones that impact the solution the most? Once the popover has proper width, all the other, already done changes will most likely be wasted work.

Making the width datablock search popover UI element dynamic or at least much wider is the way to go. The days when the fixed width value was decided were most likely the days when 640x480 was dominant screen resolution. Right now, the horizontal space is on modern resolutions is ridiculously underutilized (vertical too): ![image.png](https://archive.blender.org/developer/F9600292/image.png) The current screenshot of 2.83 is still shows really poor result. I am really confused why multiple changes to the clipping and formatting of the text were done **prior** to increasing the width, which is the actual, proper way to address it. It really confuses me why in the list of "A few things we could do", are the things done in the order from those which have the least useful impact to solving the problem to the ones that impact the solution the most? Once the popover has proper width, all the other, already done changes will most likely be wasted work.

While I agree that increasing the popover's size is the proper first-step to a solution, I note the width of your image suggest (vaguely) that you're using a widescreen monitor. I'd like to remind folks that some of us old pharts ;-) still use 4:3 screens, so please don't go overboard.

While I agree that increasing the popover's size is the proper first-step to a solution, I note the width of your image suggest (vaguely) that you're using a widescreen monitor. I'd like to remind folks that some of us old pharts ;-) still use 4:3 screens, so please don't go overboard.
Contributor

In #84188#1101742, @VanessaE wrote:
While I agree that increasing the popover's size is the proper first-step to a solution, I note the width of your image suggest (vaguely) that you're using a widescreen monitor. I'd like to remind folks that some of us old pharts ;-) still use 4:3 screens, so please don't go overboard.

Well, obviously the width would be defined as a fraction of the horizontal screen resolution, rather than fixed size (which is where the current implementation fails). So I'd expect it to have for example about 960 pixels max width on 1280 pixels wide screen, and so on. On the other hand, you are sort of right. This is Blender, so I expect it to first be implemented wrong (bigger but fixed width) and then stay there the wrong way for 2-3 years before someone fed up decides to fix it again.

> In #84188#1101742, @VanessaE wrote: > While I agree that increasing the popover's size is the proper first-step to a solution, I note the width of your image suggest (vaguely) that you're using a widescreen monitor. I'd like to remind folks that some of us old pharts ;-) still use 4:3 screens, so please don't go overboard. Well, obviously the width would be defined as a fraction of the horizontal screen resolution, rather than fixed size (which is where the current implementation fails). So I'd expect it to have for example about 960 pixels max width on 1280 pixels wide screen, and so on. On the other hand, you are sort of right. This is Blender, so I expect it to first be implemented wrong (bigger but fixed width) and then stay there the wrong way for 2-3 years before someone fed up decides to fix it again.
Author
Member

In #84188#1101681, @Rawalanche wrote:
Making the width datablock search popover UI element dynamic or at least much wider is the way to go.

A few things to be said here:

  • Dynamically deciding the width to fit all items would require possibly hundreds of string width calculations, which aren't entirely cheap. This may be unreasonably performance intensive.
  • We could make an educated guess based on the number of characters. But even there, clipping might be likely. It would also have to consider multi-byte characters, not sure if this can be done well & cheap.
  • We could use the size of the biggest visible item (10 max currently). But jumps in menus size are odd, jumps in the position of names are even worse.
  • What about the menus showing previews in a grid? The text width will likely still be limited to roughly the preview size and require clipping, no matter the solution for other cases.
  • Simply increasing the menu size results in situations like this: Screenshot 2021-01-27 at 17.01.03.png Smaller increases also look odd and also only slightly improve things. Maybe positioning the menu differently can help. But even when increasing the size, sooner or later there will be cases where names are too long to fit.
    Point is, it's not as simple as changing the width. It's not something I could do easily.

The changes I've done don't need much design discussion and will likely be needed anyway. The tooltip is a reliable way to display all un-clipped text in all cases (even with previews), plus the full library path. Also, the clipping changes can easily be considered a regression fix and be committed to the 2.92 beta.

> In #84188#1101681, @Rawalanche wrote: > Making the width datablock search popover UI element dynamic or at least much wider is the way to go. A few things to be said here: * Dynamically deciding the width to fit all items would require possibly hundreds of string width calculations, which aren't entirely cheap. This may be unreasonably performance intensive. * We could make an educated guess based on the number of characters. But even there, clipping might be likely. It would also have to consider multi-byte characters, not sure if this can be done well & cheap. * We could use the size of the biggest visible item (10 max currently). But jumps in menus size are odd, jumps in the position of names are even worse. * What about the menus showing previews in a grid? The text width will likely still be limited to roughly the preview size and require clipping, no matter the solution for other cases. * Simply increasing the menu size results in situations like this: ![Screenshot 2021-01-27 at 17.01.03.png](https://archive.blender.org/developer/F9600856/Screenshot_2021-01-27_at_17.01.03.png) Smaller increases also look odd and also only slightly improve things. Maybe positioning the menu differently can help. But even when increasing the size, sooner or later there will be cases where names are too long to fit. Point is, it's not as simple as changing the width. It's not something I could do easily. The changes I've done don't need much design discussion and will likely be needed anyway. The tooltip is a reliable way to display all un-clipped text in all cases (even with previews), plus the full library path. Also, the clipping changes can easily be considered a regression fix and be committed to the 2.92 beta.

Maybe add a toggle somewhere to completely hide the linked filename?

Maybe add a toggle somewhere to completely hide the linked filename?
Contributor

In #84188#1101989, @JulianEisel wrote:

In #84188#1101681, @Rawalanche wrote:
Making the width datablock search popover UI element dynamic or at least much wider is the way to go.

A few things to be said here:

  • Dynamically deciding the width to fit all items would require possibly hundreds of string width calculations, which aren't entirely cheap. This may be unreasonably performance intensive.
  • We could make an educated guess based on the number of characters. But even there, clipping might be likely. It would also have to consider multi-byte characters, not sure if this can be done well & cheap.
  • We could use the size of the biggest visible item (10 max currently). But jumps in menus size are odd, jumps in the position of names are even worse.
  • What about the menus showing previews in a grid? The text width will likely still be limited to roughly the preview size and require clipping, no matter the solution for other cases.
  • Simply increasing the menu size results in situations like this: Screenshot 2021-01-27 at 17.01.03.png Smaller increases also look odd and also only slightly improve things. Maybe positioning the menu differently can help. But even when increasing the size, sooner or later there will be cases where names are too long to fit.
    Point is, it's not as simple as changing the width. It's not something I could do easily.

The changes I've done don't need much design discussion and will likely be needed anyway. The tooltip is a reliable way to display all un-clipped text in all cases (even with previews), plus the full library path. Also, the clipping changes can easily be considered a regression fix and be committed to the 2.92 beta.

The thing is, in the current state, there's already string clipping calculation going on. Those strings clipped by ... at the end or in the middle of the name. At this point, you are already processing all the strings if their rendered text exceeds some dimension. So all you really need to know is what is the horizontal dimension of the longest string in the popover list, and expand the popover up to x% of the current Blender window width. If the horizontal dimension of the rendered text of the longest string would exceed the specified x percent of the Blender window width, then it'd make sense to clip those strings, only those strings which exceed it. So in the end there should not be much performance hit, since some performance should be saved by not having to process and clip so many strings.

Given the wonky Blender architecture at some places, it's pretty much safe to assume that by the time user had so many materials in one .blend file that just processing their strings in the datablock popover list would have any noticeable impact on performance, the user would have way, way worse performance issues due to other factors related to material data management.

> In #84188#1101989, @JulianEisel wrote: >> In #84188#1101681, @Rawalanche wrote: >> Making the width datablock search popover UI element dynamic or at least much wider is the way to go. > A few things to be said here: > * Dynamically deciding the width to fit all items would require possibly hundreds of string width calculations, which aren't entirely cheap. This may be unreasonably performance intensive. > * We could make an educated guess based on the number of characters. But even there, clipping might be likely. It would also have to consider multi-byte characters, not sure if this can be done well & cheap. > * We could use the size of the biggest visible item (10 max currently). But jumps in menus size are odd, jumps in the position of names are even worse. > * What about the menus showing previews in a grid? The text width will likely still be limited to roughly the preview size and require clipping, no matter the solution for other cases. > * Simply increasing the menu size results in situations like this: ![Screenshot 2021-01-27 at 17.01.03.png](https://archive.blender.org/developer/F9600856/Screenshot_2021-01-27_at_17.01.03.png) Smaller increases also look odd and also only slightly improve things. Maybe positioning the menu differently can help. But even when increasing the size, sooner or later there will be cases where names are too long to fit. > Point is, it's not as simple as changing the width. It's not something I could do easily. > > The changes I've done don't need much design discussion and will likely be needed anyway. The tooltip is a reliable way to display all un-clipped text in all cases (even with previews), plus the full library path. Also, the clipping changes can easily be considered a regression fix and be committed to the 2.92 beta. The thing is, in the current state, there's already string clipping calculation going on. Those strings clipped by ... at the end or in the middle of the name. At this point, you are already processing all the strings if their rendered text exceeds some dimension. So all you really need to know is what is the horizontal dimension of the longest string in the popover list, and expand the popover up to x% of the current Blender window width. If the horizontal dimension of the rendered text of the longest string would exceed the specified x percent of the Blender window width, then it'd make sense to clip those strings, only those strings which exceed it. So in the end there should not be much performance hit, since some performance should be saved by not having to process and clip so many strings. Given the wonky Blender architecture at some places, it's pretty much safe to assume that by the time user had so many materials in one .blend file that just processing their strings in the datablock popover list would have any noticeable impact on performance, the user would have way, way worse performance issues due to other factors related to material data management.
Author
Member

In #84188#1101993, @VanessaE wrote:
Maybe add a toggle somewhere to completely hide the linked filename?

If such a toggle is needed it would just be a workaround for lazy design work. Plus, it's not just about the library name, the data-block name itself can be wider than the available width.

In #84188#1102211, @Rawalanche wrote:
The thing is, in the current state, there's already string clipping calculation going on. Those strings clipped by ... at the end or in the middle of the name. At this point, you are already processing all the strings if their rendered text exceeds some dimension.

Only the strings visible on screen get clipped. So we only process 10 strings (or 20 with the library name) per redraw currently.

So all you really need to know is what is the horizontal dimension of the longest string in the popover list, and expand the popover up to x% of the current Blender window width.

That is what I explained in the 3rd bullet point. But as I said there such a solution would lead to sudden jumps while scrolling. Not too good of a solution IMO.

> In #84188#1101993, @VanessaE wrote: > Maybe add a toggle somewhere to completely hide the linked filename? If such a toggle is needed it would just be a workaround for lazy design work. Plus, it's not just about the library name, the data-block name itself can be wider than the available width. > In #84188#1102211, @Rawalanche wrote: > The thing is, in the current state, there's already string clipping calculation going on. Those strings clipped by ... at the end or in the middle of the name. At this point, you are already processing all the strings if their rendered text exceeds some dimension. Only the strings visible on screen get clipped. So we only process 10 strings (or 20 with the library name) per redraw currently. > So all you really need to know is what is the horizontal dimension of the longest string in the popover list, and expand the popover up to x% of the current Blender window width. That is what I explained in the 3rd bullet point. But as I said there such a solution would lead to sudden jumps while scrolling. Not too good of a solution IMO.
Contributor

In #84188#1102263, @JulianEisel wrote:

In #84188#1101993, @VanessaE wrote:
Maybe add a toggle somewhere to completely hide the linked filename?

If such a toggle is needed it would just be a workaround for lazy design work. Plus, it's not just about the library name, the data-block name itself can be wider than the available width.

In #84188#1102211, @Rawalanche wrote:
The thing is, in the current state, there's already string clipping calculation going on. Those strings clipped by ... at the end or in the middle of the name. At this point, you are already processing all the strings if their rendered text exceeds some dimension.

Only the strings visible on screen get clipped. So we only process 10 strings (or 20 with the library name) per redraw currently.

So all you really need to know is what is the horizontal dimension of the longest string in the popover list, and expand the popover up to x% of the current Blender window width.

That is what I explained in the 3rd bullet point. But as I said there such a solution would lead to sudden jumps while scrolling. Not too good of a solution IMO.

I meant iterating over strings of all the materials, not just the visible ones. As I said, by the time user has so many materials in their .blend file that iterating over their names would have any noticeable impact on performance, there would be much, much bigger performance issues somewhere else, most likely depsgraph related.

Also, there are so many ways to tackle it. For example storing integer of name length with each material, which is only updated during material creation and upon material name change. Then it'd become a matter of just iterating one array of integers, finding the highest one and setting the width according to that.

But I don't see inside that mess, so of course it doesn't make much sense debating implementation details. My overall point is that this is a trivial problem to solve, so there's no need to pretend like it's a difficult one.

> In #84188#1102263, @JulianEisel wrote: >> In #84188#1101993, @VanessaE wrote: >> Maybe add a toggle somewhere to completely hide the linked filename? > If such a toggle is needed it would just be a workaround for lazy design work. Plus, it's not just about the library name, the data-block name itself can be wider than the available width. > >> In #84188#1102211, @Rawalanche wrote: >> The thing is, in the current state, there's already string clipping calculation going on. Those strings clipped by ... at the end or in the middle of the name. At this point, you are already processing all the strings if their rendered text exceeds some dimension. > Only the strings visible on screen get clipped. So we only process 10 strings (or 20 with the library name) per redraw currently. >> So all you really need to know is what is the horizontal dimension of the longest string in the popover list, and expand the popover up to x% of the current Blender window width. > That is what I explained in the 3rd bullet point. But as I said there such a solution would lead to sudden jumps while scrolling. Not too good of a solution IMO. I meant iterating over strings of all the materials, not just the visible ones. As I said, by the time user has so many materials in their .blend file that iterating over their names would have any noticeable impact on performance, there would be much, much bigger performance issues somewhere else, most likely depsgraph related. Also, there are so many ways to tackle it. For example storing integer of name length with each material, which is only updated during material creation and upon material name change. Then it'd become a matter of just iterating one array of integers, finding the highest one and setting the width according to that. But I don't see inside that mess, so of course it doesn't make much sense debating implementation details. My overall point is that this is a trivial problem to solve, so there's no need to pretend like it's a difficult one.

Added subscriber: @APEC

Added subscriber: @APEC

In #84188#1101681, @Rawalanche wrote:
Making the width datablock search popover UI element dynamic

Yes, finally some one say it.
It's a very nice solution match width to the longest name in the list.
I'm very suffering with this clipping names.
clipping name.png
Popover is dynamic so why 'datablock' can't be?
And I found that material name have characters limit...so it can be limits for dynamic width.

> In #84188#1101681, @Rawalanche wrote: > Making the width datablock search popover UI element dynamic Yes, finally some one say it. It's a very nice solution match width to the longest name in the list. I'm very suffering with this clipping names. ![clipping name.png](https://archive.blender.org/developer/F9624846/clipping_name.png) Popover is dynamic so why 'datablock' can't be? And I found that material name have characters limit...so it can be limits for dynamic width.

Added subscriber: @FDesimpel

Added subscriber: @FDesimpel

In #84188#1101989, @JulianEisel wrote:
Dynamically deciding the width to fit all items would require possibly hundreds of string width calculations, which aren't entirely cheap

You would only need to recalculate this when a name string is added / the longest one shortened/lengthened ? just keeping one variable like longest_name_char_count or something ( per type of name ) . If mono-spaced, recalculating is then just comparing with char_count of currently edited name / lib name and adjust accordingly. Also beneficial for non-monospaced fonts, only calculate the longest effective string length upfront when the names change. You could even use some heuristics on what characters used trigger a recalc.

Maybe even calculate the effective longest string length per char key hit / backspace / copy-paste / select and delete, etc... ( with current widths per char given text size/font/etc, those would trigger a full recalc) dunno the variable names but say longest_name_str_width...

It seems to me choosing from a drop down is done more often then (re)naming or changing text size / font.

This not only happens with names with library references by the way. If a strategy to fix this is found to work well, it could be applied to all the name drop downs.

> In #84188#1101989, @JulianEisel wrote: > Dynamically deciding the width to fit all items would require possibly hundreds of string width calculations, which aren't entirely cheap You would only need to recalculate this when a name string is added / the longest one shortened/lengthened ? just keeping one variable like *longest_name_char_count* or something ( per type of name ) . If mono-spaced, recalculating is then just comparing with char_count of currently edited name / lib name and adjust accordingly. Also beneficial for non-monospaced fonts, only calculate the longest effective string length upfront when the names change. You could even use some heuristics on what characters used trigger a recalc. Maybe even calculate the effective longest string length per char key hit / backspace / copy-paste / select and delete, etc... ( with current widths per char given text size/font/etc, those would trigger a full recalc) dunno the variable names but say longest_name_str_width... It seems to me choosing from a drop down is done more often then (re)naming or changing text size / font. This not only happens with names with library references by the way. If a strategy to fix this is found to work well, it could be applied to all the name drop downs.
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:23:48 +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
6 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#84188
No description provided.