Cleanup: Nodes: use utility method to check if node is undefined

This commit is contained in:
Jacques Lucke
2025-02-07 13:40:26 +01:00
parent fa912845ac
commit 190ba72acf
4 changed files with 5 additions and 5 deletions

View File

@@ -863,7 +863,7 @@ void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
BLO_write_struct(writer, NodeGeometryAttributeCapture, node->storage);
nodes::socket_items::blend_write<nodes::CaptureAttributeItemsAccessor>(writer, *node);
}
else if (node->typeinfo != &NodeTypeUndefined) {
else if (!node->is_undefined()) {
BLO_write_struct_by_name(writer, node->typeinfo->storagename.c_str(), node->storage);
}
}

View File

@@ -35,7 +35,7 @@ static void update_node_vector(const bNodeTree &ntree)
bNode &node = *nodes[i];
node.runtime->index_in_tree = i;
node.runtime->owner_tree = const_cast<bNodeTree *>(&ntree);
tree_runtime.has_undefined_nodes_or_sockets |= node.typeinfo == &bke::NodeTypeUndefined;
tree_runtime.has_undefined_nodes_or_sockets |= node.is_undefined();
if (node.is_group()) {
tree_runtime.group_nodes.append(&node);
}

View File

@@ -51,7 +51,7 @@ static InputSocketFieldType get_interface_input_field_type(const bNode &node,
/* Outputs always support fields when the data type is correct. */
return InputSocketFieldType::IsSupported;
}
if (node.typeinfo == &blender::bke::NodeTypeUndefined) {
if (node.is_undefined()) {
return InputSocketFieldType::None;
}
if (node.type_legacy == NODE_CUSTOM) {
@@ -85,7 +85,7 @@ static OutputFieldDependency get_interface_output_field_dependency(const bNode &
/* Input nodes get special treatment in #determine_group_input_states. */
return OutputFieldDependency::ForDependentField();
}
if (node.typeinfo == &blender::bke::NodeTypeUndefined) {
if (node.is_undefined()) {
return OutputFieldDependency::ForDataSource();
}
if (node.type_legacy == NODE_CUSTOM) {

View File

@@ -2796,7 +2796,7 @@ struct GeometryNodesLazyFunctionBuilder {
this->build_multi_function_node(bnode, fn_item, graph_params);
break;
}
if (node_type == &bke::NodeTypeUndefined) {
if (bnode.is_undefined()) {
this->build_undefined_node(bnode, graph_params);
break;
}