Commit Graph

113137 Commits

Author SHA1 Message Date
Clément Foucault
318eab5584 Fix: #126455: Missing refraction with only emissive material
When the opaque layer was populated with only emissive
material, no raytracing was used for it and no feedback
buffer was needed. Thus, the refraction layer had nothing
to raytrace against.

This fixes it by forcing the use of feedback buffer in this
corner case.

Pull Request: https://projects.blender.org/blender/blender/pulls/127771
2024-09-18 12:29:02 +02:00
Sean Kim
b5d418a83f Refactor: Sculpt: Specialize pose face set IK chain creation
Part of #118145.

Doing so removes the last usages of some dependent code as well, namely
the `SCULPT_VERTEX_NEIGHBORS_ITER` macro and the `PBVHVertRef` version
of the `flood_fill` algorithms. The now dead & unused code, as well as
their related helper functions, structs, and defines have been removed.

Additionally, a helper `vert_face_set_get` method for multires has been
added to be consistent with the other provided APIs

Pull Request: https://projects.blender.org/blender/blender/pulls/127781
2024-09-18 05:33:15 +02:00
Jacques Lucke
9db50bed04 Fix: Geometry Nodes: use better hash for InstanceReference
Before, sometimes instance references that would compare equal could
have different hashes.
2024-09-17 23:01:45 +02:00
Pratik Borhade
2ba69519a8 Fix #127678: Auto-Save Preferences does not work for few anim properties
`U.runtime.is_dirty` is not tagged dirty when some animation preferences
are changed. To fix this, pass `rna_userdef_update` updated function
which will tag preference dirty with the help of `USERDEF_TAG_DIRTY`
macro.

Pull Request: https://projects.blender.org/blender/blender/pulls/127754
2024-09-17 20:31:13 +02:00
Lukas Tönne
6b63fa8f85 GPv3: Interpolate Sequence operator
This is a variation of the modal "Interpolate" operator, where a series
of keyframes is generated according in stead of a single keyframe.
The behavior should be the same as the GPv2 operator.

Much of the code is shared between the "Interpolate" and "Interpolate
Sequence" operators now (utility functions section at the top).

Pull Request: https://projects.blender.org/blender/blender/pulls/127709
2024-09-17 20:20:18 +02:00
Hans Goudey
d15681a459 Sculpt: Extract deformation position data and logic to a class
In an effort to improve code documentation, reduce the number of
commonly needed arguments, and avoid repeating work for each
BVH node, combine position data and shape key data arrays to a
temporary struct used during brush deformation.

I'm generally wary of adding such object-oriented abstractions to
the code, but I think this one will hold up, and I find things easier to
understand after the change. It reduces overhead too, since the
evaluated position attribute and shape key data aren't retrieved
potentially thousands of times.

Pull Request: https://projects.blender.org/blender/blender/pulls/127725
2024-09-17 19:55:25 +02:00
Hans Goudey
b2ce5393ad Cleanup: Sculpt: Remove unused automasking function
See 1e22f364f8
2024-09-17 13:37:00 -04:00
Miguel Pozo
9c54ddff69 Fix #127590: EEVEE: Wrong background motion vectors
Add the missing view matrix multiplication and use the view forward
vector instead of the incident vector.

Pull Request: https://projects.blender.org/blender/blender/pulls/127718
2024-09-17 19:33:35 +02:00
Sean Kim
b70c00bf4e Cleanup: Sculpt: Various non-functional sculpt_ops.cc changes
* Move grab brush preview method to `grab.cc`
* Use `enum class` where possible
* Use `const` where possible
* Use C++ math libraries where possible
  * float3 instead of float *
  * numeric limits & constexpr instead of macros
* Clarify naming of some variables
* Add doxygen sections

Pull Request: https://projects.blender.org/blender/blender/pulls/127743
2024-09-17 19:20:23 +02:00
Nathan Vegdahl
7acdb8f90d Fix: compiler warning from using memcpy on non-trivial type
Also return a pointer from `Layer::duplicate_with_shallow_strip_copies()`
rather than a reference, since it doesn't maintain ownership of the
returned item.
2024-09-17 18:55:30 +02:00
Jacques Lucke
2976520525 Geometry Nodes: transform grease pencil layers instead of points
Transforming the layers instead of points is way more efficient and usually has
the same effect visually. Therefore, it is the better standard behavior.

The main problem with this right now is that layer transforms are stored
as separate location/rotation/scale, so shearing is not supported. This will have
to be solved separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/127757
2024-09-17 17:57:20 +02:00
Nathan Vegdahl
e0d5379ef8 Anim: change how action strip data is stored
This updates the layered action data model to store strip data differently.  Specifically:

