Commit Graph

156 Commits

Author SHA1 Message Date
Campbell Barton
b3dfde88f3 Cleanup: spelling in comments (check_spelling_* target)
Also uppercase acronyms: API, UTF & ASCII.
2025-05-17 10:17:37 +10:00
Sebastian Parborg
e4aa758d70 Fix #137346: IME input getting lost when using Wayland
Our IME input system relied on passing around pointers to global variables.
However this will not work as the Wayland input handling is multithreaded so the content of the global variable would change while the event loop were reading the data.

Pull Request: https://projects.blender.org/blender/blender/pulls/138871
2025-05-16 14:21:06 +02:00
Hans Goudey
153abc372e GPU: Replace U32/I32 combination with GPU_FETCH_INT_TO_FLOAT in UI code
The conversion from int to float is not supported natively
so it ends up happening beforehand on the CPU or as a
step before the vertex buffer can be used. It's better to just
upload floats in the first place.

Related to:
- 1e1ac2bb9b
- 617858e453

Pull Request: https://projects.blender.org/blender/blender/pulls/138855
2025-05-14 15:15:21 +02:00
Leon Schittek
d66b171996 Fix #112402: Improve search menu layout
Several small improvements to the layout of the search menu:
* Avoid the separator arrow on highlighted items being cutoff
* Properly center and prevent overlap of the scroll indicator
  arrows at the top and bottom
* Improve robustness with different zoom levels
* Overall more unified spacing and margins
This patch was originally authored by Yevgeny Makarov (@jenkm).

Pull Request: https://projects.blender.org/blender/blender/pulls/112422
2025-05-07 02:32:13 +02:00
Julian Eisel
a8b031dcc6 UI: Use two lines for Asset/File Browser file names under previews
Part of #134755 / #134766

Makes asset and file browser use up to two lines to display the name of the asset or file under
preview images. Lines are wrapped using our existing wrapping algorithm at characters like spaces,
hyphens, under-scores, etc.

This leads to much less information loss because of clipped labels in common cases. When displaying
assets or files as previews the labels would become rather useless in many cases. Especially with
smaller preview sizes.

When there's still not enough space to display the full asset or file name, the second line is
truncated in the middle, leaving the beginning, and some of the end of the label visible. This
produced best results in testing.

Pull Request: https://projects.blender.org/blender/blender/pulls/136907
2025-04-24 18:03:26 +02:00
Harley Acheson
101d8782f7 UI: Increase Contrast of Scroll Bar Thumb for Light Themes
Since 115d809358 the scroll bars are darker on light theme. But this
makes the circular "handles", in Timeline for example, to not be
visible. This is because we start with the item color and then make
it darker when over a threshold. But we never make them lighter when
they are dark. This PR makes these darker or lighter depending on the
base color.

Pull Request: https://projects.blender.org/blender/blender/pulls/137618
2025-04-17 01:29:06 +02:00
Campbell Barton
3bf92a6e83 Cleanup: rename nullptr to null for null-characters 2025-04-11 23:55:00 +00:00
Guillermo Venegas
6397a4fb9a Refactor: UI: Use typed enum class for eUIEmbossType enum
Part of incoming refactors in interface layout c++ code, this enables
forward declaring this enum type. Enum is renamed as `EmbossType` and
moved to `blender::ui` namespace. No user visible changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/136725
2025-03-31 00:36:46 +02:00
Harley Acheson
3dc78529f2 Fix #136504: Clamp Scaling of Color Picker Value Handle
If you scale down the color pickers to very small sizes the calculation
of the handle size of the value slider will cause it to proportionally
increase as it all approaches zero. This PR just calculates the size in
a better way and clamps it as well. For both the round and square
versions.

Pull Request: https://projects.blender.org/blender/blender/pulls/136566
2025-03-26 18:32:29 +01:00
Julian Eisel
4499fad40e UI: Horizontal list view for asset browser
Part of #134755 / #134766.

The asset browser currently lacks a compact view that leaves names
readable. Especially when managing asset libraries (e.g. to prepare it
for sharing or set up a production library), this is quite a usability
issue. A column view like the file browser has can solve this, allowing
a quick overview and fast browsing of libraries, while keeping names
readable.

