Commit Graph

646 Commits

Author SHA1 Message Date
Omar Emara
0cee690de3 Fix: String file path interface socket has wrong type
The string interface sockets with a file path subtype are assigned a
vector translation type, which is probably a typo in the original
implementation.

Pull Request: https://projects.blender.org/blender/blender/pulls/138803
2025-05-13 10:56:56 +02:00
Jacques Lucke
23d5ae7da5 Refactor: Nodes: decentralize node storage blend read/write
Previously, whenever a node had a non-trivial storage struct, there would have
to be code for it in `node.cc`. Now there is a general callback that new node
types can use to implement their blend read/write behavior.

Some existing nodes were converted to use this decentralized method. However,
some older nodes can't use it in the same way, because the node types were
introduced before there were node idnames. It's also somewhat hard to reason
about special cases that versioning code might have for these nodes, so they
remain unchanged.

The node callback only writes the non-trivial data, while the main node storage
struct is written automatically by relying on `bNodeType::storagename`. This
simplifies the callback in many cases or makes it unnecessary for trivial types.

Some nodes have specific handling for forward-compatibility. This
forward-compatibility code is kept in `node.cc` for now, because it also affects
the main storage struct and therefore has to be changed before that struct is
written.

Pull Request: https://projects.blender.org/blender/blender/pulls/138722
2025-05-13 07:00:03 +02:00
Omar Emara
fd3ca68b5e Compositor: Turn Bokeh Blur options to inputs
This patch turns the options of the Bokeh Blur node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138664
2025-05-09 14:15:14 +02:00
Campbell Barton
fd6ac498b0 Cleanup: spelling in comments, strings (make check_spelling_*)
Also replace some triple-quoted non-doc-string strings with commented
blocks in examples.
2025-05-06 00:18:39 +00:00
Jacques Lucke
e09ccc9b35 Core: add templated version of BKE_id_new_nomain to reduce explicit casting
This adds a version of `BKE_id_new_nomain` that takes the ID type parameter as
template argument. This allows the function the return the newly created ID with
the correct type, removing the need to use `static_cast` on the call-site.

To make this work, I added a static `id_type` member to every ID struct. This
can also be used to create a similar API for other id management functions in
future patches.

```cpp
// Old
Mesh *mesh = static_cast<Mesh *>(BKE_id_new_nomain(ID_ME, "Mesh"));

// New
Mesh *mesh = BKE_id_new_nomain<Mesh>("Mesh");
```

Pull Request: https://projects.blender.org/blender/blender/pulls/138383
2025-05-05 18:41:03 +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
Habib Gahbiche
987fc14ada Cleanup: simplify logic in node tree iterator
Return separately for each node tree type.

This patch originally started as a refactor to change the logic of
iterating through compositing node trees but we ended up choosing
a different solution so only the small cleanup part is submitted here.

Pull Request: https://projects.blender.org/blender/blender/pulls/138205
2025-05-01 11:08:13 +02:00
Omar Emara
510130de07 Compositor: Turn Bilateral Blur options to inputs
This patch turns the options of the Bilateral Blur node into inputs.

In the process, the Sigma Space and Iterations were joined into a single
Size input, previously they were just added together then ceiled to get
the blur size. Furthermore, Sigma Color was renamed to threshold and now
represents the average color difference, not the sum, so it was
previously multiplied by 3.

Versioning and RNA compatibility is not perfect due to joining the two
size options.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138249
2025-05-01 09:57:57 +02:00
Omar Emara
f216b3ca62 Compositor: Turn Directional Blur options to inputs
This patch turns the options of the Directional Blur node into inputs.

In the process, the node now allows scaling down, not just scaling up.
The transformation options were renamed to Translation, Rotation, and
Scale as opposed to Distance, Spin, and Zoom. Finally, scaling is now
defined as a scale instead of a delta. So 1 is identity, 2 means scale
up two times, and so on. While previously, 0 was an identity scale, 1
means scale up by two types.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138198
2025-04-30 14:40:13 +02:00
Damien Picard
a4669e3a8f Fix: Bring back UI translation of node header labels
Translation of node header labels was removed in cleanup
commit 02281dd26a, likely by mistake.

