Commit Graph

5305 Commits

Author SHA1 Message Date
Brecht Van Lommel
4786fbe774 Refactor: Remove extern "C" from most headers
The only remaining code in source/blender that must be compiled as C
is now datatoc generated code and the DNA defaults that use designated
initializers.

Pull Request: https://projects.blender.org/blender/blender/pulls/134469
2025-02-13 18:58:08 +01:00
Jacques Lucke
1657545603 Merge branch 'blender-v4.4-release' 2025-02-13 16:48:12 +01:00
Jacques Lucke
808635e52a Fix #102598: Resample Curve node collapses curves to a single point
Collapsing curves to a single point when just resampling is unexpected. This
patch changes it so that non-zero-length curves keep at least one segment.

The fix is fairly straight forward, but a bunch of additional code is added to
support the legacy option to avoid breaking backward compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/133659
2025-02-13 16:47:10 +01:00
Campbell Barton
640e70b6e8 Cleanup: various non-functional changes for C++ 2025-02-13 13:33:09 +11:00
Brecht Van Lommel
c7a33a62a2 Cleanup: Directly include DNA_userdef_types.h and BLI_listbase.h
Instead of relying on them being included indirectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134406
2025-02-12 23:01:08 +01:00
Alaska
8ed69341d0 Shader: Expose light path "is volume scatter ray" in UI
This commit adds the "is volume scatter" output to the light path node
in the shader editor.

All the funcitonal code for this feature already exists in Cycles SVM
and OSL, but the output wasn't exposed on the node.

EEVEE does not support the feature, so it's output will
always be zero.

Pull Request: https://projects.blender.org/blender/blender/pulls/134343
2025-02-12 15:45:04 +01:00
Brecht Van Lommel
2c34786474 Merge branch 'blender-v4.4-release' 2025-02-11 20:43:17 +01:00
Brecht Van Lommel
89e3d0a688 Fix: MaterialX normal map node not exported
Space input was removed in MaterialX 1.39.

Pull Request: https://projects.blender.org/blender/blender/pulls/134411
2025-02-11 20:40:33 +01:00
Brecht Van Lommel
21da1aec16 Fix: MaterialX of gradient texture node is wrong
Node input names changes in MaterialX 1.39.

Pull Request: https://projects.blender.org/blender/blender/pulls/134411
2025-02-11 20:40:33 +01:00
Jacques Lucke
4980dc5e29 Merge branch 'blender-v4.4-release' 2025-02-11 17:47:45 +01:00
Jacques Lucke
1cb2d991f9 Fix #134230: missed multi-threading opportunity when using repeat zone
In setups where only very few elements are processed at once, the lazy-threading
hints that come from `parallel_for` are not triggered. However, often it can
still be worth to use multi-threading in such cases. Therefore, we need to find
additional places where the lazy-threading hints are sent. There are many
possibilities and we probably have to add them step by step as we find .blend
files that show missing multi-threading.

In this patch I choose to send the hint at the beginning of evaluating a repeat
zone if it has 10 or more iterations. The exact number here is just a guess and
could be fine tuned over time if necessary.

A slightly modified version of the file in #134230 speeds up from ~1100ms to
~100ms with this change. The exact speedup changes quite a bit each run, but is
always between 5 and 20x, so it's quite noticable.

Pull Request: https://projects.blender.org/blender/blender/pulls/134408
2025-02-11 17:46:53 +01:00
Lukas Tönne
d01f2e232b Fix ASAN warnings in node socket forward compatibility code
These are due to casting a nullptr to an `ID`, which is valid but
confuses ASAN. `reinterpret_cast` avoids this.

Pull Request: https://projects.blender.org/blender/blender/pulls/134386
2025-02-11 12:15:54 +01:00
Hans Goudey
ef8e85c436 Cleanup: Remove unnecessary indirection in CSV importer 2025-02-10 12:19:45 -05:00
Devashish Lal
1a62fdc82a Geometry Nodes: CSV import node
This commit implements a node to import CSV files as a point cloud.
The interface is minimal, with just a file path input. The type of each
column is chosen by whether the first value is an integer or a float
(those are currently the only supported types).

