UI: Refactor quick label tooltip implementation for buttons #110200

Merged
Julian Eisel merged 6 commits from JulianEisel/blender:temp-but-quick-label-refactor into main 2023-07-25 16:22:38 +02:00
Member

No user visible changes expected. Used in the asset shelf branch,
see #104831:

These tooltips only show a label string and appear after a shorter timeout
than the regular tooltips. After the regular tooltip timeout they expand to
the full tooltip. The toolbar and properties editor navigation tabs make use
of this already.

The changes here enable more control over quick label tooltips, making them
usable in more cases, and less ad-hoc. Main changes:

  • Refactors internal logic so a single UI_BUT_HAS_TOOLTIP_LABEL button flag
    can be used to enable quick label tooltips. This decentralizes logic in a
    way that's more consistent and extensible.
  • Custom callback to return a quick label. This is useful when a label tooltip
    should be displayed even when there is no button string set. E.g. in the
    asset shelf with "Show Names" disabled.

Note: I'd like to split tooltip related flags into an own button bitfield.
Would do that separately though.

No user visible changes expected. Used in the asset shelf branch, see #104831: <image src="https://projects.blender.org/attachments/b2db2988-2f51-4296-97d5-6b824392a6be" width="250px"/> These tooltips only show a label string and appear after a shorter timeout than the regular tooltips. After the regular tooltip timeout they expand to the full tooltip. The toolbar and properties editor navigation tabs make use of this already. The changes here enable more control over quick label tooltips, making them usable in more cases, and less ad-hoc. Main changes: - Refactors internal logic so a single `UI_BUT_HAS_TOOLTIP_LABEL` button flag can be used to enable quick label tooltips. This decentralizes logic in a way that's more consistent and extensible. - Custom callback to return a quick label. This is useful when a label tooltip should be displayed even when there is no button string set. E.g. in the asset shelf with "Show Names" disabled. Note: I'd like to split tooltip related flags into an own button bitfield. Would do that separately though.
Julian Eisel added 1 commit 2023-07-17 13:02:40 +02:00
357d65d436 UI: Customizable quick label tooltip for buttons
Variation of #110016, but refactors tooltip label logic so a new
`UI_BUT_HAS_TOOLTIP_LABEL` flag is used instead of ad-hoc logic in
`UI_but_has_tooltip_label()`. This decentralizes logic in a way that's
more consistent and extensible.
Julian Eisel requested review from Campbell Barton 2023-07-17 18:11:21 +02:00
Julian Eisel requested review from Hans Goudey 2023-07-17 18:11:28 +02:00
Julian Eisel added 3 commits 2023-07-24 16:55:19 +02:00
Julian Eisel reviewed 2023-07-24 16:57:22 +02:00
@ -803,0 +801,4 @@
if (but_tip_label.strinfo &&
/* Buttons with dynamic tool-tips also don't get their default label here since they
* can already provide more accurate and specific tool-tip content. */
!but->tip_func)
Author
Member

I'd actually like to remove this tip_func check, I don't think it's necessary, and doesn't make sense to me. It should be possible for a button to have the quick label tooltip, and still expand that using the custom tooltip callback. Separate change though.

I'd actually like to remove this `tip_func` check, I don't think it's necessary, and doesn't make sense to me. It should be possible for a button to have the quick label tooltip, and still expand that using the custom tooltip callback. Separate change though.
Brecht Van Lommel approved these changes 2023-07-24 17:54:28 +02:00
Hans Goudey approved these changes 2023-07-24 20:38:07 +02:00
@ -6078,1 +6085,4 @@
void UI_but_func_tooltip_label_set(uiBut *but, std::function<std::string(const uiBut *but)> func)
{
but->tip_label_func = func;
Member

std::move(func)

`std::move(func)`
JulianEisel marked this conversation as resolved
Julian Eisel added 1 commit 2023-07-25 12:13:48 +02:00
Julian Eisel added 1 commit 2023-07-25 12:14:33 +02:00
Campbell Barton approved these changes 2023-07-25 15:08:58 +02:00
Julian Eisel merged commit 9d0907560a into main 2023-07-25 16:22:38 +02:00
Julian Eisel deleted branch temp-but-quick-label-refactor 2023-07-25 16:22:39 +02:00
Julian Eisel changed title from UI: Customizable quick label tooltip for buttons to UI: Refactor quick label tooltip implementation for buttons 2023-07-25 16:42:58 +02: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
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#110200
No description provided.