Commit Graph

142100 Commits

Author SHA1 Message Date
Campbell Barton
066c6f3674 Fix UBSAN warning caused by uninitialized memory use
Unwrapping warned that a non 0/1 boolean value was being set.

Initialize all members of PVert since they would be accessed
when duplicating a PVert causing the uninitialized memory to be read.
2024-10-29 14:36:13 +11:00
Sean Kim
f408531b9b Fix #129448: Undoing face set changes produces artifacts on dense mesh
Introduced in 60ab232afb

An incorrect subset of nodes was calculated as the code prior to this
commit was inspecting vertex indices instead of face indices.

Pull Request: https://projects.blender.org/blender/blender/pulls/129487
2024-10-28 22:52:40 +01:00
Hans Goudey
d87f604a0d Fix #129428: Sculpt undo crash after remesh with deform modifier
This "update object for edit" call is incorrect because it retrieves the
evaluated state for the object that the undo itself invalidates. The
object/modifiers must reevaluate before we rebuild the deformation
matrix array (which is the operation causing the crash).

Pull Request: https://projects.blender.org/blender/blender/pulls/129474
2024-10-28 22:40:46 +01:00
Julian Eisel
58a0b565cd Fix: Curves: Missing brush assets selector in curves sculpt mode
All sculpt and paint modes should have the brush selector asset shelf
popup in the tool settings header. For curves sculpt mode this was
missing. There's no good reason for this, probably just an oversight.
2024-10-28 18:23:43 +01:00
Julian Eisel
8b0206fa26 Fix: Grease Pencil: Brush selector shortcut missing in vertex paint mode
All sculpt and paint modes should bring up the brush selector asset
shelf popup on Shift+Spacebar. For grease pencil vertex paint mode the
shortcut was missing. I think it was added earlier, but only for the
grease pencil v2 keymap, the v3 one got merged later only.
2024-10-28 18:19:10 +01:00
Omar Emara
f0125f26fd Fix #129435: Bad Cryptomatte output in camera view
The Cryptomatte node produces a bad output when the viewport is in
camera view. That's because compositing is limited to the camera region
in that case, but the node assumes the full viewport size. To fix this,
only consider the compositing region instead of the full viewport.
2024-10-28 14:14:49 +03:00
Campbell Barton
d6d612dc46 Fix memory leak pasting images in Wayland 2024-10-28 12:38:22 +11:00
Campbell Barton
a312bfe6d5 Fix use of undefined variable in blend2json utility 2024-10-28 09:50:57 +11:00
Campbell Barton
59c52ef2cf Cleanup: remove unused import in CLI example 2024-10-28 09:36:28 +11:00
Campbell Barton
41cb811849 Cleanup: update the default theme
Re-generate the default theme from blender_theme_as_c.py
2024-10-27 23:24:21 +11:00
Campbell Barton
4ac25883a3 Update blender_theme_as_c to match renamed define 2024-10-27 23:22:13 +11:00
Campbell Barton
005d439264 Fix industry compatible keymap keys for spreadsheet region toggle
Ctrl bracket keys weren't used for toolbar/UI region toggling.
2024-10-27 22:45:43 +11:00
Sean Kim
1dd6cdb172 Fix #129334: Multires displays incorrectly in Sculpt mode with materials
Introduced in 853269aeb0

Prior to this commit, the PBVH partitioning process did not work
correctly for multires meshes with materials. Specifically, it failed
upon mapping the partitioned faces into their corresponding corners.

The rough process here is as follows:
* Flatten out the array of face indices into an array of corner indices.
* Sum up each `GridsNode` `prim_indices` corner count into an array.
* Create an `OffsetIndices` from these sums
* Use the `OffsetIndices` to slice the array created at the beginning
  to assign to each node.

However, this process requires that the main PBVH array of corner
indices has the same order as iterating over the nodes, which the
partitioning algorithm does not do.

To solve this, this commit iterates over the Node `prim_indices` `Span`s
in the same order that the nodes are stored when flatting out the
corner data, ensuring a correct mapping.

