Commit Graph

122334 Commits

Author SHA1 Message Date
Bastien Montagne
b02ebf8e43 Fix #144373: Removing and then redefining an override property causes a crash.
Code needs to ensure it gets an override property operation here, not
only search for an existing one.

Mistake has been there probably for years...
2025-08-13 11:08:29 +02:00
Weizhen Huang
a7283fc1d5 Cycles: Shade volume with null scattering
The distance sampling is mostly based on weighted delta tracking from
[Monte Carlo Methods for Volumetric Light Transport Simulation]
(http://iliyan.com/publications/VolumeSTAR/VolumeSTAR_EG2018.pdf).

The recursive Monte Carlo estimation of the Radiative Transfer Equation is
\[\langle L \rangle=\frac{\bar T(x\rightarrow y)}{\bar p(x\rightarrow
y)}(L_e+\sigma_s L_s + \sigma_n L).\]
where \(\bar T(x\rightarrow y) = e^{-\bar\sigma\Vert x-y\Vert}\) is the
majorant transmittance between points \(x\) and \(y\), \(p(x\rightarrow
y) = \bar\sigma e^{-\bar\sigma\Vert x-y\Vert}\) is the probability of
sampling point \(y\) from point \(x\) following exponential
distribution.

At each recursive step, we randomly pick one of the two events
proportional to their weights:
* If \(\xi < \frac{\sigma_s}{\sigma_s+\vert\sigma_n\vert}\), we sample
scatter event and evaluate \(L_s\).
* Otherwise, no real collision happens and we continue the recursive
process.

The emission \(L_e\) is evaluated at each step.

This also removes some unused volume settings from the UI:

* "Max Steps" is removed, because the step size is automatically specified
by the volume octree. There is a hard-coded threshold `VOLUME_MAX_STEPS`
to prevent numerical issues.
* "Homogeneous" is automatically detected during density evaluation

An option "Unbiased" is added to the UI. When enabled, densities above
the majorant are clamped.
2025-08-13 10:28:50 +02:00
Bastien Montagne
dcba54a495 Fix #144469: Regression: LiboVerride: Crash on startup in some cases.
Regression from 00375abc38, since hierarchy roots are no more ensured
for all liboverrides after each recursive resync level, these pointer
can now be null in the code cleaning up unused liboverrides.

Note that they could already be null before (in isolated override case),
but this case is very rare in practice.
2025-08-13 10:05:36 +02:00
YimingWu
16820b7dc6 Cleanup: LineArt: Bump version when doing thickness versioning
Version should always be bumped when doing changes to DNA, not combined
with other changes in the latest version.

The versioning code was introduced in 6f57268e9a .

Pull Request: https://projects.blender.org/blender/blender/pulls/144472
2025-08-13 06:39:59 +02:00
Sean Kim
34dea22b3f Cleanup: Remove deprecated toggle_brush field
Follow up to c89baaf768cab4dbb52a20969062325a08574d90

Pull Request: https://projects.blender.org/blender/blender/pulls/139906
2025-08-13 02:42:32 +02:00
Campbell Barton
0d1bece64b Help text: support extracting Vulkan & OpenGL args even when disabled
Support extracting arguments for all GPU backends irrespective
of the build argumetns.
2025-08-13 09:26:02 +10:00
clankill3r
72bda4eaee PyDoc: added missing screen parameter
Ref !144452
2025-08-12 22:42:03 +00:00
nutti
d901c95502 Fix: typo in mathutils.Vector doc-string
Ref !143771
2025-08-12 22:41:59 +00:00
Campbell Barton
494bb557fb Fix: error referencing a temporary variable
Correct error from [0] which held a reference to a temporary variable.
Also improve comment wording.

[0]: d278e7d424
2025-08-13 08:39:34 +10:00
Sean Kim
bf7c8f1ef3 Fix #144281: Missing redraw for Unified Paint Setting toggles
Pull Request: https://projects.blender.org/blender/blender/pulls/144398
2025-08-12 23:41:47 +02:00
Sean Kim
84c2634d6b Fix #144426: Vertex Paint falloff doesn't work
Introduced with ba291976b2

The above fix was incomplete; while it resulted in the correct value
being applied for the buffer, the actual blending and application of the
color with the existing mesh values was incorrect.

Pull Request: https://projects.blender.org/blender/blender/pulls/144465
2025-08-12 23:31:38 +02:00
Namit Bhutani
e4c763ff23 Fix: Sculpt spatial reodering crash after recent fix
Caused by #144388.
Move the for loop such that isolated vertices are processed
in the end, after the face groups are done processing their vertices.

Pull Request: https://projects.blender.org/blender/blender/pulls/144463
2025-08-12 23:09:07 +02:00
Jesse Yurkovich
0240a1f32f Cleanup: CMake: Modernize bf_intern_openvdb dependencies
This follows the other CMake "modernization" commits, this time for
`bf_intern_openvdb` and the OpenVDB dependency itself.

The difference with this one is that `intern/openvdb` becomes an
"optional" dependency itself. This is because downstream consumers often
want to include this dependency rather than openvdb directly, so this
target must also be optional. Optional, in this case, means the target
always exists but may be entirely empty.

Summary
- If you are using BKE APIs to access openvdb features, then use the
  `bf::blenkernel` target
- If you are only using `intern/openvdb` APIs then use the
  `bf::intern::optional::openvdb` target (rare)
- For all other cases, use the `bf::dependencies::optional::openvdb`
  target (rare)

context: https://devtalk.blender.org/t/cmake-cleanup/30260
Pull Request: https://projects.blender.org/blender/blender/pulls/137071
2025-08-12 21:26:38 +02:00
Harley Acheson
42b6c7f804 Fix #132460: Remove File Browser Path Validation
This PR removes validation of saved bookmarks and system paths in File
Browser. The act of checking validity of a path can result in a timeout
that can last many seconds. Blender will have a very long startup time
if any such items are disconnected, invalid, offline, or removed. Even
if these paths are not used during the Blender session, like network
shares used only at work, web storage for some non-Blender use, a
shortcut to a USB drive, etc. Items will not be greyed out, and
clicking on one will result in a timeout _at that time_ but this seems
like expected behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/138218
2025-08-12 21:22:52 +02:00
Jacques Lucke
cea51d82be Refactor: Geometry Nodes: remove bNodeSocketType::geometry_nodes_cpp_type
This type was the same for every socket type supported by Geometry Nodes.
It's always `SocketValueVariant` now. Therefore, it was unnecessary to s
tore an explicit pointer to it.

Pull Request: https://projects.blender.org/blender/blender/pulls/144458
2025-08-12 20:09:52 +02:00
Mohamed Hassan
ce7759bae6 Compositor: Removing Sun Beams node
This patch removes the Sun Beams node since it is now part of the
Glare node. It is versioned using a Glare node of Sun Beams type.

Pull Request: https://projects.blender.org/blender/blender/pulls/144110
2025-08-12 19:53:54 +02:00
Jacques Lucke
69cf5e1ad7 Refactor: Geometry Nodes: use SocketValueVariant to get value from socket
This moves us closer to removing `geometry_nodes_cpp_type` which is
always `SocketValueVariant` now.

Pull Request: https://projects.blender.org/blender/blender/pulls/144445
2025-08-12 19:11:05 +02:00
Falk David
5f721c2e2e Fix: VSE: Scene Strip template ID "new" function not working
In the `Strip` panel in the scene template ID, the "new/duplicate"
operator would duplicate the active scene in the window instead
of the selected scene in the strip.

Pull Request: https://projects.blender.org/blender/blender/pulls/144453
2025-08-12 18:55:26 +02:00
Hans Goudey
cfb8696a73 Curves: Add cyclic curve offsets cache
This will be used to simplify the rendering of cyclic curves and improve
the performance. The cache is just a prefix sum of the cyclic attribute.

Pull Request: https://projects.blender.org/blender/blender/pulls/144444
2025-08-12 18:21:52 +02:00
Christoph Lendenfeld
809f7abfb6 Fix #144364: Incorrect RNA update function called for Bones
The issue was that an rna function was called on `Bone`
that expected an `EditBone`. Because the pointer was just casted,
this means it would write into wrong bytes on the struct.

Caused by a43359eb88

Pull Request: https://projects.blender.org/blender/blender/pulls/144447
2025-08-12 17:40:08 +02:00
Leon Schittek
520eaa76ff Fix #144168: Ignore mouse event when creating search popups
When search popups are created at the bottom of the screen, they are
repositioned to stay within the bounds of the main window. This
can cause the cursor to hover over one of the search results, causing
it to become active.

Since some searches put recently searched items at the top of the
result list, the first search result should always be active by default.

This is achieved by ignoring the mouse event after the creation of
the popup by checking if the mouse has actually moved.

Pull Request: https://projects.blender.org/blender/blender/pulls/144296
2025-08-12 17:33:26 +02:00
Clément Foucault
a2515f68b8 Fix: Overlay: Missing fragment output for curve edit overlays 2025-08-12 16:55:42 +02:00
Clément Foucault
f0cff4ff46 Fix: GPU: Shader: Preprocess tests 2025-08-12 16:55:41 +02:00
Habib Gahbiche
d485c2a6d0 Fix: Compositor: Wrong tooltip for Crop Node 2025-08-12 15:36:50 +01:00
Jacques Lucke
951d2d2b3a Refactor: Geometry Nodes: use SocketValueVariant instead of raw pointers
Refactor to get us closer to being able to remove `bNodeSocketType::geometry_nodes_cpp_type`
which is always `SocketValueVariant` now.

Pull Request: https://projects.blender.org/blender/blender/pulls/144419
2025-08-12 16:03:09 +02:00
Aras Pranckevicius
4204609770 VSE: Improve Histogram scope for HDR content
For HDR (float) content, previously the Histogram scope was displaying
-0.25..+1.25 value range. Negative range display is not really useful,
and the upper bound of 1.25 is not really large enough for HDR.

Change the histogram to:
- Display 0..12 range for HDR content, with the same amount of
  uniformly distributed histogram bins (256 bins for 0..1 range, so
  3072 bins for HDR range). Larger amount of bins does not affect
  histogram calculation performance in a measurable way.
- Histogram scale is so that horizontal image range is 0..1 (LDR) part
  of the histogram; HDR part extends to the right. When displaying the
  histogram, the preview area zoom aspect ratio is not locked, so the
  user can arbitrarily change it. Frame All/Selected operators,
  while showing the histogram, frame the entire range.
- Draw maximum R/G/B values as semitransparent vertical lines in the
  histogram.
- Display each bin as a rectangle, instead of lines joining next and
  previous bin values. This feels better especially for isolated bins.
- For vertical grid lines, make the line stop below the text label,
  instead of going through it.

Images in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/143537
2025-08-12 16:01:31 +02:00
Jeroen Bakker
ea83567811 Vulkan: Destroy resources in submission thread
This PR moves the responsibility of destroying discarded resources to
the submission thread. Previous implementation could be blocked and
would not always run.

This solves memory leak when rendering in background and keeps the
overall memory usage lower as all is done in a single location.

Pull Request: https://projects.blender.org/blender/blender/pulls/144440
2025-08-12 15:58:49 +02:00
Omar Emara
d2d77a38a1 Compositor: Allow menu sockets for pixel nodes
This patch extends the support for menu sockets in the compositor to
also include pixel nodes. Menu sockets are not yet used in any node, so
this has no apparent effect.

Pull Request: https://projects.blender.org/blender/blender/pulls/144436
2025-08-12 15:36:48 +02:00
Damien Picard
a166db31a9 Fix #144306: I18n: Wrong values in bpy.app.translations.locales
Commit 798f85a710 changed the way the languages menu is generated in
order to improve the items' descriptions. This revealed that items in
`bpy.app.translations.locales` used this description instead of the
identifier, resulting in them looking like:

  'Locale code: ca_AD. Translation progress: 100%'

instead of:

  'ca_AD'

To use the language code, this commit uses the menu item's identifier
instead of description.

-----

This should be backported to 4.5.

Pull Request: https://projects.blender.org/blender/blender/pulls/144366
2025-08-12 15:02:47 +02:00
Bastien Montagne
cbf763e700 LibOverride: Prevent matching collection items only by their index if a name and ID are provided.
If an item name (and ID) is provided, never successfully match only
based on the item index.

This can lead to matching to a complete different ID than the intended
one, which can be catastrophic for the integrity of the next resync.

Also, do not require sucessful match on both source and destination
data, this will always fail in case e.g. an item is removed from a
collection, and can prevent detecting required resync from that
collection then.

This commit also enables new 'harder' test in unittests, added in
previous commit, which is now expected to pass.

Pull Request: https://projects.blender.org/blender/blender/pulls/144429
2025-08-12 14:10:44 +02:00
Bastien Montagne
00375abc38 LibOverride: Fix recursive resync incorrectly clearing hierarchy info.
Recursive resync would validate hierarchy info of all IDs in Main, when
it should only handle the ones in its currently processed 'library level'.

Otherwise, it could incorrectly clear hierarchy info from 'more local'
liboverrides that were still to be resynced, leading to issues like
left-over 'orphaned'/unused liboverrides, needless renames, etc.

Also contains a few 'logical mistakes' fixes in the resync code, though
these did not seem to have any known practical effect.
2025-08-12 14:10:43 +02:00
Clément Foucault
cae6c6d81a GPU: Remove Shader Draw Parameter workaround
With 5.0 we start requiring this extension for GL and VK.
All of our target hardware supports it with up to date
drivers.

Some old drivers were disabling this extension because of
buggy behavior. We simply drop support for them in 5.0.

This allows us to remove a lot of code and the last
shader create info override done at startup. This will
unlock more refactoring of the shader create info into
static classes to reduce binary size and other benefits.

## TODO:
- [x] Remove checks for ARB_shader_draw_parameters
- [x] Remove checks for ARB_clip_control
- [x] Check for the extension on startup for OpenGL
- [x] Check for the extension on startup for Vulkan
- [x] ~~Add user facing popup message about minimum
      requirements not being met.~~ Done using the same
      popup as old hardware.

Pull Request: https://projects.blender.org/blender/blender/pulls/142334
2025-08-12 14:04:41 +02:00
Aras Pranckevicius
9fbc1a5259 Fix #144432: VSE scopes sometimes stop updating during playback
Address it by not only checking whether the image pointer is the same,
but also whether the timeline frame is the same.

Pull Request: https://projects.blender.org/blender/blender/pulls/144433
2025-08-12 14:02:50 +02:00
Christoph Lendenfeld
b06d534148 Refactor: simplify and test ANIM_unit_mapping_get_factor()
Simplify ANIM_unit_mapping_get_factor() by returning early and reducing
cognitive complexity. This will make it significantly simpler to expand it
for other RNA property (sub)types.

Also I added a unit test for rotation conversion between radians and
degrees.

No functional changes.

This is intended as a cleanup for !143880.

Taken over from #144140

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/144427
2025-08-12 12:28:49 +02:00
Jeroen Bakker
42c3f35780 Vulkan: Swap to system memory for device local memory
This PR will swap device local memory to system ram. It relies on
VK_EXT_external_memory and VK_EXT_pageable_device_local_memory
extensions to be supported by the system.

Most platforms support these extensions.

Pull Request: https://projects.blender.org/blender/blender/pulls/144422
2025-08-12 11:51:40 +02:00
Campbell Barton
d278e7d424 Fix #144270: Edge slide fails when moving towards a single triangle
Technically a regression in [0] however even before this commit
there where no check to prevent an intersection being used which
is far outside triangle the vertex is sliding towards.

Resolve by only using the line-line intersection if the intersection
points lie within a conical region defined by the edge pair the user
is sliding towards (see code-comment for details).

Ref !144418

[0]: 49ab0bb844
2025-08-12 09:12:45 +00:00
Lukas Tönne
dab6b45336 Fix #143551: Cache invalidation causes crash when changing node tree item properties
Changing a node tree item property (such as the default value) was using a very
broad and generic "tag" function which invalidates the runtime items cache.
This also invalidates any python iterators due to the API using the runtime
cache. Changing node tree items in a loop will then crash.

It's not necessary to invalidate the runtime items cache when the actual item
pointers have not changed. Most RNA updates only change superficial properties,
or at most require a recursive node tree update due to change of identifiers or
types.

This PR introduces a simpler "tag" function to only tag for tree updates by not
rebuild the entire runtime items cache. It also renames existing functions and
docstrings to better explain what each of them does and should be used for.

The `NodeTreeInterfaceChangedFlag` is removed completely because it is only ever
used as a simple boolean indicator of "item changes" that require a cache
rebuild. It is replaced with an atomic bool like flags used for runtime caches.

Pull Request: https://projects.blender.org/blender/blender/pulls/143932
2025-08-12 11:00:10 +02:00
YimingWu
c3ae3926da Fix #144392: LineArt: End job explicitly when not baking in background
Previously the baking job is not properly ended when not baking in
background, this means when the bake is called from the script, the
interface lock is not properly reset, then parts of the interface can
stay locked afterwards. This fix adds `lineart_bake_endjob` to the
foreground code path so the interface will be unlocked properly.

Pull Request: https://projects.blender.org/blender/blender/pulls/144405
2025-08-12 10:39:45 +02:00
Jeroen Bakker
3b8ea045da Vulkan: Disable descriptor buffers
There are stability issues with the vulkan backend. Some scenes indicate
that there is no space left to allocate the next descriptor buffer. For
stability reasons we will disable descriptor buffers and look into a
better solution.

Pull Request: https://projects.blender.org/blender/blender/pulls/144421
2025-08-12 10:28:28 +02:00
Janne Nylander
c95aa8dbd1 Fix #139258: Grease Pencil: Strokes lose deform groups when moved to another layer
Strokes would lose their deform group values after moving them to a
different layer, because `vertex_group_names` weren't transferred to
the newly created `CurvesGeometry` inside `execute_realize_curve_tasks`.

This commit adds another version of `copy_vertex_group_names` for
Curves, and separates the duplicate code into `copy_vertex_group_name`,
which is used by both meshes and curves.

This also fixed strokes losing deform weights in multiple situations, such as:
- When performing a layer merge.
- When applying generative modifiers like Mirror or Array

Pull Request: https://projects.blender.org/blender/blender/pulls/142881
2025-08-12 10:25:47 +02:00
Clément Foucault
831969f4f0 GPU: Shader: Rewrite default_argument_mutation using parser
This avoid failure cases from the regex.

Pull Request: https://projects.blender.org/blender/blender/pulls/144386
2025-08-12 10:10:12 +02:00
Jacques Lucke
33cc0eb805 Cleanup: remove dead code
This file should have been removed earlier when the bundle storage was
moved to the nodes module.
2025-08-12 09:27:31 +02:00
Jacques Lucke
fbd29acaa2 Cleanup: Geometry Nodes: avoid unnecessary void pointer
All socket types use `SocketValueVariant` now, so using `void *` is not necessary anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/144415
2025-08-12 09:12:08 +02:00
Omar Emara
8d1e26865d Compositor: Support strings sockets
This patch adds support for String sockets in the compositor. The
sockets are not yet used anywhere, but are added to aid development.

Pull Request: https://projects.blender.org/blender/blender/pulls/144327
2025-08-12 08:54:13 +02:00
Jacques Lucke
fa7b8b8532 Cleanup: GeometryNodes: avoid unnecessary void pointer
Pull Request: https://projects.blender.org/blender/blender/pulls/144412
2025-08-12 08:19:40 +02:00
Jacques Lucke
7c5f7434f2 Refactor: Geometry Nodes: use SocketValueVariant in bake api
This simplifies the bake API used by Geometry Nodes by using `SocketValueVariant`
 instead of raw pointers. This is possible now, because all socket types use
`SocketValueVariant` under the hood.

Pull Request: https://projects.blender.org/blender/blender/pulls/144410
2025-08-12 07:59:18 +02:00
Jacques Lucke
d9410660ca Refactor: Geometry Nodes: simplify parameter access
Now that every socket type uses `SocketValueVariant` since #144355, the
parameter access code can be simplified a bit.

This also adds a new `GeoNodesMultiInput<T>` type that's used to access the list
of inputs value multi-input sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/144409
2025-08-12 07:45:03 +02:00
Campbell Barton
f96a73961a Cleanup: avoid "nullptr" in Python strings & error messages
This is a C++ term not expected in exceptions and messages.
2025-08-12 13:32:41 +10:00
Campbell Barton
570eb9c60a PyAPI: minor clarification to error 2025-08-12 13:32:01 +10:00
Campbell Barton
5a22993253 Cleanup: remove redundant parenthesis 2025-08-12 13:32:01 +10:00