Commit Graph

123376 Commits

Author SHA1 Message Date
YimingWu
5cde024fc9 Fix #146413: Truncate socket names only if space is present after prefix
In 95259228d9 an optimization was made to
simplify geometry nodes socket names on panels when they contain the
exact group title as prefix, but this leads to issue where `Opening` can
be truncated as `ing` which is not desired. Now will check if a space
character is present after the prefix, then do the truncation.

Note that this implementation still doesn't truncate `CamelCase` or any
CJK name strings because they don't use the space character as
separator.

Pull Request: https://projects.blender.org/blender/blender/pulls/146973
2025-09-29 17:37:17 +02:00
Jacques Lucke
02bdc709c2 Shader Nodes: support Menu Switch node
This implements the Menu Switch node in shader nodes. It's the same node that is
used in Geometry Nodes and the Compositor.

The Menu Switch node is purely handled during preprocessing and thus builds on
top of #141936. Hence, it's input has to be a single value, just like the
iteration count for repeat zones. This limitation can be lifted in the future,
but currently there is no way to produce a non-single menu value in shader
nodes. This will become possible if other Switch nodes are added though.

Pull Request: https://projects.blender.org/blender/blender/pulls/146896
2025-09-29 17:26:38 +02:00
Hans Goudey
d75808fdf0 Fix: Node editor drawing stack use after scope
Caused by a bad conversion to StringRef in 950a2bb8a3.
Instead pass around StringRef since that's all that's needed by the UI code
anyway. And make the argument to the node socket drawing RNA function
clearer, previously it relied on the char pointer being first in StringRefNull.

Pull Request: https://projects.blender.org/blender/blender/pulls/146985
2025-09-29 17:24:50 +02:00
Clément Foucault
1cb373e980 Fix: EEVEE: Reversed condition in metallic BSDF optimization
This is a mistake from 0517e90233.
2025-09-29 17:24:16 +02:00
Pablo Vazquez
b5a6587ef9 Cleanup: Make format 2025-09-29 17:15:04 +02:00
Iliya Katushenock
2d6a4da01a Cleanup: Improve description of asserton related to topology cache
Pull Request: https://projects.blender.org/blender/blender/pulls/145248
2025-09-29 16:55:28 +02:00
Brecht Van Lommel
7147227a40 Python API: Make context.tool_settings never null
Since 1122a05cb6 tool settings could return None, but we do not check this
consistently in scripts. Now always return some tool settings, since it's difficult
to verify and easy to forget proper null checks in e.g. operator poll functions.

The sequencer UI code was updated to continue showing tool settings only when
there is a sequencer scene.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/146166
2025-09-29 16:54:40 +02:00
Guillermo Venegas
9aaefbab5b Refactor: Make layout resolve functions into virtual methods
Following to the uiLayout refactor, this converts each
layout resolve  function as virtuals methods, so `x_`,  `y_`,
`w_` and `h_` properties can become protected.

No user visible changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/146185
2025-09-29 16:53:44 +02:00
Clément Foucault
0517e90233 Fix: EEVEE: Metallic BSDF roughness broken in certain condition
This was caused by the `GPU_MATFLAG_REFLECTION_MAYBE_COLORED`
flag not being properly set for every parameters of this
BSDF.
2025-09-29 16:53:07 +02:00
Clément Foucault
0a8fd69ad5 Fix #146885: EEVEE: Principled BSDF incorrect when not fully metallic
Caused by faulty optimization. We can consider metal anything non
purely dielectric.
2025-09-29 16:53:07 +02:00
MattiasF
29b27bb19b Curves: Numerically robust curve tangents
Current approach for computing the curve tangent approximations using
the average of the sum of the normalized segment direction vectors
suffers from catastrophic cancellation as the angle between the segments
approach 0°, with increasingly large error in resulting tangent.

Improving current behavior by conditionally computing the tangent using
the cross product to rotate the difference around the orthogonal axis
show a significant improvement for small angles. For segments in an axis
aligned plane, additional errors from computing the cross product is
avoided as terms cancel out. When the rotation axis is not axis aligned,
the method still shows a constant improvement for angles smaller
than ~45°.

Changes improves behavior for cases such as #145558.

For more information see https://projects.blender.org/blender/blender/pulls/146332.

Pull Request: https://projects.blender.org/blender/blender/pulls/146332
2025-09-29 16:45:12 +02:00
Lukas Tönne
b121142828 Fix #144983: Skip attribute transfer when no attribute writer is created
Attribute writer creation can fail in cases where a built-in attribute exists
and prevents arbitrary name/type/domain combinations. In those cases the
attribute should just be skipped.

