Commit Graph

120055 Commits

Author SHA1 Message Date
Sybren A. Stüvel
85d77b79a6 Refactor: Anim, use eBezTriple_KeyframeType in more code
Instead of using `short key_type`, use `eBezTriple_KeyframeType key_type`,
so that it's clear which type it is, and so that a `switch()` can cause
compiler warnings when it's incomplete.

This also adds missing `case`s to `switch`es where necessary, in a way
that doesn't affect the outcome. There is one change that looks like it
is a functional change, but it should provide the same result:

```diff
- size -= 0.8f * key_type;
+ size *= 0.8f;
```

Since `size = 12` and in this case `key_type = 3`, the numerical values
are the same, but now the code is consistently multiplying and thus should
scale properly.

Furthermore some overly obvious comments are removed and some missing
`const` keywords have been added.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/120178
2024-04-05 11:53:57 +02:00
Campbell Barton
ea567c76ec Unbreak build WITH_GPU_BUILDTIME_SHADER_BUILD
This was valid C++ but not GLSL.

Own error in a00843d560.
2024-04-05 19:27:46 +11:00
Omar Emara
0dc98f784c Fix: Vector Blur slightly differs between CPU and GPU
The Vector Blur implementation slightly differs between CPU and GPU due
to different precision in the sqrt2 constant, so use the float variant
in CPU to make it closer to GPU.
2024-04-05 10:25:27 +02:00
Jacques Lucke
ceccb6f50e Cleanup: remove scary warning about reading Library data-block
From what I can tell, this was fixed a long time ago already in 42057481fb.
See the change from `(Library *)(bheadlib+1)` to `read_struct(fd, bheadlib, "Library")`.

The warning was added 5 months before that in f1a217c5f9.

Pull Request: https://projects.blender.org/blender/blender/pulls/120272
2024-04-05 09:54:57 +02:00
Omar Emara
b229d32086 Compositor: Port GPU Vector Blur to CPU
This patch ports the GPU Vector Blur node to the CPU, which is in turn
ported from EEVEE. This is a breaking change since it produces different
motion blur results that are more similar to EEVEE's motion blur.
Further, the Curved, Minimum, and Maximum options were removed on the
user level since they are not used in the new implementation.

There are no significant changes to the code, except in the max velocity
computation as well as the velocity dilation passes. The GPU code uses
atomic indirection buffers, while the CPU runs single threaded for the
dilation pass, since it is a fast pass anyways. However, we impose
artificial constraints on the precision of the dilation process for
compatibility with the atomic implementation.

There are still tiny differences between CPU and GPU that I haven't been
able to solve, but I shall solve them in a later patch.

Pull Request: https://projects.blender.org/blender/blender/pulls/120135
2024-04-05 09:48:03 +02:00
Jeroen Bakker
4574de1092 Revert "Overlay: Wireframe: avoid using custom depth bias with xray enabled"
This reverts commit 14500953ed.

The commit has introduced multiple drawing regressions in xray mode and
was already reverted in 4.1. A different solution has to be found or
the current one should make sure these regressions are fixed.

Finding the correct solution isn't priority.

* #120208
* #119527

Pull Request: https://projects.blender.org/blender/blender/pulls/120285
2024-04-05 08:08:09 +02:00
Aras Pranckevicius
4cb1d7242a Tests: extend ghash performance tests to cover blender::Map
Clean up the GHash performance testing suite (more C++ constructs), and
extend to cover blender::Map equivalents of the same functionality.

Pull Request: https://projects.blender.org/blender/blender/pulls/120252
2024-04-05 08:04:52 +02:00
Jesse Yurkovich
14e0547da9 Fix: OBJ failing to create a proper .mtl filepath
The MTLWriter was using a BLI_assert to check user-provided data, which
is incorrect and would only work in Debug builds. Release builds would
end up using too small of a buffer and would needlessly fail to append
the `.mtl` extension in some cases.

Instead, we now allow the path manipulation code to just use the full
max size available to it.

Pull Request: https://projects.blender.org/blender/blender/pulls/120275
2024-04-05 04:43:28 +02:00
Campbell Barton
c9130ad460 Python: support a null context for BPY_run_string_{exec/eval}
This was only used for accessing the CTX_wm_reports and isn't needed
for running scripts.
2024-04-05 12:33:48 +11:00
Bastien Montagne
cb66cc3028 Fix #120058: Undoing a rename while in edit mode crashes Blender.
The root of the issue, as identified by Jake-Faulkner in his PR
(!120099), was that after changes in commit 195bb4f8f5,
`BKE_libblock_ensure_unique_name` would not always correctly set
`bmain->is_memfile_undo_written` to false when an ID name was actually
modified.

