From f7c890e32fa3159112f3e5857cfd5f9028f46c67 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 12 May 2025 13:55:09 +0200 Subject: [PATCH] Cleanup: Nodes: remove stored static sdna type Since 9fd7a093c9de4 this id can be derived automatically from the corresponding C++ type. Pull Request: https://projects.blender.org/blender/blender/pulls/138760 --- source/blender/nodes/NOD_socket_items_blend.hh | 3 ++- source/blender/nodes/geometry/include/NOD_geo_bake.hh | 1 - source/blender/nodes/geometry/include/NOD_geo_bundle.hh | 2 -- .../nodes/geometry/include/NOD_geo_capture_attribute.hh | 1 - source/blender/nodes/geometry/include/NOD_geo_closure.hh | 4 ---- .../geometry/include/NOD_geo_foreach_geometry_element.hh | 3 --- .../blender/nodes/geometry/include/NOD_geo_index_switch.hh | 1 - .../blender/nodes/geometry/include/NOD_geo_menu_switch.hh | 1 - source/blender/nodes/geometry/include/NOD_geo_repeat.hh | 1 - source/blender/nodes/geometry/include/NOD_geo_simulation.hh | 1 - .../nodes/geometry/nodes/node_geo_attribute_capture.cc | 2 -- source/blender/nodes/geometry/nodes/node_geo_bake.cc | 1 - source/blender/nodes/geometry/nodes/node_geo_closure.cc | 4 ---- .../blender/nodes/geometry/nodes/node_geo_combine_bundle.cc | 2 -- .../nodes/geometry/nodes/node_geo_evaluate_closure.cc | 4 ---- .../geometry/nodes/node_geo_foreach_geometry_element.cc | 6 ------ .../blender/nodes/geometry/nodes/node_geo_index_switch.cc | 1 - source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc | 1 - source/blender/nodes/geometry/nodes/node_geo_repeat.cc | 1 - .../nodes/geometry/nodes/node_geo_separate_bundle.cc | 2 -- source/blender/nodes/geometry/nodes/node_geo_simulation.cc | 1 - 21 files changed, 2 insertions(+), 41 deletions(-) diff --git a/source/blender/nodes/NOD_socket_items_blend.hh b/source/blender/nodes/NOD_socket_items_blend.hh index 46bafbe05e1..d50f09d132f 100644 --- a/source/blender/nodes/NOD_socket_items_blend.hh +++ b/source/blender/nodes/NOD_socket_items_blend.hh @@ -14,7 +14,8 @@ template inline void blend_write(BlendWriter *writer, const b { using ItemT = typename Accessor::ItemT; const SocketItemsRef items = Accessor::get_items_from_node(const_cast(node)); - BLO_write_struct_array_by_id(writer, Accessor::item_dna_type, *items.items_num, *items.items); + BLO_write_struct_array_by_id( + writer, dna::sdna_struct_id_get(), *items.items_num, *items.items); for (const ItemT &item : Span(*items.items, *items.items_num)) { Accessor::blend_write_item(writer, item); } diff --git a/source/blender/nodes/geometry/include/NOD_geo_bake.hh b/source/blender/nodes/geometry/include/NOD_geo_bake.hh index fe5f20c0abc..4dd90302e94 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_bake.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_bake.hh @@ -31,7 +31,6 @@ struct BakeItemsAccessor { using ItemT = NodeGeometryBakeItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeBake"; static constexpr bool has_type = true; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/include/NOD_geo_bundle.hh b/source/blender/nodes/geometry/include/NOD_geo_bundle.hh index aed64614e4f..aa8fc16ef1f 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_bundle.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_bundle.hh @@ -34,7 +34,6 @@ struct CombineBundleItemsAccessor { using ItemT = NodeGeometryCombineBundleItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeCombineBundle"; static constexpr bool has_type = true; static constexpr bool has_name = true; @@ -108,7 +107,6 @@ struct SeparateBundleItemsAccessor { using ItemT = NodeGeometrySeparateBundleItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeSeparateBundle"; static constexpr bool has_type = true; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/include/NOD_geo_capture_attribute.hh b/source/blender/nodes/geometry/include/NOD_geo_capture_attribute.hh index dc99b2c562a..50373d5954b 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_capture_attribute.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_capture_attribute.hh @@ -16,7 +16,6 @@ struct CaptureAttributeItemsAccessor { using ItemT = NodeGeometryAttributeCaptureItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeCaptureAttribute"; static constexpr bool has_type = true; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/include/NOD_geo_closure.hh b/source/blender/nodes/geometry/include/NOD_geo_closure.hh index c670d71cc02..5559203f834 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_closure.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_closure.hh @@ -34,7 +34,6 @@ struct ClosureInputItemsAccessor { using ItemT = NodeGeometryClosureInputItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeClosureOutput"; static constexpr bool has_type = true; static constexpr bool has_name = true; @@ -110,7 +109,6 @@ struct ClosureOutputItemsAccessor { using ItemT = NodeGeometryClosureOutputItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeClosureOutput"; static constexpr bool has_type = true; static constexpr bool has_name = true; @@ -186,7 +184,6 @@ struct EvaluateClosureInputItemsAccessor { using ItemT = NodeGeometryEvaluateClosureInputItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeEvaluateClosure"; static constexpr bool has_type = true; static constexpr bool has_name = true; @@ -263,7 +260,6 @@ struct EvaluateClosureOutputItemsAccessor { using ItemT = NodeGeometryEvaluateClosureOutputItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeEvaluateClosure"; static constexpr bool has_type = true; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/include/NOD_geo_foreach_geometry_element.hh b/source/blender/nodes/geometry/include/NOD_geo_foreach_geometry_element.hh index 66e7d9717a0..343e0f3bc53 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_foreach_geometry_element.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_foreach_geometry_element.hh @@ -14,7 +14,6 @@ struct ForeachGeometryElementInputItemsAccessor { using ItemT = NodeForeachGeometryElementInputItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeForeachGeometryElementOutput"; static constexpr bool has_type = true; static constexpr bool has_name = true; @@ -101,7 +100,6 @@ struct ForeachGeometryElementMainItemsAccessor { using ItemT = NodeForeachGeometryElementMainItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeForeachGeometryElementOutput"; static constexpr bool has_type = true; static constexpr bool has_name = true; @@ -187,7 +185,6 @@ struct ForeachGeometryElementGenerationItemsAccessor { using ItemT = NodeForeachGeometryElementGenerationItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeForeachGeometryElementOutput"; static constexpr bool has_type = true; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/include/NOD_geo_index_switch.hh b/source/blender/nodes/geometry/include/NOD_geo_index_switch.hh index 17e949946df..07d9e852975 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_index_switch.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_index_switch.hh @@ -18,7 +18,6 @@ struct IndexSwitchItemsAccessor { using ItemT = IndexSwitchItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeIndexSwitch"; static constexpr bool has_type = false; static constexpr bool has_name = false; diff --git a/source/blender/nodes/geometry/include/NOD_geo_menu_switch.hh b/source/blender/nodes/geometry/include/NOD_geo_menu_switch.hh index afdf639856f..13041ba9e1d 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_menu_switch.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_menu_switch.hh @@ -19,7 +19,6 @@ struct MenuSwitchItemsAccessor { using ItemT = NodeEnumItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeMenuSwitch"; static constexpr bool has_type = false; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/include/NOD_geo_repeat.hh b/source/blender/nodes/geometry/include/NOD_geo_repeat.hh index 7daadab08a2..ba378c963df 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_repeat.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_repeat.hh @@ -18,7 +18,6 @@ struct RepeatItemsAccessor { using ItemT = NodeRepeatItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeRepeatOutput"; static constexpr bool has_type = true; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/include/NOD_geo_simulation.hh b/source/blender/nodes/geometry/include/NOD_geo_simulation.hh index d4a018dd045..9cb69732308 100644 --- a/source/blender/nodes/geometry/include/NOD_geo_simulation.hh +++ b/source/blender/nodes/geometry/include/NOD_geo_simulation.hh @@ -18,7 +18,6 @@ struct SimulationItemsAccessor { using ItemT = NodeSimulationItem; static StructRNA *item_srna; static int node_type; - static int item_dna_type; static constexpr const char *node_idname = "GeometryNodeSimulationOutput"; static constexpr bool has_type = true; static constexpr bool has_name = true; diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc index eac2c120ceb..77ae0bab648 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc @@ -284,8 +284,6 @@ namespace blender::nodes { StructRNA *CaptureAttributeItemsAccessor::item_srna = &RNA_NodeGeometryCaptureAttributeItem; int CaptureAttributeItemsAccessor::node_type = GEO_NODE_CAPTURE_ATTRIBUTE; -int CaptureAttributeItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void CaptureAttributeItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_bake.cc b/source/blender/nodes/geometry/nodes/node_geo_bake.cc index 2a4f72fcffd..c1fab1c034b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_bake.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_bake.cc @@ -912,7 +912,6 @@ std::unique_ptr get_bake_lazy_function( StructRNA *BakeItemsAccessor::item_srna = &RNA_NodeGeometryBakeItem; int BakeItemsAccessor::node_type = GEO_NODE_BAKE; -int BakeItemsAccessor::item_dna_type = dna::sdna_struct_id_get(); void BakeItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_closure.cc b/source/blender/nodes/geometry/nodes/node_geo_closure.cc index e90103acf94..eb9021312c3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_closure.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_closure.cc @@ -301,8 +301,6 @@ namespace blender::nodes { StructRNA *ClosureInputItemsAccessor::item_srna = &RNA_NodeGeometryClosureInputItem; int ClosureInputItemsAccessor::node_type = GEO_NODE_CLOSURE_OUTPUT; -int ClosureInputItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void ClosureInputItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { @@ -316,8 +314,6 @@ void ClosureInputItemsAccessor::blend_read_data_item(BlendDataReader *reader, It StructRNA *ClosureOutputItemsAccessor::item_srna = &RNA_NodeGeometryClosureOutputItem; int ClosureOutputItemsAccessor::node_type = GEO_NODE_CLOSURE_OUTPUT; -int ClosureOutputItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void ClosureOutputItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc b/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc index 7f4267a3538..757dd542110 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_combine_bundle.cc @@ -141,8 +141,6 @@ namespace blender::nodes { StructRNA *CombineBundleItemsAccessor::item_srna = &RNA_NodeGeometryCombineBundleItem; int CombineBundleItemsAccessor::node_type = GEO_NODE_COMBINE_BUNDLE; -int CombineBundleItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void CombineBundleItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc b/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc index 395b11d6dbb..e596596a09d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_evaluate_closure.cc @@ -139,8 +139,6 @@ namespace blender::nodes { StructRNA *EvaluateClosureInputItemsAccessor::item_srna = &RNA_NodeGeometryEvaluateClosureInputItem; int EvaluateClosureInputItemsAccessor::node_type = GEO_NODE_EVALUATE_CLOSURE; -int EvaluateClosureInputItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void EvaluateClosureInputItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { @@ -155,8 +153,6 @@ void EvaluateClosureInputItemsAccessor::blend_read_data_item(BlendDataReader *re StructRNA *EvaluateClosureOutputItemsAccessor::item_srna = &RNA_NodeGeometryEvaluateClosureOutputItem; int EvaluateClosureOutputItemsAccessor::node_type = GEO_NODE_EVALUATE_CLOSURE; -int EvaluateClosureOutputItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void EvaluateClosureOutputItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc b/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc index 29ff45b9fae..ffe28044536 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc @@ -453,8 +453,6 @@ namespace blender::nodes { StructRNA *ForeachGeometryElementInputItemsAccessor::item_srna = &RNA_ForeachGeometryElementInputItem; int ForeachGeometryElementInputItemsAccessor::node_type = GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT; -int ForeachGeometryElementInputItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void ForeachGeometryElementInputItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) @@ -471,8 +469,6 @@ void ForeachGeometryElementInputItemsAccessor::blend_read_data_item(BlendDataRea StructRNA *ForeachGeometryElementMainItemsAccessor::item_srna = &RNA_ForeachGeometryElementMainItem; int ForeachGeometryElementMainItemsAccessor::node_type = GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT; -int ForeachGeometryElementMainItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void ForeachGeometryElementMainItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) @@ -490,8 +486,6 @@ StructRNA *ForeachGeometryElementGenerationItemsAccessor::item_srna = &RNA_ForeachGeometryElementGenerationItem; int ForeachGeometryElementGenerationItemsAccessor::node_type = GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT; -int ForeachGeometryElementGenerationItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void ForeachGeometryElementGenerationItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) diff --git a/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc index 0738459c37f..784125e3792 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc @@ -410,7 +410,6 @@ std::unique_ptr get_index_switch_node_lazy_function( StructRNA *IndexSwitchItemsAccessor::item_srna = &RNA_IndexSwitchItem; int IndexSwitchItemsAccessor::node_type = GEO_NODE_INDEX_SWITCH; -int IndexSwitchItemsAccessor::item_dna_type = dna::sdna_struct_id_get(); void IndexSwitchItemsAccessor::blend_write_item(BlendWriter * /*writer*/, const ItemT & /*item*/) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc index b989278d371..d0d67ecf820 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_menu_switch.cc @@ -453,7 +453,6 @@ std::unique_ptr get_menu_switch_node_socket_usage_lazy_function(co StructRNA *MenuSwitchItemsAccessor::item_srna = &RNA_NodeEnumItem; int MenuSwitchItemsAccessor::node_type = GEO_NODE_MENU_SWITCH; -int MenuSwitchItemsAccessor::item_dna_type = dna::sdna_struct_id_get(); void MenuSwitchItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc index fc2cbbd48c9..1f4284e87b1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_repeat.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_repeat.cc @@ -284,7 +284,6 @@ namespace blender::nodes { StructRNA *RepeatItemsAccessor::item_srna = &RNA_RepeatItem; int RepeatItemsAccessor::node_type = GEO_NODE_REPEAT_OUTPUT; -int RepeatItemsAccessor::item_dna_type = dna::sdna_struct_id_get(); void RepeatItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc b/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc index 16060e370d7..3c402702f97 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_separate_bundle.cc @@ -158,8 +158,6 @@ namespace blender::nodes { StructRNA *SeparateBundleItemsAccessor::item_srna = &RNA_NodeGeometrySeparateBundleItem; int SeparateBundleItemsAccessor::node_type = GEO_NODE_SEPARATE_BUNDLE; -int SeparateBundleItemsAccessor::item_dna_type = - dna::sdna_struct_id_get(); void SeparateBundleItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation.cc index a20f7e2ef9e..8717a3a244b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation.cc @@ -980,7 +980,6 @@ void mix_baked_data_item(const eNodeSocketDatatype socket_type, StructRNA *SimulationItemsAccessor::item_srna = &RNA_SimulationStateItem; int SimulationItemsAccessor::node_type = GEO_NODE_SIMULATION_OUTPUT; -int SimulationItemsAccessor::item_dna_type = dna::sdna_struct_id_get(); void SimulationItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item) {