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
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
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
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
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
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
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
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
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
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
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
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
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
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