This patch turns the options of the Color Balance node into inputs.
In the process, each of the wheels were split into two inputs, a base
float and a color. For instance, Gain is controlled using both a Base
Gain and Color Gain, the former controls the gain for all channels while
the latter controls it per channel.
Reference #137223.
Pull Request: https://projects.blender.org/blender/blender/pulls/138610
Use a similar convention for struct member identifiers,
(the identifiers without surrounding spaces). This allows the values
to be scanned and validated.
For default values, the fairly complex reasoning for the code is explained
in details in comments. The TL;DR: would be that this code is needed to
safely load blendfiles older than 2.83, which were saved without any DNA
type information for these default value data.
Storage data have always been written with DNA info (added in commits
3bae60d0c9 and 9d91bc38d3), so no need to add special handling for them.
Just use regular DNA struct reading.
Pull Request: https://projects.blender.org/blender/blender/pulls/139175
This patch turns the options of the Crop node into inputs.
Instead of specifying the bounds of the crop, the inputs now specify the
Width and Height of the crop region. The Crop Image Size option was
renamed to Alpha Crop and inverted, so it now defaults to actual
cropping. The Relative option was removed, as it is now superseded by
the Relative To Pixel node, and removal was done to facilitate the
options to inputs project.
Reference #137223.
Pull Request: https://projects.blender.org/blender/blender/pulls/139163
This patch adds support for the Factor and Percentage subtypes for
vector sockets. This is needed by the compositor, since it has some node
inputs that specify locations and sizes relative to image size, and
having factor and percentage subtypes for those improves the UX quite a
bit according to user feedback.
Pull Request: https://projects.blender.org/blender/blender/pulls/138805
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