Commit Graph

139 Commits

Author SHA1 Message Date
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
Campbell Barton
430d7961a2 Cleanup: remove redundant checks & struct declaration 2024-04-08 12:03:08 +10:00
Harley Acheson
5bed08fc56 Fix #120133: Incorrect BG color Hovering Inactive
Hovering on inactive menu items combines the colors in a way that does
not work correctly with light themes. This PR changes nothing but how
colors are mixed for hover + inactive, doing so similarly to hovering
active.

Pull Request: https://projects.blender.org/blender/blender/pulls/120262
2024-04-05 18:08:45 +02:00
Campbell Barton
01dceb6b89 Cleanup: remove redundant checks for known states 2024-03-29 10:30:42 +11:00
Hans Goudey
893130e6fe Refactor: Remove unnecessary C wrapper for GPUBatch class
Similar to fe76d8c946

Pull Request: https://projects.blender.org/blender/blender/pulls/119898
2024-03-26 03:06:25 +01:00
Hans Goudey
fe76d8c946 Refactor: Remove unnecessary C wrappers for vertex and index buffers
Now that all relevant code is C++, the indirection from the C struct
`GPUVertBuf` to the C++ `blender::gpu::VertBuf` class just adds
complexity and necessitates a wrapper API, making more cleanups like
use of RAII or other C++ types more difficult.

This commit replaces the C wrapper structs with direct use of the
vertex and index buffer base classes. In C++ we can choose which parts
of a class are private, so we don't risk exposing too many
implementation details here.

Pull Request: https://projects.blender.org/blender/blender/pulls/119825
2024-03-24 16:38:30 +01:00
Hans Goudey
8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
Harley Acheson
a1f92f5820 Refactor: ui_draw_popover_back Impossible Null Dereference
The function ui_draw_popover_back has a "block" argument, that is
checked for null, but then has an "else" that would require it and
cause a null pointer dereference. This is an internal function that has
one caller, in response to a condition on that same block's flag.
Therefore this PR removes this function's check for null and the else
code as this condition is not possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/119092
2024-03-05 17:39:35 +01:00
Hans Goudey
8c63889241 Cleanup: UI: Use derived struct for list scroll bars, remove a1, a2 usage 2024-03-01 14:27:57 -05:00
Hans Goudey
365966d51d Cleanup: UI: Use derived struct for label buttons, remove a1, a2 usage 2024-03-01 14:27:56 -05:00
Harley Acheson
5e669d99d7 Refactor: UI_BTYPE_SEPR_LINE Without Need for uiBut->a1
The line separator needs to know vertical or horizontal orientation
at draw time, and is independent of button rect. This PR removes the
use of uiBut->a1 for this in favor of a derived struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/118969
2024-03-01 18:09:02 +01:00
Harley Acheson
67ae79cadc Merge branch 'blender-v4.1-release' 2024-02-20 18:05:21 -08:00
Harley Acheson
857341a7a7 Fix #118473: Glitches for Square Color Picker When Very Wide
When using a square color picker you can drag it very wide in an RGB
node. Once over a threshold the round cursor in the color canvas will
turn into a vertical bar. Caused by (dumb) proportion test. Replaced
with a proper check for gradient type.

Pull Request: https://projects.blender.org/blender/blender/pulls/118542
2024-02-21 03:03:48 +01:00
Harley Acheson
bc0001aa04 Merge branch 'blender-v4.1-release' 2024-02-19 13:27:24 -08:00
Harley Acheson
42a74a28f2 Fix #117780: Allow Embossing With Horizontal Layouts
Although it is nice to skip embossing for middle buttons in aligned
rows, this only applies to vertically-aligned buttons. Horizontal ones
need to keep their embossing, if enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/118304
2024-02-19 22:26:08 +01:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
2024-02-19 15:59:59 +01:00
Harley Acheson
48dee674f3 UI: Changes to Menu Separator Padding
Add interior horizontal padding to menu separator lines.

Pull Request: https://projects.blender.org/blender/blender/pulls/118227
2024-02-14 17:14:17 +01:00
Harley Acheson
4c50e6992f UI: Configurable Layout Separators
Ability to create vertical bar separators in horizontal layouts,
horizontal lines in popovers, and vertical (non-line) spacers in menus.

Pull Request: https://projects.blender.org/blender/blender/pulls/117310
2024-02-09 17:38:36 +01:00