Commit Graph

121878 Commits

Author SHA1 Message Date
Ray Molenkamp e63f84de29 make.bat: adjust for recent submodule changes
the path for clang_format_paths.py changed when the submodules
moved but format.cmd was never updated for that.

the work previously done by check_submodules.cmd is now done by
make_update.py so this file can be removed.
2023-03-16 17:51:12 -06:00
Brecht Van Lommel 20a8bc1204 Fix #105455: GPU subdivision with textures corrupts display after undo
This is an issue revealed by the recent optimization in 4d3bfb3f41 to have
CPU and GPU subdivision topology both cached.

BKE_subsurf_modifier_subdiv_descriptor_ensure is what (re)creates the
topology refiner when needed. Invalidating the topology refiner on changes
must be done before it, otherwise we end up with an incomplete Subdiv that
either does not draw or draws incorrectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/105844
2023-03-16 23:18:55 +01:00
Leon Schittek f46fb8051d Fix #105778: Prevent invalid links with link swap
Remove swapped links when they link sockets that belong to
the same node.

Pull Request: https://projects.blender.org/blender/blender/pulls/105809
2023-03-16 21:39:32 +01:00
Brecht Van Lommel f234d2d440 Subdivision: remove info message that GPU subdivision being used
This is the normal case, it's only when both CPU and GPU subdivision is used
that the user needs to be informed that performance is suboptimal.
2023-03-16 19:48:55 +01:00
Julian Eisel a958ae36e8 Fix #104305: Crash in node editor with large asset libraries
Various UI code would store the `AssetHandle` in a way that turns out to
be unsafe. The file-data is part of the file browser caching system that
releases file-data when a certain maximum of items is in the cache. So
even while just iterating over the assets, earlier iterated asset
handles may become invalid. Now asset handles are really treated as
volatile, short lived objects.

For the asset-view, the fix was more involved. There we need an RNA
collection of asset-handles, because the UI list code requires that. So
we create a dummy collection and get the asset handles as needed by
index. This again meant that I had to keep the index of the collection
and the asset-list in sync, so all filtering had to be moved to the UI
list.
I tried duplicating the file-data out of the cache instead, but that
caused problems with managing the memory/ownership of the preview
images.

`AssetHandle` should be removed and replaced by `AssetRepresentation`,
but this would be an even more disruptive change (breaking API
compatibility too).

Fixes #104305, #105535.

Pull Request: #105773
2023-03-16 15:40:31 +01:00
Julian Eisel 55811b2919 Assets: Add function to query data-block library path from asset
No user visible change.

This is needed for #105773, but will cause conflicts in the main branch,
so committing it separately.
2023-03-16 15:25:00 +01:00
Brecht Van Lommel 4fba59c55d Fix #105803: Cycles slow light tree build when previewing shader nodes
When linking a texture directly to the material output, it's likely being
done for the purpose of previewing. In that case, bias the heuristic towards
not building a light tree, as it's likely not needed and slow on dense meshes.
2023-03-16 14:58:47 +01:00
Jason Fielder 7bdd82eca0 Metal: Resolve Race Condition in Memory Manager
Fix race condition if several competing threads are inserting Metal
buffers into the MTLSafeFreeList simultaneously while a new list
chunk is being created.

Also raise the limit for an MTLSafeFreeListChunk size to optimize
for interactivity when releasing lots of memory simultaneously.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/105254
2023-03-16 08:25:15 +01:00
Jason Fielder d3409f2159 Fix: Uncached Metal Materials not Being Released
Optimized node graphs do not get cached and were
not correctly freed once their reference count reached
zero, due to being excluded from the GPUPass garbage
collection.

