Commit Graph

122151 Commits

Author SHA1 Message Date
Jeroen Bakker
cd00d8ca00 Fix: Vulkan: Use after free when switching scenes
Unreported issue introduced from recent changes. (memory leak in immediate mode)

Pull Request: https://projects.blender.org/blender/blender/pulls/144116
2025-08-07 08:56:59 +02:00
Campbell Barton
d441a90030 Cleanup: use RNA_def_enum_flag 2025-08-07 16:55:41 +10:00
Jacques Lucke
33a039dbac Fix #143532: Spreadsheet: use-after-free displaying instance tree
The `GeometrySet` was only allocated on the stack but was accessed after the function ended.

Pull Request: https://projects.blender.org/blender/blender/pulls/144085
2025-08-07 08:30:49 +02:00
Campbell Barton
62a38eacb3 Fix #144086: Crash Running "New Scene" in an Empty file 2025-08-07 14:51:33 +10:00
Campbell Barton
08cf60c66e PyDoc: generate a list of types that support custom properties
Methods for `bpy_struct` such as `get()` & `items()` noted that only
some types support custom-properties.

Since these docs were written many more types support custom properties.
Replace the inline list with a link to a generated list since there are
now too many to include inline.

Resolves #141450.
2025-08-07 14:37:38 +10:00
Campbell Barton
0858f68d3c Fix #143905: Creating a face between two edges can make a bow-tie quad
The check that triangles from a quad point away from each other wasn't
sufficient to avoid creating bow-tie quads.

Resolve by picking the most planar triangle pair.
2025-08-07 13:01:36 +10:00
Campbell Barton
5ff6b6b800 Correct error in e6e7f92ce0 2025-08-07 01:06:42 +00:00
Campbell Barton
e6e7f92ce0 Refactor: simplify checks for the user & environment temp directory 2025-08-07 11:02:36 +10:00
Campbell Barton
4958be0394 Cleanup: remove redundant loop 2025-08-07 10:18:23 +10:00
Campbell Barton
b07a1adf04 Core: remove use of the environment variable TMP on Unix
This isn't a standard and seems only to be included for historic reasons.

Ref !144100
2025-08-07 10:17:51 +10:00
Campbell Barton
9fcdf4822a Cleanup: correct comment, remove unused variable 2025-08-07 09:22:10 +10:00
Campbell Barton
87c4f47312 Fix #139585: Blender could erase OS root
Temporary directory handling had a logical error, assuming the
"session" temporary directory was owned and created by Blender
and could be recursively removed on exit.

