Commit Graph

152198 Commits

Author SHA1 Message Date
Richard Antalik
40b2cd92ee Fix #142195: Crash when adding stereo 3D image
Caused by assigning pointer to address which is eventually freed.

Use `MEM_mallocN()` with copy assignment instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/142361
2025-07-21 14:05:31 +02:00
Bastien Montagne
2933433abc Cleanup/Refactor: Readfile: Add a fd_bmain new pointer to FileData.
Existing code was confusing, as existing `FileData::bmain` was not
really documented, and it could be in some cases the 'library bmain' of
a library filedata, instead of the 'main' Main (i.e. the local data of
the currently editied blendfile, the one containing all local IDs).

Now, `FileData::bmain` is always the 'main' root Main.

The new `FileData::fd_bmain` is assigned with the Main matching that
filedata and its blendfile: either the same 'main' Main (when used to
read the main edited blendfile), or the 'library' Main (when used to
read a library blendfile).

This is mostly no-op change in current code (with one exception, see
below), as this pointer is currently mostly used either:
* In a context whgere it is also always the 'main' Main, or...
* In a context where it is only used to access the (shared among all
  Mains) list of `Main::split_mains`.

But having a clear and sane definition of this data gets much more
important with packed linked data (see !133801), as there we have data
that 'belong' to a library, but must e.g. be read from another FileData,
with the added complexity of different versions etc.

NOTE: The only effective change in this commit is
`read_library_file_data`, which used to assign the _library_ Main to the
new (library) `FileData::bmain`. This should not have any effect in
practice in current code, as this Main is only used to access its list
of split_mains.

Pull Request: https://projects.blender.org/blender/blender/pulls/142384
2025-07-21 13:32:31 +02:00
Richard Antalik
10b2670616 Fix #141709: VSE doesn't show scene strip subframes
Caused by source cache using integer for frame index, which is used as
cache key. Use float for scene strips instead.

Co-authored-by: Aras Pranckevicius <aras@nesnausk.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/142380
2025-07-21 12:45:12 +02:00
Sebastian Parborg
0f4a46093e Fix: Properly package unicode folders/files with make_source_archive.py
The issue was that `git ls-files` will per default escape unicode
characters. This make it so that our python script couldn't find any
files or folder as it expected unescaped characters.
2025-07-21 12:37:11 +02:00
Lukas Tönne
79e61be409 Fix #142649: Grease Pencil remove fill guides operator breaks triangle cache
This needs a topology cache update to ensure triangles are update after removing
curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/142671
2025-07-21 12:16:50 +02:00
Weizhen Huang
5a27edcf79 Fix #141136: Cycles Hair black artifacts with direct coloring
fixed by clamping negative input colors

Pull Request: https://projects.blender.org/blender/blender/pulls/142667
2025-07-21 12:15:04 +02:00
Pratik Borhade
744793ff72 Fix #141565: Mode icons in outliner too far to the left
Affected due to c046b8bb21
To fix this, move icon to the right by same factor as in the above commit

Pull Request: https://projects.blender.org/blender/blender/pulls/141596
2025-07-21 11:56:13 +02:00
Bastien Montagne
f67ce27f69 I18N: Updated UI translations from git/weblate repository (def3c8131dbed9f). 2025-07-21 11:33:49 +02:00
YimingWu
f74ad86748 Fix #142647: Don't create preset that has the same name as built-in ones
When creating presets in some panels, names like "Default" can be used
which are the same preset names as bundled presets. New entries created
like this can't be deleted because blender will treat it as a bundled
preset which then leaves stale entries in the list. This fix prevents
those kind of preset names to be used during creation.

Pull Request: https://projects.blender.org/blender/blender/pulls/142652
2025-07-21 11:23:40 +02:00
Aras Pranckevicius
e57b73bdf7 Fix #142333: new FBX importer produces broken rotation fcurves in some cases
Need to ensure that interpolation between neighboring quaternions
takes the shortest path. The Python FBX importer was doing this;
due to oversight was missed in the new importer.

Pull Request: https://projects.blender.org/blender/blender/pulls/142659
2025-07-21 10:50:48 +02:00
Habib Gahbiche
a775d58b2e Fix: Assert after importing a USD scene with DomeLight
**How to reproduce the bug:**
Load the attached Blend File OR

