Commit Graph

149367 Commits

Author SHA1 Message Date
Sergey Sharybin
bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00
Omar Emara
1f51172692 Compositor: Turn Alpha Over options to inputs
This patch turns the options of the Alpha Over node into inputs.

In the process, Convert Premultiplied option was renamed to Straight
Alpha.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138441
2025-05-05 14:16:27 +02:00
YimingWu
787f7272ae Fix #138439: Annotation: Correct immVertex when drawing stabilizer
the float/int version of `immVertex` can not be mixed in one
`immBegin/End` block. This fix corrects the usage and prevent invalid
int values from passing into the batch.

Pull Request: https://projects.blender.org/blender/blender/pulls/138442
2025-05-05 13:45:36 +02:00
Clément Foucault
7aef8c2917 GPU: Shader Preprocess: Add utility to search for references
This utility will only match `&` character inside a
reference declaration. This is needed for speeding up the
regex matches.
2025-05-05 13:42:42 +02:00
Clément Foucault
74e6d2c575 GPU: Shader: Add support for basic loop unrolling through preprocessor
This adds basic unrolling support for 2 syntax:
- `[[gpu::unroll]]` which does full loop unrolling
- `[[gpu::unroll(x)]]` which unrolls `x` iteration

Nesting is supported.

This change is motivated by the added cost in compilation
and execution time that some loops have even if they have
compile time defined iteration counts.

The syntax is inspired by `GL_EXT_control_flow_attributes`.
However, we might want to have our own prefix to show it is
a blender specific feature and that it differs from the standard.
I propose `[[gpu::unroll]]`.

In the future, we could extend this to support more directives that
can be expanded to backend specific extension / syntax. This would
avoid readability issue an error prone copy paste of large amount
of preprocessor directives.

Currently, given that GL's GLSL flavor doesn't support
any of these attributes, the preprocessor does some copy-pasting
that does the unrolling at the source level. Note that the added
`#line` allow for correct error logging.

For the `[[gpu::unroll]]` syntax, the `for` declaration
needs to follow a specific syntax to deduce the number
of loop iteration.
This variant removes the continue condition between iteration,
so all iterations are evaluated. This could be modified
using a special keyword.

For the `[[gpu::unroll(n)]]` syntax, the usercode needs
to make sure that `n` is large enough to cover all iterations
as the loop is completely removed.
We could add shader `assert` to make sure that there is
never a remaining iteration.
This behavior is usually different from what you see in other
implementation as we do not keep a loop at all. Usually, compilers
still keep the loop if it is not unrolled fully. But given we don't
have IR, this is the best we can do.

`break` and `continue` statement are forbidden at the unrolled loop
scope level. Nested loop and switch can contain these keywords.
This is accounted for by checks in the pre-processor.

Only `for` loops are supported for now. There are no real
incentive to add support for `while` given how rare it is
in the shader codebase.

Rel #137446

Pull Request: https://projects.blender.org/blender/blender/pulls/137444
2025-05-05 13:37:51 +02:00
Jacques Lucke
c271c3b291 Fix: ID code not should not be passed as part of name
Found in #138383.
2025-05-05 11:47:42 +02:00
Bastien Montagne
d653499991 I18N: Updated UI translations from git/weblate repository (a2fbba96fa53376). 2025-05-05 11:37:52 +02:00
YimingWu
e441095edb Fix #137918: LineArt: Prevent invalidating the wrong cache
When baking multiple line art modifiers at once, line art can pick the
wrong cache data and free it before all modifiers have finished baking.
This fix corrected that logic so that when baking all line art, it will
always use/create/free the correct cache data.

Pull Request: https://projects.blender.org/blender/blender/pulls/138114
2025-05-05 11:03:58 +02:00
Clément Foucault
a14fa6bfe5 GPU: Shader Preprocess: Add string utilities
Allow faster and more robust parsing / mutation.
2025-05-05 11:03:36 +02:00
Omar Emara
ebe67e5ca0 Compositor: Remove Premultiplied option from Alpha Over node
This patch removes the Premultiplied option from the Alpha Over node.
The reasoning is as follows:

- The option mixed between alpha being straight and premultiplied, a
  state which doesn't happen in practice.
- The option conflicts with the Convert Premultiplied option, if it is
  not zero, then Convert Premultiplied does nothing.
- The option is implemented in a lossy way. It premultiplies the alpha
  assuming it is straight, then converts the result to straight again,
  then mixed between both results. This is as opposed to mixing the
  original straight input with the premultiplied input. The successive
  alpha conversion causes data loss in transparent regions.

Pull Request: https://projects.blender.org/blender/blender/pulls/138428
2025-05-05 10:51:34 +02:00
Falk David
a7d2b7850e Grease Pencil: Add initial support for Node Tools
This adds inital Grease Pencil support for node tools.