Pull Request: https://projects.blender.org/blender/blender/pulls/146976
2025-09-29 16:38:31 +02:00
Hans Goudey
59aa61b8be UI: Interleave essentials modifiers in "Generate" menu
Hardocde the position of the essentials assets in the menu,
for consistent alphabetical order and a clearer indication of
the different between the nodes and builtin "Array" modifiers
(the old one is now called "Array (Legacy)").

Pull Request: https://projects.blender.org/blender/blender/pulls/146887
2025-09-29 16:37:35 +02:00
Clément Foucault
596062329d GPU: Improve shader dependency logger
Add shader name to graph.
Strip CLOG prefix for mermaid lines.
2025-09-29 16:31:47 +02:00
Hans Goudey
c58a789673 Fix #146966: Crash joining mesh objects
Caused by 113d91aba8.

A use-after-free when custom data layers are reallocated to add
attributes. Fix by using std::string instead of referencing the name.
This will be unnecessary after #122398 is finished.

Pull Request: https://projects.blender.org/blender/blender/pulls/146982
2025-09-29 16:22:44 +02:00
Jeroen Bakker
cfeacef394 Vulkan: Streaming Buffers
OpenGL has the concept of streaming buffers these buffers are marked to be
rewritten and used a small number of times. Vulkan (being low-level API)
doesn't have this concept. When performing font rendering Blender uses
streaming buffers and can slow down Vulkan as GPU barriers are added
between uploading and using the buffer.

Using a different approach could reduce the GPU barriers. The overall
idea is:

Altering render graph nodes

During font rendering the streaming buffer is rewritten from start with
the data to render the next part. This could only cover a part of the fully
allocated buffer. And would introduce a barrier before and after rewritting
the next part.

The allocated buffer on the GPU can fit more data but that data needs to be
passed along the first update to reduce the barriers. Allowing access to an
existing node in the render graph would allow to change the initial upload to
upload more data, without additional barriers.

VKStreamingBuffer

A new buffer type is introduced that will keep track of the streaming buffer
on the current render graph. A streaming buffer can be shared between multiple
threads and requires state manager to be done per context.

Pull Request: https://projects.blender.org/blender/blender/pulls/146956
2025-09-29 16:15:04 +02:00
Jeroen Bakker
a0370d2fe3 Fix: Vulkan: Performance regression text drawing
7becc38a3c introduced new text rendering.
In the refactoring the vertex buffer was replaced by a more shallow
storage buffer. However the refactoring removed one optimization that
the vulkan backend uses, namely the actual amount of bytes that is being
used by the draw call. This resulted in overly large data transfers.

For example in the text editor the texts are rendered one glyph at a
time. But the storage buffer would always upload the data for 1024
glyphs.

This PR allows the usage size of a storage buffer to be set to ensure
that the data transfers are limited.

The implementation wasn't added to OpenGL as it draws incorrectly.

Issue detected during the research of !146956 That PR will implement
better data streaming inside the Vulkan backend and also requires
to know the actual usage size of the buffer to detect what data can
be grouped together.

Pull Request: https://projects.blender.org/blender/blender/pulls/146958
2025-09-29 15:55:31 +02:00
Falk David
7ac7aadce5 Fix: File Browser: Filter for Annotations and Grease Pencil
The current filter was still using the legacy Grease Pencil
type (now Annotations).

Now this uses the correct `FILTER_ID_GP` and uses the
other filter for Annotations.

Pull Request: https://projects.blender.org/blender/blender/pulls/146978
2025-09-29 15:48:32 +02:00
Bastien Montagne
24a33045cd Fix #146763: Texture Paint Memory Leak.
Deletion of NTree IDs through custom code path using
`blender::bke::node_tree_free_tree` is fully by-passing standard ID
management code, and was missed when ID::runtime was made an allocated
pointer.

We should really spend some time at some point to get these custom temp
node IDs handling code under control, there should be little to no need
for all this custom allocation and deletion code anymore nowadays.
2025-09-29 15:05:40 +02:00
Bastien Montagne
1c64e403c4 Fix #146802: Py-defined property min/max handling is broken.
Regression from 469f54f484, somehow the clamping for default set of Int
properties was removed in this big refactor, merely add it back, and add
some unittests covering min/max handling.