1. Create a new World in python: bpy.data.worlds.new("Test")
2. Switch to this new world in the UI (but do nothing else to it)
3. Import in a USD file with a DomeLight (see attached file in PR)
4. Close Blender
5. Observe assert `BLI_assert(ELEM(owner_id, nullptr, id));`

The issue was caused by a assigning a regular node tree
`World->nodetree` whereas an embedded one is expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/142367
2025-07-21 10:21:51 +02:00
Habib Gahbiche
806c317306 Cleanup: Node gizmos: move ibuf check to centralized function
Follow up to https://projects.blender.org/blender/blender/pulls/140356

Pull Request: https://projects.blender.org/blender/blender/pulls/141947
2025-07-21 10:20:56 +02:00
Alaska
281a594c22 Tools: Small changes for fixes per release script
This commit makes a few small changes to the bug fixes per release
script:

- The main loop is factored out into it's own function, making it
easier for external scripts to reuse.
- The cached commits file has been renamed to include the range
that is cached. This allows multiple caches to be kept for situations
where you're collecting a list for both the current release and main.
- The Blender 5.0 example has been updated with the 4.5 backport task.

Pull Request: https://projects.blender.org/blender/blender/pulls/141867
2025-07-21 08:06:29 +02:00
Harley Acheson
690000da9f UI: Hide More Content for Full Screen Area
The "Full Screen Area" makes the area take up the screen and also hides
most regions. This is meant to be as clean as possible, as part of the
stereo 3D pipeline. There are some items that remain though. This PR
removes navigation gizmos, text overlay, and statistics overlay.

Pull Request: https://projects.blender.org/blender/blender/pulls/142418
2025-07-20 21:44:19 +02:00
Howard Trickey
d6e49385cf Fix #142454: Blur Attribute after Manifold Boolean crashing.
The code added to postprocess the manifold result to remove
extra vertices introduced on edges had a logic bug in it.
It would sometimes dissolve a vertex from a triangle.
I thought that would be very rare and just repeated a vertex to
fill out the triangle, but that leads to a mesh that doesn't validate.
Anyway, my logic to prevent a single vertex from being dissolved from
a triangle was wrong (if the triangle was seen second while looking).
I fixed that, and then the even rarer case of two vertices being
dissolved from a quad showed up. I have prevented all such cases
by a loop that disables all vertex dissolving in faces where it
would leave less than three vertices.
Also added an assert (so, debug-mode only) that the mesh produced
by manifold boolean is valid.
2025-07-20 15:19:42 -04:00
Howard Trickey
248529d6e0 Fix #142494: Manifold Boolean Subtraction causes crash.
The case of subtracing a plane is handled specially as the
plane is not manifold, but the library has a TrimByPlane function.
The special handling code did not deal with the empty result case
properly.
Also, there was no error return checking from Manifold in this special
case, so that was added.
Also, the general error handling just assumed that any Manifold error
on the inputs was a "not manifold" error, which while probably true,
should not be assumed, so that was fixed too.
2025-07-20 08:36:53 -04:00
Campbell Barton
f8c0d504f4 Fix #142245: Crash adding subsurf with invalid material indices
Bounds check material indices since they may exceed the total number of
materials. This looks to be an oversight in [0] which added support
for an OpenGL evaluator.

[0] eed45d2a23
2025-07-20 19:50:19 +10:00
Campbell Barton
008ed81d26 Fix #141777: Crash closing an unfocused window on Wayland 2025-07-20 16:31:57 +10:00
Campbell Barton
1762a66b82 Cleanup: use const cast 2025-07-20 15:27:07 +10:00
Campbell Barton
df1da0fbdd Cleanup: pass large arguments by const reference instead of by value 2025-07-20 15:23:07 +10:00
Campbell Barton
e5947bdf63 Cleanup: spelling (make check_spelling_*)
Also exclude some files that have too many false positives.
2025-07-20 14:59:19 +10:00
Germano Cavalcante
732436946e Fix #142338: Edge center snapping interferes with face snapping
The snapping system could return a regular 'Snap to Edge' result when
only derived edge snap types (midpoint, endpoint, perpendicular) were
enabled, even if 'Snap to Edge' itself was not included among the
selected snap modes. This led to unintended snapping behavior.

To address this, a backup of the previous snap result is stored before
edge snapping is attempted. If the resulting snap mode is not among the
explicitly selected types, the previous state is restored. Additionally,
the `hit_list` assignment was moved to the runtime context to separate
intermediate data from the final snap result.

