Fix: Nodes: handle undefined nodes more gracefully

Found while checking #134193.
This commit is contained in:
Jacques Lucke
2025-02-07 13:26:11 +01:00
parent 3791001b1c
commit 3baac1992a
3 changed files with 14 additions and 0 deletions

View File

@@ -822,6 +822,11 @@ inline bool bNode::is_group_output() const
return this->type_legacy == NODE_GROUP_OUTPUT;
}
inline bool bNode::is_undefined() const
{
return this->typeinfo == &blender::bke::NodeTypeUndefined;
}
inline bool bNode::is_type(const blender::StringRef query_idname) const
{
return this->typeinfo->is_type(query_idname);

View File

@@ -492,6 +492,7 @@ typedef struct bNode {
bool is_group() const;
bool is_group_input() const;
bool is_group_output() const;
bool is_undefined() const;
/**
* Check if the node has the given idname.

View File

@@ -148,6 +148,10 @@ struct SocketUsageInferencer {
if (all_socket_usages_.contains(socket)) {
return;
}
if (socket->owner_node().is_undefined()) {
all_socket_usages_.add_new(socket, false);
return;
}
if (socket->is_input()) {
this->usage_task__input(socket);
}
@@ -481,6 +485,10 @@ struct SocketUsageInferencer {
/* Task is done already. */
return;
}
if (socket->owner_node().is_undefined()) {
all_socket_values_.add_new(socket, nullptr);
return;
}
const CPPType *base_type = socket->typeinfo->base_cpp_type;
if (!base_type) {
/* The socket type is unknown for some reason (maybe a socket type from the future?).*/