Commit Graph

108328 Commits

Author SHA1 Message Date
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
Philipp Oeser
8af4c72ddd Fix #120113: crash reading large jpeg
Caused by 406cfd214a

Above commit added a multiplication by 4 to the offset (rightfully so),
but this could overflow with very large image dimensions.

Pull Request: https://projects.blender.org/blender/blender/pulls/120214
2024-04-03 17:38:02 +02:00
Aras Pranckevicius
b3ea1e75dc Cleanup: comment why DDS DXT/S3TC needs power of two sizes, and clearer log message
It is not immediately clear why DDS compressed (DXT/S3TC) textures need
to be power of two in size (since nothing in DXT/S3TC intrinsically
requires that). It is only needed due to the "flip the texture upside
down" dance that we do for DDS at load time.

While at it, when logging DXT related messages, tell which texture
was it for, and dimensions. This changes logs like:
```
Unable to load non-power-of-two DXT image resolution, falling back to uncompressed.
Unable to load non-power-of-two DXT image resolution, falling back to uncompressed.
Unable to find a suitable DXT compression, falling back to uncompressed.
```
Into:
```
Unable to load non-power-of-two DXT image resolution, falling back to uncompressed (281splash-dxt1-mips.dds, 890x501).
Unable to load non-power-of-two DXT image resolution, falling back to uncompressed (281splash-dxt5-mips.dds, 890x501).
Unable to find a suitable DXT compression, falling back to uncompressed (281splash-rgba8-mips.dds, 890x501).
```

Pull Request: https://projects.blender.org/blender/blender/pulls/120210
2024-04-03 17:12:46 +02:00
Laurynas Duburas
4889aed8ac Curves: Bezier handle selection support
Adds ".selection_handle_left" and ".selection_handle_right" attributes to
`CurvesGeometry` and their support in curve's select all, pick, box, circle
and lasso select tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/119712
2024-04-03 16:40:36 +02:00
Falk David
8512a608a4 GPv3: Onion Skinning
Implements the GPv2 onion skinning functionality.

There are no functional changes exept for the `use_ghosts_always`
option, which has been removed. This was used to show onion
skinning in the final render.

Pull Request: https://projects.blender.org/blender/blender/pulls/119792
2024-04-03 15:34:40 +02:00
Sergey Sharybin
1e2e20fe3c Fix #120200: Sculpting is slow with modifier with driver
A regression caused by 7a2d04a5c4

Safest solution is to consider that shading changes will take care
of other components explicitly when/if needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/120207
2024-04-03 15:06:32 +02:00
Hans Goudey
4bdf5bf2e2 Mesh: Remove unnecessary wrapper_type_finalize logic
After some discussions and investigation over the last couple months,
it's not clear what the "wrapper type finalize" logic is necessary for.
For edit meshes and regular meshes, normals are calculated lazily when
building the draw cache.

Apart from the unnecessary complication for mesh GPU draw data
extraction, this code also causes normals to always be calculated
when turning an edit mesh wrapper into a regular mesh. However, those
normals are immediately discarded since the edit deform cache is deleted
in the next line.

Beyond the obvious simplification, the motivation for this change is to
avoid requesting write access on the evaluated mesh and cage mesh. This
works better with implicit sharing, allowing other improvements.

Pull Request: https://projects.blender.org/blender/blender/pulls/120066
2024-04-03 14:15:31 +02:00
Hans Goudey
e7339bdd5f Geometry: Use implicit sharing for deformed positions
Avoid copying the positions array into the evaluated edit hints array
that's used to support editing with deformed positions when there is
a topology-changing procedural operation. In a simple test in sculpt
mode with 706k curve points, memory usage went from 78 to 70 MB.