Pull Request: https://projects.blender.org/blender/blender/pulls/146975
2025-09-29 15:01:08 +02:00
Lukas Tönne
8f8d267a69 Fix #146145: Fluid domain initialization uses face attribute without checking
Attribute VArray is only valid if there actually are faces in the geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/146974
2025-09-29 14:47:22 +02:00
Clément Foucault
23134124dc LOG: Change shader dependency printing to its own prefix
This avoid flooding the console when using --debug-gpu.
2025-09-29 14:06:33 +02:00
Philipp Oeser
1e92530aa2 Fix #146963: VSE compositor modifier Strip mask input field disappearing
Caused by 866fcd0a09

To search for strips, we do so on an `Editing` object or a `MetaStrip`
object.
Code from 866fcd0a09 got the `MetaStack` but then tried to use this
directly as a `MetaStrip`.
We should be getting its `parent_strip` though it seems.

For reference, this is what was done prior to 866fcd0a09

`sequences_object = ed.meta_stack[-1]`

Pull Request: https://projects.blender.org/blender/blender/pulls/146967
2025-09-29 14:04:13 +02:00
Jacques Lucke
f025637e3b Nodes: new operator to join Group Input nodes
This adds a new operator which can join multiple nodes together. Currently, it
only supports joining Group Input nodes. However, in the future it could be
extended to join e.g. Bake and Capture Attribute nodes.

This uses the recently freed up ctrl+J shortcut for this functionality, which
feels natural to me.

The implementation is fairly straight forward. The main tricky aspect is
sometimes the nodes can't be joined when that would result in two sockets being
linked to each other twice. In this case, the a separate Group Input node is
kept.

The selected nodes are merged into the active node (in case the active node is
part of the selection, otherwise there is a fallback).

Pull Request: https://projects.blender.org/blender/blender/pulls/146894
2025-09-29 13:58:27 +02:00
Jacques Lucke
cadb3fe5c5 Blenloader: stable pointers in .blend files
When writing .blend files, Blender traditionally wrote raw runtime-pointers into
the file. Since these pointers are different whenever Blender is restarted or
the file is loaded again, the written .blend file will be very different every
time. The file always changing is a problem with tools that use change-detection
on .blend files such as:
* Change detection during undo in Blender. When a serialized data-block is the
  same in two consecutive undo steps, it's known that the data didn't change and
  the data-block does not have to be reloaded and can potentially skip depsgraph
  evaluation. Also see #141262.
* BAT: https://projects.blender.org/studio/flamenco/issues/104437
* Generally using .blend files in version control. The diffs can be smaller when
  pointers aren't changing all the time and have a lower memory footprint.

This PR makes pointers in .blend files across multiples saves much more
consistent, improving the situation for the cases above. Although there is still
other data that changes on almost every save currently; that needs to be
addressed separately.

The basic design for pointer stability in blend files stable pointers, described
in #127706, is fairly straight forward. This patch implements a slightly
modified variant of that design. When reading .blend files, Blender already does
not care if the stored pointer values are actual pointer values, or just some
arbitrary identifiers. Therefore, we mainly just have to change the write-file
code. This also implies that this change is fully forward and backward
compatible.

The main non-obvious aspect of this patch is how to actually do the remapping of
runtime pointers to stable identifiers. In theory, having a single integer that
increments for every newly detected pointer works. But in practice that leads to
many changes in the .blend file because one pointer is added or removed
somewhere, all subsequent pointers will be different too. So some kind of
scoping is required to make sure that one small change does not affect
everything else.

This PR starts a new scope pointer identifier scope whenever a new ID data-block
starts. At first I thought it would be good to have separate maps for id-local
and global pointers. However, that's tricky currently, because at write-time, we
don't always have enough information to know if a specific pointer is local or
global. I worked on #146136 to improve the situation but the problem is bigger
than that since we also have various void pointers in DNA structs. Fortunately,
the solution implemented now also works fine with a single global map.

Implicit sharing in undo steps also had to be changed slightly to work with the
stable address identifiers instead of raw pointers.

There's also new code to find all pointers in DNA structs in the first place.
This is done once when writing starts. Then whenever a struct is written, a copy
is made, all pointers are replaced and the modified struct is written to the
.blend file. There is an optimization for the case when a struct does not
contain any pointers because then the copy can be skipped.

For checking the diff between two saved .blend files, I recommend enabling
`GENERATE_DEBUG_BLEND_FILE` and then diffing the text version of the .blend
files.

Co-authored-by: Hans Goudey <hans@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/127729
2025-09-29 13:56:13 +02:00
Jacques Lucke
4d91f5c8ef Fix #146588: raise exception when attempting invalid idproperty renaming in Python
Each name has to be unique within a group, so when renaming an idproperty, one
has to make sure that the parent group does not contain duplicates afterwards.
This patch raises a `NameError` when setting the name to one that exists
already. Alternatively, one could delete the already-existing property, but that
seems unexpected and the user should rather do that explicitly.