The goal of the node is to make it easier to get arbitrary data into
geometry nodes for visualization purposes, for example.

https://devtalk.blender.org/t/gsoc-2024-geometry-nodes-file-import-nodes/34482

Pull Request: https://projects.blender.org/blender/blender/pulls/126308
2025-02-10 16:56:52 +01:00
Omar Emara
bd379e1892 Refactor: Compositor: Use gpu_fn for ShaderNode class
This patch refactors the ShaderNode class to be a concrete class that
is implemented in terms of the node type gpu_fn. This is done to make it
easier to reuse existing nodes in other parts of Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/134210
2025-02-10 11:51:57 +01:00
Bastien Montagne
87a4c0d3a8 Refactor: Make Library.runtime an allocated pointer.
Move `Library.runtime` to be a pointer, move the related
`LibraryRuntime` struct to `BKE_library.hh`. Similar to e.g.
Mesh.runtime, that pointer is expected to always be valid, and is
allocated at readtime or when creating a new Library ID.

Related smaller changes:
* Write code now uses standard ID writing codepath for Library IDs too.
  * Runtime pointer is reset to nullptr before writing.
* Looking up a library by its absolute path is now handled through a
  dedicated utils, `search_filepath_abs`, instead of using
  `BLI_findstring`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134188
2025-02-07 17:47:16 +01:00
Jacques Lucke
190ba72acf Cleanup: Nodes: use utility method to check if node is undefined 2025-02-07 13:40:26 +01:00
Jacques Lucke
fa912845ac Merge branch 'blender-v4.4-release' 2025-02-07 13:31:43 +01:00
Jacques Lucke
3baac1992a Fix: Nodes: handle undefined nodes more gracefully
Found while checking #134193.
2025-02-07 13:26:24 +01:00
Hans Goudey
4f833b0b5f Refactor: Add StringRef overloads to translation functions
Currently UI code always has to use char pointers when interacting with
the translation system. This makes benefiting from the use C++ strings
and StringRef more difficult. That means we're leaving some type safety
and performance on the table. This PR adds StringRef overloads to the
translation API functions and removes the few calls to `.c_str()` that
are now unnecessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/133887
2025-02-06 17:47:52 +01:00
Brecht Van Lommel
7112eb3e8b Merge branch 'blender-v4.4-release' 2025-02-06 14:30:15 +01:00
Brecht Van Lommel
d5823ad895 Fix: MaterialX 1.39 subsurface not exporting correctly
Pull Request: https://projects.blender.org/blender/blender/pulls/134139
2025-02-06 14:29:42 +01:00
Omar Emara
31444fe5b1 Refactor: Compositor: Use generic container for results
This patch refactors the Result class in the compositor to use
GMutableSpan and std::variant to wrap the result's data. This reduces
the complexity of the code and slightly optimizes performance. This will
also make it easier to add new types and interface with other code like
multi-function procedures.

Pull Request: https://projects.blender.org/blender/blender/pulls/134112
2025-02-06 13:49:44 +01:00
YimingWu
981f9f767d Fix #134082: Clarify description for subsurface scattering radius
User may think of the `radius` vector value as RGB color, however it's
meant to be the depth of scattering for R/G/B channels. Now clarified in
the desctiption.

Pull Request: https://projects.blender.org/blender/blender/pulls/134088
2025-02-06 12:23:23 +01:00
Jacques Lucke
3b49b5b587 Fix: Geometry Nodes: Instance on Points ignores Grease Pencil layer transform
It already doesn't work in a very fairly simple case when the Grease Pencil
geometry is transformed. This simple case used to work before we changed
the Transform Geometry node to transform layers instead of points.

