Commit Graph

120055 Commits

Author SHA1 Message Date
Hans Goudey
e3fc40dfc3 Cleanup: Sculpt: Remove unused PBVHVertRef functions 2024-09-18 16:59:49 -04:00
Hans Goudey
dcb3391e10 Refactor: Sculpt: Specialize expand face set and boundary access
Part of #118145.
2024-09-18 16:54:43 -04:00
Hans Goudey
9562056f50 Cleanup: Sculpt: Remove unused PBVHVertRef functions 2024-09-18 15:24:39 -04:00
Julian Eisel
622affe853 Fix #126521: Redo popup doesn't refresh layout on changes
98c92b9033 disabled refreshing for the redo popup, since that requires
passing an operator pointer to the UI to holding on to it while the popup is
visible. Usually operators are short lived and shouldn't be held by the UI, to
avoid dangling pointer accesses. In this case it's fine though, because the
operator will be kept alive in the window manager.

Partially reverts 98c92b9033, and adds a comment to note this special case.

Fixes: #126521, #127561

Pull Request: https://projects.blender.org/blender/blender/pulls/127795
2024-09-18 20:50:53 +02:00
Julian Eisel
42b390fe3d Fix #127510: Crash when registering panel as instanced
Generally the instanced option shouldn't be necessary, and it's not used as
intended in the report. However, crashes should be avoided.
2024-09-18 19:17:33 +02:00
Hans Goudey
721ece9efb Cleanup: Sculpt: Move automasking functions to proper header 2024-09-18 11:11:13 -04:00
Jacques Lucke
4a45ae7393 Nodes: rename "unavailable" to "available" in node declaration
This simplifies future use of this method by avoiding double negations.
2024-09-18 16:08:05 +02:00
Hans Goudey
711313a054 Fix: Sculpt: Mask gesture crash with multires 2024-09-18 08:59:16 -04:00
Hans Goudey
f52819c044 Cleanup: Sculpt: Simplify grids indexing in two places 2024-09-18 08:47:32 -04:00
Habib Gahbiche
50f2857b1a Fix #127793: Crash on startup on macOS 15
std::sort() requires a strict weak ordering, i.e. `x < x` must be false. Therefore `id_order_compare(ID *a, ID *b)` must return false for `a.name == b.name`
Pull Request: https://projects.blender.org/blender/blender/pulls/127794
2024-09-18 14:46:02 +02:00
Hans Goudey
77d69f4347 Cleanup: Remove unused sculpt PBVHVertRef functions
Part of #118145.
2024-09-18 08:42:02 -04:00
Hans Goudey
7f26485f68 Refactor: Sculpt: Specialize face set access in mask init
Part of #118145.
2024-09-18 08:37:44 -04:00
Hans Goudey
45b5ea7d1e Refactor: Sculpt: Specialize expand cache active vertex position
Part of #118145.
2024-09-18 08:33:29 -04:00
Pratik Borhade
ac66069eff Fix #127582: Crash when clicking onto particle settings button
This is due to memory allocation mismatch. `MEM_dupallocN` is used on
cpp style `ButsTextureUser` pointer. Now fixed by using `MEM_new`. Also
pass `uiButArgNFree/Copy` callback fn arguments to avoid the use of
default arguments which are C style.

Pull Request: https://projects.blender.org/blender/blender/pulls/127690
2024-09-18 13:32:06 +02:00
Aras Pranckevicius
92544d6d76 BLI: add float<->half conversion functions with correct math, use in Vulkan
Blender codebase had two ways to convert half (FP16) to float (FP32):

- BLI_math_bits.h half_to_float. Out of 64k possible half values, it converts
  4096 of them incorrectly. Mostly denormals and NaNs, which is perhaps not too
  relevant. But more importantly, it converts half zero to float 0.000030517578
  which does not sound ideal.
- Functions in Vulkan vk_data_conversion.hh. This one converts 2046 possible
  half values incorrectly.

Function to convert float (FP32) to half (FP16) was in Vulkan
vk_data_conversion.hh, and it got a bunch of possible inputs wrong. I guess it
did not do proper "round to nearest even" that CPU/GPU hardware does.

This PR:

- Adds BLI_math_half.hh with float_to_half and half_to_float functions.
    - Documentation and test coverage.
    - When compiling on ARM NEON, use hardware VCVT instructions.
- Removes the incorrect half_to_float from BLI_math_bits.h and replaces single
  usage of it in View3D color picking to use the new function.
- Changes Vulkan FP32<->FP16 conversion code to use the new functions, to fix
  correctness issues (makes eevee_next_bsdf_vulkan test pass). This makes it
  faster too.

Pull Request: https://projects.blender.org/blender/blender/pulls/127708
2024-09-18 13:15:00 +02:00
dupoxy
5fe32f351a Fix #127731: Sculpt crash on Extract Face Set usage
This is due to function mismatch. Use CPP style `MEM_delete` to fix
the crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/127732
2024-09-18 13:01:01 +02:00
Pratik Borhade
eb44c39824 Fix #127616: Copy to selected adds modifier to linked object
Add extra check to prevent copying modifier on selected linked objects

Pull Request: https://projects.blender.org/blender/blender/pulls/127797
2024-09-18 12:47:52 +02:00
Sebastian Parborg
928ab6dc0f Fix: Compile error when building without WITH_EXPERIMENTAL_FEATURES 2024-09-18 12:47:28 +02:00
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