Commit Graph

107 Commits

Author SHA1 Message Date
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
Hans Goudey
cf5304855f Fix #117632: IME input crash after refactor to use std::string
The IME widget drawing code replaces the button's draw string, but it
did this with a C-style const cast which let this go unnoticed in
089c389b5c which changed the string from a C array to a
C++ std::string, where it's UB to just change the length this way.

To fix the crash, just store the string in a temporary array so we
can use the existing unchanged formatting code.

Pull Request: https://projects.blender.org/blender/blender/pulls/117968
2024-02-08 05:52:19 +01:00
Hans Goudey
7fa5fc02b7 Cleanup: Move BLF headers to C++ 2024-01-31 14:04:56 -05:00
Hans Goudey
99f9084bee Cleanup: Replace some CLAMP macros with C++ functions
Pull Request: https://projects.blender.org/blender/blender/pulls/117460
2024-01-23 21:10:33 +01:00
Hans Goudey
089c389b5c Cleanup: Store UI button drawstr with std::string
Similar to bff51ae66c
2024-01-22 14:54:44 -05:00
Hans Goudey
0618de49ad Cleanup: Replace MIN/MAX macros with C++ functions
Use `std::min` and `std::max` instead. Though keep MIN2 and MAX2
just for C code that hasn't been moved to C++ yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/117384
2024-01-22 15:58:18 +01:00
Hans Goudey
bff51ae66c Cleanup: Use std::string to store UI button string
This simplifies memory management and button string manipulation in
general. Just change one of the few strings stored in `uiBut` for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/117183
2024-01-16 21:04:17 +01:00
Harley Acheson
458ef077c9 UI: Don't Emboss Within a Stack of Buttons
Only emboss individual buts or the bottom of a stacked group.

Pull Request: https://projects.blender.org/blender/blender/pulls/116921
2024-01-12 19:58:42 +01:00
Brecht Van Lommel
d377ef2543 Clang Format: bump to version 17
Along with the 4.1 libraries upgrade, we are bumping the clang-format
version from 8-12 to 17. This affects quite a few files.

If not already the case, you may consider pointing your IDE to the
clang-format binary bundled with the Blender precompiled libraries.
2024-01-03 13:38:14 +01:00
Harley Acheson
639272ef77 Fix #100784: Truncate Text with Ellipsis inside Number Inputs
When a property name is shown inside of a numerical input, truncate
with ellipsis if it cannot fit.

Pull Request: https://projects.blender.org/blender/blender/pulls/115958
2023-12-08 23:40:09 +01:00
Harley Acheson
0fbc3e956f Fix #115601: Clamp Color Picker Vertical Value Slider Position
The position of the vertical value slider has to be clamped to be
within the area of that slider, otherwise it can draw outside the
range when a value is over 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/115680
2023-12-01 20:01:22 +01:00
Campbell Barton
27c660707d Cleanup: spelling in comments, variables 2023-11-27 09:54:36 +11:00
Leon Schittek
42ddc13033 Fix #95709: Improve pulldown menu corner rounding
Improve corner rounding of menus and popup blocks.

Pull Request: https://projects.blender.org/blender/blender/pulls/111554
2023-11-24 23:55:43 +01:00
Leon Schittek
0335b6a3b7 UI: Improve menu dropshadow
Improvements to the drawing of shadows, used with blocks, menus, nodes,
etc. Improvements to shape, especially at the top corner or at extremes
of widget roundness. Allows transparent objects to have shadows. This
is a nice refactor that removes a lot of code.

Pull Request: https://projects.blender.org/blender/blender/pulls/111794
2023-11-24 22:50:20 +01:00
Harley Acheson
c11d5b4180 UI: Color Picker Position Indication
Changes to how the current positions in the color picker are shown.

