Commit Graph

120055 Commits

Author SHA1 Message Date
Philipp Oeser
5cfc7b7c65 Fix #134825: Assert in draw code when enabling "Paint Mask"
This happend for meshes without UVs.
The call to `texpaint_request_active_uv` in
`DRW_mesh_batch_cache_get_surface_edges` is from 9c010c44f4.

Looks like this is not needed (assumed to be copy paste error).

Pull Request: https://projects.blender.org/blender/blender/pulls/134856
2025-02-21 12:40:21 +01:00
Jeroen Bakker
310d103600 SubDiv: Use shader create info for normal accumulation shader
This PR migrates the subdiv_normal_accumulation_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134837
2025-02-21 12:38:57 +01:00
Sybren A. Stüvel
963f291901 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-21 12:34:32 +01:00
Andy Beers
d6da9710d0 Modeling: Support normalization with locked vertex groups in N-panel
In the Vertex Weights panel of the 3D Viewport sidebar, allow for
normalization of vertex groups when any number of vertex groups are
locked.

As with other normalization operators that handle locked vertex groups,
locked weights are summed, and whatever space is left between that sum
and 1.0 is used to normalize the unlocked weights.

Pull Request: https://projects.blender.org/blender/blender/pulls/134535
2025-02-21 12:33:40 +01:00
Omar Emara
367b6d2b55 Cleanup: Unused warning in release builds 2025-02-21 13:05:47 +02:00
Sybren A. Stüvel
6225c3e667 Refactor: make FCurve and Channelbag 'ensure' functions return a reference
Make `action_channelbag_ensure()` and `action_fcurve_ensure()` return a
reference. Earlier it returned pointer that should never be `nullptr`,
but in certain cases (which would indicate a bug, as the function's
preconditions aren't met) could technically still be a `nullptr`.

Instead, the preconditions are checked with `BLI_assert()`, and a
release build will simply assume that they are met. This simplifies the
code of the functions themselves, as well as the callers.

For reference: this was discussed in !134866.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/134918
2025-02-21 11:55:56 +01:00
Sybren A. Stüvel
73bd35e63f Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-21 11:22:39 +01:00
Sybren A. Stüvel
f046fa5272 Refactor: pass FCurveDescriptor as const reference instead of value
Over time the `FCurveDescriptor` class has grown, and some concern was
raised (!134866) about the performance impact of passing it by value.
It's now passed by const reference instead.

No functional changes. I did find some non-`const` uses that are now
also `const`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134913
2025-02-21 11:22:13 +01:00
Clément Foucault
c3eba77c2d Mesh Edit Selection: Use last_update for update detection
Rel #134690

Pull Request: https://projects.blender.org/blender/blender/pulls/134881
2025-02-21 10:50:15 +01:00
Jeroen Bakker
3969e30c6f SubDiv: Add base for polygon offset
Subdiv shader library contains an optional part that shaders can include.
As we are migrating each shader at a time there are now multiple PRs doing
the same thing. Best to add the changes to main already so it doesn't add
confusion during review.

Pull Request: https://projects.blender.org/blender/blender/pulls/134906
2025-02-21 10:21:44 +01:00
Pratik Borhade
b17ee902c0 Fix #134898: Grease Pencil: Select Similar doesn't work in stroke mode
Greyed out in UI due to wrong poll function.

Pull Request: https://projects.blender.org/blender/blender/pulls/134899
2025-02-21 10:20:30 +01:00
Omar Emara
d0ade434f7 BKE: Add type conversion rules for float4
This patch adds conversion rules for the float4 type in BKE type
conversion. This is needed for use in the compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/134862
2025-02-21 07:41:34 +01:00
Sean Kim
4712f4a75a Cleanup: Various non-functional changes for multires.cc
This commit contains the following changes:
* Reduces scope of variables where possible, joining declaration and
  assignment where necessary.
* Uses const for parameters and local variables where possible.
* Uses static_cast or reinterpret_cast where possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/130487
2025-02-21 01:08:19 +01:00
Sean Kim
6b59fd5c5e Cleanup: Minor tidying up in paint.cc modifier methods
* Reduces scope of variables
* Joins declaration and assignment where possible
* Uses static_cast and reinterpret_cast instead of C-style cast
* Uses const where possible
* Uses reference instead of pointer where possible

Pull Request: https://projects.blender.org/blender/blender/pulls/134816
2025-02-21 00:31:58 +01:00
Campbell Barton
4fab3b04b3 Cleanup: avoid duplicate calls to WM_keyconfig_active
Reuse the result of WM_keyconfig_active instead of calling it for
every keymap while reconfiguring keymaps.
2025-02-21 10:15:01 +11:00
Brecht Van Lommel
83874e6ce5 Merge branch 'blender-v4.4-release' 2025-02-20 19:21:33 +01:00
Brecht Van Lommel
878e5dc0c5 Fix #134596: Crash baking light probe while rendering animation
Pull Request: https://projects.blender.org/blender/blender/pulls/134874
2025-02-20 19:20:19 +01:00
Sybren A. Stüvel
3473680f39 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-20 17:07:03 +01:00
Sybren A. Stüvel
94563dedca Refactor: rename BKE_fcurve_bezt_shrink to ..._resize and allow growing
The `BKE_fcurve_bezt_shrink()` function had an artificial limitation to
only allow shrinking the `bezt` array. That limitation is now removed,
and therefore the function renamed to `BKE_fcurve_bezt_resize()`.

A note was added to the documentation that newly added array elements
should be initialized by the caller.

Pull Request: https://projects.blender.org/blender/blender/pulls/134864
2025-02-20 17:04:27 +01:00
Sybren A. Stüvel
2185143fc2 Refactor: split animrig::action_fcurve_ensure() into two components
Split the majority of `animrig::action_fcurve_ensure()` into a new
function `action_channelbag_ensure()`. This ensures that the Action has
a layer, keyframe strip, action slot, and channelbag for the given ID.

`animrig::action_fcurve_ensure()` now just calls into that function, and
then ensures that there is an F-Curve in that channelbag.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/134864
2025-02-20 17:04:23 +01:00
Bastien Montagne
318ae49f1e Cleanup: Remove void * handling from MEM_freen<T>.
Followup to 48e26c3afe, and discussions in !134771 about keeping
'C-style' and 'C++ template type-safe style' implementations of our
guardedalloc separated. And it makes `MEM_freeN<T>` code simpler.

Also skip type-checking in `MEM_freeN<T>` only with MSVC, as clang-cl on
windows-arm64 does work fine with DNA structs using
`DNA_DEFINE_CXX_METHODS`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134861
2025-02-20 16:42:22 +01:00
Brecht Van Lommel
4b10c63617 Merge branch 'blender-v4.4-release' 2025-02-20 16:34:00 +01:00
Gracjan Jeżewski
4b348453db Fix: Hydra: Make final render run render loop
Hydra's viewport and final engines conflict on whether the rendering loop
is internal or external. The old approach works for Hydra Delegates that
converge with a single sample (hdStorm) but causes engines relying on sample
accumulation (hdEmrbee) to become stuck.

This minimal change retains compatibility with delegates like Storm while
replicating the behavior of the viewport engine in the final engine.

Pull Request: https://projects.blender.org/blender/blender/pulls/134804
2025-02-20 16:32:24 +01:00
Janne Nylander
9924ad9baf Fix: Grease Pencil: "Extrude" operator breaks vertex group weights
The Grease Pencil extrusion operator didn't transfer the vertex group names
from the old `CurvesGeometry` to the new one, resulting in the `gather_attributes`
function not transferring the vertex group weights correctly. This PR adds
`BKE_defgroup_copy_list` to the operator to remedy this.

Pull Request: https://projects.blender.org/blender/blender/pulls/134695
2025-02-20 16:27:11 +01:00
Pratik Borhade
695d53f493 Fix #134822: Crash when trying to Join empty PointClouds or Curves
Make sure selected objects are not empty, otherwise cancel the operation
with error message.

Pull Request: https://projects.blender.org/blender/blender/pulls/134831
2025-02-20 16:19:26 +01:00
Clément Foucault
91de4a50ab Cleanup: DRW: Make Open subdiv evaluator part of a DRW module
This avoids the global variable access with race condition.
Rel #134690

Pull Request: https://projects.blender.org/blender/blender/pulls/134855
2025-02-20 15:04:27 +01:00
Omar Emara
31aa6d9aee Cleanup: Compositor: Deduplicate CPPType getters 2025-02-20 16:01:51 +02:00
Hans Goudey
28d7ae7478 Cleanup: Improve naming for sculpt draw index creation 2025-02-20 08:24:19 -05:00
Hans Goudey
ab979d6742 Fix #134828: Dynamic topology wireframe overlay crash
Mistake in a369397301.
2025-02-20 08:16:49 -05:00
Omar Emara
370748cbb6 Compositor: Support Vector outputs for Image node
This patch adds support for vector outputs in the Image node.
Previously, only float and color outputs were supported, and vector
outputs were implicitly treated as color ones.

Pull Request: https://projects.blender.org/blender/blender/pulls/134501
2025-02-20 14:10:50 +01:00
Lukas Tönne
b7b60e2a3c Fix #134808: Grease Pencil: Interpolation tool crashes when stroke has zero length
The interpolation tool is using stroke length to map points between strokes with
uneven number of points. This fails when a source stroke has zero length (all points
in the same location).

Added a special case check to ensure uniform mapping by index is used in this case.
Segment mapping has been moved to a separate function for clarity.

Pull Request: https://projects.blender.org/blender/blender/pulls/134849
2025-02-20 13:49:53 +01:00
Omar Emara
fc02027d1c Cleanup: Compositor: List all types in switch case
Replace default cases with all types to make adding new types easier.
2025-02-20 14:32:39 +02:00
Omar Emara
5e8f96277d Compositor: Reduce vector type components to 3
Previously, the vector type in the compositor had 4-components to
accommodated float4 types, while the last component was ignored for the
rest of the vector types. But now that we have a dedicated type for
float4 in #134486. We can reduce that vector type to 3-components.

Pull Request: https://projects.blender.org/blender/blender/pulls/134570
2025-02-20 13:23:54 +01:00
Sybren A. Stüvel
611a138719 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-20 12:54:26 +01:00
Jeroen Bakker
e39669e3c3 SubDiv: Use shader create info for SubdivNormalsFinalize shaders.
This change migrates the first 2 subdiv shaders  to use the ShaderCreateInfo.
Other shaders will follow in separate PRs.

- Should compile when using `WITH_GPU_SHADER_CPP_COMPILATION`
- A `subdiv_` prefix is added only to the functions related to `PosNorLoop`.
    But eventually the prefix should also be added to other lib functions.
- Due to Metal restrictions `subdiv_set_vertex_*` is implemented using a
    functional paradigma. Our Metal backend only supports `inout` qualifier
    on thead local data structures.

Pull Request: https://projects.blender.org/blender/blender/pulls/134218
2025-02-20 12:30:51 +01:00
Sybren A. Stüvel
3dbede128e Fix #134581: Regression: Animation breaking going from 4.3 to 4.4
Fix an issue where the versioning of Action & slot assignments did not
use RNA properties to do the slot assignment. This caused certain
on-update callbacks to be missed, which in turn meant that an Action
constraint could remain disabled even though its action slot assignment
had been corrected.

This is now resolved by actually using RNA to set the assigned slot in
the versioning code.

Unfortunately that does mean that any reporting done will be by the
generic RNA code as well, and won't be specific to versioning. This
shouldn't be much of an issue in practice, as any warning was only shown
in the rare case of mis-matched `action.idroot` properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/134759
2025-02-20 11:58:01 +01:00
Jacques Lucke
88157430c1 Geometry Nodes: eagerly update bounding box after CSV import
This avoids computing the bounding box later (if the positions are not changed).
Since the positions are are zero, the bounding box is just the origin point too.
2025-02-20 11:45:21 +01:00
Anthony Roberts
c8929b856a Merge branch 'blender-v4.4-release' 2025-02-20 10:27:08 +00:00
Bastien Montagne
8045576c60 Cleanup: Avoid some void pointer freeing for type safety
Essentially add some API to properly free non-public data, instead of directly calling `MEM_freeN` on them.

Based on @brecht code from
https://projects.blender.org/mont29/blender/compare/tmp-guardedalloc-api...brecht:free-void

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/134765
2025-02-20 11:24:34 +01:00
Jeroen Bakker
b1eaf58aa4 Fix #134586: EEVEE: Crash when rendering large resolutions
EEVEE crashes when it is not able to allocate buffers. Previously we had a
message showing to the user that it tries to allocate a texture larger than
supported by the GPU. But was not implemented for EEVEE-next. This fix will
add back this error message.

![image.png](/attachments/723c10a4-2b44-49c4-a30f-6e8178055d8a)

Pull Request: https://projects.blender.org/blender/blender/pulls/134725
2025-02-20 11:18:26 +01:00
Jeroen Bakker
3ca5f6f62e Cleanup: GPU: Reduce compilation warnings
When compiling shaders using GCC there are warnings about functions
being declared twice. This PR will remove those warnings as they are
false positives. The warnings exists to identify typing errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/134832
2025-02-20 11:17:49 +01:00
Jacques Lucke
46ae0a86ca Geometry Nodes: improve multi-threading and avoid redundant work in CSV import
The position attribute was not initialized in parallel. Also there was an accidental
single threaded copy of each attribute because a `std::move` didn't work because
the variable was `const`.
2025-02-20 10:52:15 +01:00
Omar Emara
a5ecde48ae Compositor: Add Float4 type
The compositor previously overloaded the vector type to represent
multiple dimensions that are always stored in a 4D float vector. This
patch introduce a dedicated type for float4, leaving the vector type to
always represent a 3D vector, which will be done in a later commit.

This is not exposed to the user as a separate socket type with a
different color, it is only an internal type that uses the same vector
socket shape and color.

Since the vector socket represents both 4D and 3D vectors, code
generally assumes that such sockets represents 3D vectors, and the
developer is expected to set it to a 4D vector if needed in the node
operation constructor, or use the newly added skip_type_conversion flag
for nodes that do not care about types, like the File Output node.
Though this should be redundant once we add a dimension property for
vector sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/134486
2025-02-20 10:38:40 +01:00
Bastien Montagne
48e26c3afe MEM_guardedalloc: Refactor to add more type-safety.
The main goal of these changes are to improve static (i.e. build-time)
checks on whether a given data can be allocated and freed with `malloc`
and `free` (C-style), or requires proper C++-style construction and
destruction (`new` and `delete`).

* Add new `MEM_malloc_arrayN_aligned` API.
* Make `MEM_freeN` a template function in C++, which does static assert on
  type triviality.
* Add `MEM_SAFE_DELETE`, similar to `MEM_SAFE_FREE` but calling
  `MEM_delete`.

The changes to `MEM_freeN` was painful and useful, as it allowed to fix a bunch
of invalid calls in existing codebase already.

It also highlighted a fair amount of places where it is called to free incomplete
type pointers, which is likely a sign of badly designed code (there should
rather be an API to destroy and free these data then, if the data type is not fully
publicly exposed). For now, these are 'worked around' by explicitly casting the
freed pointers to `void *` in these cases - which also makes them easy to search for.
Some of these will be addressed separately (see blender/blender!134765).

Finally, MSVC seems to consider structs defining new/delete operators (e.g. by
using the `MEM_CXX_CLASS_ALLOC_FUNCS` macro) as non-trivial. This does not
seem to follow the definition of type triviality, so for now static type checking in
`MEM_freeN` has been disabled for Windows. We'll likely have to do the same
with type-safe `MEM_[cm]allocN` API being worked on in blender/blender!134771

Based on ideas from Brecht in blender/blender!134452

Pull Request: https://projects.blender.org/blender/blender/pulls/134463
2025-02-20 10:37:10 +01:00
Dalai Felinto
6be8dd16e7 Fix (experimental) Point Cloud properties editor not showing
This was introduced on: 1584cd9aa5.
2025-02-20 09:32:21 +01:00
Omar Emara
263d9b9ccc Merge branch 'blender-v4.4-release' 2025-02-20 08:30:51 +02:00
Omar Emara
f0e92c695d Fix: File Output node crash when saving vector image
The File Output node crashes when saving a 16-bit vector image in an
RGBA image. That's because the OIIO writer assumes 4-channel buffer
while the buffer provided by the node is only 3-channel. To fix this,
the OIIO writer is extended to support all possible combination of
source and target channels.

Pull Request: https://projects.blender.org/blender/blender/pulls/134789
2025-02-20 07:29:34 +01:00
Sean Kim
0dd326592a Undo: Add explicit filtering for IDs and RNA structs marked as skippable
In the past, around the time that 2.80 was released, 4a08b974f4
introduced the idea of filtering out certain editor changes inside
the paint modes and edit mode (e.g. changing brush sizes in the editor).

This commit is the first in a series to attempt to refine this behavior
so that only certain editor settings are filtered out from the undo
stack.

In total, it does the following:
* Adds the Brush datablock to the list of IDs that do not have undo
  pushes.
* Adds support to filter out RNA structs that do not have the
  `STRUCT_UNDO` property applied (currently, just the 3D Cursor).

This has the following effects:
* Changing brush settings inside the Image Editor no longer causes
  undo pushes, becoming consistent with the other paint modes.
* Changing brush settings while in object mode in the outliner data
  block view no longer causes undo pushes.

Co-authored-by: Campbell Barton <campbell@blender.org>
2025-02-20 07:12:56 +01:00
Campbell Barton
3f6a152bf0 Cleanup: avoid redundant file-type flag calculation 2025-02-20 16:38:59 +11:00
Harley Acheson
80ae7ab04f Merge branch 'blender-v4.4-release' 2025-02-19 17:06:17 -08:00