However, after analyzing a bit more the code in ID renaming, it appeared
that `BKE_libblock_ensure_unique_name` was not needed and only made
things more confusing. Some ID renaming code (from RNA, the Outliner,
and some do_version areas) would then do some manual ID renaming
operations and then call it, instead of simply using the existing 'all
in one' `BKE_libblock_rename` function.

This commit removes `BKE_libblock_ensure_unique_name` and all of its
usages, and simplify all code previously using it by calling
`BKE_libblock_rename` instead.

NOTE: The only non-trivial (not-so-nice) aspect of this commit is the
changes needed in the Outliner renaming code, since here the name of the
ID is directly edited, before calling the rename function, so this edit
needs to be undone to allow calling the generic ID rename API.

Pull Request: https://projects.blender.org/blender/blender/pulls/120196
2024-04-05 03:19:35 +02:00
Campbell Barton
800e470ced Fix crash running a script without any context data
While calling into scripts with an empty `Main` shouldn't be possible
under normal circumstances, I ran into this during development.

This situation is meant to print an error, add a null check so it works
as expected.
2024-04-05 11:43:00 +11:00
Campbell Barton
06dcd264ea Python: assert Python start/end/reset are used properly 2024-04-05 11:41:12 +11:00
Campbell Barton
204d282c75 Refactor: generalize deferred command line argument execution
Making arguments call into Python was impractical because Python
is only initialized for ARG_PASS_FINAL.

Replace "--command" specific logic with a general method of arguments
requesting to be executed once all sub-systems have been initialized.

Without this, the `main()` function needs hard coded logic to support
any time an argument needs to use Python internally.
2024-04-05 11:31:56 +11:00
Campbell Barton
a00843d560 Cleanup: use const references instead of values 2024-04-05 11:31:53 +11:00
Hans Goudey
4db6cbfbe0 Cleanup: Improve comment for Mesh::runtime::mesh_eval 2024-04-04 16:52:00 -04:00
Hans Goudey
b195014e05 Cleanup: Clarify modifier depends_on_normals handling
Because normals are calcualted lazily for all cases "depends_on_normals"
except for BMesh original normals, this is mostly unnecessary. It's actually
probably not necessary at all, because in practice there is always a separate
positions array stored in `EditMeshData` during mesh edit mode modifier
evaluation, bringing us back to the lazy calculation. But anyway, removing
the usage for topology-changing modifiers and modifiers  which don't
accept BMesh as input anyway simplifies things.

Pull Request: https://projects.blender.org/blender/blender/pulls/120274
2024-04-04 22:46:41 +02:00
Jacques Lucke
23265a2b6d Curves: add edit mode operator to convert curve types
This operator shares the underlying code with the corresponding node.

Pull Request: https://projects.blender.org/blender/blender/pulls/120269
2024-04-04 21:04:51 +02:00
Clément Foucault
7f68026990 EEVEE-Next: Allow raytacing for translucent BSDF without refraction
This was an oversight. It was working when adding refraction
which made the check pass.
But this only allows raytracing using screen tracing with
raytraced refraction turned on.
Horizon Scan is still not compatible with transmission.
2024-04-04 21:02:52 +02:00
Hans Goudey
274d7c6d12 Cleanup: Remove unused BVH tree function 2024-04-04 14:49:01 -04:00
Jacques Lucke
d315a6a793 Curves: add toggle cyclic edit mode operator
This operator also exists in legacy edit mode and allows changing
whether the curve is cyclic. If all curves are non-cyclic, the attribute
is removed because it does not contain any useful information.

Pull Request: https://projects.blender.org/blender/blender/pulls/120266
2024-04-04 19:39:14 +02:00
David-Haver
68d948efb9 Fix #119958: Crash when baking during animation
Sometime when baking during an animation blender could crash.
WM_set_locked_interface(job->wm, true) was inside the wm thread.
This caused a race condition between the check and the lock.

Pull Request: https://projects.blender.org/blender/blender/pulls/120258
2024-04-04 18:42:44 +02:00
Falk David
398c4471ec Cleanup: GPv3: Const parent functions for tree nodes
This resolves #120220.