Adds a new "Horizontal List" display mode to the asset browser that
distributes assets over multiple columns, with horizontal scrolling.
Asset previews are shown in this mode, plus an asset type icon if
there's enough space. The size of previews and the columns can be
configured next to the display mode, for optimizing the display.

Pull Request: https://projects.blender.org/blender/blender/pulls/135306
2025-03-14 16:43:12 +01:00
Harley Acheson
0ee642611c UI: Add Specific Icon to Represent Preview While Loading
Rather than continuing to use ICON_TEMP, meant to represent temporary
locations, this PR adds a specific one - ICON_PREVIEW_LOADING - for
this purpose. Just a copy of ICON_TEMP for now, but with all parts at
40% opacity, matching how we use it now. Not only gives us an icon we
can later change, but also removes our special handling of reducing
opacity for one icon id.

Pull Request: https://projects.blender.org/blender/blender/pulls/135463
2025-03-04 23:35:30 +01:00
Julian Eisel
80d6ad3e9d Fix: UI: Text shortening function off by one character
Noticed while working on #134814 that `BLF_width_to_rstrlen()` would
give one character too much to put into the available space, resulting
in a visual overflow or clipped text when BLF clipping is enabled.

I think the issue was hidden by the code from 9c09998530, which would
remove further characters until the string actually fits. I'm proposing
to disable that code for now, hoping that this properly fixes the issue.

`BLF_width_to_rstrlen()`/`blf_font_width_to_rstrlen()` are supposed to
find the largest part from the end of a string that fits into a given
width. It would iterate the string from the back until a character
doesn't fit into the width anymore. However, it would return the
index of that character, the one that doesn't fit anymore, instead of
the last character known to fit.

Pull Request: https://projects.blender.org/blender/blender/pulls/135239
2025-02-28 11:58:52 +01:00
Hans Goudey
d0a6189b50 Refactor: DRW: Centralize and clean up packed normals conversion
Move the code dealing with converting float3 to GPU normals
out of the vertex format header into a separate header. Use a
proper C++ namespace and remove duplication by only using
the more recently added C++ templated conversions.

Most of the diff comes from the removal of the indirect includes
from GPU_vertex_format.hh. A lot of files ended up mistakenly
depending on that.

Pull Request: https://projects.blender.org/blender/blender/pulls/134873
2025-02-24 16:08:30 +01:00
Harley Acheson
2e90aace03 Fix #134796: Adjust Error Theme Color for Widget Text
When using the Error theme color for widget text color, this has to be
altered to provide sufficient contrast with other content.  This was
done with label text color, before recent changes to make these colors
themeable, by blending with text color. This PR makes similar changes
and gives similar results.

Pull Request: https://projects.blender.org/blender/blender/pulls/134807
2025-02-19 20:24:33 +01:00
Campbell Barton
d02f957296 Merge branch 'blender-v4.4-release' 2025-02-16 17:17:56 +11:00
Campbell Barton
78ccea432f UI: correct array size check for colors
Allow arrays to be larger than 4.

Related to #134537.
2025-02-16 17:14:12 +11:00
Guillermo Venegas
7682258ff9 Refactor: UI: Use a Vector to store buttons in UI blocks
This changes the ui-blocks buttons storage from Listbase to Vector.

Major changes that might cause a performance considerations are
in `ui_but_update_from_old_block` that requires to track buttons when restoring
button state between block redraws or in  `uiItemFullR` that may needs to insert
uiButs in the middle of the vector to add decorators. This might not be as fast as
removing or inserting elements in the middle of a listbase container. Also buttons currently
don't know its position in the container, so to get the previous and next
button its required to make a lookup of the button in the container.

`UI_block_update_from_old> ui_but_update_from_old_block` restores the state
of buttons between frames, this is done by sequentially testing if a button is the
same as an old button, however since UI can be created procedurally some old buttons
may not be drawn while editing other button data, this requires an extra track of what
buttons may not match to a new button while comparing for restoring state, but still
this buttons may be candidates to match to an new button.

