Commit Graph

118328 Commits

Author SHA1 Message Date
Guillermo Venegas
4245f1320e Fix #135742: Avoid unespecified font style for side panel categories text draw
Apply widget style to avoid drawing with the incorrect text size or
weight for side panel categories.

Pull Request: https://projects.blender.org/blender/blender/pulls/135824
2025-03-13 21:44:23 +01:00
Miguel Pozo
d7efed77b8 Merge branch 'blender-v4.4-release' 2025-03-13 19:59:10 +01:00
Miguel Pozo
08bd2d687d Fix #135848: Selection-Next: Backface culling (2)
Alternative fix for #135848.
Initially fixed by #135867, but broken again by #135917.

This performs the early return manually for the depth prepass.

Pull Request: https://projects.blender.org/blender/blender/pulls/135924
2025-03-13 19:26:15 +01:00
Bastien Montagne
36826f0237 BKE ID management: Add an overload of BKE_libblock_find_session_uid without idtype.
Allows to search for a session_uid in a whole Main, when the target ID
type is not known.
2025-03-13 19:03:12 +01:00
Clément Foucault
e5ae55af88 Cleanup: Overlay: Resolve warning about unused variable with C++ shader 2025-03-13 16:34:13 +01:00
Clément Foucault
9f97d19ebd Cleanup: DRW: Resolve warning about unused variable in release 2025-03-13 16:33:46 +01:00
Clément Foucault
dfb5be53cd Fix #135922: DRW: Blender crashes when saving a file
Was using the wrong viewport variable (that could be
nullptr) for the drawing.
2025-03-13 16:27:04 +01:00
Clément Foucault
cdacaa0a13 Fix: DRW: Warning about missing declaration in lite build 2025-03-13 16:27:04 +01:00
Jeroen Bakker
7857d9e3bf Fix: Vulkan: Std430 push constant packing
When using vec3[] as push constants it selected the incorrect
branch resulting in uploading incorrect data to the shader.

This resulted in not seeing the clipping bounds in vulkan.

Ref: #131111
2025-03-13 16:21:28 +01:00
Jeroen Bakker
330583961a Fix: Vulkan: Incorrect background blending
`GPU_BLEND_BACKGROUND` set incorrect blend mode, resulting
in incorrect rendering when activating bordered rendering.

Ref: #131111
2025-03-13 16:21:28 +01:00
Hans Goudey
70095e9041 Cleanup: DRW: Use data span to fill lattice line index buffer
Pull Request: https://projects.blender.org/blender/blender/pulls/135921
2025-03-13 16:19:18 +01:00
Hans Goudey
284ac406d6 Mesh: Avoid function call overhead when extracting UV lines indices
Similar to other changes from #116901.
2025-03-13 16:19:17 +01:00
Miguel Pozo
083878c46b Merge branch 'blender-v4.4-release' 2025-03-13 16:14:24 +01:00
Miguel Pozo
ce41fbaefa Revert "Fix #135848: Selection-Next: Backface culling"
This reverts commit
44b64ca9df.
The fix is broken by
04a57dd937.
2025-03-13 16:11:33 +01:00
Sean Kim
7ea75dccc2 Cleanup: Remove OBEDIT_FROM_OBACT usage in info_stats.cc
Pull Request: https://projects.blender.org/blender/blender/pulls/135812
2025-03-13 15:59:15 +01:00
Clément Foucault
04a57dd937 Fix #135898: Selection: Make selection not depth aware
No depth awareness is wanted during object mode selection.
The hits are depth ordered in some selection mode but none
is supposed to reject based on depth.

Pull Request: https://projects.blender.org/blender/blender/pulls/135917
2025-03-13 15:16:05 +01:00
Jeroen Bakker
15d88e544a GPU: Storage buffer allocation alignment
Since the introduction of storage buffers in Blender, the calling
code has been responsible for ensuring the buffer meets allocation
requirements. All backends require the allocation size to be divisible
by 16 bytes. Until now, this was sufficient, but with GPU subdivision
changes, an external library must also adhere to these requirements.

For OpenSubdiv (OSD), some buffers are not 16-byte aligned, leading
to potential misallocation. Currently, this is mitigated by allocating
a few extra bytes, but this approach has the drawback of potentially
reading unintended bytes beyond the source buffer.

This PR adopts a similar approach to vertex buffers: the backend handles
extra byte allocation while ensuring data uploads and downloads function
correctly without requiring those additional bytes.

No changes were needed for Metal, as its allocation size is already
aligned to 256 bytes.

**Alternative solutions considered**:

- Copying the CPU buffer to a larger buffer when needed (performance impact).
- Modifying OSD buffers to allocate extra space (requires changes to an external library).
- Implementing GPU_storagebuf_update_sub.

Ref #135873

Pull Request: https://projects.blender.org/blender/blender/pulls/135716
2025-03-13 15:05:16 +01:00
Omar Emara
e9af802330 Refactor: Compositor: Use generic pointer with MF operation
This patch refactors how single values are passed to MF operations by
utilizing generic pointers. This avoids boilerplate and makes it easier
to add new types.
2025-03-13 15:47:46 +02:00
Miguel Pozo
44b64ca9df Fix #135848: Selection-Next: Backface culling
Allow extending the DRWState on select_bind so backface culling can be used when needed.

