Commit Graph

119231 Commits

Author SHA1 Message Date
luz paz
0c3005ca0c Cleanup: Fix typos in source/blender/draw
Fixes user-facing and non-user-facing typos.
Found via codespell

Pull Request: https://projects.blender.org/blender/blender/pulls/145972
2025-09-10 11:19:36 +02:00
luz paz
7ecf44a05c Cleanup: Fix typos in source/blender/depsgraph
A few typos in source/blender/depsgraph subdirectory.
Found via codespell

Pull Request: https://projects.blender.org/blender/blender/pulls/145973
2025-09-10 11:17:49 +02:00
Clément Foucault
91614ee5d6 Fix #145203: Switching armatures in pose mode fails when behind mesh
The code introduced in a08de337db
did not account for the special case of `SELECT_PICK_NEAREST`
where the depth data is actually bitshifted.

Pull Request: https://projects.blender.org/blender/blender/pulls/145924
2025-09-10 10:52:21 +02:00
Philipp Oeser
29d18c45e4 Fix #145890: Crash using playhead snapping in VSE in new scene
Code was not guarding against missing `Editing` (like we usually do for
these situations).

This also corrects usage of `CTX_data_scene` (use `CTX_data_sequencer_scene`
where needed instead) which should be needed since 1122a05cb6

Pull Request: https://projects.blender.org/blender/blender/pulls/145908
2025-09-10 09:22:04 +02:00
Jacques Lucke
ccdbcaa652 Fix: Nodes: inactive panel toggle is not grayed out
The panel label was grayed out, but not the panel toggle.

Pull Request: https://projects.blender.org/blender/blender/pulls/146006
2025-09-10 08:51:12 +02:00
Campbell Barton
c241ea1083 Cleanup: remove unused variable 2025-09-10 14:27:56 +10:00
John Kiril Swenson
3878748b2f Fix #145715: Right click select doesn't work with Blade Tool
Blade cursor patch #136749 cancelled select operations if the current
tool was the blade tool. This was to prevent LCS users from being able
to select handles when the blade tool would pass-through.  This however
resulted in an RCS regression.

Fix instead by cancelling split if the mode is `use_cursor_position`
and there is no valid split, preventing a pass-through.

In RCS this works nicely because users can just select using right-click
and bypass split logic. In LCS this makes it impossible to select with
the blade tool enabled, but this is expected behavior as the blade tool
does not need strips to be selected to work anyways, and tools should
ideally have different, non-overlapping purposes. For instance, the slip
tool also does not affect selection logic.
(Note: there is one small caveat to this principle, which is that the blade
tool can't currently split connected strips together unless theyre both
already selected. This issue should be fixed with a future blade tool
refactor).

This also fixes unrelated bugs:
- Blade cursor no longer shows on first/last frames, where split point
  fails
- You can no longer split in the gutters between channels

Pull Request: https://projects.blender.org/blender/blender/pulls/145938
2025-09-10 00:44:33 +02:00
Ramon Klauck
46ad17f351 Fix #145817: Crash while pasting audio strips
This happened because it was attempted to access or set the
non- existent pixelspace offset of these audio strips. It is fixed by
applying the "paste at mouse" behavior only for strips that would be
rendered, which excludes sound strips implicitly. This has also
benefit, that strips with effects would only change position of the
effect thus avoiding double transformation.

Pull Request: https://projects.blender.org/blender/blender/pulls/145819
2025-09-10 00:11:34 +02:00
Sybren A. Stüvel
0aa3a0dc0a Cleanup: fix unused parameter in release builds
Add `UNUSED_VARS_NDEBUG(ac);` to silence the 'unused parameter' warning
in non-debug builds.

No functional changes.
2025-09-09 17:57:27 +02:00
Richard Antalik
9882f35353 Fix #145629: Crash when pasting strip with driver
Original code assumed, that if there is action or drivers, action
datablock will be copied into `Main`, which is later freed. But drivers
are not part of action datablock.

Pull Request: https://projects.blender.org/blender/blender/pulls/145677
2025-09-09 17:24:20 +02:00
Habib Gahbiche
a7a07b4102 Fix #145675: Crash when opening file with undefined node
The crash happens in 5.0. The fix is for 4.2 mainly because 4.2 is a
currently maintained LTS so it's the oldest version that will
practically get the fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/145726
2025-09-09 16:28:34 +02:00
Jacques Lucke
32c301e3cf Shader Nodes: support repeat zones, closures and bundles
This adds a function that can turn an existing `bNodeTree` into an inlined one.
The new node tree has all node groups, repeat zones, closures and bundles
inlined. So it's just a flat tree that ideally can be consumed easily by render
engines. As part of the process, it also does constant folding.