- `Strip` is now just a single, POD type that only stores the data common to all
  strips, such as start/end frames.
- The data that might be of a completely different nature between strips (e.g.
  keyframe data vs modifier data) is now stored in arrays on the action itself.
- `Strip`s indicate their type with an enum, and specify their data with an
  index into the array on the action that stores data for that type.

This approach requires a little more data juggling, but has the advantage of
making `Strip`s themselves super simple POD types, and also opening the door to
trivial strip instancing later on: instances are just strips that point at the
same data.

The intention is that the RNA API remains the same: from RNA's perspective there
is no data storage separate from the strips, and a strip's data is presented as
fields and methods directly on the strip itself. Different strip types will be
presented as different subtypes of `ActionStrip`, each with their own fields and
methods specific to their underlying data's type. However, this PR doesn't
implement that sub-typing, leaving it for a future PR. It does, however, put the
fields and methods of the one strip type we have so far directly on the strip,
which avoids changing the APIs we have so far.

This PR implements the bulk of this new approach, and everything should be
functional and working correctly. However, there are two TODO items left over
that will be implemented in forthcoming PRs:

- Type refinement in the RNA api. This PR actually removes the existing type
  refinement code that was implemented in terms of the inheritance tree of the
  actual C++ types, and this will need to be reimplemented in terms of the new
  data model. The RNA API still works without the type refinement since there
  are only keyframe strips right now, but it will be needed in preparation for
  more strip types down the road.
- Strip data deletion. This PR only deletes data from the strip data arrays when
  the whole action is deleted, and otherwise just accumulates strip data as more
  and more strips are added, never removing the data when the corresponding
  strips get removed. That's fine in the short term, especially since we only
  support single strips right now. But it does need to be implemented in
  preparation for proper layered actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/126559
2024-09-17 17:31:09 +02:00
Lukas Stockner
1c7c1829b6 Cleanup: Refactor animdata iterators to C++ callbacks
Pull Request: https://projects.blender.org/blender/blender/pulls/125485
2024-09-17 17:26:47 +02:00
Hans Goudey
f2c32f2a23 Cleanup: Sculpt: Remove finished undo comment 2024-09-17 11:17:37 -04:00
Bastien Montagne
37c0e3668e Fix (unreported) broken IPO to FCurve versionning code.
Code would try to use a random ID as a legacy curve one, without any
check on the actual ID type. When trying to open
`tests/data/io_tests/blend_big_endian/2.30/dolphin.blend` recently added
to our collection of regression tests, this ended up 'converting' a
shapekey into a legacy curve ID, leading to invalid memory access
detected by ASAN.
2024-09-17 16:57:07 +02:00
Iliya Katushenock
dceccfda5a BLI: support mod_periodic on integer types
See #125876 for more details.

Pull Request: https://projects.blender.org/blender/blender/pulls/125876
2024-09-17 15:48:06 +02:00
Sybren A. Stüvel
4b642637b9 UI: fix nullptr access in slider drawing code
Fix a null pointer access in the slider drawing code. Determining the
width of the property label used `std::string::c_str()`, which on a
calloc'ed `std::string` returns `nullptr`.

The fix was to use `MEM_new()` instead of `MEM_callocN()` to allocate
the struct that contains the `std::string`.

Pull Request: https://projects.blender.org/blender/blender/pulls/127760
2024-09-17 15:07:11 +02:00
Falk David
943832a841 GPv3: Add armature parent "With Envelope Weights" option
Implements the envelope weights parenting option for armatures.
Uses the same algorithm as for meshes.

Pull Request: https://projects.blender.org/blender/blender/pulls/127714
2024-09-17 12:47:41 +02:00
Julian Eisel
93d37e7000 Cleanup: UI: Use default arguments for rarely used template options
These arguments are almost never used. Default arguments can make the
invokations quite a bit simpler.
2024-09-17 12:22:18 +02:00
Falk David
5857238432 Fix: GPv3: Build Modifier missing object after conversion
The Build Modifier was not copying the ID pointer to the object.
This resulted in the object field being empty when loading a GPv2
file.

The fix makes sure the ID pointer is copied.
2024-09-17 11:12:56 +02:00
Falk David
70c0400e03 Fix: GPv3: Build Modifier crash when using object
The build modifier did not walk the ID link of the object in the settings.
This meant that the pointer was just pointing to random memory after
loading a file that had this object set.