Node tools work in `Object Mode`, `Edit Mode`,`Sculpt Mode`,
and `Draw Mode`.

While Grease Pencil has many editing tools, including editing
multiple frames at the same time, for now, node tools only
allow editing the current frame.

Currently, the idea is that node tools can do arbitrary changes
to the drawings, but cannot do changes to the existing layer tree, e.g.
changing the order of layers, removing a layer or groups, etc.

All the node tool specific nodes like `Selection` and `Set Selection`
are adapted to work with Grease Pencil. In `Draw Mode`, we currently
interpret everything as selected.
The `Active Element` node has a `Layer` mode that provides the
index of the active layer (if there is one).

When `Auto-Key` is used, a new keyframe is created on the
current frame.
Locked/invisible layers cannot be edited with node tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/136624
2025-05-05 10:41:21 +02:00
Kevin C. Burke
d5b697b3f1 Python API: Grease Pencil: Add handle helper class to expose more handle attributes
Exposes bézier handle data through a new `GreasePencilStrokePointHandle`
class on each point, which provides `position`, `type`, and `select` for both
`point.handle_left` and `point.handle_right`.

Also removes the old separate point attributes:
* `handle_left_type`, `handle_right_type`
* `select_handle_left`, `select_handle_right`

Pull Request: https://projects.blender.org/blender/blender/pulls/137780
2025-05-05 10:32:18 +02:00
Clément Foucault
8dee08996e GPU: Shader: Add wrapper to stage agnostic function
This avoid having to guards functions that are
only available in fragment shader stage.

Calling the function inside another stage is still
invalid and will yield a compile error on Metal.

The vulkan and opengl glsl patch need to be modified
per stage to allow the fragment specific function
to be defined.

This is not yet widely used, but a good example is
the change in `film_display_depth_amend`.

Rel #137261

Pull Request: https://projects.blender.org/blender/blender/pulls/138280
2025-05-05 09:59:00 +02:00
Omar Emara
92ac9f3b25 Compositor: Remove Premultiplied option from Brightness node
This patch removes the Convert Premultiplied option from the Brightness
and Contrast node. The reasoning is that it is the only node that has
the option to operate on straight alpha, while not being particularly
different. Adding alpha conversion nodes around it is also very easy.
Furthermore, alpha conversion is a lossy operation, so the option looses
data in emissive pixels, and since it is enabled by default, users not
familiar with the exact mechanism of the option wouldn't know how to fix
this.

Pull Request: https://projects.blender.org/blender/blender/pulls/138318
2025-05-05 08:33:29 +02:00
Daniel Salazar
a36c9adfe4 Fix: Description error in uv_layers.remove()
Description for uv_layers.remove() is wrong, copy paste error.

Pull Request: https://projects.blender.org/blender/blender/pulls/124940
2025-05-05 08:28:21 +02:00
Jordan Henshaw
2ab8c7a5bb Fix: Docs: Remove Improper Comma from main README
No grammatical justification for this comma in English lexicon.

A similar and correct use would be this:

"Blender as a whole is licensed under the GNU General Public License, Version 3.
Individual files may have a different, but compatible, license."

But that's far more clunky, so it's best to simply remove the comma.

Pull Request: https://projects.blender.org/blender/blender/pulls/138234
2025-05-05 06:37:48 +02:00
Sean Kim
bf0018d75b Cleanup: Add comment for tilt_sensitivity constant
Derived from discussions on D8893

Pull Request: https://projects.blender.org/blender/blender/pulls/138417
2025-05-05 04:45:48 +02:00
Hans Goudey
91c340a1a5 Cleanup: Remove redundant break after return in switch 2025-05-04 22:07:23 -04:00
Hans Goudey
beadd08fb7 Fix: A few small issues with spreadsheet row filters
- int2 and short2 filters were completely disfunctional
- Don't use threshold for integer comparisons; it's not in the UI
- Filter with geometry set name for instance "Name" column
2025-05-04 22:07:23 -04:00
Nicola
33bef53c3e Sculpt: Use box test to select BVH nodes affected by Clay Strips
Implements a box test to select nodes affected by Clay Strips. The ratio
of nodes selected compared to the sphere test depends heavily on the
mesh, but is generally between 50% and 70%. This results in better
performance and reduces memory usage.

Pull Request: https://projects.blender.org/blender/blender/pulls/138170
2025-05-05 04:01:01 +02:00
Clément Foucault
c0f191f580 GPU: Make polylines vertex shader use C++ shader compilation
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/138411
2025-05-05 00:44:34 +02:00
Jesse Yurkovich
223aca7703 Build: Fix overzealous line wrap for COMPILER_CODE_COVERAGE_CXXFLAGS
Broken by f48b4e3abf

