Commit Graph

108318 Commits

Author SHA1 Message Date
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
Hans Goudey
768c68f19b Fix #120179: Assert failure after sculpt trim operation
Seems to be caused by c53e220aef. I didn't think our PBVH building would
ever create a node with no triangles, but I guess I was wrong, since I
checked and the PBVH is clearly being rebuilt after the trim operation,
so it seems there isn't anything else weird going on here.

Rather than trying to figure that out, I'll just add the empty check
back here. Eventually we should completely replace the algorithm that
creates the PBVH nodes anyway.
2024-04-02 17:58:36 -04:00
Hans Goudey
d001302200 Fix #117709: Crash with single point NURBS curve
The root of the issue seems to be calling `BLI_snprintf` with the
wrong number of arguments in the `MorePointsForBezierRequired`
case. The fix arguably makes things simpler anyway: just use a
separate call in each case of the switch.
2024-04-02 17:44:49 -04:00
Hans Goudey
bf2b684913 Cleanup: Remove unused variable after recent cleanup 2024-04-02 17:41:27 -04:00
Sean Kim
d80b8cbcdc Cleanup: Add doxygen sections to sculpt_face_set.cc
This PR adds doxygen headers to `sculpt_face_set.cc`

Pull Request: https://projects.blender.org/blender/blender/pulls/120190
2024-04-02 23:13:52 +02:00
Iliya Katueshenock
3f3df16ba2 Cleanup: Mesh calculate edges file cleanup
Trivial changes of code:
1. Const correctness.
2. Arguments order.
3. Use regular constructor instead of aggregate one.
4. Replace stateful iterators of corners by `bke::mesh` functions.
5. Offset Indices instead of manual prefix sum.
6. Slight changes of iterator names which is affected by cleanup.
7. Cpp allocator.
8. Explicit template parameter.

Pull Request: https://projects.blender.org/blender/blender/pulls/120189
2024-04-02 22:48:58 +02:00
Hans Goudey
89d38cf008 Cleanup: Use ImplicitSharingInfo type instead of C handle 2024-04-02 16:40:33 -04:00
Harley Acheson
d1b6621903 UI: Complete Event Icon Coverage
This PR completes coverage of the event icons used to represent keymap
entries on the status bar. This adds 0-9, non-alpha keys, tablet, F13-
F24, NDOF buttons, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/120117
2024-04-02 21:52:57 +02:00
Harley Acheson
65bfae2258 UI: Status Bar Keymap Spacing
Adjustments to the spacing of keymap items shown in the status bar
while idle and during modal operators. Decreased space between icon
and related text makes each item have better separation.

Pull Request: https://projects.blender.org/blender/blender/pulls/120124
2024-04-02 21:25:56 +02:00
Hans Goudey
930d645b4c Fix #120154: Cage face normals overlay always draws original normals
When the cage mesh is the output of a modifier that supports deforming
BMesh directly, it will be a mesh wrapper and `MR_EXTRACT_BMESH` will
be used. Otherwise the cage mesh will be a `Mesh` and its own normals
should be drawn instead of the the original normals. Thought this seems
deceivingly simple, it works with no modifiers, BMesh-deforming modifiers
with cage enabled and disabled, and topology changing modifiers, which
should be all the possible cases here.
2024-04-02 13:42:06 -04:00
Sean Kim
6160335c4d Cleanup: Extract common functions in sculpt_trim.cc
This PR extracts a few common functions for operations
in `sculpt_trim.cc` to reduce duplication.

Pull Request: https://projects.blender.org/blender/blender/pulls/120180
2024-04-02 19:38:37 +02:00