The fix makes sure this ID link is handled in `foreach_ID_link`.
2024-09-17 11:12:56 +02:00
Sybren A. Stüvel
d5a1b02c5d Refactor: Anim, Generic functions for RNA Action Slots / Handles
Refactor the slot assignment & related properties to use as much generic
code as possible. This'll make it much easier to add Action+Slot
properties to other data-blocks in the future (currently just planned
for the Action Constraint).

Pull Request: https://projects.blender.org/blender/blender/pulls/127720
2024-09-17 11:03:06 +02:00
Lukas Tönne
d918c22fcc Revert "CMake: suppress warnings building with mold on Linux"
This reverts commit 0a0551cf26.

This commit broke building on linux with mold. It seems to never
generate the necessary file when something other than the `blender`
binary is the first thing being built.
2024-09-17 10:48:16 +02:00
Campbell Barton
65d71c2672 Cleanup: spelling in comments 2024-09-17 17:28:02 +10:00
Campbell Barton
b70925a8cc Cleanup: prefer ASCII characters
Use ASCII quotes, punctuation so strings are easily editable.
2024-09-17 17:28:01 +10:00
Campbell Barton
0791f53029 Fix shape-keys always being freed in BKE_mesh_nomain_to_mesh
Regression in [0] caused vertex numbers always detect as being changed.

Detect vertex count change before clearing vertices.

[0]: 21f2bacad9
2024-09-17 17:27:59 +10:00
Campbell Barton
cb4a203677 Fix #93911: Multires Unsubdivide destroys the vertex groups
Resolve regression since 3.0 when running un-subdivide.
2024-09-17 17:04:55 +10:00
Campbell Barton
0a0551cf26 CMake: suppress warnings building with mold on Linux
Support manipulating symbols_unix.map using symbols_unix.map.cmake
script.

Currently this removes symbols that generate noisy warnings with the
mold linker.
2024-09-17 14:42:31 +10:00
Aras Pranckevicius
bab4f7a0cd Fix #127654: Video Deinterlace option does not work in some cases
Looks like ffmpeg AVFrame width/height/format for the deinterlaced frame
was never initialized. That was not a problem until starting with 4.1
the colorspace conversion and upside down flip was started to be
multi-threaded, which accessed the frame width/height.

Also, the memory storage for the deinterlaced frame was never freed
either; fix that too.

Pull Request: https://projects.blender.org/blender/blender/pulls/127689
2024-09-17 06:05:55 +02:00
Campbell Barton
fffec9a12a Cleanup: remove unused window position function 2024-09-17 12:44:44 +10:00
Hans Goudey
4df0dc4181 Fix: Sculpt: Avoid repeatedly retrieving mesh data
These accessors are non-trivial and shouldn't be called
again and again. That's besides the fact that it's inefficient
to re-access data on every iteration of a hot loop.
2024-09-16 22:25:21 -04:00
Hans Goudey
d53862d155 Cleanup: Consistent order for Mesh/SubdivCCG arguments
Order is verts, edges, faces, corners, topology data, attributes,
then for the multires case, subdivided geometry info next.
2024-09-16 22:20:15 -04:00
Hans Goudey
4fcc1b2ba1 Cleanup: Sculpt: Avoid copying float3 values, const for local variables 2024-09-16 22:05:16 -04:00
Hans Goudey
d0119ed552 Cleanup: Sculpt: Remove unused PBVHVertRef accessor function 2024-09-16 22:03:12 -04:00
Hans Goudey
3a9a64aafe Refactor: Sculpt: Specialize automasking vertex factors
Part of #118145.
2024-09-16 21:59:43 -04:00
Hans Goudey
7c42c80126 Refactor: Sculpt: Specialize automasking face sets and boundary modes
Part of #118145.
2024-09-16 21:38:29 -04:00
Hans Goudey
037b064480 Refactor: Sculpt: Specialize automask cavity factor calls
Part of #118145.
2024-09-16 21:37:37 -04:00
Hans Goudey
a4c9c01f31 Refactor: Sculpt: Specialize automasking factors loop per geometry type
Also duplicate for the face sets brush automasking calculation.
Further work in the area will cleanup in incremental steps.
Part of #118145.
2024-09-16 20:53:49 -04:00
Sean Kim
210dfd316a Refactor: Sculpt: Specialize IK chain FK face set calculation
Part of #118145.

* Removes usages of PBVHVertRef and flood_fill:execute for specific
  versions per PBVH type
* Adds stub method for BMesh face set retrieval to make future
  implementation easier.

Pull Request: https://projects.blender.org/blender/blender/pulls/127666
2024-09-16 22:29:18 +02:00
Sean Kim
0c02840a46 Fix: Incorrect debug assert in average_data_grids
Introduced in 0205db4f03

