Cleanup: Nodes: remove stored static sdna type

Since 9fd7a093c9 this id can be derived automatically from the corresponding C++ type.

Pull Request: https://projects.blender.org/blender/blender/pulls/138760
This commit is contained in:
Jacques Lucke
2025-05-12 13:55:09 +02:00
parent 11ceddb9df
commit f7c890e32f
21 changed files with 2 additions and 41 deletions

View File

@@ -14,7 +14,8 @@ template<typename Accessor> inline void blend_write(BlendWriter *writer, const b
{
using ItemT = typename Accessor::ItemT;
const SocketItemsRef<ItemT> items = Accessor::get_items_from_node(const_cast<bNode &>(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<ItemT>(), *items.items_num, *items.items);
for (const ItemT &item : Span(*items.items, *items.items_num)) {
Accessor::blend_write_item(writer, item);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<NodeGeometryAttributeCaptureItem>();
void CaptureAttributeItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -912,7 +912,6 @@ std::unique_ptr<LazyFunction> 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<NodeGeometryBakeItem>();
void BakeItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -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<NodeGeometryClosureInputItem>();
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<NodeGeometryClosureOutputItem>();
void ClosureOutputItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -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<NodeGeometryCombineBundleItem>();
void CombineBundleItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -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<NodeGeometryEvaluateClosureInputItem>();
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<NodeGeometryEvaluateClosureOutputItem>();
void EvaluateClosureOutputItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -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<NodeForeachGeometryElementInputItem>();
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<NodeForeachGeometryElementMainItem>();
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<NodeForeachGeometryElementGenerationItem>();
void ForeachGeometryElementGenerationItemsAccessor::blend_write_item(BlendWriter *writer,
const ItemT &item)

View File

@@ -410,7 +410,6 @@ std::unique_ptr<LazyFunction> 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<IndexSwitchItem>();
void IndexSwitchItemsAccessor::blend_write_item(BlendWriter * /*writer*/, const ItemT & /*item*/)
{

View File

@@ -453,7 +453,6 @@ std::unique_ptr<LazyFunction> 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<NodeEnumItem>();
void MenuSwitchItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -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<NodeRepeatItem>();
void RepeatItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -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<NodeGeometrySeparateBundleItem>();
void SeparateBundleItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{

View File

@@ -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<NodeSimulationItem>();
void SimulationItemsAccessor::blend_write_item(BlendWriter *writer, const ItemT &item)
{