UI: Show folders when selecting font #117389

Merged
Richard Antalik merged 1 commits from iss/blender:font-ui-folder into main 2024-01-31 18:56:34 +01:00

On some systems, fonts may be categorized in folders, in which case user
sees nothing by default.

For example on my system:
Screenshot_2024-01-21_21-05-11.png

On some systems, fonts may be categorized in folders, in which case user sees nothing by default. For example on my system: ![Screenshot_2024-01-21_21-05-11.png](/attachments/3151fbfc-b6c6-4e51-96d9-f4283d477bde)
Richard Antalik added 1 commit 2024-01-21 21:05:58 +01:00
aaa4677356 UI: Show folders when selecting font
On some systems, fonts may be categorized in folders, in which case user
sees nothing by default.
Richard Antalik requested review from Harley Acheson 2024-01-21 21:07:57 +01:00
First-time contributor

Yo, error "Image not found"...

Yo, error "Image not found"...
Member

Oh I'm guessing this is Linux?

In this situation where there are subfolders of fonts, how does it look to also show recursive so see them all in the same list?

diff --git a/source/blender/editors/space_buttons/buttons_ops.cc b/source/blender/editors/space_buttons/buttons_ops.cc
index ea711d27fba..8738942e848 100644
--- a/source/blender/editors/space_buttons/buttons_ops.cc
+++ b/source/blender/editors/space_buttons/buttons_ops.cc
@@ -351,6 +351,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
       }
       RNA_boolean_set(op->ptr, "filter_font", true);
       RNA_enum_set(op->ptr, "display_type", FILE_IMGDISPLAY);
+      RNA_boolean_set(op->ptr, "filter_folder", true);
+      RNA_int_set(op->ptr, "recursion_level", 2);
       RNA_enum_set(op->ptr, "sort_method", FILE_SORT_ALPHA);
     }
     else {

Oh I'm guessing this is Linux? In this situation where there are subfolders of fonts, how does it look to also show recursive so see them all in the same list? ``` diff --git a/source/blender/editors/space_buttons/buttons_ops.cc b/source/blender/editors/space_buttons/buttons_ops.cc index ea711d27fba..8738942e848 100644 --- a/source/blender/editors/space_buttons/buttons_ops.cc +++ b/source/blender/editors/space_buttons/buttons_ops.cc @@ -351,6 +351,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event) } RNA_boolean_set(op->ptr, "filter_font", true); RNA_enum_set(op->ptr, "display_type", FILE_IMGDISPLAY); + RNA_boolean_set(op->ptr, "filter_folder", true); + RNA_int_set(op->ptr, "recursion_level", 2); RNA_enum_set(op->ptr, "sort_method", FILE_SORT_ALPHA); } else { ```
Author
Member

Yo, error "Image not found"...

Interesting... Will try to fix, but not sure what to believe.
Screenshot_2024-01-21_21-46-16.png

Oh I'm guessing this is Linux?

In this situation where there are subfolders of fonts, how does it look to also show recursive so see them all in the same list?

Three recursions is not quite enough, but that would be better solution probably...
Screenshot_2024-01-21_21-51-13.png

Perhaps recursion + folders would (+ optionally sorting fonts first) would provide better UX?

> Yo, error "Image not found"... Interesting... Will try to fix, but not sure what to believe. ![Screenshot_2024-01-21_21-46-16.png](/attachments/d746238e-6600-4a3d-b48f-1ee5ac7f050e) > Oh I'm guessing this is Linux? > > In this situation where there are subfolders of fonts, how does it look to also show recursive so see them all in the same list? Three recursions is not quite enough, but that would be better solution probably... ![Screenshot_2024-01-21_21-51-13.png](/attachments/4e8e2ad3-f2cd-42df-ad8c-1df1dd4bd0c1) Perhaps recursion + folders would (+ optionally sorting fonts first) would provide better UX?
Member

Sorry, I only use Windows. But those captures makes me think that what you want is recursions on but folders off. That way you'd see all the fonts together but without the redundant folders.

Sorry, I only use Windows. But those captures makes me think that what you want is recursions on but folders off. That way you'd see all the fonts together but without the redundant folders.
First-time contributor

Interesting... Will try to fix, but not sure what to believe.

It's fixed now...
Gitea has a bug... you probably copied and pasted the image from clipboard directly in the text field, right?
When you do that, the image only show up for you... on everyone else it says "not found"...

> Interesting... Will try to fix, but not sure what to believe. It's fixed now... Gitea has a bug... you probably copied and pasted the image from clipboard directly in the text field, right? When you do that, the image only show up for you... on everyone else it says "not found"...
Member

@iss

My gut feeling is that you'd want either filter_folder or recursion_level, but not both. But I am happy with whatever you prefer. Just nice to have someone with Linux looking at this.

@iss My gut feeling is that you'd want either `filter_folder` or `recursion_level`, but not both. But I am happy with whatever you prefer. Just nice to have someone with Linux looking at this.
Author
Member

Sorry, I only use Windows. But those captures makes me think that what you want is recursions on but folders off. That way you'd see all the fonts together but without the redundant folders.

It's not linux only issue technically. Even though on windows, you would probably want to have your fonts installed for whole system. But if you for whatever reason don't do that, you need to navigate to your fonts, so you want to see the folders. That is my reasoning at least.

@JulianEisel , @lichtwerk Can you share your opinion?

> Sorry, I only use Windows. But those captures makes me think that what you want is recursions on but folders off. That way you'd see all the fonts together but without the redundant folders. It's not linux only issue technically. Even though on windows, you would probably want to have your fonts installed for whole system. But if you for whatever reason don't do that, you need to navigate to your fonts, so you want to see the folders. That is my reasoning at least. @JulianEisel , @lichtwerk Can you share your opinion?
Member

No strong opinion here, first I thought to be careful with recursion level (who knows if someone browses the root folder), but I think we are doing it elsewhere as well.

Since this can be arbitrary though (unless you set it extremely high as FILE_SELECT_MAX_RECURSIONS), this could still fail, so I would definitely include folders (probably without recursion).

Everything is better than the current default :)

No strong opinion here, first I thought to be careful with recursion level (who knows if someone browses the root folder), but I think we are doing it elsewhere as well. Since this can be arbitrary though (unless you set it extremely high as `FILE_SELECT_MAX_RECURSIONS`), this _could_ still fail, so I would definitely include folders (probably without recursion). Everything is better than the current default :)
Member

With filter_folder and without recursions is probably the simplest and safest route.

With filter_folder and without recursions is probably the simplest and safest route.
Harley Acheson approved these changes 2024-01-29 00:16:30 +01:00
Richard Antalik merged commit 048cece74d into main 2024-01-31 18:56:34 +01:00
Richard Antalik deleted branch font-ui-folder 2024-01-31 18:56:36 +01:00
Harley Acheson added this to the User Interface project 2024-01-31 22:07:02 +01:00
Sign in to join this conversation.
No reviewers
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#117389
No description provided.