This also adds a new unit test for this case.

Pull Request: https://projects.blender.org/blender/blender/pulls/146892
2025-09-29 13:54:08 +02:00
Julian Eisel
eef971e377 UI/BPY: Remove grid layout for UI lists
The grid layout for UI lists wasn't used in practice from all we can
tell. It was badly maintained for a long time (bugs went unnoticed). I
think it was added for an earlier version of the asset UI design.

This was planned for removal in 5.0, see blender/blender#110461.

Usages in bundled scripts were already removed in efa8d942b8.

Pull Request: https://projects.blender.org/blender/blender/pulls/146656
2025-09-29 13:07:31 +02:00
Pratik Borhade
f1d0f79302 UI: Shape Key: Support Drag drop multiple selected elements
When drag is initiated, store selected keyblocks inside pointer array
(see: `create_drag_data`). Later iterate over these pointers inside
`on_drop()` function to place them one by one at `drop_index`

Resolves #143929

See PR description for video

Pull Request: https://projects.blender.org/blender/blender/pulls/144431
2025-09-29 12:53:05 +02:00
Philipp Oeser
be6b147d16 Outliner: allow "Show Active" to center/scroll in Data API view
Unlike other Outliner views, this will not open up elements to find
objects "underneath" (since Data API view lazy loads elements iirc), but
given that you already have that object visible somewhere in the DataAPI
view (so e.g. Objects expanded) we could actually do the centering/
scrolling by getting an ID from the `TreeElement` (in case of an
`TSE_RNA_STRUCT`).

This came up in #145904

Pull Request: https://projects.blender.org/blender/blender/pulls/145920
2025-09-29 12:52:09 +02:00
Casey Bianco-Davis
e8bb5a6558 Python: Rename IDType_ID_GP.name_plural to grease_pencils
This renames `IDType_ID_GP.name_plural` for Grease Pencil from
`grease_pencil_v3` to `grease_pencil`.

Part of #125058.

Pull Request: https://projects.blender.org/blender/blender/pulls/146903
2025-09-29 12:33:42 +02:00
Casey Bianco-Davis
d2269441bb Python: Rename bpy.data.grease_pencils_v3 to bpy.data.grease_pencils
This renames `bpy.data.grease_pencils_v3` to `bpy.data.grease_pencils`.

Part of #125058.

Pull Request: https://projects.blender.org/blender/blender/pulls/146904
2025-09-29 12:32:08 +02:00
Nika Kutsniashvili
1067112c11 UI: Theme: Remove "Active Spline" theme property
In 3D Viewport theme settings there is "Active Spline" property, which behaves weirdly.
Color of that property is multiplied to color of curve handles. Even though it says active,
it's multiplied in selected and unselected states, for all curves all the time.

That doesn't make much sense, has no real value, and ends up only causing confusion.
Having this property on anything but pure black means that whatever colors you choose
for curve handles in Preferences isn't actually what you're getting them. If color is set to
high-saturation color it completely washes away all colors and makes it difficult to differentiate
between handle types.

I think there is no reason for this property to exist, so this PR just removes that property.

Pull Request: https://projects.blender.org/blender/blender/pulls/145360
2025-09-29 12:27:16 +02:00
Casey Bianco-Davis
f8d2a3af38 Python: Rename bpy.types.GreasePencilv3 to bpy.types.GreasePencil
This renames python Grease Pencil type
from `bpy.types.GreasePencilv3` to `bpy.types.GreasePencil`.

Part of #125058.

Pull Request: https://projects.blender.org/blender/blender/pulls/146902
2025-09-29 12:25:23 +02:00
Pablo Vazquez
7089def6cb UI: Add icons to Compositor nodetree sub-type menu
* Use Scene data icon for Scene.
* Use Sequencer editor icon for Sequence.
* Update tooltips.
2025-09-29 11:18:22 +02:00
Damien Picard
950a2bb8a3 I18n: Use correct translation context for node socket in side bar
Node socket labels used their declared translation context in the
nodes themselves, but not in the editor side bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/146731
2025-09-29 11:07:05 +02:00
Damien Picard
e4d5368908 I18n: Use translation context from declaration for menu socket items
Allow translating node menu socket items using the declared socket
translation context.

In order to do this, the context needs to be copied to the socket's
default_value property when the tree is evaluated. To do that, the
context is redefined inside the prop's itemf callback, getting it from
the socket declaration.