The `parent_group()` and `parent_node()` functions would be
callable on `const` instances but return a non-`const` pointer/reference.

This introduces `const` and non-`const` variants of these
methods.

Pull Request: https://projects.blender.org/blender/blender/pulls/120261
2024-04-04 18:41:38 +02:00
Nate Rupsis
298c9276e9 Anim: Update NLA "make single user" popup dialog
Update the `NLA_OT_make_single_user` dialogue and confirmation modal to make explicitly clear what's happening for the selected strips.

Pull Request: https://projects.blender.org/blender/blender/pulls/120082
2024-04-04 18:34:08 +02:00
Hans Goudey
7ba8fc1768 Fix: Duplicate auto smooth modifier added by versioning in one case
When an object uses linked mesh data and the object and the modifier
node group are made local after versioning runs for the first time,
a new modifier is added every time the file is opened. An obvious
fix is to check whether there is already a modifier with the versioning
node group. In that case we can skip the object.

This doesn't fully fix the scenario from #120030; it requires that
the node group is made local so it doesn't leave a reference to
a non-existent library data-block.
2024-04-04 11:57:27 -04:00
YimingWu
11556bb994 Fix #120152: Clear mesh runtime after validation
The cache for triangles and other runtime caches could
be out of date after `mesh.validate()` is called.

Pull Request: https://projects.blender.org/blender/blender/pulls/120159
2024-04-04 17:21:21 +02:00
Sebastian Parborg
a9fff1f22f Fix: Missing include in BLI_implicit_sharing.hh 2024-04-04 17:13:31 +02:00
Germano Cavalcante
1180a25c23 Fix #120245: Grid snap not working when constraining axis before moving
`sctx->grid.size` was only updated while the constraint was not
enabled.

This was causing division by zero.
2024-04-04 11:42:27 -03:00
Christoph Lendenfeld
ed2408400d Fix #117927: Limit rotation constraint flipping
The issue from the bug report mentions that the `Limit Rotation` constraint snaps
back to 0 when reaching 180 degrees with a min and max of 0 / 180.

The root cause of this goes a bit deeper though. Because the following also snaps back to 0.
* min max of 0 / 360
* angle of 185

The reason for this is that the clamping logic in the constraint was very simple.
It just took the matrix, decomposed it to euler and clamped the values directly.
However in that process, the euler angles are bound to a range of -180 / 180,
which means that any angle >= 180 would snap back to the min.

Pull Request: https://projects.blender.org/blender/blender/pulls/118502
2024-04-04 16:30:51 +02:00
Jason Fielder
93cc55889c EEVEE Next: Horizon scan Metal compiler tuning
Tune Metal compilation parameters for horizon scan
shaders for optimal performance. Selectively unrolling
loops and modifying compilation heuristics results in a
~25% uplift in tracing shader performance, due to
improved latency management.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/119737
2024-04-04 16:24:20 +02:00
YimingWu
022e46a7e2 Fix #120213: GPv3: Tint modifier not working correctly
The GPv3 tint modifier will give incorrect result in fill tint due to
two reasons: 1) The material index being wrong; 2) The default value
for `fill_color` attribute needs to be explicitly assigned as
`ColorGeometry4f(float4(0.0f))` to ensure correct color mixing and
switching between fill/material color in the tint modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/120249
2024-04-04 15:08:10 +02:00
Omar Emara
b0bebd6265 Fix #119911: Compositor saved in 4.2 does not work in 4.1
Blend files with compositor node trees saves in 4.2 do not work in older
version. This is because 4.2 removed the chunk size property of the node
tree, so it is set to zero, which is invalid in older versions. To fix
this, we add it again as a deprecated DNA member, and set it to default
value upon write.

Pull Request: https://projects.blender.org/blender/blender/pulls/120246
2024-04-04 13:14:10 +02:00
Omar Emara
79ca9e5afe Fix: File Output node always has inputs of type Color
The File Output node always has inputs of type Color regardless of the
type of the connected socket. This is because the socket type update
mechanism no longer works, so the default socket type persisted.

This is a regression due to 4a4916db45, where the RNA set function no
longer allows editing socket types for built-in nodes, and the File
Output node utilized the RNA set function. To fix this, we avoid the RNA
route and set the type directly.