Not functional changes expected.
Ref: #117604

Co-authored-by: Julian Eisel <julian@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/127128
2025-02-14 15:29:26 +01:00
Harley Acheson
5956752eb7 UI: Themeable RedAlert, Error, Warning, Info Colors
The "Red Alert" color is currently hard-coded, which causes problems in
themes.  It also has an Enum value of 0, which precludes using this
value as "unset". We also use Error, Warning, and Info colors that are
part of the Info Editor.  This PR moves these out of the Info Editor
and into the "State" part of the theme. And then makes TH_REDALERT use
the TH_ERROR color.

Pull Request: https://projects.blender.org/blender/blender/pulls/131127
2025-02-12 20:59:47 +01:00
Julian Eisel
47bbf3fcae Fix #134225: Data-block selector icon drawn too big
DPI scaling was applied twice. Added an API comment to make this more
clear for the caller of the function.
2025-02-07 18:31:50 +01:00
Julian Eisel
4755503356 UI: Draw subtle background for preview items in menus
Draw a subtle background to make individual parts of each item feel more
connected. E.g. showing loading icons or labels might make it feel like
a bunch of floating icons/labels.

Suggested in #133880.

Pull Request: https://projects.blender.org/blender/blender/pulls/133980
2025-02-03 16:11:55 +01:00
Julian Eisel
1f88645728 UI: Draw loading icon while previews load
Show a dimmed loading icon while previews are being loaded in a
background thread. The asset shelf and asset/file browsers do this
similarly already.

This is implemented in drawing code, so the loading icon will always
appear when an in-progress preview is being drawn. I experimented with
doing this in `ui_def_but_icon()`, but this won't update correctly with
popups that don't support full refreshing.

This also makes any normal icon that is drawn as preview use the normal
icon size. These icons are usually made for smaller sizes and look very
outblown when displayed at the size of a preview. Yet it's useful to
sometimes pass a normal icon. E.g. for the asset shelf we would already
draw the data-block type icon in place of the preview if there was no
preview to display, and we'd use the normal, smaller size already.
Larger can still be drawn differently.
I don't know of any current cases this would affect though.

Pull Request: https://projects.blender.org/blender/blender/pulls/133880
2025-02-03 16:03:06 +01:00
Brecht Van Lommel
3725fad82f Cleanup: Various clang-tidy warnings in editors
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:17 +01:00
Alaska
be975efc9e Fix #133465: Pulldown selected outline color was not used
In the theme settings for the user interface, there was a option to
change the outline color of pulldown menus (E.g. the buttons at the top
of the 3D viewport) when the button was selected.

However this color wasn't used. This commit aims to fix that
by using the selected outline color for the outline of selected
pulldown buttons.

Pull Request: https://projects.blender.org/blender/blender/pulls/133470
2025-01-27 22:19:05 +01:00
Brecht Van Lommel
890455affe Refactor: Rename function to clarify it's for sRGB only
Pull Request: https://projects.blender.org/blender/blender/pulls/133368
2025-01-21 18:05:56 +01:00
Hans Goudey
c6f5c44350 Cleanup: Remove unused includes in editors modules
Pull Request: https://projects.blender.org/blender/blender/pulls/133166
2025-01-16 23:17:51 +01:00
Harley Acheson
7ed5b11c64 Fix #125035: Stop widget_box from Drawing over Contents
The complaint shows the background of the box widget drawn over top of
its contents, the color picker. This is resolved by flushing the widget
cache so that other content draws after.

Pull Request: https://projects.blender.org/blender/blender/pulls/131525
2024-12-07 00:26:52 +01:00
Clément Foucault
601de8bfcb Fix: GPU: Assert due to new GPU requirements regarding wide lines
The formats was not using the correct attribute type.
2024-11-28 11:56:49 +01:00
Julian Eisel
209dc899ea Fix #128649: Tool icon in toolbar shrinked down with non HiDPI screens
Pixelsize and DPI scaling had to be applied correctly.
2024-11-13 17:00:18 +01:00
Julian Eisel
a641001207 Fix: UI previews don't refresh outside of properties editor
The preview template (`UILayout.template_preview()`) to display previews
for materials, textures or similar would only work correctly in the
Properties editor. This had explicit logic to trigger rerendering on
changes. When displaying such previews elsewhere (e.g. in the 3D View
sidebar), the only way to have changes reflected would be by resizing
the preview.