However, it's possible creating the session sub-directory fails,
in that case the temporary directory was used for the "session".
This meant setting `C:\` as the temporary directory in the preferences
would attempt to recursively remove `C:\` on exit.

Resolve with the following changes:

- Only perform a recursive removal on the temporary directory
  if a session sub-directory was created.

- If the creating the user-preferences temporary "session" sub-directory
  fails fall back to the systems temporary directory and try to
  create the "session" directory there.

  Previously this was only done if the preference path didn't exist.
  The preferences path was still used if it existed but couldn't be
  written to.

Include a test to ensure this is working as expected.

Ref !144042
2025-08-06 23:13:58 +00:00
Hans Goudey
21cbdab34a Cleanup: Pass ReportList instead of wmOperator
This is more flexible and doesn't include unnecessary information.
2025-08-06 17:47:32 -04:00
Campbell Barton
a229d0d08f Fix #143018: Assert browsing a non UTF8 render output path
Use copy_bytes_truncated when copying file paths which may not be UTF8.

Ref !144052
2025-08-07 06:26:50 +10:00
Campbell Barton
accacc65fc BLI_string_ref: add copy_bytes_truncated method
Needed to copy non UTF8 bytes into a null terminated string.

Ref !144052
2025-08-07 06:25:29 +10:00
Campbell Barton
558d1c4774 Cleanup: use the suffix "_maxncpy" instead of "_len" for string sizes
The term "_len" is too easily confused with the strlen(),
excluding the nil byte.
2025-08-07 06:18:21 +10:00
Campbell Barton
53c2ba29a6 Cleanup: use defines for buffer sizes 2025-08-07 06:18:21 +10:00
Campbell Barton
d30cb946fa Cleanup: remove string length argument for proxy path dir access
Move the fixed size to the function signature since it wasn't used
when passed to BLI_path_abs.
2025-08-07 06:14:46 +10:00
Jacques Lucke
d1d07876c6 Fix: Geometry Nodes: wrong structure types in a couple of nodes
This mainly changes field sockets to dynamic and vice versa in a few cases.
2025-08-06 21:37:44 +02:00
Jesse Yurkovich
cb9ae01c69 Cleanup: USD: Remove some redundant property type checks
For cases where we've already checked that the property is holding a
particular type, use UncheckedGet to ensure the type isn't checked a
second time. This matches all the other call sites doing similar.

Pull Request: https://projects.blender.org/blender/blender/pulls/144084
2025-08-06 21:21:24 +02:00
Guillermo Venegas
363873b821 IO: Improve FileHandler drop operator missing properties warning
As seen in #140942 or 100ed60f2d, files listed in the files property are
relative to the directory property, which may not be the same as the
filepath property parent directory. Not having the directory property
may cause errors.

This improves the warning log message so devs can be more aware of
missing properties. No user visible changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/143804
2025-08-06 20:22:12 +02:00
Jacques Lucke
9bf9f587f9 Fix #143983: crash when shader node from properties editor
This just reverts a very small part of 119fc054f8 that caused this regression.

Pull Request: https://projects.blender.org/blender/blender/pulls/144015
2025-08-06 20:11:38 +02:00
Sean Kim
5066173fbf Fix #143110: Custom keymaps missing versioning for unified settings
Introduced in 4434a30d40

The above commit changed many of the `wm.radial_control` default
keybinds used in various paint modes to support accessing the "unified"
properties on a per-mode basis. While the base Blender keymap and the
industry compatible keymap were updated, this change was not applied
to custom keymaps, leading to confusing behavior for the users.

Pull Request: https://projects.blender.org/blender/blender/pulls/143872
2025-08-06 18:23:11 +02:00
Sean Kim
919eb4bfe7 Sculpt: Emit size for geometry sculpt undo steps
The Sculpt Undo system does not provide an estimated amount of allocated
memory when the `Geometry` type is used. This is commonly used for
non-brush operations that may affect the topology of the base mesh. As a
result, the Memory Limit undo preference is effectively ignored,
potentially leading to scenarios where much more memory is used than the
user desires and / or crashes due to OOM issues.

To address this, use the `MemoryCounter` abstraction to provide an
approximation to the overall undo system.

Note that this does not change any default behavior, as we only limit the
number of steps, not the total memory used by undo.

Resolves: #143257

Pull Request: https://projects.blender.org/blender/blender/pulls/143756
2025-08-06 17:18:19 +02:00
Habib Gahbiche
0b77aec780 Compositor: remove preview for File Output node
Output nodes typically don't have a preview (see also ed13dad0). Also,
it is not clear what should be shown as a preview, especially when the
file output node can have an arbitrary number of inputs of different
types.

This commit removes the preview for the File Output node.

Pull Request: https://projects.blender.org/blender/blender/pulls/144029
2025-08-06 17:15:23 +02:00
Sean Kim
56c08fd5c4 Weight Paint: Round values lower than 0.0001 to 0 when painting
When attempting to paint weights to a value of 0, the current brush
algorithm struggles to reach 0 when iteratively mixing the current and
previous values due to the falloff from the stroke's center.

Values lower than this are rarely helpful, so to improve the overall
experience of zeroing out weights, round values less than 0.0001 to 0.

Resolves #134160

Pull Request: https://projects.blender.org/blender/blender/pulls/144034
2025-08-06 17:13:06 +02:00
Aras Pranckevicius
8222cb0cfd VSE: Faster waveform & vectorscope calculation
Waveform, Parade and Vectorscopes were calculated by copying the
rendered image, transforming it into display space, and calculating
the the scope from that. On large resolutions, this
copy+transform+free of the image was taking up majority of the time.
Especially for default case when the display transform is a no-op.
Change the code so that display transform, if needed, is done directly
inside scope calculation, without needing a full-size temporary image.

Additionally, the vectorscope calculation was single threaded.
Multi-thread it by doing a parallel reduction, where each job
calculates their own scope image, and they are merged. Since job
payload is fairly large (512x512 bytes), make jobs pretty large
(256k pixels each).

Time (in ms) taken to calculate scope at 4K resolution (Ryzen 5950X,
Windows). Default color management settings:

- Waveform, PNG/SDR: 5.5 -> 5.2
- Waveform, EXR/HDR: 33.5 -> 10.3
- Vectorscope, PNG/SDR: 32.4 -> 4.5
- Vectorscope, EXR/HDR: 53.2 -> 9.8

Timings when additional color space management is needed (display
space set to Display P3, sequencer kept at sRGB):

- Waveform, PNG/SDR: 29.5 -> 10.9
- Waveform, EXR/HDR: 67.6 -> 10.9
- Vectorscope, PNG/SDR: 56.8 -> 12.0
- Vectorscope, EXR/HDR: 85.9 -> 13.4

This also fixes calculation of waveform / vectorscope on float (HDR)
images that have alpha channel; the scope was wrongly calculated on
premultiplied color values, which was not consistent with how it was
calculated on the byte images.

Pull Request: https://projects.blender.org/blender/blender/pulls/144059
2025-08-06 16:24:05 +02:00
Falk David
ef6f74f658 Cleanup: VSE: Add additional info to function comment 2025-08-06 16:12:17 +02:00
Brecht Van Lommel
c02b41d8bf Fix #144014: Driver for data.shape_keys path fails with GPU subdivision
Assign the shape keys pointer to the subdiv mesh as was already done for the
evaluated mesh This could already fail before, but is more common now that
subdiv evaluation is always using the wrapper.

Pull Request: https://projects.blender.org/blender/blender/pulls/144030
2025-08-06 15:52:47 +02:00
Mattias Fredriksson
a57c3558cd Curves: Unit tests for curves::nurbs::calculate_evaluated_num()
Unit tests veryfying expectation for curves::nurbs::calculate_evaluated_num().
Expectation is computed from closed form expressions rather then hard coded
values. Purpose for this is to make the tests easier to adjust if, for example,
parameter sampling pattern is changed. It should also make them easier to read
and understand.

Additional purpose is to create a baseline and verify changes for #144000.

Implementation is essentially examples from:
https://link.springer.com/book/10.1007/978-3-642-59223-2

Pull Request: https://projects.blender.org/blender/blender/pulls/143920
2025-08-06 13:59:10 +02:00
Omar Emara
c3688f7bb7 Fix #136939: Translation is ignored in some nodes
The compositor ignores translation in certain nodes like Corner Pin.
Users find this unexpected as adjusting the translation of the input has
no effect on the output. The only alternative logical thing to do if
translation exists is to clip the image, which this patch do.

This affects the following nodes:

- File Output.
- Map UV (Image input).
- Corner Pin.
- Plane Track Deform.
- Bokeh Blur (Bokeh Kernel input).

Pull Request: https://projects.blender.org/blender/blender/pulls/144049
2025-08-06 13:46:34 +02:00
Hans Goudey
3724ebeaa6 Refactor: Extract BMesh attribute lookup function
This is the second time I've needed a function to find an attribute by
name on all attribute domains, with a third time coming soon. It seems
time to put this in a BMesh header.

Pull Request: https://projects.blender.org/blender/blender/pulls/144039
2025-08-06 13:40:51 +02:00
Hans Goudey
b2d0b9535f Fix #143739: Operator redo broken for duplicate move
In this case the depsgraph isn't necessarily evaluated before the
transform operator executes. We need to make sure there's an evaluated
depsgraph so the evaluated deform positions are updated based on the
duplicate operator (the first step of the operator macro).

Pull Request: https://projects.blender.org/blender/blender/pulls/144037
2025-08-06 13:38:49 +02:00
Nig3l
4bede1b555 Image Mask Editor: Expose tools in the Toolbar
Expose existing mask operators as tools in the toolbar.

The primitive tools are commented out since interactively placement
isn't currently supported by the operators.

Ref !136086
2025-08-06 09:44:24 +00:00
Omar Emara
77bb71d8da Fix: Wrong structure type for Transform node output
The output of the Transform node in the compositor has a single value
structure type, while it should be dynamic.
2025-08-06 12:33:44 +03:00
Clément Foucault
b903d3ade3 Fix #143336: Frustum culling is incorrect in Blender 4.5
Caused by a compiler issue with function accessing the same SSBO in
different control flow.

Loading the SSBO data before doing the computation fixes the issue.

Candidate for Backporting to 4.5 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/143926
2025-08-06 10:41:23 +02:00
Campbell Barton
aaedeb3852 Fix #143838: hotkey customization's aren't saved for custom operators
Operators registered after the key-map was initialized would not have
their user customization's loaded from user preferences.

Resolve by tagging the keymap to be updated when appending operators
as well as removal, this only runs the updates when appending
operators after startup.

May also resolve #126641.
2025-08-06 08:09:50 +00:00
Campbell Barton
c54b981b14 Cleanup: rename the keyconfig operator type update function
Use a tag suffix since this read as if it might perform the update.
2025-08-06 18:03:16 +10:00
Campbell Barton
e8501d2f54 Cleanup: grammar corrections, minor improvements to wording
Also back-tick quote some code references in comments
to differentiate them from English text.
2025-08-06 00:20:39 +00:00
John Kiril Swenson
641e4aed95 Cleanup: VSE: Remove StripData.start/endstill
Not to be confused with `Strip.start/endstill` which were renamed with
a legacy suffix. The `StripData` version here isn't present anywhere
in versioning code or otherwise, so it should be safely removable.

Reduces the size of this struct by 8 bytes.

Pull Request: https://projects.blender.org/blender/blender/pulls/143874
2025-08-06 01:37:20 +02:00
John Kiril Swenson
54c63c4138 Cleanup: VSE: Rename deprecated DNA fields with _legacy suffix
No functional changes intended.
2025-08-06 01:37:16 +02:00
John Kiril Swenson
cedf2d9949 Cleanup: VSE: Add deprecation notices to DNA, improve comments
- Add `DNA_DEPRECATED` macros, and comments noting when the fields were
  deprecated
- Improve other comment clarity
- Other small casing fixes and tidying of the file.
2025-08-06 01:37:16 +02:00
Sean Kim
ba291976b2 Fix #143399: Vertex Paint subtract blend mode can cause artifacts
Error in 96e549c092.

The order of colors passed into `BLI_mix_colors` is significant in cases
where the alpha being used is 0. The intent of this line is that the
temporary stroke buffer should have the value of mixing the brush color
with the current buffer value.

Pull Request: https://projects.blender.org/blender/blender/pulls/143972
2025-08-05 22:52:34 +02:00
Laurynas Duburas
c59a1aedbf Curves: Add "Curve Data" edit mode panel
Adds "Curve Data" panel analogous to "Active Spline" in legacy curves.
This allows setting values both for single and multiple selected curves.
If a particular field's value differs among selected curves, the mean
value is shown in inactive field. The field is modifiable and input
value is set to all selected curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/141572
2025-08-05 22:25:06 +02:00
Harley Acheson
df7da7ef21 UI: VFont Placeholder Size Correction
This PR scales the VFont placeholder character so that it is always
approximately en width. It is currently too wide and scales the size
and line width incorrectly for different font dimensions.

Pull Request: https://projects.blender.org/blender/blender/pulls/143812
2025-08-05 19:31:44 +02:00
Hans Goudey
2a8da4c1fa Fix #143952: Broken Grease Pencil edit lines overlay in some cases
Caused by 5f6e94ca58

When there are more than 2^16 points, the GPU index buffer code tries
to compress the indices to uint16 because we passed the incorrect max
index. In general that optimization just isn't worth the complexity
of precalculating the max index in this situation. There are other
potential optimizations here that would be vastly more helpful.
So just pass INT_MAX to disable the compression.
2025-08-05 12:56:26 -04:00
Hans Goudey
1d34381abd Cleanup: Fix missing declaration warnings in compositor 2025-08-05 12:11:27 -04:00
Sybren A. Stüvel
0fa67c3ea2 Fix #142464: Add customizable color for W quaternion channel
The W channel in quaternion and axis-angle F-Curves is now themeable
(defaulting to yellow), instead of incorrectly blending the X and Y axis
theme colors.

The original blending math did not take into account that the hue
channel actually wraps around, and so the blended color became blue
instead of the intended yellow.

Instead of fixing the math, the theme has been expanded for this W axis.
The default color is set to the mathematically correct yellow.

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/143211
2025-08-05 17:55:12 +02:00
Jacques Lucke
0f65acef25 Fix #143839: missing warning when connecting field to single value
The behavior of the field inferencing changed slightly. So instead of checking
if the link connects a socket that has a field to one that does not, check the
source is a field and the target does not support one. Note the difference
between "having a field" and "supporting a field".

This was probably broken in 7b7c630018.

Pull Request: https://projects.blender.org/blender/blender/pulls/143975
2025-08-05 16:28:16 +02:00
Jeroen Bakker
8bfcb5e509 Fix #142093: Fix crash when entering sculpt mode
In case an image editor is open in the same window, entering sculpt mode
could crash. The cause is that the 3d viewport can request the sculpt
data vbo and its batch. But the image editor doesn't need it and removes
the sculpt data vbo, but doesn't remove the batch. Next frame the batch
could point to invalid data.

This fix will not keep the batch around so it is always being
reconstructed. A better solution needs to be found as the removal of the
vbo is done in a strange part, and the vbo should be checked against the
cd needed over time.

Pull Request: https://projects.blender.org/blender/blender/pulls/144013
2025-08-05 16:26:55 +02:00