UI: Customizable quick label tooltip for buttons #110016

Closed
Julian Eisel wants to merge 1 commits from JulianEisel/blender:temp-but-quick-label into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

No user visible changes expected.

Used in the asset shelf branch, see #104831:

Essentially this enables more control over quick label tooltips, which were
quite specialized before, but are useful in more instances. Namely this adds:

  • 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.
  • A flag to force enable quick label tooltips, since the internal checks
    are rather ad-hoc and it's useful to be able to just override them.
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"/> Essentially this enables more control over quick label tooltips, which were quite specialized before, but are useful in more instances. Namely this adds: - 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. - A flag to force enable quick label tooltips, since the internal checks are rather ad-hoc and it's useful to be able to just override them.
Julian Eisel added 1 commit 2023-07-12 17:32:45 +02:00
7b1294255e UI: Allow buttons to set a quick label tooltip
No user visible changes expected.

Used in the asset shelf branch, see #104831.

Adds:
- 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.
- A flag to force enable quick label tooltips, since the internal checks
  are rather ad-hoc and it's useful to be able to just override them.
Julian Eisel changed title from UI: Allow buttons to set a quick label tooltip to UI: Customizable quick label tooltip for buttons 2023-07-12 17:33:17 +02:00
Julian Eisel added the
Module
User Interface
Interest
Asset Browser
labels 2023-07-12 17:37:28 +02:00
Julian Eisel requested review from Campbell Barton 2023-07-12 17:37:35 +02:00
Julian Eisel added this to the Brush Assets & Asset Shelf project 2023-07-12 17:37:42 +02:00
Hans Goudey reviewed 2023-07-12 17:43:23 +02:00
@ -144,11 +144,19 @@ bool UI_but_is_tool(const uiBut *but)
bool UI_but_has_tooltip_label(const uiBut *but)
{
if (but->drawflag & UI_BUT_FORCE_TOOLTIP_LABEL) {
Member

It may be better to use the new method completely, so that UI_BUT_FORCE_TOOLTIP_LABEL becomes UI_BUT_HAS_TOOLTIP_LABEL. That decentralizes the logic in a way that's more consistent and more extensible.

It also avoids adding complexity as this PR currently does by adding a new way to do the same thing.

It may be better to use the new method completely, so that `UI_BUT_FORCE_TOOLTIP_LABEL` becomes `UI_BUT_HAS_TOOLTIP_LABEL`. That decentralizes the logic in a way that's more consistent and more extensible. It also avoids adding complexity as this PR currently does by adding a new way to do the same thing.
Author
Member

Submitted a separate PR for this: #110200. Both solutions are fine with me, but the new one is a bit more risky since it changes existing code.

Submitted a separate PR for this: #110200. Both solutions are fine with me, but the new one is a bit more risky since it changes existing code.

The other PR still includes UI_BUT_FORCE_TOOLTIP_LABEL,. Wasn't it supposed to be completely replaced by UI_BUT_HAS_TOOLTIP_LABEL?

The other PR still includes `UI_BUT_FORCE_TOOLTIP_LABEL`,. Wasn't it supposed to be completely replaced by `UI_BUT_HAS_TOOLTIP_LABEL`?
Author
Member

That was to skip the !STRPREFIX(but->drawstr, but_tip_label.strinfo) condition in the tooltip code, but I think we can remove this entirely. It was a weak check and didn't account for label clipping.

That was to skip the `!STRPREFIX(but->drawstr, but_tip_label.strinfo)` condition in the tooltip code, but I think we can remove this entirely. It was a weak check and didn't account for label clipping.
Author
Member

#110200 is merged now, so this can be closed.

#110200 is merged now, so this can be closed.
Julian Eisel closed this pull request 2023-07-25 16:41:49 +02:00

Pull request closed

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 Assignees
3 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#110016
No description provided.