Issue reported by Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/138052
2025-04-30 12:29:00 +02:00
Omar Emara
7a6acfac62 Compositor: Turn Sun Beams options to inputs
This patch turns the options of the Sun Beams node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138184
2025-04-30 11:46:36 +02:00
Omar Emara
93408e03a4 Compositor: Turn Ellipse Mask options to inputs
This patch turns the options of the Ellipse Mask node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138130
2025-04-29 15:20:54 +02:00
Omar Emara
3d4900f412 Compositor: Turn Box Mask options to inputs
This patch turns the options of the Box Mask node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138129
2025-04-29 14:34:23 +02:00
Omar Emara
ddc0f9460d Compositor: Turn Lens Distortion options to inputs
This patch turns the options of the Lens Distortion node into inputs.

The Projector option was turned into an enum between two options.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138113
2025-04-29 09:54:12 +02:00
Omar Emara
39aa73628d Compositor: Turn Color Correction options to inputs
This patch turns the options of the Color Correction node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138003
2025-04-28 12:19:42 +02:00
Omar Emara
ad49181f90 Compositor: Turn Plane Track Deform options to inputs
This patch turns the options of the Plane Track Deform node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137949
2025-04-24 12:47:15 +02:00
Omar Emara
290c015a75 Compositor: Turn Stabilize node options to inputs
This patch turns the options of the Stabilize node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137911
2025-04-24 09:34:30 +02:00
Omar Emara
f4e46b3fdd Compositor: Turn ID Mask node options to inputs
This patch turns the options of the ID Mask node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137905
2025-04-23 16:31:27 +02:00
Omar Emara
8c616a8a00 Compositor: Turn Keying node options to inputs
This patch turns the options of the Keying node into inputs.

In the process, some options were renamed for clarity and consistency
with other nodes.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137900
2025-04-23 15:33:22 +02:00
Omar Emara
8bb1ebb5f7 Compositor: Turn Keying Screen options to inputs
This patch turns the options of the Keying Screen node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137851
2025-04-22 15:57:46 +02:00
Omar Emara
730cb40f4c Compositor: Turn Color Spill options to inputs
This patch turns the options of the Color Spill node into inputs.

In the process, the Ratio option was renamed to Limit Strength, the
unspill option was renamed to Spill Strength.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137848
2025-04-22 14:51:26 +02:00
Omar Emara
5e93b6a2cd Compositor: Turn Luminance Key options to inputs
This patch turns the options of the Luminance Key node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137823
2025-04-22 09:09:51 +02:00
Omar Emara
d791ea7cc2 Compositor: Turn Distance Key options to inputs
This patch turns the options of the Distance Key node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137817
2025-04-21 19:28:57 +02:00
Omar Emara
3c9f33ad07 Compositor: Turn Difference Key options to inputs
This patch turns the options of the Color Key node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137816
2025-04-21 17:59:24 +02:00
Omar Emara
fa7d58ab4c Compositor: Turn Color Key options to inputs
This patch turns the options of the Color Key node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137815
2025-04-21 16:40:17 +02:00
Omar Emara
4f3413ff80 Compositor: Turn Chroma Key options to inputs
This patch turns the options of the Chroma Key node into inputs.

In the process, the minimum and maximum angles were renamed to Minimum
and Maximum for consistency with other matte nodes.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137812
2025-04-21 15:28:37 +02:00
Omar Emara
89b268bf0c Compositor: Turn Channel Key options to inputs
This patch turns the options of the Channel Key node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137806
2025-04-21 14:02:15 +02:00
Omar Emara
e115467f8a Compositor: Turn Vector Blur node options to inputs
This patch turns the options of the Vector Blur node into inputs.