Pull Request: https://projects.blender.org/blender/blender/pulls/129392
2024-10-25 20:17:39 +02:00
Campbell Barton
98cae94f6b Fix potential out of bounds read in UTF8 string length calculation
The length checking wasn't accounting for null bytes within multi-byte
sequences and could step over the null bytes.

For BLI_strlen_utf8 this could result in an out of bounds read.

In practice most UTF8 data is validated so the extra checks
are mainly to prevent errors on invalid or corrupt UTF8 text.
2024-10-25 16:50:10 +11:00
Campbell Barton
259611ca4f AUTHORS: add 1 new author 2024-10-25 14:06:30 +11:00
Leon Marz
1a872e69f3 Fix terminating the EGL connection without a valid display
When wl_display_connect fails don't attempt to disconnect EGL,
no connection will have been made.

Ref: !129301
2024-10-25 13:55:06 +11:00
Campbell Barton
584b96018a Fix #128322: Pack Islands warnings & fails to use tool-settings
Ref !128757
2024-10-25 10:03:30 +11:00
Lukasz Czyz
85907199b7 Fix #127963: UV importance weights in minimum stretch randomly fails
Ref !128757
2024-10-25 10:03:22 +11:00
Campbell Barton
1cd2bece60 Fix memory leak on exit for bpy.app.translations members 2024-10-25 09:16:46 +11:00
Sean Kim
420a54a9e4 Fix #129373: Invalid "Cloth" asset shelf category appears in Sculpt mode
The catalog path was updated in
blender/blender-assets@88f1a1caf7 but was
not updated here, resulting in a category that had no effect when
toggled and was not visible in the larger tree view.

Pull Request: https://projects.blender.org/blender/blender/pulls/129387
2024-10-24 23:17:23 +02:00
Michael Jones
0f6a83202d Revert unintended change to tests/data
Revert unintentional tests/data change that happened in 029cd1f739
2024-10-24 11:12:25 +01:00
Anthony Roberts
73974f7beb GPU Subdivision: Disable on Qualcomm GPUs on Windows
This resolves #124515 - albeit a little heavy handedly, as it disables 8cx Gen3 devices which work fine, but for the sake of code cleanliness, this should be okay.

Pull Request: https://projects.blender.org/blender/blender/pulls/129355
2024-10-24 11:55:48 +02:00
Campbell Barton
e3e6dd8fdb Fix #125958: Disable/uninstall an add-on can keep its dependencies
Python wheels from extensions were not being removed after
install/uninstall in some cases - although installing an extension
afterwards that used wheels would recalculate deps & remove them.

- Installing an extension didn't include the extension in the
  compatibility-cache, causing uninstalling not to remove deps.
- Uninstalling an extension wasn't re-calculating the deps,
  leaving them as-is.

Always write the compatibility-cache after installing and uninstalling
so changes are detected & handled.
2024-10-24 20:53:07 +11:00
Michael Jones
029cd1f739 Cycles: Remove invalid use of MetalRT accept_any_intersection in scene_intersect_local
This PR fixes a latent issue arising from invalid use of `accept_any_intersection(true)` when performing SSS ray-stepping with MetalRT. The comment incorrectly states that "we can optimize and accept the first hit", but to guarantee correct behaviour in future we need to request the closest hit.
2024-10-24 10:42:59 +01:00
Campbell Barton
f23478439c Fix #129323: Slowdown adding/removing objects from Python
Python scripts could perform actions that created notifiers
which would not be handled until the script was complete.

In the case of adding & removing objects a notifier would be created
for adding the object, then cleared when the ID was removed.

This lead to the notifier queue filling up with cleared notifiers
which were included in the search whenever an ID was removed.

The result of this was that adding and removing objects from a script
would become increasingly slower & use more memory.

Resolve by storing the current notifier being handed which isn't freed
(only cleared). The notifier handling loop detects cleared notifiers
and frees them after use.
2024-10-24 12:50:31 +11:00
Campbell Barton
9a252c2e73 Fix #127097: Extension preferences crashes after "import multiprocesing"
Remove a workaround for #23871 which manipulated the module
to prevent classes defined in the text editor from having their
name-space cleared.

This caused the "multiprocessing" module to store the "__main__" module
as "__mp_main__" for later use.