This fix is related to #120175 and partially fixes it, though another
fix is still necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/120199
2024-04-04 09:01:20 +02:00
Omar Emara
0c91ad9008 Fix #120175: File Output node has wrong BW output
The File Output node produces wrong output when the output is set to BW.
This is because the image saving logic assumes float buffers always have
4 channels and ignores the image buffer channels member. So for single
channel images, the code weighted sum neighbouring pixels and asigned
them as a single pixel, producing bleeding at best and crashes at worst.

To fix this, we skip Color to BW conversion if the image is already BW.
And, we fix the functions that assume 4 channels for float buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/120206
2024-04-04 08:51:57 +02:00
Campbell Barton
7e9f7320e4 Cleanup: spelling in comments & comment blocks 2024-04-04 11:26:28 +11:00
Campbell Barton
82904454b4 Docs: tweak help text & correct punctuation 2024-04-04 11:18:56 +11:00
Campbell Barton
61bd22e99b Cleanup: avoid duplicating UVBorder on iteration
Iterating over UVBorder duplicated it's allocated vector each iteration.
Use a const reference instead.
2024-04-04 10:55:22 +11:00
Campbell Barton
c1a0804794 Cleanup: remove redundant null check, declare arguments non-null
Checking if `ob` was null in ED_armature_pose_select_pick_bone
implied later access should check too. Remove the null check
as this isn't needed.
2024-04-04 10:55:19 +11:00
Campbell Barton
eb04e1a753 Cleanup: quiet set-but-unused warnings 2024-04-04 10:55:18 +11:00
Campbell Barton
cc4b5facb8 Cleanup: order index range checks before using them to index arrays
While these particular cases didn't cause out-of-bounds array access,
it's reads like it could be an oversight.
2024-04-04 10:55:16 +11:00
Campbell Barton
a7439dd7ef Cleanup: clear a pointer to stack memory in what_does_obaction
Don't leave `workob->adt` set to a stack memory,
avoid the same error occurring which !118847 addressed.
2024-04-04 10:55:14 +11:00
Campbell Barton
fdaaebce54 Cleanup: remove unnecessary checks & unused assignments 2024-04-04 10:55:13 +11:00
Campbell Barton
52ce8d408f Cleanup: use const arguments & variables 2024-04-04 10:55:10 +11:00
Campbell Barton
e086e88e37 Fix null pointer dereference in assertion
Also re-order null check before accessing the pointer's value.
2024-04-04 10:55:08 +11:00
Clément Foucault
e0e6dc8550 DRW: Avoid undefined behavior when volume objects have no bounds
Pull Request: https://projects.blender.org/blender/blender/pulls/120228
2024-04-03 21:37:49 +02:00
Clément Foucault
5c0551fac9 DRW: Replace texspace coord for volume grid by matrix transform
This reduces the complexity inside the shaders and is easier
to debug on CPU.
2024-04-03 20:59:08 +02:00
Clément Foucault
b4dbd04590 Cleanup: Replace dummy_grid_mat by identity matrix 2024-04-03 20:59:08 +02:00
Jacques Lucke
51f8bf53b2 Geometry Nodes: use xxhash for compute context hash
Previously, md5 was used which is significantly slower. In almost all cases
this does not have a significant performance impact in practice. However,
it's possible to build geometry nodes setups that become a few percent
faster ( by combining lots of cheap node groups). Using xxhash instead of
md5 should never be slower.

Pull Request: https://projects.blender.org/blender/blender/pulls/120225
2024-04-03 20:11:09 +02:00
Hans Goudey
ef07f5d66e Cleanup: Improve naming and comments for sculpt undo node 2024-04-03 14:01:08 -04:00
Hans Goudey
ebab68d4f1 Fix #120187: Over-allocation in multires sculpt undo nodes
4b427e1b57 confused `unode->maxgrid` and `unode->grids.size()`
which is the number of all grids in the mesh. A follow-up commit will
rename `maxgrid` to make that clearer.
2024-04-03 13:49:26 -04:00
Falk David
85ce2a34e3 Fix #120212: GPv3: Hide masks flag wrongly set
This was caused by ab84f9eaf0.

The issue is that setting the flag in the `TreeNode`
constructor means that the root group will always
hide masks when its created. This effectively disables
masks in the entire object.

Instead, leave the default flag to be `0` (masks enabled)
and explicitly set the `HIDE_MASKS` flag when
creating a new layer/layer group.

Pull Request: https://projects.blender.org/blender/blender/pulls/120218
2024-04-03 17:59:30 +02:00