This fix makes sure such previews are tagged as dirty and refreshed on
changes to the underlying ID. We do this the same way as tagging the ID
previews as dirty, through a function called by the dependency graph for
such updates.

Pull Request: https://projects.blender.org/blender/blender/pulls/129641
2024-11-01 15:25:24 +01:00
Julian Eisel
f57b9b12d2 UI: Increase size of active asset highlight in asset shelf
Generally increases padding of preview widgets a bit (while keeping the
preview size the same), and increases the size of the highlight surface
a bit. The default grease pencil brushes from the essentials asset
library use an opaque background, so the highlight was barely visible
before. It was difficult to identify the active brush from that. Now
it's a lot easier to identify visually.

See PR for comparison screenshots.

Pull Request: https://projects.blender.org/blender/blender/pulls/128432
2024-10-01 15:33:15 +02:00
Campbell Barton
473bd60164 Cleanup: clarify arguments using const or r_ prefixed return args 2024-09-26 15:03:24 +10:00
Campbell Barton
47c6ac2930 Refactor: use integer values for cursor width in BLF
As all the values involved in cursor offset calculation are integers,
treating the cursor width to a float doesn't give any benefits.
2024-09-16 11:38:58 +10:00
Harley Acheson
fb651c1613 UI: Show Splash Version Text in White
The version text shown over the splash screen image needs to always be
white regardless of the theme. With "Blender Light" this text is black
and almost impossible to read. This PR adds the ability to set a
specific color for labels without icons and does so for the splash
screen.

Pull Request: https://projects.blender.org/blender/blender/pulls/126340
2024-08-30 20:52:17 +02:00
Harley Acheson
108b71047a UI: Remove "Widget Label" Text Style
This PR removes the "Widget Label" text style, found in Preferences /
Themes / Text Style. This results in both labels and the text found in
input boxes sharing settings. This results in a slight loss of
customization but it isn't that useful to have these things separate
and results in code complication and errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/122898
2024-07-19 21:57:49 +02:00
Harley Acheson
ef080a4219 UI: Icon Hover Brightness for Properties Items
Properties category icons with new SVG icons are slightly brighter than
before, and therefore do not seem to brighten on hover. This PR makes
them match exactly. Was assigning an alpha instead of multiplying. And
an earlier refactor for outlines made these icons not show initially
dimmer unless there is also an outline.

Pull Request: https://projects.blender.org/blender/blender/pulls/125029
2024-07-19 04:17:52 +02:00
Campbell Barton
48383cf20e Cleanup: avoid shadowing, redundant assignment & minor changes
Quiet cppecheck warnings, use const pointers, ELEM(..) macro,
replace NULL -> nullptr, unsigned int -> uint.
2024-07-07 00:18:00 +10:00
Harley Acheson
9ae237d0b4 UI: Allow Discretionary Use of Icon Outline
Icons can have contrasting outlines, but currently this can only happen
for some icons and when the theme setting "Icon Border" is greater than
zero. This change shows them in the same situations but also allows
them to be shown when needed. For special situations like having an
icon overlay on an icon, or for the icons in the corners of File
Browser preview items, etc.  In a nutshell this allows UI_icon_draw_ex
to honor its outline argument, rather than ignoring it unless the theme
setting was also set.

Pull Request: https://projects.blender.org/blender/blender/pulls/123863
2024-06-27 23:00:53 +02:00
Julian Eisel
e425faf696 Cleanup: Replace term "radial" with "pie menu" in UI code
Code was often referring to pie menus using the term "radial" which just
obfuscates that it relates to pie menus. Just call it what it is
directly.

Doesn't replace usages of the term for names that are not strictly tied
to pie menus. Also doesn't change instances of the term in the Python
API to keep compatibility, noted in #110461.