Pull Request: https://projects.blender.org/blender/blender/pulls/142512
2025-07-19 22:45:20 +02:00
Jeroen Bakker
4de5da1ea2 OpenXR: Compile without OpenGL backend
This PR allows blender to be compiled with OpenXR, but without
OpenGL support.

For investigating a bug we needed to compile Blender without
OpenGL (`WITH_OPENGL_BACKEND=OFF`) but it would fail to
compile OpenXR (`WITH_XR_OPENXR=ON`). This PR tweakes
the preprocess directives to compile the openxr graphics
binding without OpenGL.

Co-authored-by: Jonas Holzman <jonas@holzman.fr>
Pull Request: https://projects.blender.org/blender/blender/pulls/141668
2025-07-19 21:40:49 +02:00
Sebastian Parborg
17b9759942 CMake: Sync up minimum version to 3.10
Besides being more consistent with the minimum version we use, this also
fixes warnings when using CMake 4.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/142497
2025-07-19 20:37:10 +02:00
Nikita Sirgienko
9875836519 Cycles: oneAPI: Compile only needed device binaries in multi-GPU case
The code of the "oneapi_load_kernels" function before this modification
was loading kernels and compiling them, if needed, for all devices in
the associated GPU context. This makes sense for one GPU execution
scenario, as well as for execution scenario of multi identical GPU,
but in cases where Blender users have several different GPUs in
render, the previous implementation would compile all kernels
for all devices for each device, unnecessarily doing the same
work multiple times. Because of this, I am changing the
implementation so that now compilation happens only for the used
device per used device, ensuring that no unnecessary work is done.

No render performance changes are expected.
2025-07-19 14:15:36 +02:00
John Kiril Swenson
27af4a2f52 VSE: Clamp "Move Strips" starting position to region bounds
This patch clamps newly added strips with the "Move Strips" property
to the VSE region bounds.