Pull Request: https://projects.blender.org/blender/blender/pulls/134131
2025-02-06 11:34:58 +01:00
Jacques Lucke
4fd236dc32 Fix #134111: sockets are incorrectly grayed out after random node
The issue was that the code did not handle input sockets that are fields
implicitly correctly. It just retrieved a single from them, instead of
treating them as having an unknown value.
2025-02-05 14:09:48 +01:00
carnaval
0e7924ac25 Fix: add missing dependencies for object and collection value nodes
The new Object and Collection constant geometry nodes do not register their dependency on their targets.
This causes the graph not to update properly when they are modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/133784
2025-02-03 15:16:07 +01:00
Jacques Lucke
7c011440c6 Fix #133925: crash when removing animated input socket 2025-02-03 15:14:38 +01:00
илья _
b7085d8554 Fix: Geometry Nodes: muted nodes have incorrect socket usage inferencing
Only inputs that are passed through internal links are used by the outputs.

Pull Request: https://projects.blender.org/blender/blender/pulls/133903
2025-02-03 12:44:06 +01:00
Omar Emara
1a973bcb06 Cleanup: Compositor: Forward declare DerivedResources 2025-02-03 10:40:30 +02:00
Brecht Van Lommel
315d07bd12 Cleanup: Various clang-tidy warnings in nodes
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:18 +01:00
Omar Emara
028506712d Fix #133807: File Output node ignores transforms
The File Output node sometime ignores the transformations of their
inputs. That's due to the fact that transforms are now delayed and the
File Output node does not realize its inputs on its domain in case it
was not multi-layer.

To fix this, add another realization mode for transforms only. And use
that in the File Output node, as well as the Bokeh Blur, UV Map, and
Plane Track Deform, which also need this fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/133850
2025-01-31 10:14:54 +01:00
Omar Emara
75f1cbb6dd Refactor: Clarify code around scheduling composite nodes
There is a special case in the compositor code where viewer nodes are
treated as composite nodes. This patch renames relevant methods and
updates comments to clarify this use case.

Pull Request: https://projects.blender.org/blender/blender/pulls/133811
2025-01-31 07:43:00 +01:00
Omar Emara
5fd5685a6a Compositor: Allow repeating in the Translate node
This patch changes how the Wrap option in the Translate node works. It
now repeats infinitely when realized, and not just in its own domain.
This is essentially how it used to work prior to version 4.2, so we are
reverting that change. We also rename Wrap to Repeat for clarity.

This is part of an ongoing to project to allow the user to control how
boundaries and empty areas are filled after transformations. So similar
options will be added to all transform nodes. But this patch is the
first step, since the functionality is already there, we just need to
extend it to work in all domains.

Pull Request: https://projects.blender.org/blender/blender/pulls/133766
2025-01-31 07:41:40 +01:00
Hans Goudey
8e13b2b048 Fix: Missing subtype for Points node position input 2025-01-30 14:31:02 -05:00
Habib Gahbiche
b51c560f6e Compositor: Implement shortcuts for Viewer nodes
Artists often want to quickly switch back and forth between two or more nodes while compositing.

This patch implements two operators `NODE_OT_viewer_shortcut_set` and `NODE_OT_viewer_shortcut_get` that allow users to map a viewer node to a shortcut. For example, pressing `cltr+1` while a node is selected, assigns that node to the shortcut `1`, creates a viewer node if it has none attached and sets that viewer node to active. Pressing `1` will set the active node with shortcut `1` to active.

Shortcuts are saved in DNA to preserve them after saving/loading blend files.

Limitations:
- Only compositor node tree is supported, because shading editor has no viewer node and geometry nodes viewer works differently.

Pull Request: https://projects.blender.org/blender/blender/pulls/123641
2025-01-29 18:35:26 +01:00
Jacques Lucke
e1753900b7 BLI: improve UTF-8 safety when copying StringRef to char buffers
Previously, there was a `StringRef.copy` method which would copy the string into
the given buffer. However, it was not defined for the case when the buffer was
too small. It moved the responsibility of making sure the buffer is large enough
to the caller.