Accessing attributes from this module would then attempt to read from
with a null "mp_dict" which crashed. This happened when showing the
extensions preferences but would have occurred if "__mp_main__" was
accessed from elsewhere too.

Resolve by removing the workaround since it has not been needed
since Python 3.2.
2024-10-23 19:45:57 +11:00
Campbell Barton
26d34d3bfc Fix #128312: Incorrect defaults for gizmo properties 2024-10-23 16:12:33 +11:00
Campbell Barton
21457db162 Cleanup: remove deprecated typing use for extensions utility
Also replace some uses of Generator with Iterator.
2024-10-23 15:44:06 +11:00
Campbell Barton
17c32d1bcd AUTHORS: add 1 new author 2024-10-23 12:37:52 +11:00
Campbell Barton
7cacd0da46 Cleanup: suppress unknown source files from "make check_cmake" 2024-10-23 12:37:51 +11:00
Campbell Barton
d1c82cc537 Cleanup: spelling in comments 2024-10-23 12:25:58 +11:00
Campbell Barton
1d286a1b93 Fix #129302: GIL not released if poll_message_set was passed a string
Regression in [0].

Co-authored-by: Jorn Visser <git@jornvisser.com>

[0]: ebe04bd3ca
2024-10-23 12:25:57 +11:00
Philipp Oeser
ef6a035884 Fix #129200: Transfer Mode operator can be used on already active object
If source and destination objecs are the same, we can just early out
(dont even need a report message for this I think).

Pull Request: https://projects.blender.org/blender/blender/pulls/129208
2024-10-22 21:03:30 +02:00
Weizhen Huang
afd629bffc Cycles: make switching of sampling techniques in Draine less noticeable
Draine phase function sampling internally use Henyey-Greenstein and
Rayleigh sampling for degenerated cases, but the sampling pattern was
different between Draine and Rayleigh. The commit effectively replace
`rand` with `1 - rand` in Rayleigh sampling.

Pull Request: https://projects.blender.org/blender/blender/pulls/129261
2024-10-22 15:38:06 +02:00
Weizhen Huang
ee6f27a100 Fix: Cycles: NaN in Draine phase function when g == 0
When `g == 0`, the Draine phase function from
https://doi.org/10.1051/0004-6361/202142437 simplifies to
\[\Phi(\theta)=\frac{3}{4\pi(3+\alpha)}(1+\alpha\cos^2\theta).\]
Similar as Rayleigh sampling in https://doi.org/10.1364/JOSAA.28.002436,
The solution to the CDF of the marginal density function is
\[\cos^3\theta+a\cos\theta+b=0,\]
with
\[a=\frac{3}{\alpha},\quad b=\frac{3+\alpha}{\alpha}(2\xi_1-1),\]
which has only one real root since \(\alpha > 0\),
resulting in the sample technique
\[\cos\theta=u-\frac{1}{\alpha u}.\]

Pull Request: https://projects.blender.org/blender/blender/pulls/129259
2024-10-22 15:37:37 +02:00
Omar Emara
cce896fe11 Fix #127292: Cryptomatte passes are missing meta-data
Meta-data are missing on Cryptomatte layers in the GPU compositor, so
they do not get saved using the File Output node. This is due to a use
after free error where a temporary string is used in the meta-data
population logic. This is fixed by assigning the string to a temporary
variable instead.

Thanks to Jorn Visser for finding the cause of the issue.
2024-10-22 11:50:04 +03:00
Lukas Tönne
71398478b2 Fix #128055: parentinv matrix uninitialized in old GPv2 files
In GPv2 the parentinv matrix is zero initially and only becomes valid
after setting the layer parent. This matrix must not be copied to the
GPv3 layers unless the parent is set.

In addition the parentinv matrix should also be computed when changing
the layer parent. This has been nominally added, except that a full
computation isn't possible without the actual grease pencil Object. This
means a local RNA property cannot update the parentinv matrix, this
needs to become a full-blown operator. The behavior now should be the
same as in GPv2 at least.