In the process, the factor input was renamed to Shutter and was remapped
to match the shutter in Cycles/EEVEE.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137725
2025-04-18 15:09:27 +02:00
Omar Emara
54a8ab9a97 Compositor: Turn Anti-Alias node options into inputs
This patch turns the options of the Anti-Alias node into inputs.

In the process, the [0, 1] limit of the Contrast Limit input was lifted
to allow normalized arbitrary positive limits.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137717
2025-04-18 12:48:08 +02:00
Omar Emara
24379b8243 Compositor: Turn Denoise node options into inputs
This patch turns the options of the Denoise node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137669
2025-04-17 16:39:11 +02:00
Omar Emara
96761b8df2 Compositor: Turn Despeckle node options into inputs
This patch turns the options of the Despeckle node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137656
2025-04-17 13:21:36 +02:00
Omar Emara
293e2ed833 Compositor: Turn Kuwahara node options into inputs
This patch turns the options of the Kuwahara node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137609
2025-04-17 10:23:24 +02:00
Omar Emara
7f02fd3192 Compositor: Turn Pixelate node options into inputs
This patch turns the options of the Pixelate node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137603
2025-04-16 15:34:50 +02:00
Omar Emara
55cc96b556 Compositor: Turn Inpaint node options into inputs
This patch turns the options of the Inpaint node into inputs.

The Distance options were renamed to Size for consistency with other
nodes.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137597
2025-04-16 14:56:00 +02:00
Omar Emara
e361054df4 Compositor: Turn Dilate node options into inputs
This patch turns the options of the Dilate node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137593
2025-04-16 12:50:46 +02:00
Omar Emara
e7778593f8 Compositor: Turn Tone Map node options into inputs
This patch turns the options of the Tone Map node into inputs.

In the process, a few changes were made. Input ranges were adjusted to
remove artificial limits. The papers indeed mention those limits, but
they were only mentioned as typical values, not valid ranges.

- The Key option is no longer limited to 1.
- Gamma is no longer limited to a value of 3.
- Intensity is no longer limited to [-8, 8].
- Contrast is no longer limited to [0, 1].

A few renames were done to clarify options and match the reference
papers.

- Offset was renamed to Balance, since it is not really an offset, but
  balances between shadows and highlights. This can be looked up in the
  paper.
- Correction was renamed to Chromatic Adaptation, since it doesn't
  really correct anything.
- Adaptation was renamed to Light Adaptation to distinguish from
  Chromatic Adaptation and now default to global tone mapping, since
  this is more useful by default.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137589
2025-04-16 11:59:04 +02:00
Omar Emara
4940418317 Compositor: Turn Z Combine node options into inputs
This patch turns the options of the Z Combine node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137534
2025-04-15 15:20:02 +02:00
Omar Emara
ab81cd7bbb Compositor: Turn Invert node options into inputs
This patch turns the options of the Invert node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137527
2025-04-15 14:18:04 +02:00
Omar Emara
a4e7028b4c Compositor: Turn Split node options into inputs
This patch turns the options of the Split node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137518
2025-04-15 11:43:20 +02:00
Omar Emara
f71358d281 Compositor: Turn Switch node options into inputs
This patch turns the options of the Switch node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137512
2025-04-15 11:04:20 +02:00
Omar Emara
bc9176e5e1 Compositor: Turn Mask options into inputs
This patch turns the options of the Mask node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137479
2025-04-14 17:00:44 +02:00
Omar Emara
10af6e8ca5 Compositor: Turn Time Curve options into inputs
This patch turns the options of the Time Curve node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137465
2025-04-14 13:03:50 +02:00
Omar Emara
08e73814d7 Compositor: Turn Bokeh Image options into inputs
This patch turns the options of the Bokeh Image node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/137350
2025-04-14 11:26:55 +02:00
Omar Emara
3b43f6ba57 Compositor: Make Rotate Star 45 option an input
This patch converts the Rotate Star 45 option in the Glare node into an
exposed input, with code to handle backward and forward compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/137140
2025-04-11 16:51:03 +02:00
Habib Gahbiche
51c2cf2b9d Fix #137268: CTRL+Shift clicking creates additional Material Outputs
Only geometry nodes is allowed to have no active output (the group output node acts as an explicit node tree output). The previous fix only considered geometry nodes and compositor cases, which was not enough.