This adds more duplication would be ideal, mainly because retrieving
the data with write access and making implicit sharing info for arbitrary
arrays aren't abstracted by implicit sharing utilities. It may be possible
to improve both of those aspects, either now or in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/120146
2024-04-03 14:14:34 +02:00
Falk David
50f5128be0 Fix: GPv3: Crash converting vertex groups
A grease pencil test file
(can be found here: https://cloud.blender.org/p/gallery/5d9c6ee20f9018baaca071c3)
was crashing when converting to GPv3.
The index of a deform weight group was out of bounds.
We will have to investgate how this can happen, but
in the conversion code it seems best to ignore and skip over
invalid indices.

Pull Request: https://projects.blender.org/blender/blender/pulls/120170
2024-04-03 11:40:10 +02:00
Jacques Lucke
e2d170f685 Libraries: integrate xxHash library for fast hashing
`xxHash` is a fast non-cryptographic hashing library. It significantly outperforms
md5 which we use in some places currently while also having great collision
resistance if not attacked explicitly.

The library is added to `extern` because that was the easiest way to do it and has
the least impact on others. I expect this library to become a required dependency
instead of an optional one. It's licence is `BSD 2-Clause` which seems to be the
first of its kind in Blender (there is `BSD 3-Clause` a couple of times).

For now, I used the library only for data deduplication when baking geometry nodes
where the same geometry is generated for each frame. The bake time in my test
goes down from >6s to <1s (note that this includes more than just the hashing time).

Pull Request: https://projects.blender.org/blender/blender/pulls/120139
2024-04-03 10:22:53 +02:00
Campbell Barton
8252208955 Cleanup: pass CoplanarClusterInfo::add_cluster arg by const reference 2024-04-03 15:04:31 +11:00
Campbell Barton
861536b24c Unbreak lite-build WITH_GMP enabled 2024-04-03 15:04:31 +11:00
alxdsptr
eca8e5d4b3 Fix: Video alignment issue caused by fix for #120077
after alignment, the rgb_frame's linesize is not equal to the actual
data length, so when copying the data generated from render to the
rgb_frame, they should use different linesize, one after alignment
and one before alignment.

Pull Request: https://projects.blender.org/blender/blender/pulls/120184
2024-04-03 05:56:56 +02:00
Campbell Barton
a85b1dd2fc Cleanup: avoid shadowing local variables 2024-04-03 14:41:43 +11:00
Campbell Barton
b24a295af1 Cleanup: pass arguments by const reference instead of value 2024-04-03 14:40:39 +11:00
Campbell Barton
b03332a055 Cleanup: use BLI_assert_msg instead of checking string literals 2024-04-03 14:27:54 +11:00
Campbell Barton
c4c1aedd00 Cleanup: correct comments in scanfill.c, don't use bool for a flag
Logically PolyFill::f is a flag so use uchar instead of bool.
2024-04-03 14:07:37 +11:00
Campbell Barton
cbd6266162 Cleanup: simplify init_meta logic
- Remove redundant loop on meta-elements.
- Use continue to reduce nested blocks.
- Move zero-axis matrix check into a function.
2024-04-03 14:07:04 +11:00
Hans Goudey
820865bacf Cleanup: Improve EditMeshData comments 2024-04-02 21:11:34 -04:00
Sean Kim
06f04a2c19 Refactor: Use blender::Array for SubdivCCGNeighbors
To avoid requiring callers to remember to free the allocated data.

Pull Request: https://projects.blender.org/blender/blender/pulls/120194
2024-04-03 02:37:45 +02:00
Campbell Barton
56c78a9236 Cleanup: use boolean instead of float for motion_blur_fx_enable
Logically this is used as a boolean so use a bool type.

Ref !120156
2024-04-03 10:22:18 +11:00
Campbell Barton
d5d1025e94 Cleanup: use const pointer arguments 2024-04-03 10:22:05 +11:00
Harley Acheson
bc099fe808 UI: Remove Extraneous Parentheses
My #120117 introduced a build warning for extraneous parentheses, this
PR just removes those.

Pull Request: https://projects.blender.org/blender/blender/pulls/120193
2024-04-03 01:09:20 +02:00
Pratik Borhade
96ce5a1fd1 Fix #120095: Missing stats in sculpt mode
Caused by 2df06a05ae
totobj and selected objects are not counted for sculpt mode stats (can
do that but it's unnecessary). Hence the above commit falsely showed 0
objects in statistics. To fix this, skip showing object count in sculpt
mode, otherwise print 0 objects if selobj and totobj are none.

Pull Request: https://projects.blender.org/blender/blender/pulls/120106
2024-04-03 01:00:43 +02:00
Hans Goudey
5b9ed4258b Cleanup: Access edit mesh caches with span return values
Instead of accessing the data directly from the cache struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/120191
2024-04-03 00:36:29 +02:00
Hans Goudey
41ed0d4001 Cleanup: Remove unnecessary cache checks in mesh analysis VBO creation
These functions are already called in `mesh_render_data_create` which
happens before the various VBO extraction functions are called.
2024-04-02 18:03:49 -04:00
Hans Goudey
e29d582137 Cleanup: Use C++ Span, float3 in legacy instancing code 2024-04-02 18:03:49 -04:00
Hans Goudey
a4b4f0116c Cleanup: Use C++ Span, float3 for BMesh normals API 2024-04-02 18:03:49 -04:00