Pull Request: https://projects.blender.org/blender/blender/pulls/138379
2025-05-04 21:37:28 +02:00
Mattias Fredriksson
8d06479d24 Fix #137057: Sample Single Point Curves
Fixes behavior for #137057 when sampling single point curves.
Previous behavior just checked the evaluated length cache size and
called fill_invalid(), it will now fill using the point value and terminate.

Pull Request: https://projects.blender.org/blender/blender/pulls/138153
2025-05-04 16:31:58 +02:00
Nika Kutsniashvili
5dd53fdb29 Fix: Avoid relative imports in UI code
Relative imports are intentionally avoided in UI code (`scripts/startup/bl_ui`) because it makes it impossible to run individual files in isolation.

Common workflow for making mock-ups and quick UI edits is to load the UI file in Blender's text editor with "Edit Source" operator, make changes, and run the script to see the changes. But in the current version it's impossible because files include relative imports, which don't allow Python to run scripts individually.

Pull Request: https://projects.blender.org/blender/blender/pulls/138246
2025-05-04 13:26:03 +02:00
илья _
aa2ca33da2 Fix #137064: Nodes: Some nodes have a blank header when no datablock is selected
Similar to Mix node in #135535, some nodes did not properly implement a
callback to provide a UI node name.

Pull Request: https://projects.blender.org/blender/blender/pulls/137065
2025-05-04 11:37:07 +02:00
Jacques Lucke
5dd37abfbf Fix: Nodes: new empty frame node is always at origin
Now, when a new frame node is added while no node is selected,
it will be added at the cursor.
2025-05-04 09:40:22 +02:00
YimingWu
884ef238c0 Fix #136397: Line Art: Skip dupli objects with include_objects
Previously to handle unevaluated objects in line art "load all"
iteration, a `include_objects` variable is added in depsgraph
iteration settings, and this was only processed by object iterator
but not for any of the dupli objects. Now `make_duplis_collection`
will also handle `include_objects`

The only case where this border case can lead to crash is that a
line art grease pencil object is inside one of the dupli collection,
which isn't a valid use in the first place. But this fix makes it
more robust.

Pull Request: https://projects.blender.org/blender/blender/pulls/137323
2025-05-04 08:20:06 +02:00
Jacques Lucke
327ac569b2 Geometry Nodes: show node timings for import nodes 2025-05-04 05:44:52 +02:00
Aaron Carlisle
ebeb5cc2fc Fix: Missing UI class registration
This was missing in ad9b5a1b00
2025-05-03 22:38:08 -04:00
Sean Kim
6ec5ad88b9 Fix: Making a brush local doesn't set user count correctly
When copying a brush from a linked library to the current main, the fake
user flag is set, but the user count is set to 0. This later means that
saving such a file does not persist the brush datablock, and the
associated invariants are violated.

Related to / Found in #138105

Pull Request: https://projects.blender.org/blender/blender/pulls/138243
2025-05-04 01:25:05 +02:00
Aaron Carlisle
c92abb6af1 Icons: Match SVG height for Add/Remove icons
Adjust the height of the remove icon SVG to match the add icon, ensuring consistent sizing across UI elements.

This resolves alignment issues when pairing SVG icons with text or font-based elements. A height of 1100px was chosen to vertically center the icon cleanly in Blender's UI without introducing fractional pixel offsets.

