UI: Custom Tooltips with Optional Images #105905
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105905
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Harley/blender:CustomTooltips"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This adds an optional uiBut callback that allows creating a tooltip
line-by-line with specified style and color in any order. It also
allows adding images as well to create very informative tooltips.
The format and content of tooltips are currently just automatically created based on the data type. We have the quick ability to supply a single simple string to replace the content, but otherwise we have no custom control over the data, styles, formatting, etc.
This PR adds the ability to create the tooltip contents line-by-line, with each one having custom style, color, etc. This also adds the ability to add images to it.
As an example of usage, we can create a custom tooltip in file_draw.cc. Instead of creating a dynamic tooltip like this:
...we set up a custom tooltip like this:
That custom tooltip callback gets passed a
uiTooltipData
that can then be added to withUI_tooltip_text_field
andUI_tooltip_image_field
like this:So when you hover over the small icon in the list view of File Manager you would get the following. Obviously with the "Blender" logo standing in for any ImBuf we might want to show. And the file details are just placeholders to show the differences in color, spacing, etc that is possible.
Although this PR seems to have a lot of changes, it is actually quite simple. Instead of uiTooltipData, styles, and colors being private to
interface_region_tooltip.cc
they are made public. Creating a custom tooltip is just setting a callback that passes an empty uiTooltipData to you. Then you can add any fields you want in any order by callingUI_tooltip_text_field_add
orUI_tooltip_image_field_add
.This makes a little bit of mess inside
interface_region_tooltip.cc
. Currently there is a pattern where we create a new field and then add text to it. This PR makes that one step (so there is no need to be aware of uiTooltipField), creating the field and adding strings to it. Most of the changes here is just this.Harley Todo: This post includes information from Julian about how asset tooltips might look: #104693
2dfe4381df
to27d3098c7c
WIP: Demonstration of Custom Tooltipsto WIP: Custom Tooltips with Optional ImagesOverall this approach makes sense to me.
It may be best to make a copy of the
ImBuf
(assuming it's always small), since there is some risk that it gets freed before the tooltip.e10764d619
to6b92a102f4
WIP: Custom Tooltips with Optional Imagesto UI: Custom Tooltips with Optional ImagesCampbell has said similar when we talked about it, although he did not look at the code.
Good point. It now does so.
Is this closer to what you are wanting?
Although without the path. Just the full file name makes sense in this context.
Yes, this without the path looks good to me.
This looks good to me (knowing that the changes in
file_draw_tooltip_func
are for demonstration purposes and would be left out).Yes, for sure.
Will merge this quite soon, so can update ##104547.
@blender-bot build
Is there an example of doing this with an addon?
Do you have an example of where you would want this for an addon?
a good example of an addon using GIFs for tooltips is maya's animbot addon. everything you see here (https://animbot.ca/tooltips/en/) is a tooltip in the addon itself
it is a bit busy but it also eliminates the need for separate documentation imo