Commit Graph

6800 Commits

Author SHA1 Message Date
Miguel Pozo
e6638d6e5e Refactor: GPU: GPUMaterial & GPUPass compilation
Cleanup and simplification of GPUMaterial and GPUPass compilation.
See #133674 for details/goals.

- Remove the `draw_manage_shader` thread.
  Deferred compilation is now handled by the gpu::ShaderCompiler
  through the batch compilation API.
  Batch management is handled by the `GPUPassCache`.
- Simplify `GPUMaterial` status tracking so it just queries the
  `GPUPass` status.
- Split the `GPUPass` and the `GPUCodegen` code.
- Replaced the (broken) `GPU_material_recalc_flag_get` with the new
  `GPU_pass_compilation_timestamp`.
- Add the `GPU_pass_cache_wait_for_all` and
  `GPU_shader_batch_wait_for_all`, and remove the busy waits from
   EEVEE.
- Remove many unused functions, properties, includes...

Pull Request: https://projects.blender.org/blender/blender/pulls/135637
2025-05-22 17:53:22 +02:00
Bastien Montagne
647927a330 Fix IDP_MergeGroup_ex not taking 'ID management' flags as parameter.
For IDProperties, this flag is mostly used only to controll whether
IDProperty code should also handle ID refcounting or not (through
`LIB_ID_CREATE_NO_USER_REFCOUNT`).

Without this fix, IDProp Group Merge could end up trying to modify ID
refcount of its data-block properties (via `IDP_FreeProperty`), which
can lead to data corruption or even crashes (e.g. when used in readfile
code, before lib-linking process).

Issue discovered while working on the system IDProperties split project
(!135807).

Pull Request: https://projects.blender.org/blender/blender/pulls/139230
2025-05-22 09:19:21 +02:00
Guillermo Venegas
44160a0524 Refactor: UI: Replace uiItemFullO with class method uiLayout::op
This converts the public `uiItemFullO` function to an object oriented
API (an `uiLayout::op` overload), matching recents changes in the API.

Changes includes the removal of the paramether `IDProperty *properties`
that seems unused (all places just sets `nullptr`, can be added as last
argument with `nullptr` as default value though), and instead of using a
return paramether the function now returns the pointer to write properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/138961
2025-05-20 15:19:34 +02:00
Campbell Barton
b3dfde88f3 Cleanup: spelling in comments (check_spelling_* target)
Also uppercase acronyms: API, UTF & ASCII.
2025-05-17 10:17:37 +10:00
Campbell Barton
be3199771e WM: use boolean for ime_data_is_composing
This only used char since it was originally part of DNA.

Also correct typo.
2025-05-17 09:05:28 +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
Jacques Lucke
4d2aa7d828 Fix #138769: crash when baking
The issue appears to have been that the same depsgraph is evaluated twice at the
same time. Once by the bake code in a background thread and once by gizmo
related event handler.

This patch fixes it by not running event handlers in locked regions. Generally,
accessing evaluated data while the interface is locked (and thus some baking is
usually going on), is not safe.

Pull Request: https://projects.blender.org/blender/blender/pulls/138806
2025-05-14 15:19:29 +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
Jacques Lucke
afd760f2b7 UI: Ghost: support horizontal scrolling for 2D editors
Some mice have an additional horizontal scroll wheel. This patch adds support
for receiving such events. By default it is used to scroll 2D editors left and right.

I originally developed this because I was missing it in the spreadsheet, but it
seems to be useful in many other editors too.

It's supported on Linux (Wayland), Windows and macos.