No visual differences are expected in Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/137438
2025-05-03 17:21:06 -04:00
Hans Goudey
71ac8eee68 Cleanup: Use const arguments for realize instances function
OrderedAttributes was passed by value unnecessarily.
2025-05-03 15:25:24 -04:00
Guillermo Venegas
9e5151d294 Refactor: UI: Replace uiLayoutSplit with class method uiLayout::split
This converts the public `uiLayoutSplit` function to an object oriented
API (`uiLayout::split`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::split` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138361
2025-05-03 20:51:42 +02:00
Mukhesh
5055a4e5a3 FIX: Select operators in Sequencer Preview
Behavior of select all operator invoked by shortcut was inconsistent
with menu. This was, because operator context was not set.

Also the selection in timeline is cleared when running this operator
as not doing it may cause unexpected behavior for users.
Selection invert also follows the same behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/137713
2025-05-03 02:20:56 +02:00
Campbell Barton
7d97ba4c5f Cleanup: use float2, int2 types for cursor drawing callbacks
Ref !138172
2025-05-02 23:01:29 +00:00
Campbell Barton
0d6a0dfa29 Cleanup: reduce right-shift in Python iterators 2025-05-03 08:57:44 +10:00
Andrej730
db78c031c5 PyDoc: add types to property doc-strings in bpy.types
Also correct type for Object.children_recursive.

Ref !138346
2025-05-03 08:45:53 +10:00
Andrej730
24dc0482ac PyAPI: minor optimization using iterators for contains checks
Avoid building a list to perform a __contains__ check.

Ref !138346
2025-05-03 08:45:14 +10:00
Hans Goudey
ae2c601a0c Fix: Curves split/separate points operators lose vertex group status
The fix is only clearly correct if `copy_data_to_geometry` returns by value.
2025-05-02 14:39:20 -04:00
Guillermo Venegas
5dc86dacda Refactor: UI: Replace uiLayoutBox with class method uiLayout::box
This converts the public `uiLayoutBox` function to an object oriented
API (`uiLayout::box`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code (or vice-versa),
making it almost seamless.

`uiLayout::box` now returns an `uiLayout` reference instead of a pointer.
New calls to this method should use references too.

Pull Request: https://projects.blender.org/blender/blender/pulls/138334
2025-05-02 19:46:26 +02:00
Bastien Montagne
b1fd91c2c0 Fix #138329: Workbench Material color type broken for meshes with no material.
Regression from 368c737fe7. Forgot to fully move to using
`BKE_id_new_nomain` at some point for default materials, instead
of doing more low-level set of 'alloc liblock, initialize it with
default values'.
2025-05-02 18:58:15 +02:00
Miguel Pozo
f24ad7a470 Build: Add WITH_OPTIMIZED_BUILD_TOOLS
Enable optimizations on Debug builds for executables used for the build
process (datatoc and glsl_preprocess) and enable unity builds for
shader preprocessing targets.

Debug: From 28.9s to 5.7s
Release: From 4.9s to 3.5s

Pull Request: https://projects.blender.org/blender/blender/pulls/138274
2025-05-02 18:33:44 +02:00
Hans Goudey
37dcdb2b6a Depsgraph: Avoid quadratic overhead when building collection relations
Checking whether relations already existed was a bottleneck when building
collection -> object hierarchy relations. The duplicate checking would be
unnecessary since an object can only be in a collection once, but this function
to build relations can be called multiple times for the same collection.

To avoid the need to check for duplicates, only run the relation creation
once for each collection. The `BuilderMap` gives a simple way to do that.
Note that because a collection might be built separately as a non-layer
collection, there may still be duplicate hierarchy relations.

Building a Depsgraph for 60k simple objects became 1.86x faster, from 2.39
to 1.29 seconds.

Pull Request: https://projects.blender.org/blender/blender/pulls/137737
2025-05-02 17:51:10 +02:00
Brecht Van Lommel
204050d1a3 Fix #115714: Change OpenColorIO abort to CLOG_ERROR
OpenColorIO exceptions would abort when WITH_ASSERT_ABORT is enabled.
But these do not generally indicate a bug in Blender. They may just be a
blend file using an unknown color space, or an error loading the
configuration file, which we can handle gracefully.
2025-05-02 17:39:56 +02:00
Brecht Van Lommel
321e9e049e Fix: USD material reader uses fixed colorspace names
For other OpenColorIO configurations these may not exist or have a
different meaning.
2025-05-02 17:39:56 +02:00
Brecht Van Lommel
af4a7efaed Fix #138262: Movie file colorspace can't be changed
Regression from recent ccd7bc2078, restore previous logic and add
comments.
2025-05-02 17:39:56 +02:00
Laurynas Duburas
45a2634917 Fix: Curves: "Separate" in point selection mode loses boundary segments
The current code doesn't include selection boundary points in non-
selected curves after separation, causing some segments to be lost.
Legacy curves do include those points. The second issue is with cyclic
curves. The current version leaves the separated part cyclic, though
the more intuitive behavior would be cut off the result. This is also
different from legacy curves. This commit fixes both issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/135035
2025-05-02 17:30:02 +02:00
Sergey Sharybin
5b29ba488f Color management: Implement shader to convert to scene linear
Previous conversion to scene linear was done in the display transform
shader. Having a separate shader to convert texture to scene linear
allows drawing input textures with different color spaces into a
viewport and apply display transform on all of them.

Currently unused, but is required for !138094. It could also be used
in the future to avoid host-side linearization in the image engine.

Internally it uses a lot of the same logic for shader caching and
binding, but the code is refactored a bit to make it easier to have
a stronger separation in the future if needed.

Ref #138094

Pull Request: https://projects.blender.org/blender/blender/pulls/138308
2025-05-02 16:51:46 +02:00
Sergey Sharybin
a26ed85adf Fix: Wrong ID type used to create Lookdev world
Fixes incorrect render of lookdev on macOS.
There might have been some other issues caused by the mistake, hard to say,
seems to be hitting some platform-specific behavior and such.
2025-05-02 16:30:44 +02:00
Julien Duroure
0fa57b7774 glTF Exporter: Restore animation hook after slots management 2025-05-02 16:19:59 +02:00