Note: There's still a difference in behavior with Overlay Legacy, causing backface culled flat objects to still be selectable at the edges, due to the "MeshFlat" workaround.
Pull Request: https://projects.blender.org/blender/blender/pulls/135867
2025-03-13 14:23:17 +01:00
Jesse Yurkovich
e492794e1e Fix: Resolve several int -> uint conversion shader warnings
Resolves several int -> uint conversion warnings. Warnings like the
following will be printed otherwise:

```
      |
  225 |   uint shadow_type = flags & 0xF;
      |                      ^
      | gpu_shader_text_vert.glsl:17:22: Warning: some implementations
        may not support implicit int -> uint conversions for `&'
        operators; consider casting explicitly for portability
```

Pull Request: https://projects.blender.org/blender/blender/pulls/135890
2025-03-13 14:22:21 +01:00
Clément Foucault
c02dea2e26 Fix: GL: Race condition in shader compilation
The patch strings did not have thread safe initialization.
The string might hav been returned null or incomplete
which might trigger compilation errors.
2025-03-13 14:04:59 +01:00
Omar Emara
9bf05f4def Refactor: Compositor: Provide const variants for data accessors
This patch provides const variants to the cpu_data accessors that
returns GSpan. This is done to better const correctness. Some code need
non-const data even for read-only data, so we have to const cast those
for the moment.
2025-03-13 14:49:01 +02:00
Clément Foucault
94c7c84bcd Refactor: DRW: Simplify the DRWContext classes and methods
This refactor part of `draw_manager_c.cc` to make it more understandable
and less bug prone.

- Splits the context handing to `draw_gpu_context.cc`
- Rename `draw_manager_c.cc` to `draw_context.cc`
- Merge `DRWContextState` into `DRWContext`
- Merge lots of static functions into `DRWContext` to avoid global access
- Deduplicate code between entry point functions
- Move context init logic to `DRWContext` constructor
- Move resource init logic to `DRWContext::acquire_data`
- Move extraction `TaskGraph` out of `DRWContext`
- Reduce / centralize complexity of enabling draw engines
- Reduce the amount of `drw_get` calls
- Remove unused code

Pull Request: https://projects.blender.org/blender/blender/pulls/135821
2025-03-13 13:47:02 +01:00
Jeroen Bakker
e1d2eee02b Cleanup: Vulkan: Remove unused variable 2025-03-13 13:31:13 +01:00
Julian Eisel
1ca05d3940 UI: Fix double padding in file browser drawing
Paddings were applied a bit oddly, resulting in a double padding for the
drawing. Each "tile" (the space to draw the file in) already had a padding
applied (`FileLayout.tile_border_x`), we'd apply another one to it. This second
padding should only be used for spacing of individual items *inside* the tile.

Code makes more sense too now, there are fewer arbitrary/eyeballed numbers to
make things "look good".

Pull Request: https://projects.blender.org/blender/blender/pulls/135915
2025-03-13 13:14:53 +01:00
Sybren A. Stüvel
ac4f22cec4 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-13 12:53:59 +01:00
Sybren A. Stüvel
30ba81f805 Fix #135894: Assigned Action can mute NLA strip when reusing the same Action
Fix an issue when the NLA is used in conjunction with a directly-
assigned Action.

When the directly-assigned Action is also used in an NLA strip, that
strip would not be evaluated any more. This was even the case when
different slots were used, which entirely muted the strip when there
was no slot directly assigned. Now the "this has been handled already"
logic considers the action and the slot.

Pull Request: https://projects.blender.org/blender/blender/pulls/135911
2025-03-13 12:50:47 +01:00
Sybren A. Stüvel
565377b8f1 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-13 11:27:13 +01:00
Sybren A. Stüvel
1d20304442 Fix #135894: after "Merge Animation" animation does not play properly
The "Merge Animation" operator now properly tags the affected Actions
with `ID_RECALC_ANIMATION_NO_FLUSH` so that new 'evaluated copies' are
created. Because this was missing, the animation evaluation code didn't
see the moved channelbags yet, which caused animation playback to be
broken.

Pull Request: https://projects.blender.org/blender/blender/pulls/135906
2025-03-13 11:26:42 +01:00
Omar Emara
9f254ef08c Refactor: Compositor: Use BKE conversion for images
This patch refactors the conversion code for images to use BKE
conversion rules. This reduces boilerplate and makes it easier to add
new types.
2025-03-13 12:17:35 +02:00
Jeroen Bakker
1ea1f4c92c Refactor: GHOST/Vulkan: Wrap handles in a struct
Vulkan handles are currently only requested once. In the future OpenXR
also needs acces to these handles and additional handles will be needed
when introducing copy queues and async compute.

This PR will collect the handles in a struct to ensure we don't need to
alter the GHOST interface for every change.

Pull Request: https://projects.blender.org/blender/blender/pulls/135905
2025-03-13 11:06:20 +01:00
Omar Emara
8f2f0520da Cleanup: Unused declaration
Removes a now unused declaration from the previous commit.
2025-03-13 11:49:46 +02:00
Omar Emara
cbd01d2a6f Refactor: Compositor: Reduce boilerplate in conversion code
This patch refactors GPU implicit conversion code by generating the name
of the shaders on the fly using fmt. This reduces boilerplate and makes
it easier to add new types.
2025-03-13 11:38:12 +02:00
Campbell Barton
ff8baa6791 Cleanup: pass BMUVOffsets by const reference 2025-03-13 17:06:32 +11:00
Campbell Barton
78c3f6a1ee Cleanup: adjust order of terms for BMesh UV map function calls
Order more generic terms first for better ordering, more useful
completion.
2025-03-13 15:23:46 +11:00
Campbell Barton
6ec1bc669e UV: correct checks for no-selection
There is no need to check "Sync Selection" as the check for no selected
vertices is also valid when sync-selection is disabled.
2025-03-13 14:57:10 +11:00
Campbell Barton
571bab615c UV: skip adding UV data layers when sync-select is used
When sync select is enabled, the data layers aren't accessed
so there is no need to add them.

Also skip adding a "pin" layer when clearing pinned UV's.
2025-03-13 14:40:56 +11:00
Campbell Barton
4a8e50e5de UI: show an error when rip is attempted with sync select
This was failing with an unhelpful error.
2025-03-13 13:50:16 +11:00
Campbell Barton
13b4da2568 Docs: update bmesh_class.hh header
- Minor corrections & clarifications.
- Use doxygen docs.
2025-03-13 13:41:19 +11:00
Campbell Barton
6ef7dae8ef Cleanup: spelling in comments (make check_spelling_*) 2025-03-13 13:41:17 +11:00
Harley Acheson
9dbd20b369 UI: Hide NLA Scrollbars When Very Short
With commit f40cd831fd we are hiding scrollbars when timeline and many
other editors are sized to be very short. This PR just does the same
for NLE.

Pull Request: https://projects.blender.org/blender/blender/pulls/135834
2025-03-13 01:27:12 +01:00
Pratik Borhade
a0fdbf0fd2 UI: Include obdata in material properties context path
Context path in the header of material properties tab always indicates
material is on object. Include object.data in context path when material
is on mesh for example.

Pull Request: https://projects.blender.org/blender/blender/pulls/134968
2025-03-12 23:09:58 +01:00
Hans Goudey
5f6e94ca58 Grease Pencil: Avoid GPU API overhead when extracting index buffers
Similar changes done elsewhere (#116901), replace usage of the GPU API's
`GPU_indexbuf_add_generic_vert` function by simply writing the index
data that we need. This avoids a function call and min/max tests for
every index added.

Pull Request: https://projects.blender.org/blender/blender/pulls/135404
2025-03-12 21:55:18 +01:00
Hans Goudey
2cf5838b87 Grease Pencil: Slightly optimize IndexMask usage in draw extraction
Instead of computing an index mask for all curves, then returning an
intersection with the visible curves, just use the visible curves as
a universe for the original calculation. Also add another early out
for when there are no NURBS curves.
2025-03-12 21:55:18 +01:00
Hans Goudey
32e96f1ff7 Grease Pencil: Avoid overhead counting visible points for drawing
Currently the drawing data extraction code uses the offset indices API
quite inefficiently, copying the size of every selected every curve, then
accumulating those sizes. Instead just use the existing API function that
counts the size of all selected curves. Also for the weight overlay, avoid
doing the same calculation twice.
2025-03-12 21:55:18 +01:00
Bastien Montagne
ef1d5432cb RNA: LibraryWeakReference: make path and ID name editable.
There is no real reason to keep these read-only, they are not exposed in
the UI anyway, and being able to edit them can become necessary in a
pipeline mamangement context.
2025-03-12 17:50:50 +01:00
Bastien Montagne
4c4e3142df Cleanup: makesrna: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/135870
2025-03-12 17:19:06 +01:00
Omar Emara
b37afc86d1 Refactor: Compositor: Replace proxy results with data sharing
This patch refactors the result class to replace proxy results with the
possibility of doing data sharing through a shared heap allocated data
reference count. This is more robust and simpler since proxy results no
longer need to be handled as a special case in a lot of the results
code. Additionally, it allows stronger const correctness since inputs to
operations can now be const.

This is somewhat similar to implicit sharing used in other parts of
Blender, so we can look into using that in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/135778
2025-03-12 16:42:26 +01:00
Bastien Montagne
f36f9bdb87 Fix (unreported) MOD_surface: raw calloc on non-trivial data.
It seems that this was 'fine', as non-trivial data in `BVHTreeFromMesh`
appear to be 'safe' when simply zero-initialized instead of being
properly constructed.

Note that this 'calloced' data was already 'MEM_deleted', this is
currently considered as a valid use-case unfortunately, otherwise the
issue would have been detected earlier.

Directly use 'copy' `MEM_new` code instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/135862
2025-03-12 15:43:34 +01:00
Bastien Montagne
58d34984d2 Cleanup: modifiers: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.
2025-03-12 15:43:33 +01:00