Pull Request: https://projects.blender.org/blender/blender/pulls/138758
2025-05-14 13:33:10 +02:00
Guillermo Venegas
3b1e123361 Refactor: UI: Replace uiItemS and uiItemS_ex with uiLayout::separator
This merges the public `uiItemS` and `uiItemS_ex` functions into an
object oriented API (`uiLayout::separator`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code
(or vice-versa), making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138826
2025-05-13 17:54:26 +02:00
Harley Acheson
b2c4d71f1d Fix: Allow Duplication of Minimized Outliner
For as long back as I have tested (2.91) using "Duplicate Area into New
Window" for Outliner when minimized (showing only header) will result
in an invalid area - at least on Windows. The area may have have a
black background, invalid screen area verts, and has the header on the
bottom. This is because it is created in a window that is our minimum
size but initialized smaller, at the height of the area (0-2 pixels).
This PR just adds a small minimum to our blender window creation.

Pull Request: https://projects.blender.org/blender/blender/pulls/138696
2025-05-10 17:38:27 +02:00
Guillermo Venegas
38c08b515f UI: Allow drag multiple files from Blender File Browser
After c00c8b1b37 its possible to handle drag-n-drop with multiple
paths, this commit enables Blender internal File Browser to have
support to start drag events with multiple files.

Pull Request: https://projects.blender.org/blender/blender/pulls/116474
2025-05-08 23:56:38 +02:00
Guillermo Venegas
dafdced6ab Refactor: UI: Replace uiItemR with class method uiLayout::prop
This converts the public `uiItemR` function to an object oriented
API (`uiLayout::prop`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138617
2025-05-08 20:45:37 +02:00
Guillermo Venegas
e5dcd0de99 Refactor: UI: Replace uiItemL with class method uiLayout::label
This converts the public `uiItemL` function to an object oriented
API (`uiLayout::label`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138608
2025-05-08 17:21:08 +02:00
Sergey Sharybin
d7aa98d07f Sequencer: Remove backdrop drawing in timeline
It always was functionality which got committed without proper review
by the module or UI/UX team. It has all sort of UX problems, but it is
also something that will be tricky to support for HDR drawing.

To brings things to a more manageable state the functionality is now
removed.
2025-05-07 16:21:06 +02:00
Sebastian Parborg
308f6032c8 Sound: Make Blender control when we open and close sound devices
On Windows and Mac (and with certain backends on Linux), Blender would
always appear to be playing back audio even if there was no timeline
playback. This would sometimes prevent devices from going to sleep or
going into lower power state modes when idling.

For the affected audio backends, we now automatically close the audio
backend after 30 seconds of inactivity.

Pull Request: https://projects.blender.org/blender/blender/pulls/136845
2025-05-07 15:00:55 +02:00
Campbell Barton
440274d42e WM: revert change to the hot-spot size (use the value from 4.4v)
Based on !138406 it seems the issue this was intended to resolve remains
so revert the increase in hot-spot size from [0].

[0]: a043a0e74d
2025-05-07 11:35:07 +10: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
Harley Acheson
022c85fec3 UI: Consistent File/Asset Drag Size
The size of preview images while dragging from File or Asset Browser is
currently related to the size that they are shown in the thumbnail
lists, sort of, but also based on the column size and with an incorrect
scaling. This PR just makes them a consistent size while dragging,
regardless of their thumbnail size.

Pull Request: https://projects.blender.org/blender/blender/pulls/138350
2025-05-06 22:35:26 +02:00
Jacques Lucke
e09ccc9b35 Core: add templated version of BKE_id_new_nomain to reduce explicit casting
This adds a version of `BKE_id_new_nomain` that takes the ID type parameter as
template argument. This allows the function the return the newly created ID with
the correct type, removing the need to use `static_cast` on the call-site.

To make this work, I added a static `id_type` member to every ID struct. This
can also be used to create a similar API for other id management functions in
future patches.

```cpp
// Old
Mesh *mesh = static_cast<Mesh *>(BKE_id_new_nomain(ID_ME, "Mesh"));

// New
Mesh *mesh = BKE_id_new_nomain<Mesh>("Mesh");
```

Pull Request: https://projects.blender.org/blender/blender/pulls/138383
2025-05-05 18:41:03 +02:00
Guillermo Venegas
9e5151d294 Refactor: UI: Replace uiLayoutSplit with class method uiLayout::split
This converts the public `uiLayoutSplit` function to an object oriented
API (`uiLayout::split`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::split` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138361
2025-05-03 20:51:42 +02:00
Campbell Barton
7d97ba4c5f Cleanup: use float2, int2 types for cursor drawing callbacks
Ref !138172
2025-05-02 23:01:29 +00:00
Sean Kim
0491c2c233 Fix #136940: brush.asset_save_as crashes in background mode
Calling `brush.asset_save_as` both creates an asset and also activates
the corresponding brush. When run while Blender is in background mode,
the `active_tool->runtime` field may be null. To avoid crashing in this
case, check for null when comparing active tool data.

Pull Request: https://projects.blender.org/blender/blender/pulls/138245
2025-05-02 00:45:06 +02:00
Jordan Henshaw
10113a119e UI: Add missing periods to Overwrite file dialogue message
The paragraph message in the Overwrite File dialogue is missing periods.
Now added in this PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/127953
2025-05-01 08:46:02 +02:00
Campbell Barton
2f2d26fc54 Cleanup: use float2 for wmTabletData::tilt & PaintStroke::tilt 2025-05-01 12:51:55 +10:00
Campbell Barton
43af16a4c1 Cleanup: spelling in comments, correct comment block formatting
Also use doxygen comments more consistently.
2025-05-01 11:44:33 +10:00
Campbell Barton
99d469e4d5 Fix: glitch highlighting gizmos when using a tablet
When using a tablet an increased gizmo hit-radius was used,
afterwards toggling modifier keys could then re-evaluate the
highlighted gizmo with a smaller radius, meaning that pressing modifiers
caused gizmos to become inactive.

Revert [0] while keeping larger radius for both mouse & tablet motion
from 10 to 12 px (scaled by the UI scale).

[0]: a043a0e74d
2025-04-29 04:52:08 +00:00
Jun Mizutani
90b735c28c Fix: UI: Incorrect splash screen width on HiDPI/Retina displays at low window sizes
This patch fixes an issue where the splash screen width clamping
calculation would result in a very narrow size on HiDPI/Retina
display due to the native pixel size not being taken into account.

Fixed by using the `WM_window_native_pixel_x()` function to obtain
the horizontal window size instead of directly using
`CTX_wm_window(C)->sizex`.

Pull Request: https://projects.blender.org/blender/blender/pulls/137997
2025-04-27 14:39:56 +02:00
Guillermo Venegas
2d896877d1 Refactor: UI: Replace uiLayoutColumn with class method uiLayout::column
This converts the public `uiLayoutColumn` function to an object oriented
API (`uiLayout::column`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::column` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138034
2025-04-26 21:07:34 +02:00
Campbell Barton
c90e8bae0b Cleanup: spelling in comments & replace some use of single quotes
Previously spell checker ignored text in single quotes however this
meant incorrect spelling was ignored in text where it shouldn't have
been.

In cases single quotes were used for literal strings
(such as variables, code & compiler flags),
replace these with back-ticks.

In cases they were used for UI labels,
replace these with double quotes.

In cases they were used to reference symbols,
replace them with doxygens symbol link syntax (leading hash).

Apply some spelling corrections & tweaks (for check_spelling_* targets).
2025-04-26 11:17:13 +00:00
Guillermo Venegas
90644b30b2 Refactor: UI: Replace uiLayoutRow with class method uiLayout::row
This converts the public `uiLayoutRow` function to an object oriented
API (`uiLayout::row`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::row` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/137979
2025-04-25 19:45:25 +02:00
Harley Acheson
94acb16e7e UI: Remove Gizmo 3D Part Hit-space Scaling
Removal of the code that scales gizmo 3D part hitspace with gizmo size,
introduced in a043a0e74d, as requested by Campbell.

Pull Request: https://projects.blender.org/blender/blender/pulls/138007
2025-04-25 18:51:58 +02:00
Campbell Barton
93f5f57e64 Fix: correct type for wmWindow::event_queue_consecutive_gesture_type
The event type was stored in a char when event type values
require a larger range.

Also correct the doc-string location of `addmousemove`.
2025-04-25 04:24:10 +00:00
Campbell Barton
c50ae81c4d Fix: incorrect use of the last handled event
Recent commits ([0], [1]) referenced the last handled event
which is incorrect.

- It represents the previous event (not the event being handled).
- It's documented to only be used by the event queue logic.

Resolve using the current event instead of the last handled.

[0]: a043a0e74d
[1]: 5102880f51
2025-04-25 02:10:47 +00:00
Campbell Barton
2ef03e08b3 WM: warn when file selector properties don't match expected types 2025-04-25 10:53:20 +10:00
Brecht Van Lommel
a00885666b Fix #98339: Spreadsheet does not immediately report mesh subdiv info
Pull Request: https://projects.blender.org/blender/blender/pulls/137959
2025-04-24 16:07:52 +02:00
Brecht Van Lommel
3ee7750fe1 Fix #137869, #105665, #98339: Wrong or delayed mesh subdivision stats
* Fix CPU subdivided meshes not being counted
* Fix wrong check for GPU subdivision
* Draw status bar last so stats reflect latest 3D viewport drawing

Pull Request: https://projects.blender.org/blender/blender/pulls/137959
2025-04-24 15:59:58 +02:00
Pratik Borhade
db700c85d8 Fix: #137772: Marker area obstructing Keyframe Manipulation
Adjust keymap poll function of markers keymap. i.e. when no marker
exists, return false from the keymap so marker operations are not
invoked from key press. Also check whether marker region is visible.
If its is hidden, we can skip the markers keymap.

Pull Request: https://projects.blender.org/blender/blender/pulls/137803
2025-04-24 00:07:02 +02:00
Campbell Barton
9356b12bd5 Fix: potential crash from null pointer dereference
Null check the operator member as this is documented to be null
and is checked elsewhere in the handler logic.

Co-authored-by: Kabinet0 <m3kabin@gmail.com>

Ref !137506
2025-04-23 22:57:32 +10:00
Harley Acheson
e9cc07a24c UI: Changes to Save Startup Dialog
Simplification of the text on the "Save Startup" Confirmation dialog,
trying to reduce jargon and instead focus on the user effect. Title
of "Overwrite Startup File" and body of "Blender will start next time
as it is now." Similar wording for template startups.

Pull Request: https://projects.blender.org/blender/blender/pulls/134429
2025-04-22 23:02:16 +02:00
Pratik Borhade
7f25d1c9d0 Fix #137784: Translate text in status bar when interface translate is on
"Options" text of cursor being translated when tooltip translation is
enabled. Now fixed by replacing with `IFACE_`

Pull Request: https://projects.blender.org/blender/blender/pulls/137801
2025-04-22 22:04:55 +02:00
Brecht Van Lommel
fb2ba20b67 Refactor: Use more typed MEM_calloc<> and MEM_malloc<>
Pull Request: https://projects.blender.org/blender/blender/pulls/137822
2025-04-22 11:22:18 +02:00
Brecht Van Lommel
388a21e260 Refactor: Eliminate various void pointers passed to MEM_freeN
It's safer to pass a type so that it can be checked if delete should be
used instead. Also changes a few void pointer casts to const_cast so that
if the data becomes typed it's an error.

Pull Request: https://projects.blender.org/blender/blender/pulls/137404
2025-04-21 17:59:41 +02:00
Harley Acheson
914d2e8164 UI: Reverse Pen Y Tilt Expected Direction
It is more convenient for math reasons, for Blender to treat a pen tilt
toward the user as a positive angle. This PR just reverses all the
comments about the expected values. And also reverses the values from
WinTab, Windows Ink, and Wayland to match.

Pull Request: https://projects.blender.org/blender/blender/pulls/137636
2025-04-17 04:26:58 +02:00
Pratik Borhade
7dea50e30d Fix #137466: Unable to assign shortcuts to 'weight' operators in Weightpaint Mode
Operators like smooth weights, or transfer weights are exposed in
weight mode. Their definition has `OBJECT_OT_*` prefix, this appends
shortcuts key on those operators to "object mode" keymap. Use
`WM_keymap_guess_from_context` instead. This will allow new shortcut
keys to relevant keymap when object operator is exposed in 3d view.

Pull Request: https://projects.blender.org/blender/blender/pulls/137519
2025-04-16 17:50:02 +02:00
Harley Acheson
e1e250aa84 UI: Consistent Pen Tilt Values
Pen tilt values come into Blender through ghost platforms and device
drivers with inconsistent and ambiguous directions. This PR codifies
that we consider tilt-x positive values to be rightward, negative
values as leftward. Similarly tilt-y positive is away from the user,
negative is toward the user. Comments are updated to make this clear.
This fixes Windows Ink (currently always returning left and away). This
also reverses the Wayland tily-y values to match. We might still have
to consider a user preference to swap directions if we find differences
within a platform.

Pull Request: https://projects.blender.org/blender/blender/pulls/137501
2025-04-15 20:23:32 +02:00
Pratik Borhade
d330c1ec65 Fix #136998: Cannot assign shortcut to insert single keyframe operator
Shortcut is actually assigned to the operator but inside wrong keymap
("Animation"). When "add shortcut" is invoked for a property within
side panel or properties tab, add the new keyitem to "User Interface"
keymap.

Pull Request: https://projects.blender.org/blender/blender/pulls/137080
2025-04-15 19:42:55 +02:00
Harley Acheson
5102880f51 UI: Decrease Tablet Drag Threshold With Pen Pressure
We have separate drag movement thresholds, and one is specifically for
tablet pen movement. A movement is not considered a drag (when using
left click select) until this amount is detected. This PR decreases
that amount with pen pressure. This results in more immediate and
responsive behavior that feels quite natural. Whether using RCS or
LCS this also similarly reduces the lag when dragging on numerical
inputs and sliders.

Pull Request: https://projects.blender.org/blender/blender/pulls/136685
2025-04-15 02:51:15 +02:00
Jonas Holzman
81efb13f49 UI: Use Theme Color for Initial Window Background
This patch makes it so that the theme color is used for the
initial/loading Blender window background color. Unlike what
it may look like, theme settings are well loaded at this point
in the initialization process, which lets us directly use them
for coloring the window background instead of relying on a
default grey color.

This also makes the colored titlebar window decorations (introduced in
#123982 for macOS, #134054 for Windows 11), always blend with the window
instead of looking somewhat broken during window initialization. On the
technical side, this uses the top-bar header background theme color to
ensure this always matches with the color used by the colored titlebar.

Pull Request: https://projects.blender.org/blender/blender/pulls/137425
2025-04-14 22:36:16 +02:00
Bastien Montagne
0eba8caaf9 Core: Add 'relocate' operation on individual linked ID.
So far it was only possible to relocate a whole library, now one can
also relocate a single linked ID (pulling in all of its dependencies).

This is essentially linking the new data, remapping local usages of the
old linked data to the new one, removing no more used IDs, and updating
liboverrides if needed.
2025-04-14 12:54:48 +02:00