Also suppress Metal shader warnings, which are prevalent
during material optimization.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/105795
2023-03-16 08:19:32 +01:00
Jason Fielder 94855119da Fix: Metal validation error when shader has no uniforms
Metal buffer binding validation would trigger an error
when a given shader had an empty PushConstantBlock.
This patch removes the default uniform code gen if
no uniforms are present, to avoid any possible issues
with buffers being bound to a shader where the destination
data block is size zero.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/105796
2023-03-16 08:10:38 +01:00
Jason Fielder ac6a70e5f8 Fix #104012: Selection crash with AMD on Metal
Crash when selecting objects on AMD platforms running
Metal. This was caused by shader compilation warnings
being treated as errors in macOS 10.15. Wrapping
compilation failure with success check resolves error.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/105739
2023-03-16 08:03:15 +01:00
Jason Fielder b96f8ac9fe Fix #105606: Metal texture upload regression
immDrawPixels performs significantly slower in Metal
than OpenGL. This was caused by two main factors. Firstly,
the additional overhead of tiled texture update, where all
memory needed to be kept in flight for each update, but
caused update to take a slow path. Avoiding tile update
with Metal is more efficient for both memory pressure
and GPU pipelining.

Secondly, on AMD platforms, the staging buffer used
for temporary texture data was page-faulting when
several texture updates would occur within one frame.
This is due to limitations of allocating one large contiguous
memory chunk. Using the Metal buffer pool for staging
data is more efficient.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/105794
2023-03-16 07:59:22 +01:00
Campbell Barton d3e37d3ed2 Fix #105224: Node editor NDOF pan changes RGB colors
Disable NDOF changing colors for 2D views since it conflicts with
panning.
2023-03-16 17:17:33 +11:00
Richard Antalik 1ad3fa09c9 Fix #90389: No labels in scrubbing area with small FPS
Maximum distance of lines in screen space is limited. This limit seems
reasonable for FPS higher than 1, but UI allows to set 0.01 FPS with
soft. even lower values are possible.

This patch allows for normal operation within soft limits and labels are
still visible and quite usable within hard limits.

Pull Request: https://projects.blender.org/blender/blender/pulls/104849
2023-03-16 04:42:27 +01:00
Damien Picard d7a68a9de8 Fix: Correct several messages in the UI
- Show/hide mask layers: the tooltip was confusing from a user's
  perspective, because they should not be expected to know what a hide
  flag is.
- Active Spline -> Active Point: likely a copy and paste error.
- Geo Nodes face is planar node: forgotten article.
- Axes, plural instead of axis for the viewport preferences. Here
  there are several usages of axis or axes. Since they refer to
  coordinate axes I believe they should be plural, even though the
  property `mini_axis_type` is still wrong.

-----
![image](/attachments/7ccdc72d-1e83-4c22-b8e9-c3b7c5fcf629)
![image](/attachments/746015bc-23e1-49bc-8828-df07d7605048)
![image](/attachments/61c58766-a8f5-4a90-b862-c9b57c44c355)

Pull Request: https://projects.blender.org/blender/blender/pulls/105814
2023-03-16 00:12:29 +01:00
Jesse Yurkovich 09cff506c1 Fix #89630: Hide backfaces when using using the "Alpha Blend" blend method
For proper display, backfaces should be hidden when using the "Alpha Blend" blend method:
https://docs.blender.org/manual/en/dev/render/eevee/materials/settings.html#blend-mode

See the mentioned bug for various examples.

Pull Request: https://projects.blender.org/blender/blender/pulls/105585
2023-03-16 00:10:26 +01:00
Germano Cavalcante 4cd102bb73 Fix #105664: measure tool ignoring snap on first click
The bug only happened in wireframe mode.

Originally the `const bool use_depth` indicated when projection should
be done on invoke.

Later it started to indicate when to snap on invoke.

But with keymap snap detection, using this `use_depth` is no longer
correct.
2023-03-15 17:14:23 -03:00
Hans Goudey e7295efb4b Fix #105791: Alembic procedural ignores materials
When creating the bounding box mesh for the viewport replacement,
copy the material from the original mesh. I'm not sure if Cycles is
meant to load materials from the original mesh or the Alembic file
itself, but either way, this should be a harmless change and fixes the
issue in the report.

Pull Request: https://projects.blender.org/blender/blender/pulls/105798
2023-03-15 19:01:53 +01:00
Clément Foucault fee6238d33 Fix #105323: Compositor: Crash when using color-ramp with b-spline
... or carnidal interpolation with only 2 color stops.