It is often the case that the file browser popup ends up away from the
VSE region, leading to strips getting added off-screen, which defeats
the intended purpose of the property (to make it easier to know where
strips are when they're first added). This patch ensures they are always
visible by default.

Minimum frame and channel to clamp to are defined by the region
bounds, and maximum x and y are 90% of the area. The time scrub
bar is taken into consideration to avoid it obscuring the new strips.

Another possibility is to center the strips if they end up offscreen,
but by having strips start out at the edge, they naturally tend to
recenter themselves if the user brings the mouse cursor closer to the
sequencer region.

Pull Request: https://projects.blender.org/blender/blender/pulls/141838
2025-07-18 23:26:06 +02:00
Sean Kim
fef8c23e9e Refactor: Paint: Migrate runtime data out of UnifiedPaintSettings
This commit moves 23 total existing runtime-only properties from the
`UnifiedPaintSettings` struct into the `PaintRuntime` BKE struct. This
shrinks the amount of persisted data by 224 bytes per paint mode per
scene.

In doing this conversion, fields that were previously `char` booleans
have been converted to `bool` types, and C++ math vector types have been
used where appropriate as well.

Some of these attributes may move again in the future to better
distinguish stroke level data from mode level data.

Pull Request: https://projects.blender.org/blender/blender/pulls/141366
2025-07-18 23:18:27 +02:00
Guillermo Venegas
3816c665a5 Cleanup: UI: Slightly optimize uiBut memory layout
This saves up to 56 bytes (896 vs 952).

Pull Request: https://projects.blender.org/blender/blender/pulls/142379
2025-07-18 22:28:44 +02:00
илья _
3e8250e60c GPU: Do not fill index buffer object with zero on allocation
There is no need to initialize index buffers with zero since such
buffers always have to be filled by the caller. This change replaces
the allocation with malloc, so that GPU_indexbuf_init results in an
uninitialized buffer. In debug, and with asan, the buffer will be still
filled by something, but the caller should initialize zero indices
manually instead of relying on a default value.

For example, sometimes the cost of zeroing on allocation is similar to
the cost of filling the buffer with actual data. For a point cloud with
1'000'000 points, octahedron topology update on each frame of simulation
takes:

|                            | Main    | PR      |
| -------------------------- | ------- | ------- |
| GPU_indexbuf_init          | 2.75 ms | 5233 ns |
| pointcloud_extract_indices | 6.95 ms | 4.64 ms |

Pull Request: https://projects.blender.org/blender/blender/pulls/141110
2025-07-18 21:22:18 +02:00
Jesse Yurkovich
c2cf3783c4 USD: Rename attr_import_mode option to property_import_mode
This rename creates separation between USD primvars/Blender geometry
attributes - which are not controlled with this setting - and the
concept of USD attributes+userProperties/Blender custom object
properties - that this option deals with.

Ref #134012

Pull Request: https://projects.blender.org/blender/blender/pulls/142301
2025-07-18 20:58:48 +02:00
Jesse Yurkovich
fe54725113 USD: Rename import_subdiv option to import_subdivision
This aligns with the option used for USD export (export_subdivision) and
the option used for FBX import (import_subdivision).

Ref #134012

Pull Request: https://projects.blender.org/blender/blender/pulls/142278
2025-07-18 20:56:01 +02:00
Jesse Yurkovich
a27384e389 Fix: Typo in documentation for new POINT_UNIFORM_COLOR gpu shader
Typo introduced with initial commit c56a855b9f
2025-07-18 20:52:10 +02:00
Clément Foucault
1f885e8ff8 Fix #142328: Sculpt: Blender crashes switching to sculpt mode
The report's mesh has a material index of -1 on one batch.

The current sanitizing of the index did not take this possibility
into account. Moreover, it was clamping to 1 index too high.

Candidate for 4.5 LTS backport.

Pull Request: https://projects.blender.org/blender/blender/pulls/142337
2025-07-18 20:38:31 +02:00
Ramon Klauck
e41811e225 Fix #142291: Crash when transforming strip in preview with audio strip active
This happened because audio strips lack the `data->transform` attribute,
but it was attempted to access this attribute. It is fixed by checking
first if `data->transform` exists.

Pull Request: https://projects.blender.org/blender/blender/pulls/142351
2025-07-18 19:56:25 +02:00
Hans Goudey
4a3d8e426a Fix: Crash with "color_attributes" property on Curves
In the initial change moving point clouds to use AttributeStorage
I mistakenly thought that only meshes had the color_attributes
property. This commit just implements that for non-meshes.
2025-07-18 13:23:03 -04:00
Hans Goudey
21f0dace48 Refactor: Make CD_TYPE_AS_MASK into a function with typed argument
So that misuse of this will result in build errors instead of bugs
(this change found three places like that).
2025-07-18 13:23:03 -04:00
Hans Goudey
4008b2dcb5 Cleanup: Remove unused attribute RNA function 2025-07-18 13:23:03 -04:00
Richard Antalik
577543c185 Fix #141503: Double click in file browser adds strip to the cursor
This happens, because after double clicking, release event was not yet
processed when `seq_slide` operator is executed.

There is `release_confirm` property to avoid this behavior, which wasn't
set to false.

Pull Request: https://projects.blender.org/blender/blender/pulls/142373
2025-07-18 19:14:49 +02:00
Hans Goudey
8cc29b9cd4 Fix: Build error in lite build
Caused by 0396316fa4
2025-07-18 12:04:58 -04:00
Falk David
11d2f48882 Fix #141887: Crash/assert hit after reading Grease Pencil
Since 5.0 (subversion 33) `CurvesGeometry` data is read from and written
to the new attribute storage. See 68759af516.

For backwards compatibility, the `CustomData curve_data`
became `curve_data_legacy` and was only read and then converted in
the versioning code to the attribute storage format.

But since `CurvesGeometry::blend_read` is still reading
`curve_data_legacy`, we need to ensure that this data is valid.

When e.g. duplicating `CurvesGeometry`, the `curve_data_legacy` was left
uninitialized, so in an invalid state. Then the writing code would write
the embedded `CustomData` struct and the reading code would fail.

This could in theory also happen for other IDs that store legacy
custom data.

To ensure that the data is valid when reading, we do the following:
1) After the conversion code ran, we reset the legacy data. This makes
sure that we don't keep the legacy data around at runtime and
potentially when writing the embedded struct.
2) Before writing, we also reset the legacy data. This makes sure that
in case there is some garbage data in the unused struct (e.g. from
copying the ID), we don't write the garbage to file.

Pull Request: https://projects.blender.org/blender/blender/pulls/142327
2025-07-18 17:55:36 +02:00
Philipp Oeser
e34f5a1d99 Fix #142326: Manifold boolean with plane ignores object transforms
To resolve, simply pass the matrix to `is_plane` and transform the
points before creating a plane from them.