Pull Request: https://projects.blender.org/blender/blender/pulls/127724
2024-09-16 20:51:44 +02:00
Julian Eisel
d28956ab99 Tools: Add BPY tool definition option for brush type
Adds a new `brush_type` argument to pass when defining a tool.
Previously the `data_block` argument would be used for this, but its
name was unclear and misleading, it never ended up being used for
anything but brushes. `brush_type` is much more clear. Note that this
isn't used yet until !125449 is merged.

Part of https://projects.blender.org/blender/blender/issues/126032.

Reviewed as part of
https://projects.blender.org/blender/blender/pulls/125449.
2024-09-16 20:07:37 +02:00
Sybren A. Stüvel
12fe0dd0cf Anim: make action/slot assignment code more generic
In the `blender::animrig` namespace, add two new functions
`generic_assign_action()` and `generic_assign_action_slot()`. These are
now used as basis for (un)assigning Actions and Action slots, both
directly on the ID and for NLA strips.

The method `Action::assign_id()` has been removed, in favour of free
functions for (un)assigning Actions and slots.

This is almost a non-functional change. The only thing that's different
is when both an Action and a slot should get assigned in one go.

Old behaviour: the slot would be inspected, and if not suitable for the
animated ID, the entire operation would be aborted. In other words, any
previously-assigned Action would still be assigned, making this an
atomic operation.

New behaviour: assigning an Action + a slot is no longer atomic. First
the new Action is assigned (which uses the automatic slot selection
based on the name). If after this the given slot cannot be assigned, the
new Action + the auto-selected slot are still kept.

This makes the Action & slot assignment more uniform in behaviour, where
"assign this Action + this slot" as one operation behaves the same as
two sequential operations "assign this Action" + "assign this slot". If
it turns out to be confusing, we can always improve things.

The return code for slot assignment is now more explicit (enum instead
of boolean), so that the caller can decide what to do in case of which
error (like unassigning the slot if the automatic behaviour is
unwanted).

Pull Request: https://projects.blender.org/blender/blender/pulls/127712
2024-09-16 19:31:35 +02:00
Hans Goudey
22cf74d23b Cleanup: Use C++ Array for dependent shape key data
Avoids manual memory management and potentially avoids
an allocation with the inline buffer.
2024-09-16 12:46:54 -04:00
Hans Goudey
5c792e429f Fix #127638: Crash switching to wireframe with custom bone shape
The "edge fac" buffer's dependency on loose geometry indices wasn't
encoded properly in `calc_loose_geom`.
2024-09-16 11:17:45 -04:00
Clément Foucault
0d9ab189d1 Fix: #126524: Overlay: Missing loose geometry wireframe with sub-D mesh
This was caused by default normal for these loose geom
to not be zero.

Setting it to zero fixes the drawing issue.
2024-09-16 16:57:06 +02:00
Clément Foucault
d3b655f76d Fix: #127135: Curve and hair drawing asserting on 0 sized VBO
These buffers are bound as texture buffers and will have
their backend object created whether or not the subsequent
drawcall is emited.

Ensuring a minimum size fixes the issue.
2024-09-16 16:01:59 +02:00
Jeroen Bakker
4be5d7f99f Vulkan: Refactor cached compiler instance
ShaderC compiler was cached on the Vulkan backend. The compiler itself
is light-weight and doesn't require any caching. This PR removes the
cached instance from the backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/127693
2024-09-16 15:51:55 +02:00
Jeroen Bakker
f8ff74f821 GPU: Update stubs of shader builder 2024-09-16 15:02:49 +02:00
Clément Foucault
e90a84469f EEVEE: Simplify barycentric_distances_get
This uses the path that metal was using.

This doesn't seems to create any difference in render
tests. This simplify the backend code and avoid
specific path for metal.

Idea suggested by Kevin Chuang

Pull Request: https://projects.blender.org/blender/blender/pulls/127687
2024-09-16 14:19:53 +02:00
Jeroen Bakker
a407186dbf GPU: Make shader cache clearing backend independent
Parallel shader compilation introduced `GPU_shader_cache_dir_clear_old`.
The implementation was specific to OpenGL and could not be overwritten
by other backends. This PR improves the implementation so the backend
can have its own implementation.

This is needed for upcoming changes to the Vulkan backend where we
want to use similar mechanisms to speed up shader compilation and caching.

Pull Request: https://projects.blender.org/blender/blender/pulls/127680
2024-09-16 14:03:14 +02:00