This was triggering an incorrect path due to missing optimisation cases.
Just fall back to the unoptimized case fixes the assert.
2023-03-15 17:30:29 +01:00
Clément Foucault 1b34c466bc Fix #105711: Regression: Clone Tool in Image Editor not showing Stencil
This was likely caused by a bad merge when doing the uniform name
patching for Metal.
This also fix the same issue for active UDIM tile overlay which wasn't
reported.
2023-03-15 17:14:08 +01:00
Hans Goudey c6878d5e82 Fix #103021: Metaballs have jagged normals
eaa87101cd made evaluated metaballs become meshes
for render engines. This exposed the normals calculated by the metaball
tessellation directly, whereas before they were recalculated later.

There are two fixes: not using the metaball tessellation normals at
all and calculating them with the standard Mesh code path instead,
or switching a define in the metaball code to use a more mesh-like
vertex normal accumulation. Since the results are very similar
(see attached renders), use the second solution, which should
be less expensive.

Pull Request: https://projects.blender.org/blender/blender/pulls/105799
2023-03-15 12:13:08 -04:00
Hans Goudey 4f18022f80 Fix #105775: Make "Add > Fur" node setup stable with deformation
Move the deform curves with surface node group to last so it affects the
final generated curves consistently (though this will have a negative
performance impact), and make the generate and interpolate modifiers use
the surface mesh's rest positions.
2023-03-15 12:09:13 -04:00
Hans Goudey 6a96a151be Fix: Dyntopo attribute data warning doesn't work
My PR https://projects.blender.org/blender/blender/pulls/104535
was committed as 88f9c55f7f and the logic was changed
while adding support for face sets, making the logic incorrect and
the warning system disfunctional.

Restore the logic from the original PR with added support for face sets,
fix const correctness issues, improve variable naming, and remove a
check for empty names, since all attribute-type layers should have
names in a valid mesh.

Fixes #105780
2023-03-15 11:14:50 -04:00
Clément Foucault 9332f27702 Fix #104124: Grease Pencil fills cover the lines below when drawing
The switch from `stroke_start` to `vertex_start` in 8c6d4aa103 forgot
to also update `iter->stroke_index_last` which also needs to use
`vertex_start`.