NOTE: we also have a crash in main when the plane is "outside" the
target, will report that separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/142336
2025-07-18 17:54:22 +02:00
Sebastian Herholz
20e0fed7da Cycles: Fixing wrong PDF evaluation when BSDF closures are excluded by the light source
Pull Request: https://projects.blender.org/blender/blender/pulls/142323
2025-07-18 17:13:54 +02:00
Richard Antalik
a002fa5efa Cleanup: Format 2025-07-18 17:07:45 +02:00
Richard Antalik
0396316fa4 Fix #141084: Sound glitches in render with equalizer
Ultimately, the issue was caused by updating sound sequence handle in
`AUD_SequenceEntry_setSound` on each new frame regardless if the
modifier data has changed.

This commit fixes the issue by implementing a means for modifiers to
check, if their parameters or inputs are changed.
This is done by storing these parameters in `StripModifierDataRuntime`
struct, that is shared between all modifier types. This is not ideal,
but it significantly simplifies dependency graph runtime store/restore
code.
Function `strip_update_sound_modifiers` passes boolean `needs_update`
to strip stack update functions. If any needs to be updated, it sets
value of `needs_update` to true allowing following update functions to
skip parameter checking to speed up the process.

Original code updated sound sequence handle twice. Once by function
`BKE_sound_update_scene_sound` then by `strip_update_sound_modifiers`.
If sound modifier is used, only `strip_update_sound_modifiers` needs to
be called, so there is condition to decide which one of these functions
is called.

Also fixes #139605

Pull Request: https://projects.blender.org/blender/blender/pulls/141595
2025-07-18 16:34:09 +02:00
Pratik Borhade
ef89c75382 Fix: Grease Pencil: Wrong layer attributes after reorder
Reordering layer nodes by drag-drop, move up/down, add new etc. swaps
layer attributes with wrong layers. This is due to mistake in map
`new_by_old_map`. Values of this map is used as indices in src array.
And keys are indices of dst array. Expected behavior is to copy attribute from
old position (`layer_i_old`) of src array to new position (`layer_i_new`) of
dst array. See: `array_utils::gather`.

Noticed during !141772.

Pull Request: https://projects.blender.org/blender/blender/pulls/141935
2025-07-18 16:30:41 +02:00
Jacques Lucke
20eaa1b1b0 Fix: Attributes: missing null check in when accessing attribute for write 2025-07-18 16:21:25 +02:00
Omar Emara
d18c9f38e0 Cleanup: Remove unused Viewer node ID member
The ID member of the Viewer node was assigned the viewer image ID. But
that member is not actually used by node execution code, so it can be
removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/142356
2025-07-18 16:18:53 +02:00
Falk David
99f3beb63f Refactor: VSE: Use new scene context function
This PR switches out the internal scene context function
used from the sequencer. This is done in preparation for
#140271.

Using a separate context function allows us to keep the
existing `context.scene` to refer to the active scene
and use a separate context member to refer to the
sequencer scene in the workspace (which is added in #140271).

Previous attempts simply overrode the `context.scene`
to refer to a different scene than the active one in the window.
This has two issues:
1) Any operator that wants to use the active scene in the window
  can't do it in the context of the sequencer. This is a problem for
  example for poll functions of operators that don't have anything to
  do with the sequencer.
2) For better or for worse, Blender expects the `context.scene` to
  always exist. For the sequencer, we'd like to possibly have no
  sequence selected.

Using a different context member for the sequencer has some
advantages:
1) Although we have to change quite a few places, it's limited to the
  sequencer. We don't have to change other parts of Blender to make
  things work.
2) It allows us to prepare for the future when we might want to
 separate the VSE from the scene. This is a step in that direction.
 Having a different context function makes it easy to find the places
 that would need to be refactored.

Pull Request: https://projects.blender.org/blender/blender/pulls/141271
2025-07-18 16:17:47 +02:00
Brecht Van Lommel
87ff645f5d Fix: Cycles preferences Python error after recent changes
Assigning properties in PropertyGroup has become more strict, define it in
__slots__ since it's a runtime property.

Pull Request: https://projects.blender.org/blender/blender/pulls/142357
2025-07-18 16:07:53 +02:00
Clément Foucault
b77d4a8f60 Fix #142259: Overlay: Velocity drawing outside of cache range causes crash
The check for ensuring active frame is in cache range was
wrong and would still try to draw the velocity.

Candidate for 4.5 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/142332
2025-07-18 15:59:53 +02:00