Commit Graph

117572 Commits

Author SHA1 Message Date
Maxime-Cots
92aab7c3db USD: Add Capsule_1 and Cylinder_1 Shapes to USD importer
This PR adds support for 2 additional USD Prim Shape Schemas :
* Cylinder_1
* Capsule_1

Additional tests will be added afterwards but a simple test is simply to
import the resulting file:
```python
from pxr import Usd, UsdGeom
stage = Usd.Stage.CreateNew('shapes.usda')
UsdGeom.Xform.Define(stage, '/world')
UsdGeom.Cylinder_1.Define(stage, '/world/cylinder_1')
UsdGeom.Capsule_1.Define(stage, '/world/capsule_1')
stage.GetRootLayer().Save()
```

Linked issue : https://projects.blender.org/blender/blender/issues/134138

Co-authored-by: Nig3l <nig3lpro@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/134944
2025-02-21 22:54:09 +01:00
Jesse Yurkovich
a810737716 USD: Improved sanitation of names with leading digits
USD identifiers cannot start with a digit and, like all unsupported
characters, they will be turned into an `_`. This is a bit unfortunate
since object names like "1" or "2" both become "_" in the output file.
This not only generates a naming collision, which is not currently
handled, but it needlessly loses information even when there is no
collision.

Treat leading digits separately and turn names like "1" and "2" into
"_1" and "_2" respectively. This will allow us to eventually enable the
`light_tree_node_subtended_angle` render test which uses such names for
the lights. Another recent test required investigation and then rework
due to the same problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/134595
2025-02-21 20:17:42 +01:00
Sean Kim
dfa8991899 Cleanup: Remove unused CCGDerivedMesh Multires modified_flags property
Value was only ever set to 0 so corresponding cleanup functions had no
effect.

Pull Request: https://projects.blender.org/blender/blender/pulls/134889
2025-02-21 19:55:07 +01:00
Sean Kim
e1258f0858 Cleanup: Minor changes for sculpt flush functions
* Slightly changes naming to be more explicit in some places
* Updates comments
* Adds const where possible
* Reduces scope of variables
* Uses references where possible

Pull Request: https://projects.blender.org/blender/blender/pulls/134891
2025-02-21 19:51:45 +01:00
Brecht Van Lommel
66e150b5f4 Merge branch 'blender-v4.4-release' 2025-02-21 18:50:21 +01:00
Brecht Van Lommel
c988a04802 Fix #134120: Crash evaluating rigid body in animation render
This shared state between original data and depsgraphs was added in
98a0bcd425. Other physics systems also share
the pointcache, but not the simulation state to this extent, which leads
to this kind of crash.

The mutex lock is not a great solution, you don't really want both                                                                                                                                                                                                                                                                                   render and viewport to be filling the same cache in parallel. However
this kind of problem also exists in other physics systems, and solving
that is certainly beyond the scope of 4.4, and probably needs to wait
for a bigger physics rewrite. In general the recommendation is to bake
everything before rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/134779
2025-02-21 18:48:54 +01:00
Christoph Lendenfeld
9cd9aa40c4 Merge branch 'blender-v4.4-release' 2025-02-21 16:47:10 +01:00
Christoph Lendenfeld
981e06f3bd Fix #134758: renaming a node breaks animation
The issue was that in the macro used, the wrong ID was passed into
the rename function. Since nodetrees are a separate embedded ID,
the rename function couldn't resolve the RNA path and thus failed.

This broke keys and drivers when renaming nodes.
Not only for the compositor, but all node trees.

This was caused by 1c7c1829b6

Pull Request: https://projects.blender.org/blender/blender/pulls/134936
2025-02-21 16:46:14 +01:00
Jeroen Bakker
3e030e3de0 SubDiv: Use shader create info for edge fac shader
This PR migrates the subdiv_vbo_edge_fac.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134907
2025-02-21 16:26:28 +01:00
Jeroen Bakker
8299b30269 SubDiv: Use shader create info for lnor shader
This PR migrates the subdiv_vbo_lnor_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134916
2025-02-21 15:43:09 +01:00
Jeroen Bakker
8e72bf937f SubDiv: Use shader create info for triangle indices shader
This PR migrates the subdiv_ibo_tris_comp.glsl to use
shader create info. Due to naming collision shader_data
needs to be accessed directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134867
2025-02-21 14:55:18 +01:00
Clément Foucault
966a424f00 Fix: GPU: Printf Memory leak
The previous fix 8f00f068ad
doesn't work as the printf buffer gets recreated.

Ensure render boundaries at lower level and do the printf
flush manually.
2025-02-21 14:35:36 +01:00
Jeroen Bakker
c436972b2b SubDiv: Use shader create info for lines shader
This PR migrates the subdiv_ibo_lines_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134857
2025-02-21 14:16:57 +01:00
Clément Foucault
8f00f068ad Fix: GPU: Memory leak from shader printf buffer
The printf buffer were not flushed in some cases
before the context destruction.
2025-02-21 13:47:28 +01:00
Jeroen Bakker
b34bc67f67 Metal: Add support for packed_float3 as storage buffers
Subdivision shaders currently fail to compile using Metal as it doesn't recognize
packed_float3 as an internal data type. This PR includes packed_float3 as an
internal data type.

Without this `blender --debug-gpu-compile-shaders` will fail as it includes a namespace.
```
ERROR (gpu.shader): subdiv_normals_accumulate Compute Shader:
      |
      | source/blender/gpu/metal/mtl_shader_generator.mm:971:9: Error: no type named 'packed_float3' in 'MTLShaderComputeImpl'; did you mean simply 'packed_float3'?
      |
      |         device MTLShaderComputeImpl::packed_float3* normals[[buffer(MTL_storage_buffer_base_index+4)]],
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         packed_float3
      |
      | /System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/32023/Libraries/lib/clang/32023.196/include/metal/metal_packed_vector:145:58: Note: 'packed_float3' declared here
      |
      | typedef __attribute__((__packed_vector_type__(3))) float packed_float3;
      |                                                          ^
```

Pull Request: https://projects.blender.org/blender/blender/pulls/134925
2025-02-21 13:46:10 +01:00
Jacques Lucke
8be66a42c9 BLI: add utilities to find first (un)set bit in a bit span
This adds three new functions to find the first 0 or 1 bit in an arbitrarily
long bit span:

```cpp
blender::bits::find_first_0_index(BitSpan) -> std::optional<int64_t>
blender::bits::find_first_1_index(BitSpan) -> std::optional<int64_t>
blender::bits::find_first_1_index_expr(Expr, BitSpans...) -> std::optional<int64_t>
```

The two first ones are implemented in terms of the third. The `*_expr` variant
allows e.g. finding the first set bit when ORing two bit spans together without
computing the entire intermediate result first. Or it can be used to find the
first index where two bit spans are different.

Pull Request: https://projects.blender.org/blender/blender/pulls/134923
2025-02-21 13:36:03 +01:00
Philipp Oeser
e4b36d677e Merge branch 'blender-v4.4-release' 2025-02-21 12:40:35 +01:00
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