Pull Request: https://projects.blender.org/blender/blender/pulls/137288
2025-04-11 10:04:56 +02:00
Jacques Lucke
b92fdff697 Refactor: BLI: use FunctionRef in BLI_uniquename api
This simplifies the API usage, removes the need for intermediate structs
and reduces the overall amount of code.

Pull Request: https://projects.blender.org/blender/blender/pulls/137300
2025-04-10 20:30:45 +02:00
Jacques Lucke
8ec9c62d3e Geometry Nodes: add Closures and Bundles behind experimental feature flag
This implements bundles and closures which are described in more detail in this
blog post: https://code.blender.org/2024/11/geometry-nodes-workshop-october-2024/

tl;dr:
* Bundles are containers that allow storing multiple socket values in a single
  value. Each value in the bundle is identified by a name. Bundles can be
  nested.
* Closures are functions that are created with the Closure Zone and can be
  evaluated with the Evaluate Closure node.

To use the patch, the `Bundle and Closure Nodes` experimental feature has to be
enabled. This is necessary, because these features are not fully done yet and
still need iterations to improve the workflow before they can be officially
released. These iterations are easier to do in `main` than in a separate branch
though. That's because this patch is quite large and somewhat prone to merge
conflicts. Also other work we want to do, depends on this.

This adds the following new nodes:
* Combine Bundle: can pack multiple values into one.
* Separate Bundle: extracts values from a bundle.
* Closure Zone: outputs a closure zone for use in the `Evaluate Closure` node.
* Evaluate Closure: evaluates the passed in closure.

Things that will be added soon after this lands:
* Fields in bundles and closures. The way this is done changes with #134811, so
  I rather implement this once both are in `main`.
* UI features for keeping sockets in sync (right now there are warnings only).

One bigger issue is the limited support for lazyness. For example, all inputs of
a Combine Bundle node will be evaluated, even if they are not all needed. The
same is true for all captured values of a closure. This is a deeper limitation
that needs to be resolved at some point. This will likely be done after an
initial version of this patch is done.

Pull Request: https://projects.blender.org/blender/blender/pulls/128340
2025-04-03 15:44:06 +02:00
Habib Gahbiche
a4c8a1235b Fix 136825: Can't deactivate Geometry Nodes viewer
Unlike the compositor, geometry nodes is allowed to have no active viewers in the node tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/136874
2025-04-02 10:38:36 +02:00
Omar Emara
79743b68a8 UI: Use a red alert theme color for unsupported nodes
Undefined nodes are currently drawn using a red alert theme color to
make it easier to spot them and replace them. On the other hand, nodes
that are unsupported, that is, nodes whose poll method fail, are not
reported to the user in any way. So this patch also uses the same red
alert color for unsupported nodes.

The node_type_is_undefined function is moved to the draw file since it
seems to be specific to it and not used anywhere else.

Pull Request: https://projects.blender.org/blender/blender/pulls/136451
2025-03-25 09:25:17 +01:00
Jacques Lucke
16dcc33cb8 Fix: Nodes: update supported node types check for dynamic legacy types
Newer nodes may not have a fixed `legacy_type`. This was not accounted for
correctly when reading nodes. Such newer nodes are exclusively identified by their idname.

Fortunately, Blender 4.4 was released without any new nodes that don't have
a fixed `legacy_type`. So this does not have to be backported.

Pull Request: https://projects.blender.org/blender/blender/pulls/136431
2025-03-24 17:54:08 +01:00