Fix: Nodes: handle undefined nodes more gracefully
Found while checking #134193.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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?).*/
|
||||
|
||||
Reference in New Issue
Block a user