The goal is to support more advanced features from geometry nodes (repeat zones,
etc.) in shader nodes which the evaluator is more limited because it has to be
able to run on the GPU. Creating an inlined `bNodeTree` is likely the most
direct way to get but may also be limiting in the future. Since this is a fairly
local change, it's likely still worth it to support these features in all render
engines without having to make their evaluators significantly more complex.

Some limitations apply here that do not apply in Geometry Nodes. For example,
the iterations count in a repeat zone has to be a constant after constant
folding.

There is also a `Test Inlining Shader Nodes` operator that creates the inlined
tree and creates a group node for it. This is just for testing purposes.

#145811 will make this functionality available to the Python API as well so that
external renderers can use it too.
2025-09-09 16:15:43 +02:00
Sergey Sharybin
d5633cc7a8 Fix #145891: Crash scrubbing VSE using Shift-RMB in scene with no channels
Pull Request: https://projects.blender.org/blender/blender/pulls/145968
2025-09-09 15:48:01 +02:00
Ray Molenkamp
c5c9b97bec Fix: Build error with MSVC
node_geo_mesh_primitive_cube.cc uses M_PI_2 without including
BLI_math_constants.h. Unsure why this is a problem for me locally
but not for the bots but i'm guessing its a unity build difference.

Pull Request: https://projects.blender.org/blender/blender/pulls/145950
2025-09-09 15:45:55 +02:00
Sybren A. Stüvel
4132c7338a Cleanup: remove unnecessary code from dopesheet editor RNA
d1962be44c removed the call to
`BKE_view_layer_active_object_get()`. It did leave some "supporting
code" around, which was necessary to make that call possible but now is
no longer needed.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/145977
2025-09-09 14:52:30 +02:00
Sybren A. Stüvel
06b36bb441 Fix #145959: Hiding from the outliner triggers an assert
Call `BKE_view_layer_synced_ensure()` before
`BKE_view_layer_active_object_get()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/145975
2025-09-09 14:51:54 +02:00
Clément Foucault
51b5ae24f5 Fix #145028: Regression: 3D cursor misaligned with axes
The port in 38ce310c17
missed that axes in 3D view are drawn using the perspective
projection matrix and not the 2D one.

Pull Request: https://projects.blender.org/blender/blender/pulls/145927
2025-09-09 14:45:37 +02:00
Clément Foucault
7761b8cfb2 Fix: Overlay: Outline of subpixel Curves produce high aliasing
Issue introduced by #143180. The code was there beforehand but
was not clear. It was left commented out.
Modify it so that it matches the new code.
2025-09-09 14:15:55 +02:00
Clément Foucault
79f3c5266a Fix: GL: Missing version parsing for Linux AMD Pro GL implementation
This avoid using the workaround on known working drivers.

Detected when investigating shader compilation performance.
These new drivers where forced to not use threaded compilation.

Candidate for backport to 4.5 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/145969
2025-09-09 14:10:26 +02:00
Jorn Visser
227052de83 Fix #145719: Crash when using Capture Screenshot Preview
When an asset in the current file is loaded from a user asset library,
weak references to it will have `asset_library_type` set to
`ASSET_LIBRARY_CUSTOM` and not `ASSET_LIBRARY_LOCAL`. Its
`relative_asset_identifier` will, however, be relative to the current
file (`Object/Cube`) instead of to the asset library's root
(`cube.blend/Object/Cube`). This combination makes loading such assets
from a weak reference fail, leading to a null dereference when using the
Capture Screenshot Preview operator.

To fix this, make such assets be loaded with `asset_library_type` set to
`ASSET_LIBRARY_LOCAL` instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/145967
2025-09-09 12:55:37 +02:00
Clément Foucault
18d3f0a1a5 Fix #145651: GPU: Memoryleak drawing node links
The link buffer was not free on exit.
Previous implementation was freing it with the
gpu::Batch which is registered as preset.
This commit introduces buffer registration
to free them on exit.

Pull Request: https://projects.blender.org/blender/blender/pulls/145921
2025-09-09 12:49:32 +02:00
Falk David
9c8eb0bcb9 Fix #145960: VSE: Modifier panel shows up in preview region
This was happening because the strip modifier types register
their panels when the editor is created, but the poll functions
of these panels did not check for the view type.

To fix this, add a condition to the `modifier_ui_poll`
that checks if the view type is not `SEQ_VIEW_PREVIEW`
when the panel is added to a sequencer space.

Pull Request: https://projects.blender.org/blender/blender/pulls/145964
2025-09-09 12:31:11 +02:00
Sybren A. Stüvel
78032d57e7 Fix #145753: Crash deleting a keyframe for another slot when tweaking
When deleting the last key of an F-Curve, the F-Curve itself also gets
deleted. This is now done via the same code as deleting F-Curves from
the channel list.

Before this fix, a deletion function was used that's not capable of
deleting from Actions in NLA strips, which is why it crashed.

Pull Request: https://projects.blender.org/blender/blender/pulls/145929
2025-09-09 10:14:46 +02:00
luz paz
81c8b22eeb Cleanup: Fix typos in source/blender/gpu
Fix some non-user-facing typos.
Found via codespell

Pull Request: https://projects.blender.org/blender/blender/pulls/145815
2025-09-09 09:07:23 +02:00
Campbell Barton
0b411ddd08 Fix: typo calculating the maximum width/height of a region
Correct typo, in practice both values are typically much larger
than the input `dist` this wasn't likely to cause real world errors.
2025-09-09 17:00:27 +10:00
luz paz
afbdf50b85 Cleanup: Fix typos in bmo_join_triangles.cc
Fix spelling "mergable" -> "mergeable"
Found via codespell

Signed-off-by: luz paz <luzpaz@proton.me>
Pull Request: https://projects.blender.org/blender/blender/pulls/145812
2025-09-09 08:50:29 +02:00
Jacques Lucke
6066a0f83c Mesh: Optimize sparse face to vertex attribute interpolation
This was found to be a bottleneck in #136477. Before this conversion would
always convert the entire attribute. However, the caller only required a single
index. Now the attribute is interpolated lazily when specific indices are
requested later.

Pull Request: https://projects.blender.org/blender/blender/pulls/145934
2025-09-09 07:58:44 +02:00
Jacques Lucke
51f8b8c3c4 Fix: Nodes: muted nodes shows all unused inputs
Previously, when a node was muted, all automatically hidden sockets suddenly
became visible. This is because of a rule where inputs that are never ever used,
are not-hidden (only sockets where the usage depends on some condition are
allowed to be hidden automatically). Since the inputs without internal link in a
muted nodes are never used, they become visible when a node is muted.

The solution is to ignore whether a node is muted in the case when the socket
usage for node-editor-drawing is computed. In nested nodes, muting should not be
ignored.

Pull Request: https://projects.blender.org/blender/blender/pulls/145729
2025-09-09 07:58:00 +02:00
Eitan Traurig
9f28549fd4 UV: Add Minimum and Maximum to Align Vertically/Horizontally
Add the option to align the vertices to the maximum or minimum of all
of the selected UV's when using the Horizontal or Vertical options in
the Align operator.

Ref !139569
2025-09-09 13:17:19 +10:00
Eitan Traurig
919acbbf7f Refactor: Convert Copy Mirror UV Coordinates operator from Python to C++
Migrate Copy Mirror UV Coordinates operator to C++. The ID has changed
from `mesh.faces_mirror_uv` to `uv.copy_mirrored_faces`

Ref !145531
2025-09-09 13:03:48 +10:00
Campbell Barton
6d5da83e63 Cleanup: minor edits for island arrange
Use term "islands" as multiple are arranged,
also add doc-string for "position".
2025-09-09 12:40:08 +10:00
Eitan Traurig
f7f4c154b6 UV: arrange and align selected UV islands
Arranges selected Islands along a selected Axis.
Islands can be aligned to center/left/right/top/bottom.

Initial Implementation of #78408

Ref !139658

Co-authored-by: Campbell Barton <campbell@blender.org>
2025-09-09 12:32:20 +10:00
Sean Kim
635f42c023 Fix: 'Reset Curve' on brush falloff curve applies incorrect default
Introduced in f4e670af2c

The `use_negative_slope` parameter was effectively ignored when `brush`
was also passed in as a parameter, always defaulting to a positive
slope (ascending from left to right).

Additionally, the `use_negative_slope` property was incorrectly
specified for many properties: In general, most brush properties have
positive slope as they correspond to a pressure value being modulated.

This commit fixes the behavior and updates the corresponding
properties so they continue to work.

Pull Request: https://projects.blender.org/blender/blender/pulls/145823
2025-09-09 04:00:03 +02:00
Sean Kim
a38c29aa0b Fix #145879: UV Sculpt settings missing from new scene
Pull Request: https://projects.blender.org/blender/blender/pulls/145945
2025-09-09 02:02:48 +02:00
Jesse Yurkovich
bbc0b35bef Fix #145856: Obey the relative_path operator property for USD import
The `relative_path` operator property on USD import was never wired up
completely. As such it would always write absolute paths when creating
MeshSequenceCache modifiers or Volume object file paths.

Obey this property and create relative paths as necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/145899
2025-09-09 01:32:44 +02:00
Richard Antalik
2f22f7e051 Fix: Strips are added to wrong position when dragging movies
Caused by a745d6cc69, which removed store/restore mechanism for
`move_strips` operator property, but failed to modify condition for
setting strip position to mouse cursor. Because of this, the strip was
always placed to mouse cursor, even when drag and drop was used.

Pull Request: https://projects.blender.org/blender/blender/pulls/145810
2025-09-08 23:05:35 +02:00
Mattias Fredriksson
32e61d3d09 OBJ IO: Import NURBS as Curves directly (not legacy)
Extends obj importer for importing NURBS directly as Curves,
avoiding importing and converting legacy curves. This change
only affects geonode importer, and will not be a change in
behavior for users (import operator will still create legacy curve).

Pull Request: https://projects.blender.org/blender/blender/pulls/145850
2025-09-08 19:16:48 +02:00
Sybren A. Stüvel
d1962be44c Anim: remove deprecated SpaceAction::action pointer
Other code that needs to operate on "the Action that's shown in the
Dope Sheet" now accesses the newly-added
`bAnimContext::active_action`, which is now also used by
`context.active_action`. I've also added
`bAnimContext::active_action_user` in case the ID that is animated by
this Action is needed. That's either the active `Object` or the active
`Key`, again depending on the mode of the Dope Sheet editor.

The active Action can also be obtained via
`ANIM_active_action_from_area(scene, view_layer, area)`. This is a
faster method than the usual `ANIM_animdata_get_context(C, &ac)` and
it doesn't need the entire `bContext`.

The "Stash Action" and "Push Down Action" to the NLA were also
implemented by writing to `SpaceAction::action` via RNA. They now use
`ANIM_animdata_get_context()` to get the active action owner ID, and a
direct call to `blender::animrig::assign_action()` instead.

The remaining use of `SpaceAction::action` was for display &
manipulation of Scene/Action markers. This required some work to get
addressed, as there was quite a bit of spaghetti and duplicate logic
to churn through. More can be improved there, but I had to limit the
time I spent on this.

Python code that was still using `context.space_data.action` to find
the currently-showing Action has been migrated to
`context.active_action`.

Related: #119626
Pull Request: https://projects.blender.org/blender/blender/pulls/145672
2025-09-08 18:12:18 +02:00
Sybren A. Stüvel
6bf8685628 Anim: drop versioning code for pre-2.50 animation
Drop all support for animation data from Blender versions 2.49 and
older.

- The `IPO` DNA struct is deleted, as is the `IDType_ID_IP` type
  definition.
- Versioning code has been removed in its entirety.
- Loading a pre-2.50 blend file will issue a warning, stating that any
  animation data that was there is now lost, and that the file should
  be loaded & re-saved with Blender 4.5 to properly port the data.

Note that versioning of Action assignments (as in, picking a slot)
still uses the tagging + updating all tagged assignments as a
post-processing step. This is necessary because picking the right slot
is only possible after all Actions (also those from libraries) have
been versioned. We might be able to address this as well, by upgrading
legacy → slotted Actions "on the fly" versioning these Action
assignments. If we do that, I think that would be better in a separate
PR though, as it could introduce issues by itself.

Ref: #134219
Pull Request: https://projects.blender.org/blender/blender/pulls/145188
2025-09-08 14:09:21 +02:00
Jacques Lucke
bfc5f8d51c Nodes: add selection output for each item in Menu Switch node
This adds a boolean output for each of the menu items. The output is true, if
the passed in menu value is that item. This avoids the need to compare the
output value to the input values to get a boolean for whether a specific menu
item was passed in.

Support is added for Geometry Nodes as well as the Compositor. Usage/Value
inferencing has been updated as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/145712
2025-09-08 13:01:47 +02:00
Clément Foucault
ff468e44ee Fix #144213: Overlay: Transparency ordering issue in texture paint
Caused by missing depth of in front objects in in-front buffer.
Forcing a depth prepass fixes the issue.
2025-09-08 12:55:16 +02:00
Jeroen Bakker
62912594d1 Cleanup: Remove instance rate vertex
Instance vertex buffers have been removed in Blender 5.0 due to limited
support in certain drivers. The Vulkan backend still had code in place.

Pull Request: https://projects.blender.org/blender/blender/pulls/145913
2025-09-08 12:46:47 +02:00
Omar Emara
329ba2f69e Fix #145667: Nearest interpolation is ignored in Vulkan
Blender compositor ignores nearest interpolation in Vulkan backend.
That's because anisotropic interpolation is used based on same left over
sampler state. To fix this, we clear anisotropic sampling in the
realization shader.

Pull Request: https://projects.blender.org/blender/blender/pulls/145905
2025-09-08 12:02:53 +02:00
Clément Foucault
f8303efd57 Revert "Draw: Use ResourceHandleRange"
This reverts commit 8adb3e758f.
This is a partial revert that just always use the fallback
path.

The new optimized path is causing issues with overlays #145446 and
volumes #145420.

The new path will be enabled back when we fix those issues.
2025-09-08 12:00:14 +02:00
Clément Foucault
af1af75006 Fix #145783: Edit Mesh: Crash when selecting edge in some setup
This was caused by DRW_select_buffer_elem_get not being
failsafe. Handling the failure case properly fixes the issue.
2025-09-08 12:00:13 +02:00
Brecht Van Lommel
a599ce0908 Video: Add mastering display metadata to HDR videos
For most players this appears to made no difference. But one case it fixes
is that with this metadata, on Youtube with SDR, 10bit PQ looks the same as
12bit PQ, where it was previously too desaturated.

10bit and 12bit HLG was already consistent without this metadata and there
appears to be no impact, though it remains inconsistent with PQ.

It seems good practice to be explicit about the mastering display regardless.

The way we get the max luminance is not ideal though. We get it from the
view transform name containing "HDR XXXX nits" as used in the Blender and
ACES configs. There is currently no way to query this information from
OpenColorIO.

In the future we can add a user control for this. For now if we can not
determine the max luminance this way, we don't write mastering display
metadata. The video player will then make some default assumption for tone
mapping, often 1000 nits.

Pull Request: https://projects.blender.org/blender/blender/pulls/144378
2025-09-08 11:47:48 +02:00
John Kiril Swenson
75bca47553 Fix #145853: Crash using Blade or Slip tool in VSE with new scene
If adding a scene from the main window header, it is possible to have a
defined `sequencer_scene` but an undefined `ed`.

Add check for non-null `ed` and move all the checks up to the start of
`sequencer_main_cursor`.

Pull Request: https://projects.blender.org/blender/blender/pulls/145854
2025-09-07 23:18:31 +02:00
Brecht Van Lommel
10027d9a6d Color Management: Use working space from custom OCIO config in startup blend
When using the default Blender config use what was saved in the startup blend.
But when using a custom config it's likely the scene linear space from that config
is wanted. And not using it can lead to some confusing situations, where you end
up with an ACES config and the Linear Rec.709 working space.

Pull Request: https://projects.blender.org/blender/blender/pulls/145884
2025-09-07 21:32:17 +02:00
Brecht Van Lommel
514b9f4ec3 Fix: Working space menu shows blank entry with custom OCIO config
If the name of the scene linear space is different in another config, make
sure we update bmain to use that name.

Pull Request: https://projects.blender.org/blender/blender/pulls/145884
2025-09-07 21:32:09 +02:00
Brecht Van Lommel
dc2b672184 Color Management: Add API to get interop ID for working space
This can be useful for exporters to identify known working spaces and write
colorspace metadata to the file rather than convert to another color space.

Pull Request: https://projects.blender.org/blender/blender/pulls/145885
2025-09-07 21:31:14 +02:00