In addition, add contexts to two sockets related to color.
2025-09-29 11:07:03 +02:00
Damien Picard
d064e17d7c Refactor: Move node_socket_translation_context to bke 2025-09-29 11:07:03 +02:00
Damien Picard
9bd249746a I18n: Translate UI for "Curve Data" panel
This panel defines labels manually, through a helper function
`add_labeled_field`. This commit simply adds `IFACE_` translation
macros around the labels.
2025-09-29 11:07:03 +02:00
Damien Picard
417792f7fe I18n: Define NO_TRANSLATION ("Do not translate") context
This new translation context is for some special cases when
translation cannot be avoided, for example in an interface where some
props are built-in (translatable) and others are
user-defined (non-translatable), but we don't know which ones in
advance.

It allows specifying explicitly that translation should not occur
for user data when building the UI.

It is a followup to !145963, in which the context was introduced as a
string literal instead of a defined context.
2025-09-29 11:07:03 +02:00
Damien Picard
13d4829b7b I18n: Disambiguate "Meta" in the context of NLA's meta strips
Use the "Action" context for this, if in any language it's different
from a sequencer meta strip, which already uses "Sequence".

Reported by Ye Gui in #43295.
2025-09-29 11:07:03 +02:00
Damien Picard
13135a6bfa I18n: Translate the name of newly-created collections 2025-09-29 11:07:03 +02:00
Damien Picard
c6f3936c0a I18n: Translate "Name" placeholder text in shader Attribute node
Reported by Ye Gui in #43295.
2025-09-29 11:07:03 +02:00
Damien Picard
4910b2d0a2 I18n: Translate "Shape" label in node editor's group socket settings
Reported by Ye Gui in #43295.
2025-09-29 11:07:03 +02:00
Damien Picard
6983b97640 I18n: Translate newly-created node group names
Reported by Ye Gui in #43295.
2025-09-29 11:07:03 +02:00
Damien Picard
51cdcc3186 I18n: Translate asset origin tooltips in asset browser 2025-09-29 11:07:03 +02:00
Amogh Shivaram
2bd06093c7 Cycles: Thin film iridescence for metals
Applies thin film iridescence to metals in Metallic BSDF and Principled BSDF.

To get the complex IOR values for each spectral band from F82 Tint colors,
the code uses the parametrization from "Artist Friendly Metallic Fresnel",
where the g parameter is set to F82. This IOR is used to find the phase shift,
but reflectance is still calculated with the F82 Tint formula after adjusting
F0 for the film's IOR.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Co-authored-by: Weizhen Huang <weizhen@blender.org>
Co-authored-by: RobertMoerland <rmoerlandrj@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/141131
2025-09-29 02:58:20 +02:00
Damien Picard
6c6d1a9b63 Cycles: OSL Camera: Improve Property UI
This expands Cycles' support for handling OSL property metadata for
Custom camera parameters and translating it to Blender's UI.

Specifically, it adds support for:
- Translation inputs (`string vecsemantics = "POINT"`)
- Normal inputs (`string vecsemantics = "NORMAL"`)
- File inputs (`string widget = "filename"`)
- Angle inputs (`string unit = "radians"`)
- Distance inputs (`string unit = "m"`)
- Time inputs (`string unit = "s"` or `string unit = "sec"`)
- Enum inputs (`string widget = "mapper", string options = "left:0|right:1"`)

It also sets the default value correctly, and corrects a warning string to
also mention cameras in addition to nodes as possible users of OSL shaders.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/146736
2025-09-29 02:20:23 +02:00
Hans Goudey
b5863c401e Fix: Geometry Nodes: Function nodes crash for unsupported grid types
The multi-function node evaluation code correctly didn't create a grid
with an unsupported type, but then the code crashed in the logging
code when setting default for the outputs. Instead just use a common
utility for that goal. And also add support for executing a function node
if only outputs with supported types are required (for example when
creating a grid for the "Fac" output of the noise node, but not the
color output).

Pull Request: https://projects.blender.org/blender/blender/pulls/146937
2025-09-29 01:49:01 +02:00
Colin Basnett
a0a43c0805 Fix: Remove animatable flag from execution_time property
This property is not user editable and is calculated internally. When presented as a property in the UI, it shows the animatable button which is useless. This just removes the flag.

Pull Request: https://projects.blender.org/blender/blender/pulls/146907
2025-09-28 23:02:58 +02:00
Jacques Lucke
96ce5ee0c0 Cleanup: use utility method to get node group input usage
This also results in a small speedup because of the early exit
in is_group_input_used.
2025-09-28 21:19:19 +02:00