Commit Graph

119583 Commits

Author SHA1 Message Date
Jacques Lucke
8a42e2b59a Nodes: support expanded menus in node group interface
Previously, menu sockets were always drawn as dropdown. This patch adds the
ability to draw them expanded instead.

As before, in the node editor, only the expanded menu is drawn, without the
label. There is simply not enough space for both. However, in the modifier and
operator settings the label is drawn currently. We'll probably need to add a
separate `Hide Label` option (similar to `Hide Value`) for group inputs that
support it. That would also help a lot with e.g. object sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/138387
2025-05-08 04:31:09 +02:00
Jacques Lucke
156a405dd5 Nodes: support searching for specific math operations in Add menu
Previously, it was possible to search for specific math operations in
link-drag-search but not in the normal add menu. This patch adds support for
searching for specific operations in various math nodes.

A good trick for adding e.g. a vector add node is to search for `vadd`
(similarly with `iadd`).

The menu itself looks unchanged. This patch only adds additional elements to the
search.

Pull Request: https://projects.blender.org/blender/blender/pulls/138534
2025-05-08 04:28:22 +02:00
Sean Kim
0e8e98016b Cleanup: Remove commented out forward declaration
Also remove unnecessary `enum` prefix

Pull Request: https://projects.blender.org/blender/blender/pulls/138576
2025-05-08 03:41:57 +02:00
Martin-Vignali
9049645d0f FFmpeg: Add support for 10/12 bits FFV1 output
FFV1 supports more than 8 bits by pixel. Add support for 10 and 12 bit
depth (FFV1 encoder uses planar pixel format for these bitdepths).
Fix pixel format for 8 bit output. Previously it was always RGBA.

Co-authored-by: mvji <33432858+mvji@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/138192
2025-05-08 02:34:56 +02:00
Harley Acheson
405d9bc0bb UI: Correct Width of Hyper Status Bar
If a keymap entry uses "Hyper" key as a modifier then it currently
shows oddly on the status bar because the text width is narrower than
the button width. This corrects that.

Pull Request: https://projects.blender.org/blender/blender/pulls/138575
2025-05-08 02:01:47 +02:00
Sean Kim
0f10ccd6b5 Fix: Clay Thumb front_angle can be NaN
Introduced in 4c38327ea2

Pull Request: https://projects.blender.org/blender/blender/pulls/138573
2025-05-08 01:10:45 +02:00
Harley Acheson
d2f6514686 UI: Status Bar Proportional Size Include MsPan
Currently while transforming with proportional editing we see an item
in the status bar for "MsPan: Adjust Proportional Influence". This is
actually for trackpad pan gesture (only available on some laptops).
This PR just combines this entry with those for Page Up and Page Down.

Pull Request: https://projects.blender.org/blender/blender/pulls/138574
2025-05-08 00:44:09 +02:00
Hans Goudey
51eab6b25a Cleanup: Use blender::Mutex for file list read job 2025-05-07 18:05:14 -04:00
Hans Goudey
9a5a5c35c7 Cleanup: Use blender::Mutex for image pool 2025-05-07 18:05:14 -04:00
Harley Acheson
48403607dd UI: Status Bar Event Icons for Trackpad Gestures
Adding three icons to represent panning, rotate, and zoom gestures
and using them for status bar event icons for
GHOST_kTrackpadEventScroll, GHOST_kTrackpadEventRotate, and
GHOST_kTrackpadEventMagnify.