Unfortunately, in practice that easily hides bugs in builds without asserts
which don't come up in testing much. Now, the method is replaced with
`StringRef.copy_utf8_truncated` which has much more well defined semantics and
also makes sure that the string remains valid utf-8.

This also renames `unsafe_copy` to `copy_unsafe` to make the naming more similar
to `copy_utf8_truncated`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133677
2025-01-29 12:12:27 +01:00
Campbell Barton
bd1ded952b Cleanup: spelling in comments 2025-01-29 12:31:19 +11:00
Hans Goudey
8692c093d6 Fix #101979: Edge angle node outputs wrong sign
Use the third point of the triangle connected to the edge
instead of the center of the second face as a reference point
for the concavity test.

Pull Request: https://projects.blender.org/blender/blender/pulls/133682
2025-01-28 18:16:53 +01:00
Clément Foucault
10c0b19213 Cleanup: GPUMaterial: Remove leftover EEVEE Legacy code 2025-01-28 17:48:34 +01:00
Jacques Lucke
a15aaa3aa6 Fix #133603: reroute node breaks graying out node group inputs
The evaluated value was not properly forwarded through reroute nodes.
2025-01-28 16:51:27 +01:00
Hans Goudey
7d6e098ca1 Cleanup: Remove unused includes in blenkernel
Pull Request: https://projects.blender.org/blender/blender/pulls/133688
2025-01-28 15:27:34 +01:00
Omar Emara
2ae06ac16e Fix: Translate node wrongly realizes transforms
The Translate node is a transform operation that should not realize the
transformations of its input. So this patch marks its input accordingly.
Additionally, we also protect against operating on single values and
pass them without changes.
2025-01-28 13:13:52 +02:00
Omar Emara
f7c543250f Fix #133665: Movie Distortion have a different name
The Movie Distortion have an ambiguous name "(Un)Distortion" after being
added, while the name should simply be Movie Distortion for clarity.
2025-01-28 10:12:39 +02:00
Hans Goudey
8b1bf74b3a Geometry Nodes: Reduce memory usage in edge angle node
Use 2 integers per edge instead of 3, by encoding the manifold
status of edges with negative face indices rather than as a separate
variable.
2025-01-27 10:59:51 -05:00
Omar Emara
2028bc8d7d Compositor: Add derived resources optimization
This patch introduces a new Derived Resources concept to the compositor.
Derived resources are resources that are computed from a particular
result and cached in it in case it is needed by another operation, which
can greatly improve performance in some cases at the cost of more memory
usage.

The first use case is to store denoised versions of the Denoising Albedo
and Denoising Normals passes if auxiliary pass denoising is enabled in
the denoise node. Consequently, multi-pass denoising setups where the
same auxiliary passes are used in multiple denoise nodes should be much
faster due to caching of the derived resources.

This implementation has the limitation that it can't preemptively
invalidate the cache when the derived resources are no longer needed to
free up memory. This requires a special resource tracking mechanism that
need to happen during node tree compilation, and will be submitted
later. The limitation is not significant in the particular derived
resources that is currently implemented. Since the auxiliary passes are
rarely used outside of denoising.

Fixes #131171.

Pull Request: https://projects.blender.org/blender/blender/pulls/125671
2025-01-27 14:58:09 +01:00
Jacques Lucke
a0b898904e Cleanup: add clarifying comment 2025-01-27 14:26:10 +01:00
Jacques Lucke
82c676676a Fix #133524: crash with localized missing node group
The issue is that the localized node tree has an invalid type if the linked file
is not available. So we essentially ended up with a geometry node group that
contains a group node that points to a non-geometry nodes group.

Pull Request: https://projects.blender.org/blender/blender/pulls/133650
2025-01-27 13:33:16 +01:00
Omar Emara
4b3ad6ff23 Compositor: UI: Clarify warning in Render Layers node
Passes are supported in EEVEE, but not other engines, so exclude EEVEE
from the warning through wording.
2025-01-27 10:33:12 +02:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00