Pull Request: https://projects.blender.org/blender/blender/pulls/105797
2023-03-15 15:59:23 +01:00
Miguel Pozo ffb120c560 Fix #105661: (Regression) Materials can use fewer images than before
Skip explicit binding location for samplers in OpenGL when not needed, since drivers can usually handle more sampler declarations this way (as long as they're not actually used by the shader).

Pull Request: https://projects.blender.org/blender/blender/pulls/105770
2023-03-15 13:58:28 +01:00
Julian Eisel c4d6f766de Fix #105180: "All" asset library includes subfolders of current file
The loading for the "All" asset library would include the "Current File"
library as if it were a regular asset libray on disk. Instead make sure
the latter is loaded properly first and is skipped when recursively
reading on disk libraries.
2023-03-15 13:06:39 +01:00
Michael Jones 089e8a1887 Cycles: Fix Metal API validation error (use uint instead of ushort)
This PR fixes an error that is given when Metal API validation is enabled. The compute grid can exceed 65536 threads so `ushort` is not sufficient for `metal_grid_id [[threadgroup_position_in_grid]]`.

This PR also fixes OS version warnings ([Cycles Metal: Unguarded access to newer macOS features #105630](https://projects.blender.org/blender/blender/issues/105630))

Pull Request: https://projects.blender.org/blender/blender/pulls/105763
2023-03-14 22:05:55 +01:00
Brecht Van Lommel a7cd6de244 Fix Cycles missing light from multiple distant lights with different visibility 2023-03-14 18:19:12 +01:00
Antonio Vazquez 3785dc8043 Fix #105146: Gpencil select does not work with Layer transforms
The transformations were applied two times and the old fix was wrong because it needs to use the evaluated point, not the original one. Also I did a small code cleanup.

Pull Request: https://projects.blender.org/blender/blender/pulls/105202
2023-03-14 16:57:46 +01:00
Jason Fielder 96c6349cbf Fix #103605: Metal barycentric coordinate compilation failure
Fix support for Wireframe and parametric nodes by resolving
compilation failures surrounding barycentric coordinates.
A final missing part of the Metal implementation for barycentric
coordinates was missing.

Feedback also addressed to move barycentric calculation out
of code-gen and into surface_lib.

Authored by Apple: Michael Parkin-White

This also resolves #103606.
Ref #96261

Pull Request: https://projects.blender.org/blender/blender/pulls/105740
2023-03-14 08:23:02 +01:00
Campbell Barton 51e5417bd3 Fix #105678: Crash assigning Image.pixels to an undersized sequence
Now only dynamic function parameters that use ParameterDynAlloc support
dynamically sized parameters arrays.

Add tests for both dynamic arrays that don't support resizing
(Image.pixels) and dynamic sized arguments using
(VertexGroup.add(index=[..])).

Regression in [0] which extended support for dynamic sized function
arguments.

[0]: dfb8c5974e
2023-03-14 16:00:24 +11:00
Campbell Barton 1c88bf6ce1 Fix #105715: Freeing the edit-mesh causes future access to fail
The BPyBMesh in `BMesh::py_handle` was invalidated but not cleared,
causing future access to return a 'dead' bmesh.
2023-03-14 13:36:54 +11:00
Campbell Barton 708e84df90 Fix #105721: Fix crash accessing driver variables & targets
- DriverVariable.name update function passed DriverVar to
  BKE_driver_invalidate_expression as a ChannelDriver.

- DriverTarget.name update function passed DriverTarget to
  BKE_driver_invalidate_expression as a ChannelDriver.

- DriverVariable.type update function DriverVar accessed ChannelDriver,
  clearing a flag.

This was exposed by [0] however this issue existed beforehand.

[0]: c26566ad27
2023-03-14 12:16:22 +11:00
Germano Cavalcante 98bfa8d458 Fix 'use_occlusion_test' option not having effect on wireframe
This is a non-recent regression that strangely went unreported.

It is expected that when snapping, only visible elements are considered
which does not include faces in wireframe mode.

This works like this before, and this change doesn't appear to have
been intentional.

Ref #105664
2023-03-13 15:34:39 -03:00
Germano Cavalcante f92bacee94 Cleanup: use macro for 'SCE_SNAP_MODE_GEOM'
One of the advantages of separating this enum member from the others is
because mixing several members in a single one hinders debugging since
in this case the IDE does not define which enums were set.

Also separating this item makes it more readable as `SCE_SNAP_MODE_GEOM`
is not a snap mode but a combination of modes.
2023-03-13 15:34:26 -03:00
Antonio Vazquez ca2bf2f3a0 Fix #105625: GPencil sculpt crash with subdivide modifier
The created point hasn't a original point in the original stroke, so
must use only the valid points.

Pull Request: https://projects.blender.org/blender/blender/pulls/105627
2023-03-13 18:04:25 +01:00
Antonio Vazquez 69c6158cc8 Fix #105589: GPencil Paste duplicate active frame
The active frame is pasted always, so if multiframe is
copying the strokes don't need copy the active frame again.

Pull Request: https://projects.blender.org/blender/blender/pulls/105605
2023-03-13 18:02:36 +01:00
Jeroen Bakker 0b68e609fc Fix 105271: Luminance Matte not Working on NVIDIA.
Issue was that the clamping parameters were not in
the correct order. This leads to undefined behavior
and also lead to small artifacts on other platforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/105735
2023-03-13 16:07:17 +01:00
Sybren A. Stüvel 6e4bcb7c87 Fix #100659: "Add F-Curve Modifier" applies only to Active F-Curve
In most places where it appears in a menu, the operator would already
apply to all selected F-Curves. Now it is done consistently and explicitly
from all menu items. The default of the operator is now also set to 'all
selected', so that it also behaves like that when called from the operator
search menu.
2023-03-13 15:23:57 +01:00
Bastien Montagne 84bcc1abfe Updated translations from svn trunk (r6385). 2023-03-13 12:59:46 +01:00
Damien Picard 4096bcfb25 I18n: extract math node operation type header messages, fix another
- The Math node lost the headers of its operation type menu in
  ee985fa925 , because a translation context was assigned to the RNA
  property, but the headers declaration was not updated to extract the
  messages with matching contexts.
- The message "Group Input" had a trailing space, which can be added
  after translation.
2023-03-12 16:01:56 +01:00
Leon Schittek 7d22b11352 Fix #105601: Remove duplicates when inserting links into multi inputs
Fix a regression that allowed to create several links between an
output socket and a multi input socket either by inserting
links or using the link swap feature.

This regression was caused by the link swapping feature
introduced in commit 89aae4ac82.

Pull Request: https://projects.blender.org/blender/blender/pulls/105631
2023-03-11 08:27:56 +01:00
Campbell Barton fe58ccfafb Mesh: compact edit-mesh undo data in parallel (address #105046)
Multiple user actions performed quickly could be blocked by undo
compacting memory - if the background compacting task was not complete
when the next undo step was pushed.

Notes:

- This and recent improvements to BLI_array_Store gives over ~2x speedup
  compared with 3.3x, over 10x compared with 3.4x.
  A sub-surfaced cube with the modifier applied was used for testing
  (~1.5 million polys), both randomized & non-randomized verts/edge/faces
  were used to avoid the sub-surface memory layout biasing the results.
  Tested transforming ~1/3rd of the mesh and inverting selection.

- Without compacting mesh-data in parallel, the optimizations to
  BLI_array_store can give similar performance to 3.3x, however there
  are still cases where performance isn't quite as good - so compact the
  arrays in parallel to ensure performance is at least as good as 3.3x.

Resolves #105046.
2023-03-11 11:58:09 +11:00
Campbell Barton 16968ccec7 BLI_array_store: improve hash accumulation for each memory chunk
The method of accumulating values to create a hash for each chunk has
been improved for ~16% better distribution of the resulting hashes.

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:58:08 +11:00
Campbell Barton 7a5cb3b470 BLI_array_store: improve hash for smaller values (including booleans)
Accumulating hashes with a byte/boolean array didn't include enough
information for a useful hash, creating hashes with many collisions.

This is the root cause of a performance regression since 3.3 where
mesh data (used for storing edit-mesh undo steps) was changed to store
selection in a boolean array, creating a bottleneck de-duplicating
chunks of that array for edit-mesh undo's custom-data de-duplication.

Resolve by increasing hash accumulation for arrays with smaller elements,
so each chunk of memory (a candidate for de-duplication) isn't as likely
to have hash collisions.

`char` (single byte) arrays now accumulate 22 values instead of 7, it's
taking more values into account was necessary as these are effectively
bits in the case of boolean arrays, 2-byte values accumulate 32 bytes,
4-byte elements accumulate 44 bytes, larger structs accumulate
`sizeof(type) * 7` bytes (as before).

Also ensure the accumulation read-ahead never exceeds the chunk size -
technically a fix although this would only happen when passing a small
`chunk_count` to BLI_array_store_create (in the range of 1-16) so this
didn't happen in practice.

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:57:56 +11:00
Campbell Barton 1b10883498 BLI_array_store: use uint32_t instead of uint64_t for hash storage
Use uint32_t since it's sufficient for hashing, using an int64_t was
especially inefficient when allocating an int64_t for every boolean
(when compacting an array of booleans).

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:57:54 +11:00
Campbell Barton 2bfe9b50c6 Fix error freeing NULL if BArrayStore_AtSize is empty
Calling BLI_array_store_at_size_clear on an BArrayStore_AtSize
which was not used would attempt to free a NULL pointer.
2023-03-11 11:57:08 +11:00
Campbell Barton 412c62f62e Cleanup: rename BChunkList::total_size -> total_expanded_size
Use this name to avoid confusion between expanded & compacted sizes.
2023-03-11 11:57:06 +11:00
Campbell Barton ce70e0055f Cleanup: improve/correct doc-strings, use doxygen formatting 2023-03-11 11:57:04 +11:00
Germano Cavalcante 3baccee0af Pass BitVector by reference in lambda
This is a fix for the previous commit d7c023eb25.

Before, every time the lambda was called, a copy of the BitVector was
made. This was very inefficient.

Now this has been fixed by passing the BitVector by reference (&) in
the lambda function.
2023-03-10 16:54:40 -03:00