Pull Request: https://projects.blender.org/blender/blender/pulls/138569
2025-05-07 23:57:03 +02:00
Guillermo Venegas
a76753ca55 Refactor: UI: Replace uiLayoutRadial with class method uiLayout::menu_pie
This converts the public `uiLayoutRadial` function to an object oriented
API (`uiLayout::menu_pie`), 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::menu_pie` 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/138563
2025-05-07 23:29:49 +02:00
Hans Goudey
1fd958fe7c Cleanup: Resolve missing declaration warning 2025-05-07 17:05:31 -04:00
Guillermo Venegas
60fdcb2d20 Cleanup: UI: Follow Using this-> code style in recent uiLayout refactors
This changes removes `this->` when accessing data member with trailing
underscore and adds `this->` to member methods.

Pull Request: https://projects.blender.org/blender/blender/pulls/138564
2025-05-07 22:51:26 +02:00
Jacques Lucke
3a2d4d151f Cleanup: move linear allocator description to class 2025-05-07 20:49:02 +02:00
Jacques Lucke
52a283a1ee Cleanup: fix misleading comment
LinearAllocator does not REallocate, it just allocates a new buffer.
2025-05-07 20:48:26 +02:00
Guillermo Venegas
0a6211a974 Refactor: UI: Replace uiLayoutListBox and uiLayoutOverlap with methods
This converts the public `uiLayoutListBox ` and `uiLayoutOverlap `
functions to an object oriented API (an `uiLayout::list_box` and
`uiLayout::overlap` respectively), following recent uiLayout changes.

Both functions 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/138559
2025-05-07 20:38:40 +02:00
Harley Acheson
1c2aaa8a57 UI: Status Bar Merge Proportional Size Keymap Entries
This PR reduces some space on the Status bar during transforms using
proportional editing by merging TFM_MODAL_PROPSIZE_UP and
TFM_MODAL_PROPSIZE_DOWN items. This also changes the description shown
to "Proportional Size" to match the description in the popover.

Pull Request: https://projects.blender.org/blender/blender/pulls/138458
2025-05-07 19:33:59 +02:00
Hans Goudey
f90e448c6a Cleanup: Use blender::Mutex for various static mutexes
Change almost all `static ThreadMutex` to `static blender::Mutex`.
See b7a1325c3c.

Pull Request: https://projects.blender.org/blender/blender/pulls/138556
2025-05-07 19:32:00 +02:00
Sebastian Parborg
969f95973a Sound: Fix compiling without WITH_AUDASPACE 2025-05-07 18:45:03 +02:00
Harley Acheson
4e33627ebd UI: Status Bar Page Up/Down Event Icons "P" -> "Pg"
This only changes the status bar display for the Page Up and Down
keymap items to show "Pg↑" and "Pg↓" rather than just "P↑" "P↓". This
also makes the key slightly wider (like "Ctrl"). Will make up for the
width change by collapsing some multiple uses.

Pull Request: https://projects.blender.org/blender/blender/pulls/138554
2025-05-07 18:20:39 +02:00
Hans Goudey
e51d538ee8 Refactor: Move image runtime out of DNA
Like other runtime structs, it doesn't make sense to write this
data to files. And moving it out of DNA to an allocated C++ struct
means we can use other C++ features in it, like the new Mutex
type which I switched to in this commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/138551
2025-05-07 18:01:34 +02:00
YimingWu
518bef9ae9 Fix #138378: Grease Pencil: Correct logic of checking render requirement
`DRW_gpencil_engine_needed` only checks whether grease pencil is
excluded in the viewport or whether there's grease pencil ID exists,
this can not handle cases where grease pencil strokes are generated from
other types of object in geometry nodes. Now this function is split into
two `gpencil_engine_needed_viewport` and
`gpencil_excluded` calls to provide more granulated logic for
places that need them.

Pull Request: https://projects.blender.org/blender/blender/pulls/138386
2025-05-07 17:42:02 +02:00
Mattias Fredriksson
87d04eadd4 Fix: Prevent NURBS .obj importer from setting invalid degree/order
Default behavior in most edit mode operators is to adjust the order
if there is not enough points/knots to support it. If the degree is
incorrectly encoded in the file, import should update it to avoid
generating an invalid  NURBS curve.

Pull Request: https://projects.blender.org/blender/blender/pulls/138374
2025-05-07 17:41:39 +02:00
Hans Goudey
fbb659c4c5 Cleanup: Remove unused TaskPool user_mutex 2025-05-07 11:32:38 -04:00
Miguel Pozo
e231adc371 Revert "Overlay: Skip passes not needed"
This reverts commit c0d6675c84.
The DEG_id_type_any_exists function only takes the original type into
account.

Fix #138548
2025-05-07 17:05:48 +02:00
Guillermo Venegas
a46e3d2e78 Refactor: UI: Replace uiLayoutAbsolute and uiLayoutAbsoluteBlock with uiLayout class methods
This converts the public `uiLayoutAbsolute ` and `uiLayoutAbsoluteBlock`
functions to an object oriented API (an `uiLayout::absolute` and
`uiLayout::absolute_block` respectively), following recent changes.

`uiLayout::absolute` 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/138546
2025-05-07 17:03:15 +02:00
Clément Foucault
b3732f057e Fix #137984: Sculpt mode crash with certain mesh
This was caused by the material indices not referring to an existing
material slot. Clamping the value to the maximum material index for
the given object fixes the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/138544
2025-05-07 16:46:47 +02:00
Clément Foucault
58d32b482b Fix #138354: GPU: Race condition with SRGB builtin uniform
Multiple threads would be setting the globals
`g_shader_builtin_srgb_transform` and
`g_shader_builtin_srgb_is_dirty`.

These are use for color management inside the builtin
shaders. But the render thread could modify these
values even if its shader have no use of these.

The fix is to move these globals to the `gpu::Context`
class. This way we remove the race condition.
2025-05-07 16:43:42 +02:00
Bastien Montagne
9db53b8dca Add assert regarding consistency of ID type info.
Followup to @e09ccc9b3599c134e/@2b2963e2903, would have prevented the
issue by asserting immediately on Blender startup.

Would love to find a more static way to check that (i.e. error at
compile time), but think it would require quite a few more changes.
2025-05-07 16:40:22 +02:00
Sergey Sharybin
18110744a2 Sequencer: Support HDR in Sequencer Preview
The title is pretty self-explanatory: this change brings support of
displaying HDR content in the sequencer preview. Before this change
it was clamped to the 0..1 range, now it is unclamped sRGB, similar
to how image editor, viewport, and nodes backdrop works.

The general idea is to draw the sequencer content on a non-overlay
frame-buffer and tag viewport as having non-standard input color
space as the sequencer operates in a different space.

The way it is done mimics what happens from the draw manager side
for the nodes backdrop, but bypassing the image engine. Partially
because the image engine expects the Image data-block to be displayed,
but also because of performance: there are a lot of things going on
like float buffer creation, clamping etc. Overall the image engine is
not fast enough for the sequencer needs.

Code-side changes that worth mentioning to highlight the overall
direction for the possible future refactors in the area:

- Decouple arguments from the scene: editing, render data, color
  management etc are now passed as individual arguments.

  This is an anticipation of story tools project where this data
  might be coming from a different place.

- Move the entire preview region drawing to sequencer_preview_draw.cc

  Previously logic was split across sequencer_preview_draw.cc and
  space_sequencer.cc which was quite tricky to know what should go
  where.

- Split functions which had boolean argument to define their behavior
  into individual functions.

  Generally if a function has boolean argument used in a way

    if(foo) { do_something_(); } else { do_something_else() }

  it is a good indication that the function is to be split.

Pull Request: https://projects.blender.org/blender/blender/pulls/138094
2025-05-07 16:21:07 +02:00
Sergey Sharybin
ee9b5532bd Cleanup: Const-correctness in various sequencer utilities 2025-05-07 16:21:06 +02:00
Sergey Sharybin
24a28ea38d Cleanup: Const-correctness in ImBuf metadata drawing 2025-05-07 16:21:06 +02:00
Sergey Sharybin
5668cf0524 Cleanup: Simplify sequencer_ibuf_get() function call
Pass timeline frame. If an offset is needed handle it in the caller.
2025-05-07 16:21:06 +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
Laurynas Duburas
071c9f0929 Curves: Add custom knots to split operator
Adds custom knots support to Split operator. Works very well if the
selection starts and ends with clamped control points (knots repeated
`order - 1` times). In other cases some geometry is lost compared to
the original curve.

Pull Request: https://projects.blender.org/blender/blender/pulls/138230
2025-05-07 16:13:09 +02:00
Clément Foucault
dd205ab7f3 Fix: EEVEE: Flickering display of position pass
This is because the non-update branch in the display
shader was not updated to support the position pass.
2025-05-07 15:56:49 +02:00
Clément Foucault
ae652e4a09 Fix #138516: EEVEE: Viewport doesn't update when render pass is changed
The updates need to be manually detected since 2131ef0a20
because the depsgraph doesn't track the UI updates.
2025-05-07 15:56:49 +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
Bastien Montagne
2b2963e290 Fix (studio-reported) broken Lattice ID management.
Typo-mistake in e09ccc9b35. Carefully rechecked all ID types,
could not spot any other error, so hopefully we'll only have this single
glitch.
2025-05-07 14:51:27 +02:00
Clément Foucault
669a51904e Fix #138521: Overlay: Edit Mode Curves display in front of meshes
The lines were not drawn inside a depth aware framebuffer.

Splitting the display into 2 draw pass fixes the issue.
2025-05-07 13:57:02 +02:00
Clément Foucault
72e50a0285 Fix: EEVEE: Warning in shader C++ compilation 2025-05-07 13:38:52 +02:00
Clément Foucault
c5e9bc4113 Fix #138159: EEVEE: Crash when rendering points with volume shader
This is caused by the pointcloud attribute header not being added
to the volume shader.

The fix is to make volume shaders not require volume attribute
for geometry types that do not support it.

Pull Request: https://projects.blender.org/blender/blender/pulls/138212
2025-05-07 11:36:18 +02:00
Clément Foucault
5055770f5b GPU: Shader: Add support for basic namespace through preprocessor
Allows basic support for using `namespace X {}` and `X::symbol`
syntax.

Benefit:
- More sharing possible with host C++ code.
- Isolation of symbols when including shader files as C++.

Requirements:
- Nesting must be done using `namespace A::B{}` rather than
  `namespace A{ namespace B {}}`, which is unsupported.
- No support for `using namespace`.
- Support of `using X` and `using X = Y` inside of function scope.
- Support of `using X` and `using X = Y` inside of namespace scope.
  However, this is only to bring symbols from the same namespace
  declared in another block (potentially inside another file).
- Only support namespace elision for symbols defined and used
  inside of the same namespace scope.

Note that this is currently limited to blender GLSL files and
not for the shared headers. This is because we need to port a lot
of code to use namespaces before allowing this.

### Follow Up:
Nesting like `namespace A{ namespace B {}}` shouldn't be hard to
support and could be added if needed.

Rel #137446

Pull Request: https://projects.blender.org/blender/blender/pulls/137445
2025-05-07 10:41:47 +02:00
Pratik Borhade
ea439fdf0c Fix #91188: Change identifier prefix for some sculpt mode operations
With `MESH_OT` prefix, the shortcut was added to wrong
keymap ("object mode", see: `WM_keymap_guess_opname`).
idname of following operations has been changed, they are
only exposed in sculpt mode UI (also see their poll function:
`geometry_extract_poll`):
- `face_set_extract`
- `paint_mask_extract`
- `paint_mask_slice`

Pull Request: https://projects.blender.org/blender/blender/pulls/133852
2025-05-07 10:30:58 +02:00
Campbell Barton
8069bf801b Cleanup: use toolsettings variable in scene defaults versioning 2025-05-07 17:40:54 +10:00
Campbell Barton
8cc63c6848 Refactor: add a version of EDBM_selectmode_set_multi that takes objects
Support setting the select mode when the object array has already
been created, needed for #131642.
2025-05-07 17:03:29 +10:00
Eitan Traurig
dd43ea4e9e UI: Add "Remove All Materials" operator
Added a new operator `OBJECT_OT_material_slot_remove_all`
that removes all materials from the material slots of selected objects

This was inspired by a request proposal on RCS.

Pull Request: https://projects.blender.org/blender/blender/pulls/138402
2025-05-07 08:06:52 +02:00
Jacques Lucke
72f7d3dec7 Fix: Nodes: draw frame labels on top of links
A frame label that is hidden by links is not all that helpful.
On the other hand, if a link is partially hidden by a frame label,
that's typically not a problem at all.
2025-05-07 05:56:10 +02:00
Jacques Lucke
5fb8c8caa5 Cleanup: use new Mutex in file cache 2025-05-07 05:04:45 +02:00
Jacques Lucke
b7a1325c3c BLI: use blender::Mutex by default which wraps tbb::mutex
This patch adds a new `BLI_mutex.hh` header which adds `blender::Mutex` as alias
for either `tbb::mutex` or `std::mutex` depending on whether TBB is enabled.

Description copied from the patch:
```
/**
 * blender::Mutex should be used as the default mutex in Blender. It implements a subset of the API
 * of std::mutex but has overall better guaranteed properties. It can be used with RAII helpers
 * like std::lock_guard. However, it is not compatible with e.g. std::condition_variable. So one
 * still has to use std::mutex for that case.
 *
 * The mutex provided by TBB has these properties:
 * - It's as fast as a spin-lock in the non-contended case, i.e. when no other thread is trying to
 *   lock the mutex at the same time.
 * - In the contended case, it spins a couple of times but then blocks to avoid draining system
 *   resources by spinning for a long time.
 * - It's only 1 byte large, compared to e.g. 40 bytes when using the std::mutex of GCC. This makes
 *   it more feasible to have many smaller mutexes which can improve scalability of algorithms
 *   compared to using fewer larger mutexes. Also it just reduces "memory slop" across Blender.
 * - It is *not* a fair mutex, i.e. it's not guaranteed that a thread will ever be able to lock the
 *   mutex when there are always more than one threads that try to lock it. In the majority of
 *   cases, using a fair mutex just causes extra overhead without any benefit. std::mutex is not
 *   guaranteed to be fair either.
 */
 ```

The performance benchmark suggests that the impact is negilible in almost
all cases. The only benchmarks that show interesting behavior are the once
testing foreach zones in Geometry Nodes. These tests are explicitly testing
overhead, which I still have to reduce over time. So it's not unexpected that
changing the mutex has an impact there. What's interesting is that on macos the
performance improves a lot while on linux it gets worse. Since that overhead
should eventually be removed almost entirely, I don't really consider that
blocking.

Links:
* Documentation of different mutex flavors in TBB:
  https://www.intel.com/content/www/us/en/docs/onetbb/developer-guide-api-reference/2021-12/mutex-flavors.html
* Older implementation of a similar mutex by me:
  https://archive.blender.org/developer/differential/0016/0016711/index.html
* Interesting read regarding how a mutex can be this small:
  https://webkit.org/blog/6161/locking-in-webkit/

Pull Request: https://projects.blender.org/blender/blender/pulls/138370
2025-05-07 04:53:16 +02:00