Pull Request: https://projects.blender.org/blender/blender/pulls/129304
2024-10-22 09:30:34 +02:00
Sergey Sharybin
a4553aad49 Build: Lower the number of concurrent HIP-RT jobs
This is an attempt to deal with an increased OOM on the buildbot.
2024-10-22 09:15:41 +02:00
Campbell Barton
f69fbb41c1 Fix #129225: Crash in modifiers & constraints with invalid enum values
Even though this is generally avoided, drivers don't prevent
invalid values being set. Further files from branches or files
written in the future may contain enum values not yet known.

Resolve by range checking enum values which are used to index arrays.
2024-10-22 15:56:58 +11:00
Campbell Barton
1d6add574d Fix #129167: Operator search can hang for some operator names
RNA label & description truncation could cause invalid UTF8
which caused BLI_string_search to hang.

Resolve by ensuring truncation of RNA descriptions & labels never
truncates a multi-byte sequences.

The issue with BLI_string_search would still be good to resolve but can
be handled separately.
2024-10-22 12:47:39 +11:00
Campbell Barton
40b5a4da2b Fix misleading assertion message setting built-in operator values 2024-10-22 12:46:39 +11:00
YimingWu
5fff95f519 Fix: Grease Pencil: Add back support for stroke direction overlay
Since GPv3 shader currently uses particle strand/points shader, we
need to modify that slightly to display the grease pencil overlays.

This adds the missing `vflag` attribute to the edit gpencil batch.

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/128116
2024-10-21 18:47:24 +02:00
Jacques Lucke
7c7b8e1f28 Fix #129087: don't show empty panels in geometry nodes modifier
If a panel is detected to be empty, it is hidden automatically now.
This is the same behavior as in group nodes.
2024-10-21 15:47:16 +02:00
Jacques Lucke
84ffe3720d Fix #129217: crash when switching geometry nodes to tool mode with active viewer
The viewer does not work without a context and the context is derived from `snode.id`.
2024-10-21 15:33:21 +02:00
Jason Fielder
4408628a94 Fix: Metal: Resource leak when closing before all compilation batches have finished.
Addresses the case when Blender is shutdown before the
parallel compiler has finished processing all the shader batches.
The parallel compiler destructor will now attempt to terminate all
of the outstanding batches and free the shaders.

Authored by Apple: James McCarthy

Pull Request: https://projects.blender.org/blender/blender/pulls/129172
2024-10-21 14:58:50 +02:00
Aras Pranckevicius
28ea1d2f7b Fix: VSE scopes crash on float images
Regression since a904db3ee7 ("skip no-op colorspace transforms for
float images"), the newly added do_display_buffer_apply_no_processor
function did not handle case of both source and destination being
float images. This happens when VSE produces a float image, and
you turn on a Waveform scope.

Pull Request: https://projects.blender.org/blender/blender/pulls/129293
2024-10-21 14:43:56 +02:00
Jacques Lucke
d7368e0068 Cleanup: remove unused variable 2024-10-21 14:29:04 +02:00
Arye Ramaty
b686e72e57 Fix: wrong offset in the 'Has Neighbour' output of the 'Index of Nearest' node
The first encounter wasn't counted for, which resulted in a bias of one
(vertices with single neighbor return false), I initialized the counting from
1 instead of zero which seems to solve the problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/129021
2024-10-21 14:21:41 +02:00
Jacques Lucke
21a24cf82b Fix #129263: improve measured node execution times
Measure the times of nodes and zones more explicitly in more cases instead
of relying on adding up smaller measurements.
2024-10-21 14:13:28 +02:00
Falk David
83e562aad4 Fix #129247: GPv3: Removing material doesn't remap some materials correctly
The issue was that the code that remaps the materials for when
a slot is removed was returning when the `material_index` attribute
didn't exist instead of continuing the loop over all drawings.

This issue was present both in `BKE_grease_pencil_material_remap`
and `BKE_grease_pencil_material_index_remove`
but `BKE_grease_pencil_material_remap` forced the `material_index`
attribute to be created, which meant that the early return
was never hit.

The fix fixes both issues:
* Continue instead of return.
* Don't create the `material_index` attribute in `BKE_grease_pencil_material_remap`
  if it doesn't exist.

Pull Request: https://projects.blender.org/blender/blender/pulls/129288
2024-10-21 14:11:11 +02:00