Pull Request: https://projects.blender.org/blender/blender/pulls/122825
2024-06-06 14:55:23 +02:00
Hans Goudey
84c4ddbbb9 Cleanup: GPU: Use references for some vertex buffer functions
Pull Request: https://projects.blender.org/blender/blender/pulls/122784
2024-06-05 18:47:22 +02:00
Jacques Lucke
cd5eb4aa03 Geometry Nodes: support renaming some sockets in the node directly
This adds support for renaming some sockets in the node UI directly by Ctrl+Clicking
on them. This is sometimes more convenient than going to the sidebar. It affects the
Menu Switch and Bake node as well as the Simulation and Repeat zone.

Some related notes:
* The Group Input and Group Output node are not yet supported, because it currently
  breaks the right-alignment on the Group Input node. I couldn't find a workaround for
  this yet.
* Double-clicking on the socket name does not trigger renaming yet. This seems to
  be a deeper issue in the interface code.
* The highlighting when hovering over sockets that can be renamed is very dim
  making it hard to see. Alternatives like drawing a box around the label when hovering
  it (like in list views) have been discussed but seem to be much more difficult to get to work.

Despite these limitations, it seems reasonable to add this already, as it shouldn't affect
anyone negatively. The nodes still look like before.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/121945
2024-05-30 10:41:05 +02:00
Campbell Barton
3b21b0deb1 Fix invalid length passed to BLF_str_selection_boxes
Correct recent fix 643f23f4ed.
2024-05-23 13:08:09 +10:00
Harley Acheson
79847acd0c Cleanup: Make format
Just formatting changes resulting from Make Format.
2024-05-22 16:43:32 -07:00
Lalit Shankar Chowdhury
b561771f50 Fix #122110: Remove long text selection flickering
Fix flickering when selecting long (scrolled) text from the left.

Pull Request: https://projects.blender.org/blender/blender/pulls/122123
2024-05-23 01:41:56 +02:00
Harley Acheson
643f23f4ed Fix #122047: Correct text selection when text is scrolled
Correct calculation of start of visual string and position of the
selection start when the text is scrolled (showing a subset of the
text) within an input box.

Pull Request: https://projects.blender.org/blender/blender/pulls/122110
2024-05-22 19:40:37 +02:00
Harley Acheson
ba36c69c9f Refactor: Add BLF Function to determine input selection boxes
Add a separate function that calculates text selection box positioning
given a string's selection start and end offsets. Moves this to a
better place and allows to have more complex boxes in future when we
might have multi-line and/or multi-directional text input.

Pull Request: https://projects.blender.org/blender/blender/pulls/121448
2024-05-18 00:13:32 +02:00
Harley Acheson
c4e5a70e07 UI: Optional Complex Layout for Workspace Status
Optionally allow complex layout instead of just plain text when using
ED_workspace_status_text.

Pull Request: https://projects.blender.org/blender/blender/pulls/120595
2024-05-06 23:52:37 +02:00
Campbell Barton
cf37424203 Cleanup: use const pointers, quiet cppcheck unreadVariable warning 2024-04-17 11:36:38 +10:00
Bastien Montagne
4dc53709b2 Fix #120703: Overrides: Missing 'override' Color overlay for some UI widgets.
Outliner's 'Restrictions' set of icon buttons would not show the
'liboverridden' teal-blue background.
2024-04-16 18:38:39 +02:00
Harley Acheson
aae8b956dd Refactor: BLF Extract Function BLF_str_offset_to_cursor
Move into own BLF function, code that returns a text cursor (caret)
position given a string offset. This code is currently just in
interface_widgets.cc but should be a separate BLF function.

Pull Request: https://projects.blender.org/blender/blender/pulls/120622
2024-04-15 18:29:25 +02:00
Jeroen Bakker
9c1cba528b OpenGL: Remove Apple specific workarounds
This PR removes apple specific OpenGL workarounds. OpenGL on Apple isn't supported
so they can be removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/120522
2024-04-11 17:25:21 +02:00