Compositor: Add forward compatibility for removed storage

This patch removes node init functions that currently exist only for
forward compatibility and moves the logic to the forward compatibility
section of node writing. This is to avoid allocating unused data
throughout the 5.x series.

Pull Request: https://projects.blender.org/blender/blender/pulls/140273
This commit is contained in:
Omar Emara
2025-06-13 11:15:51 +02:00
committed by Omar Emara
parent a639f99987
commit b62ef2cdd6
18 changed files with 180 additions and 178 deletions

View File

@@ -756,6 +756,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_BOKEHIMAGE) {
if (!node->storage) {
node->storage = MEM_callocN<NodeBokehImage>(__func__);
}
NodeBokehImage *storage = static_cast<NodeBokehImage *>(node->storage);
write_input_to_property_int("Flaps", storage->flaps);
write_input_to_property_float("Angle", storage->angle);
@@ -770,6 +773,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_MASK) {
if (!node->storage) {
node->storage = MEM_callocN<NodeMask>(__func__);
}
NodeMask *storage = static_cast<NodeMask *>(node->storage);
write_input_to_property_int("Size X", storage->size_x);
write_input_to_property_int("Size Y", storage->size_y);
@@ -843,6 +849,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_ANTIALIASING) {
if (!node->storage) {
node->storage = MEM_callocN<NodeAntiAliasingData>(__func__);
}
NodeAntiAliasingData *storage = static_cast<NodeAntiAliasingData *>(node->storage);
write_input_to_property_float("Threshold", storage->threshold);
write_input_to_property_float("Corner Rounding", storage->corner_rounding);
@@ -853,6 +862,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_VECBLUR) {
if (!node->storage) {
node->storage = MEM_callocN<NodeBlurData>(__func__);
}
NodeBlurData *storage = static_cast<NodeBlurData *>(node->storage);
write_input_to_property_short("Samples", storage->samples);
@@ -868,6 +880,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_CHROMA_MATTE) {
if (!node->storage) {
node->storage = MEM_callocN<NodeChroma>(__func__);
}
NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
write_input_to_property_float("Minimum", storage->t2);
write_input_to_property_float("Maximum", storage->t1);
@@ -875,6 +890,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_COLOR_MATTE) {
if (!node->storage) {
node->storage = MEM_callocN<NodeChroma>(__func__);
}
NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
write_input_to_property_float("Hue", storage->t1);
write_input_to_property_float("Saturation", storage->t2);
@@ -882,6 +900,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_DIFF_MATTE) {
if (!node->storage) {
node->storage = MEM_callocN<NodeChroma>(__func__);
}
NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
write_input_to_property_float("Tolerance", storage->t1);
write_input_to_property_float("Falloff", storage->t2);
@@ -894,6 +915,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_LUMA_MATTE) {
if (!node->storage) {
node->storage = MEM_callocN<NodeChroma>(__func__);
}
NodeChroma *storage = static_cast<NodeChroma *>(node->storage);
write_input_to_property_float("Minimum", storage->t2);
write_input_to_property_float("Maximum", storage->t1);
@@ -945,6 +969,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_COLORCORRECTION) {
if (!node->storage) {
node->storage = MEM_callocN<NodeColorCorrection>(__func__);
}
NodeColorCorrection *storage = static_cast<NodeColorCorrection *>(node->storage);
write_input_to_property_float("Master Saturation", storage->master.saturation);
write_input_to_property_float("Master Contrast", storage->master.contrast);
@@ -981,6 +1008,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_MASK_BOX) {
if (!node->storage) {
node->storage = MEM_callocN<NodeBoxMask>(__func__);
}
NodeBoxMask *storage = static_cast<NodeBoxMask *>(node->storage);
write_input_to_property_float_vector("Position", 0, storage->x);
write_input_to_property_float_vector("Position", 1, storage->y);
@@ -990,6 +1020,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_MASK_ELLIPSE) {
if (!node->storage) {
node->storage = MEM_callocN<NodeEllipseMask>(__func__);
}
NodeEllipseMask *storage = static_cast<NodeEllipseMask *>(node->storage);
write_input_to_property_float_vector("Position", 0, storage->x);
write_input_to_property_float_vector("Position", 1, storage->y);
@@ -999,6 +1032,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_SUNBEAMS) {
if (!node->storage) {
node->storage = MEM_callocN<NodeSunBeams>(__func__);
}
NodeSunBeams *storage = static_cast<NodeSunBeams *>(node->storage);
write_input_to_property_float_vector("Source", 0, storage->source[0]);
write_input_to_property_float_vector("Source", 1, storage->source[1]);
@@ -1006,6 +1042,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_DBLUR) {
if (!node->storage) {
node->storage = MEM_callocN<NodeDBlurData>(__func__);
}
NodeDBlurData *storage = static_cast<NodeDBlurData *>(node->storage);
write_input_to_property_short("Samples", storage->iter);
write_input_to_property_float_vector("Center", 0, storage->center_x);
@@ -1020,6 +1059,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_BILATERALBLUR) {
if (!node->storage) {
node->storage = MEM_callocN<NodeBilateralBlurData>(__func__);
}
NodeBilateralBlurData *storage = static_cast<NodeBilateralBlurData *>(node->storage);
/* The size input is `ceil(iterations + sigma_space)`. */
@@ -1043,6 +1085,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_CROP) {
if (!node->storage) {
node->storage = MEM_callocN<NodeTwoXYs>(__func__);
}
write_input_to_property_bool_int16_flag("Alpha Crop", node->custom1, (1 << 0), true);
NodeTwoXYs *storage = static_cast<NodeTwoXYs *>(node->storage);
@@ -1061,6 +1106,9 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
if (node->type_legacy == CMP_NODE_COLORBALANCE) {
if (!node->storage) {
node->storage = MEM_callocN<NodeColorBalance>(__func__);
}
NodeColorBalance *storage = static_cast<NodeColorBalance *>(node->storage);
{
@@ -1165,6 +1213,83 @@ static void write_compositor_legacy_properties(bNodeTree &node_tree)
}
}
/* The write_compositor_legacy_properties function might have allocated temporary storage for nodes
* whose storage are no longer needed and therefore have no storage name in the node type info.
* Such storage will not get saved due to the missing storage name, so we need to write them
* manually and then free the storage. */
static void write_compositor_legacy_storage(BlendWriter *writer, bNode &node)
{
if (!node.storage) {
return;
}
if (!node.typeinfo->storagename.empty()) {
return;
}
switch (node.type_legacy) {
case CMP_NODE_BOKEHIMAGE:
BLO_write_struct_by_name(writer, "NodeBokehImage", node.storage);
MEM_freeN(static_cast<NodeBokehImage *>(node.storage));
break;
case CMP_NODE_MASK:
BLO_write_struct_by_name(writer, "NodeMask", node.storage);
MEM_freeN(static_cast<NodeMask *>(node.storage));
break;
case CMP_NODE_ANTIALIASING:
BLO_write_struct_by_name(writer, "NodeAntiAliasingData", node.storage);
MEM_freeN(static_cast<NodeAntiAliasingData *>(node.storage));
break;
case CMP_NODE_VECBLUR:
BLO_write_struct_by_name(writer, "NodeBlurData", node.storage);
MEM_freeN(static_cast<NodeBlurData *>(node.storage));
break;
case CMP_NODE_CHROMA_MATTE:
case CMP_NODE_COLOR_MATTE:
case CMP_NODE_DIFF_MATTE:
case CMP_NODE_LUMA_MATTE:
BLO_write_struct_by_name(writer, "NodeChroma", node.storage);
MEM_freeN(static_cast<NodeChroma *>(node.storage));
break;
case CMP_NODE_COLORCORRECTION:
BLO_write_struct_by_name(writer, "NodeColorCorrection", node.storage);
MEM_freeN(static_cast<NodeColorCorrection *>(node.storage));
break;
case CMP_NODE_MASK_BOX:
BLO_write_struct_by_name(writer, "NodeBoxMask", node.storage);
MEM_freeN(static_cast<NodeBoxMask *>(node.storage));
break;
case CMP_NODE_MASK_ELLIPSE:
BLO_write_struct_by_name(writer, "NodeEllipseMask", node.storage);
MEM_freeN(static_cast<NodeEllipseMask *>(node.storage));
break;
case CMP_NODE_SUNBEAMS:
BLO_write_struct_by_name(writer, "NodeSunBeams", node.storage);
MEM_freeN(static_cast<NodeSunBeams *>(node.storage));
break;
case CMP_NODE_DBLUR:
BLO_write_struct_by_name(writer, "NodeDBlurData", node.storage);
MEM_freeN(static_cast<NodeDBlurData *>(node.storage));
break;
case CMP_NODE_BILATERALBLUR:
BLO_write_struct_by_name(writer, "NodeBilateralBlurData", node.storage);
MEM_freeN(static_cast<NodeBilateralBlurData *>(node.storage));
break;
case CMP_NODE_CROP:
BLO_write_struct_by_name(writer, "NodeTwoXYs", node.storage);
MEM_freeN(static_cast<NodeTwoXYs *>(node.storage));
break;
case CMP_NODE_COLORBALANCE:
BLO_write_struct_by_name(writer, "NodeColorBalance", node.storage);
MEM_freeN(static_cast<NodeColorBalance *>(node.storage));
break;
default:
return;
}
node.storage = nullptr;
}
} // namespace forward_compat
static void write_node_socket_default_value(BlendWriter *writer, const bNodeSocket *sock)
@@ -1286,6 +1411,11 @@ static void node_blend_write_storage(BlendWriter *writer, bNodeTree *ntree, bNod
if (!ntype->storagename.empty()) {
BLO_write_struct_by_name(writer, ntype->storagename.c_str(), node->storage);
}
else {
if (!BLO_write_is_undo(writer)) {
forward_compat::write_compositor_legacy_storage(writer, *node);
}
}
if (ntype->blend_write_storage_content) {
ntype->blend_write_storage_content(*ntree, *node, *writer);
return;

View File

@@ -682,6 +682,9 @@ static void do_version_bokeh_image_node_options_to_inputs(bNodeTree *node_tree,
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Color Shift", "Color Shift");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->lensshift;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -820,6 +823,9 @@ static void do_version_mask_node_options_to_inputs(bNodeTree *node_tree, bNode *
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Motion Blur Shutter", "Shutter");
input->default_value_typed<bNodeSocketValueFloat>()->value = node->custom3;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -1488,6 +1494,9 @@ static void do_version_anti_alias_node_options_to_inputs(bNodeTree *node_tree, b
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Corner Rounding", "Corner Rounding");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->corner_rounding;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -1549,6 +1558,9 @@ static void do_version_vector_blur_node_options_to_inputs(bNodeTree *node_tree,
/* Shutter was previously divided by 2. */
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fac * 2.0f;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -1666,6 +1678,9 @@ static void do_version_chroma_matte_node_options_to_inputs(bNodeTree *node_tree,
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Falloff", "Falloff");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->fstrength;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -1729,6 +1744,9 @@ static void do_version_color_matte_node_options_to_inputs(bNodeTree *node_tree,
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Value", "Value");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t3;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -1786,6 +1804,9 @@ static void do_version_difference_matte_node_options_to_inputs(bNodeTree *node_t
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Falloff", "Falloff");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t2;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -1894,6 +1915,9 @@ static void do_version_luminance_matte_node_options_to_inputs(bNodeTree *node_tr
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Maximum", "Maximum");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->t1;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -2560,6 +2584,9 @@ static void do_version_color_correction_node_options_to_inputs(bNodeTree *node_t
*node_tree, *node, SOCK_IN, SOCK_BOOLEAN, PROP_NONE, "Apply On Blue", "Apply On Blue");
input->default_value_typed<bNodeSocketValueBoolean>()->value = bool(node->custom1 & (1 << 2));
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -2755,6 +2782,9 @@ static void do_version_box_mask_node_options_to_inputs(bNodeTree *node_tree, bNo
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Rotation", "Rotation");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->rotation;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -2829,6 +2859,9 @@ static void do_version_ellipse_mask_node_options_to_inputs(bNodeTree *node_tree,
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_ANGLE, "Rotation", "Rotation");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->rotation;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -2897,6 +2930,9 @@ static void do_version_sun_beams_node_options_to_inputs(bNodeTree *node_tree, bN
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_FACTOR, "Length", "Length");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->ray_length;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -2977,6 +3013,9 @@ static void do_version_directional_blur_node_options_to_inputs(bNodeTree *node_t
/* Scale was previously minus 1. */
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->zoom + 1.0f;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -3053,6 +3092,9 @@ static void do_version_bilateral_blur_node_options_to_inputs(bNodeTree *node_tre
/* Threshold was previously multiplied by 3. */
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->sigma_color / 3.0f;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -3780,6 +3822,8 @@ static void do_version_crop_node_options_to_inputs(bNodeTree *node_tree, bNode *
/* If Relative is not enabled or no image is connected, nothing else to do. */
if (!bool(node->custom2) || !image_link) {
MEM_freeN(storage);
node->storage = nullptr;
return;
}
@@ -3890,6 +3934,9 @@ static void do_version_crop_node_options_to_inputs(bNodeTree *node_tree, bNode *
*image_link->fromsock,
*height_relative_to_pixel_node,
*height_image_input);
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */
@@ -4018,6 +4065,9 @@ static void do_version_color_balance_node_options_to_inputs(bNodeTree *node_tree
*node_tree, *node, SOCK_IN, SOCK_FLOAT, PROP_NONE, "Output Tint", "Tint");
input->default_value_typed<bNodeSocketValueFloat>()->value = storage->output_tint;
}
MEM_freeN(storage);
node->storage = nullptr;
}
/* The options were converted into inputs. */

View File

@@ -51,14 +51,6 @@ static void cmp_node_antialiasing_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>("Image");
}
static void node_composit_init_antialiasing(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeAntiAliasingData *data = MEM_callocN<NodeAntiAliasingData>(__func__);
node->storage = data;
}
using namespace blender::compositor;
class AntiAliasingOperation : public NodeOperation {
@@ -120,9 +112,6 @@ static void register_node_type_cmp_antialiasing()
ntype.declare = file_ns::cmp_node_antialiasing_declare;
ntype.flag |= NODE_PREVIEW;
blender::bke::node_type_size(ntype, 170, 140, 200);
ntype.initfunc = file_ns::node_composit_init_antialiasing;
blender::bke::node_type_storage(
ntype, "NodeAntiAliasingData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -43,14 +43,6 @@ static void cmp_node_bilateralblur_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>("Image");
}
static void node_composit_init_bilateralblur(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeBilateralBlurData *nbbd = MEM_callocN<NodeBilateralBlurData>(__func__);
node->storage = nbbd;
}
using namespace blender::compositor;
class BilateralBlurOperation : public NodeOperation {
@@ -187,9 +179,6 @@ static void register_node_type_cmp_bilateralblur()
ntype.enum_name_legacy = "BILATERALBLUR";
ntype.nclass = NODE_CLASS_OP_FILTER;
ntype.declare = file_ns::cmp_node_bilateralblur_declare;
ntype.initfunc = file_ns::node_composit_init_bilateralblur;
blender::bke::node_type_storage(
ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -61,14 +61,6 @@ static void cmp_node_bokehimage_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>("Image");
}
static void node_composit_init_bokehimage(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeBokehImage *data = MEM_callocN<NodeBokehImage>(__func__);
node->storage = data;
}
using namespace blender::compositor;
class BokehImageOperation : public NodeOperation {
@@ -144,9 +136,6 @@ static void register_node_type_cmp_bokehimage()
ntype.nclass = NODE_CLASS_INPUT;
ntype.declare = file_ns::cmp_node_bokehimage_declare;
ntype.flag |= NODE_PREVIEW;
ntype.initfunc = file_ns::node_composit_init_bokehimage;
blender::bke::node_type_storage(
ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -50,14 +50,6 @@ static void cmp_node_boxmask_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>("Mask");
}
static void node_composit_init_boxmask(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeBoxMask *data = MEM_callocN<NodeBoxMask>(__func__);
node->storage = data;
}
static void node_composit_buts_boxmask(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
layout->prop(ptr, "mask_type", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
@@ -295,9 +287,6 @@ static void register_node_type_cmp_boxmask()
ntype.nclass = NODE_CLASS_MATTE;
ntype.declare = file_ns::cmp_node_boxmask_declare;
ntype.draw_buttons = file_ns::node_composit_buts_boxmask;
ntype.initfunc = file_ns::node_composit_init_boxmask;
blender::bke::node_type_storage(
ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -58,14 +58,6 @@ static void cmp_node_chroma_matte_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>("Matte");
}
static void node_composit_init_chroma_matte(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeChroma *c = MEM_callocN<NodeChroma>(__func__);
node->storage = c;
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
@@ -154,9 +146,6 @@ static void register_node_type_cmp_chroma_matte()
ntype.nclass = NODE_CLASS_MATTE;
ntype.declare = file_ns::cmp_node_chroma_matte_declare;
ntype.flag |= NODE_PREVIEW;
ntype.initfunc = file_ns::node_composit_init_chroma_matte;
blender::bke::node_type_storage(
ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;

View File

@@ -59,14 +59,6 @@ static void cmp_node_color_matte_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>("Matte");
}
static void node_composit_init_color_matte(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeChroma *c = MEM_callocN<NodeChroma>(__func__);
node->storage = c;
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
@@ -139,9 +131,6 @@ static void register_node_type_cmp_color_matte()
ntype.nclass = NODE_CLASS_MATTE;
ntype.declare = file_ns::cmp_node_color_matte_declare;
ntype.flag |= NODE_PREVIEW;
ntype.initfunc = file_ns::node_composit_init_color_matte;
blender::bke::node_type_storage(
ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;

View File

@@ -36,8 +36,6 @@
namespace blender::nodes::node_composite_colorbalance_cc {
NODE_STORAGE_FUNCS(NodeColorBalance)
static void cmp_node_colorbalance_declare(NodeDeclarationBuilder &b)
{
b.use_custom_socket_order();
@@ -151,14 +149,6 @@ static void cmp_node_colorbalance_declare(NodeDeclarationBuilder &b)
});
}
static void node_composit_init_colorbalance(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeColorBalance *n = MEM_callocN<NodeColorBalance>(__func__);
node->storage = n;
}
static CMPNodeColorBalanceMethod get_color_balance_method(const bNode &node)
{
return static_cast<CMPNodeColorBalanceMethod>(node.custom1);
@@ -494,9 +484,6 @@ static void register_node_type_cmp_colorbalance()
ntype.nclass = NODE_CLASS_OP_COLOR;
ntype.declare = file_ns::cmp_node_colorbalance_declare;
ntype.updatefunc = file_ns::node_update;
ntype.initfunc = file_ns::node_composit_init_colorbalance;
blender::bke::node_type_storage(
ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage);
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;

View File

@@ -193,14 +193,6 @@ static void cmp_node_colorcorrection_declare(NodeDeclarationBuilder &b)
.description("If true, the correction will be applied on the blue channel");
}
static void node_composit_init_colorcorrection(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeColorCorrection *n = MEM_callocN<NodeColorCorrection>(__func__);
node->storage = n;
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
@@ -419,9 +411,6 @@ static void register_node_type_cmp_colorcorrection()
ntype.enum_name_legacy = "COLORCORRECTION";
ntype.nclass = NODE_CLASS_OP_COLOR;
ntype.declare = file_ns::cmp_node_colorcorrection_declare;
ntype.initfunc = file_ns::node_composit_init_colorcorrection;
blender::bke::node_type_storage(
ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage);
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;

View File

@@ -58,13 +58,6 @@ static void cmp_node_crop_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>("Image");
}
static void node_composit_init_crop(bNodeTree * /*ntree*/, bNode *node)
{
/* Not used, but the data is still allocated for forward compatibility. */
NodeTwoXYs *nxy = MEM_callocN<NodeTwoXYs>(__func__);
node->storage = nxy;
}
using namespace blender::compositor;
class CropOperation : public NodeOperation {
@@ -261,9 +254,6 @@ static void register_node_type_cmp_crop()
ntype.enum_name_legacy = "CROP";
ntype.nclass = NODE_CLASS_DISTORT;
ntype.declare = file_ns::cmp_node_crop_declare;
ntype.initfunc = file_ns::node_composit_init_crop;
blender::bke::node_type_storage(
ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -50,14 +50,6 @@ static void cmp_node_diff_matte_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>("Matte");
}
static void node_composit_init_diff_matte(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeChroma *c = MEM_callocN<NodeChroma>(__func__);
node->storage = c;
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
@@ -111,9 +103,6 @@ static void register_node_type_cmp_diff_matte()
ntype.nclass = NODE_CLASS_MATTE;
ntype.declare = file_ns::cmp_node_diff_matte_declare;
ntype.flag |= NODE_PREVIEW;
ntype.initfunc = file_ns::node_composit_init_diff_matte;
blender::bke::node_type_storage(
ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;

View File

@@ -76,14 +76,6 @@ static void cmp_node_directional_blur_declare(NodeDeclarationBuilder &b)
.compositor_expects_single_value();
}
static void node_composit_init_dblur(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeDBlurData *ndbd = MEM_callocN<NodeDBlurData>(__func__);
node->storage = ndbd;
}
using namespace blender::compositor;
class DirectionalBlurOperation : public NodeOperation {
@@ -317,9 +309,6 @@ static void register_node_type_cmp_dblur()
ntype.enum_name_legacy = "DBLUR";
ntype.nclass = NODE_CLASS_OP_FILTER;
ntype.declare = file_ns::cmp_node_directional_blur_declare;
ntype.initfunc = file_ns::node_composit_init_dblur;
blender::bke::node_type_storage(
ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -49,14 +49,6 @@ static void cmp_node_ellipsemask_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>("Mask");
}
static void node_composit_init_ellipsemask(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeEllipseMask *data = MEM_callocN<NodeEllipseMask>(__func__);
node->storage = data;
}
static void node_composit_buts_ellipsemask(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
layout->prop(ptr, "mask_type", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
@@ -300,9 +292,6 @@ static void register_node_type_cmp_ellipsemask()
ntype.nclass = NODE_CLASS_MATTE;
ntype.declare = file_ns::cmp_node_ellipsemask_declare;
ntype.draw_buttons = file_ns::node_composit_buts_ellipsemask;
ntype.initfunc = file_ns::node_composit_init_ellipsemask;
blender::bke::node_type_storage(
ntype, "NodeEllipseMask", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -47,14 +47,6 @@ static void cmp_node_luma_matte_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>("Matte");
}
static void node_composit_init_luma_matte(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeChroma *c = MEM_callocN<NodeChroma>(__func__);
node->storage = c;
}
using namespace blender::compositor;
static int node_gpu_material(GPUMaterial *material,
@@ -111,9 +103,6 @@ static void register_node_type_cmp_luma_matte()
ntype.nclass = NODE_CLASS_MATTE;
ntype.declare = file_ns::cmp_node_luma_matte_declare;
ntype.flag |= NODE_PREVIEW;
ntype.initfunc = file_ns::node_composit_init_luma_matte;
blender::bke::node_type_storage(
ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
ntype.gpu_fn = file_ns::node_gpu_material;
ntype.build_multi_function = file_ns::node_build_multi_function;

View File

@@ -70,14 +70,6 @@ static void cmp_node_mask_declare(NodeDeclarationBuilder &b)
.compositor_expects_single_value();
}
static void node_composit_init_mask(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeMask *data = MEM_callocN<NodeMask>(__func__);
node->storage = data;
}
static void node_mask_label(const bNodeTree * /*ntree*/,
const bNode *node,
char *label,
@@ -218,13 +210,9 @@ static void register_node_type_cmp_mask()
ntype.nclass = NODE_CLASS_INPUT;
ntype.declare = file_ns::cmp_node_mask_declare;
ntype.updatefunc = file_ns::node_update;
ntype.initfunc = file_ns::node_composit_init_mask;
ntype.labelfunc = file_ns::node_mask_label;
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_type_storage(
ntype, "NodeMask", node_free_standard_storage, node_copy_standard_storage);
blender::bke::node_register_type(ntype);
}
NOD_REGISTER_NODE(register_node_type_cmp_mask)

View File

@@ -48,14 +48,6 @@ static void cmp_node_sunbeams_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>("Image");
}
static void init(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeSunBeams *data = MEM_callocN<NodeSunBeams>(__func__);
node->storage = data;
}
using namespace blender::compositor;
class SunBeamsOperation : public NodeOperation {
@@ -190,9 +182,6 @@ static void register_node_type_cmp_sunbeams()
ntype.enum_name_legacy = "SUNBEAMS";
ntype.nclass = NODE_CLASS_OP_FILTER;
ntype.declare = file_ns::cmp_node_sunbeams_declare;
ntype.initfunc = file_ns::init;
blender::bke::node_type_storage(
ntype, "NodeSunBeams", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);

View File

@@ -60,14 +60,6 @@ static void cmp_node_vec_blur_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>("Image");
}
static void node_composit_init_vecblur(bNodeTree * /*ntree*/, bNode *node)
{
/* All members are deprecated and needn't be set, but the data is still allocated for forward
* compatibility. */
NodeBlurData *nbd = MEM_callocN<NodeBlurData>(__func__);
node->storage = nbd;
}
using namespace blender::compositor;
#define MOTION_BLUR_TILE_SIZE 32
@@ -702,9 +694,6 @@ static void register_node_type_cmp_vecblur()
ntype.enum_name_legacy = "VECBLUR";
ntype.nclass = NODE_CLASS_OP_FILTER;
ntype.declare = file_ns::cmp_node_vec_blur_declare;
ntype.initfunc = file_ns::node_composit_init_vecblur;
blender::bke::node_type_storage(
ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
ntype.get_compositor_operation = file_ns::get_compositor_operation;
blender::bke::node_register_type(ntype);