Pull Request: https://projects.blender.org/blender/blender/pulls/113753
2023-11-17 19:18:28 +01:00
Hans Goudey
3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Campbell Barton
611930e5a8 Cleanup: use std::min/max instead of MIN2/MAX2 macros 2023-11-07 16:33:19 +11:00
Julian Eisel
72a8851a95 UI Code Quality: Rename UI_ACTIVE button flag to UI_HOVER
Calling this state "active" has been confusing for a long time for a number of reasons:
- It's not clear that this is essentially a mouse hover state.
- Easy to confuse with "select" state (`UI_SELECT`), both terms are vague.
- Buttons can be "inactive" (`UI_BUT_INACTIVE`) which is totally related to this "active" state.
- Button handling can consider a button as active that doesn't have this flag set (e.g. during text input).
- Active and selected are well established terms in Blender, but they mean a different thing there.

See #112160.

Pull Request: https://projects.blender.org/blender/blender/pulls/114113
2023-10-25 18:36:27 +02:00
Harley Acheson
d0e6f894fe Merge branch 'blender-v4.0-release' 2023-10-16 10:18:41 -07:00
Harley Acheson
ffe980afad Fix #113766: Incorrect Cursor With Offset Position
Next character left edge position incorrect when string has
an offset positioning (scrolled within the input box).

Pull Request: https://projects.blender.org/blender/blender/pulls/113784
2023-10-16 19:17:28 +02:00
Harley Acheson
d578170131 Cleanup: Make format
Format changes resulting from Make Format
2023-10-15 09:09:30 -07:00
Harley Acheson
03655189d7 Fix #113735: Space Characters in UI Text Entry #113749
With #113707 text cursor position is set using the character's visible
bounds, so special care is needed for those without bounds like space.
Forgot this also applies to 4.0.
2023-10-15 09:06:44 -07:00
Harley Acheson
b6131cc338 Cleanup: Make format
Formatting changes resulting from Make Format
2023-10-15 08:45:11 -07:00
Harley Acheson
c6c86b555d Fix #113735: Space Characters in UI Text Entry
With #113707 text cursor position is set using the character's visible
bounds, so special care is needed for those without bounds like space.

Pull Request: https://projects.blender.org/blender/blender/pulls/113749
2023-10-15 17:42:28 +02:00
Harley Acheson
13de143ba8 Merge branch 'blender-v4.0-release' 2023-10-14 12:00:08 -07:00
Harley Acheson
b772603843 Fix #113682: Improved Text Caret Position
For regular UI text entry, place the text caret exactly between
adjacent glyph bounds instead of just using partial text length to
position it.

Pull Request: https://projects.blender.org/blender/blender/pulls/113707
2023-10-14 20:58:50 +02:00
Campbell Barton
2e0b844b36 Cleanup: spelling in comments 2023-10-14 13:53:00 +11:00
Julian Eisel
14d6891efe Merge branch 'blender-v4.0-release' 2023-10-13 19:05:13 +02:00
Leon Schittek
7017a9880e Fix: UI: Scale list item highlight with zoom
Fix the row highlight in list views not scaling properly by taking
the zoom into account.

Pull Request: https://projects.blender.org/blender/blender/pulls/113645
2023-10-13 19:04:42 +02:00
Harley Acheson
f7a8536112 Merge branch 'blender-v4.0-release' 2023-10-13 08:36:19 -07:00
Harley Acheson
a9dc7a4719 Cleanup: Comment for Assert in UI_text_clip_middle_ex
Just an added detailed comment for the reason for the assert in
UI_text_clip_middle_ex and why it has wriggle room.
2023-10-13 08:35:04 -07:00
Harley Acheson
4320f1a217 Merge branch 'blender-v4.0-release' 2023-10-12 11:56:24 -07:00
Harley Acheson
1c4b2ad17f Fix #113352: UI: Round Pen When Subpixel AA is Off
Testing to see if rounding the advancing pen seems to give slightly
nicer spacing when subpixel anti-aliasing is turned off.

Pull Request: https://projects.blender.org/blender/blender/pulls/113399
2023-10-12 20:54:54 +02:00