From 976efdcac9cff85c5a44b36453e4b1ececf39802 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Mon, 16 Jun 2025 08:07:21 +0200 Subject: [PATCH] Compositor: Remove storage of Alpha Over node This patch removes the storage of the Alpha Over node, since it is no longer used. This is a continuation of b62ef2cdd6. Pull Request: https://projects.blender.org/blender/blender/pulls/140359 --- source/blender/blenloader/intern/versioning_450.cc | 8 ++++++++ source/blender/makesrna/intern/rna_nodetree.cc | 4 +--- .../nodes/composite/nodes/node_composite_alpha_over.cc | 9 --------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_450.cc b/source/blender/blenloader/intern/versioning_450.cc index 0b64aec3a7b..254ddac0444 100644 --- a/source/blender/blenloader/intern/versioning_450.cc +++ b/source/blender/blenloader/intern/versioning_450.cc @@ -3391,6 +3391,14 @@ static void do_version_alpha_over_remove_premultiply(bNodeTree *node_tree) blender::bke::node_remove_link(node_tree, *link); } + + LISTBASE_FOREACH (bNode *, node, &node_tree->nodes) { + if (node->type_legacy == CMP_NODE_ALPHAOVER) { + NodeTwoFloats *storage = static_cast(node->storage); + MEM_freeN(storage); + node->storage = nullptr; + } + } } /* The options were converted into inputs. */ diff --git a/source/blender/makesrna/intern/rna_nodetree.cc b/source/blender/makesrna/intern/rna_nodetree.cc index c123eaa1e69..7d3658090a2 100644 --- a/source/blender/makesrna/intern/rna_nodetree.cc +++ b/source/blender/makesrna/intern/rna_nodetree.cc @@ -7417,10 +7417,8 @@ static void def_cmp_alpha_over(BlenderRNA * /*brna*/, StructRNA *srna) prop, "Convert Premultiplied", "(Deprecated: Use Straight Alpha input instead.)"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); - RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage"); - prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_float_sdna(prop, nullptr, "x"); + RNA_def_property_float_sdna(prop, nullptr, "custom3"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Premultiplied", "Mix Factor. (Deprecated: Unused.)"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); diff --git a/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc b/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc index e1c56c64a5c..dd6cfafe045 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alpha_over.cc @@ -48,12 +48,6 @@ static void cmp_node_alphaover_declare(NodeDeclarationBuilder &b) b.add_output("Image"); } -static void node_alphaover_init(bNodeTree * /*ntree*/, bNode *node) -{ - /* Not used, but the data is still allocated for forward compatibility. */ - node->storage = MEM_callocN(__func__); -} - using namespace blender::compositor; static int node_gpu_material(GPUMaterial *material, @@ -109,9 +103,6 @@ static void register_node_type_cmp_alphaover() ntype.enum_name_legacy = "ALPHAOVER"; ntype.nclass = NODE_CLASS_OP_COLOR; ntype.declare = file_ns::cmp_node_alphaover_declare; - ntype.initfunc = file_ns::node_alphaover_init; - blender::bke::node_type_storage( - ntype, "NodeTwoFloats", 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;