Cleanup: add utility method to get group input nodes
This commit is contained in:
parent
0cd56b7a36
commit
ea7570989d
|
@ -421,6 +421,11 @@ inline const bNode *bNodeTree::group_output_node() const
|
|||
return this->runtime->group_output_node;
|
||||
}
|
||||
|
||||
inline blender::Span<const bNode *> bNodeTree::group_input_nodes() const
|
||||
{
|
||||
return this->nodes_by_type("NodeGroupInput");
|
||||
}
|
||||
|
||||
inline blender::Span<const bNodeSocket *> bNodeTree::all_input_sockets() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
|
|
|
@ -340,7 +340,7 @@ static void determine_group_input_states(
|
|||
}
|
||||
/* Check if group inputs are required to be single values, because they are (indirectly)
|
||||
* connected to some socket that does not support fields. */
|
||||
for (const bNode *node : tree.nodes_by_type("NodeGroupInput")) {
|
||||
for (const bNode *node : tree.group_input_nodes()) {
|
||||
for (const bNodeSocket *output_socket : node->output_sockets().drop_back(1)) {
|
||||
SocketFieldState &state = field_state_by_socket_id[output_socket->index_in_tree()];
|
||||
if (state.requires_single) {
|
||||
|
@ -349,7 +349,7 @@ static void determine_group_input_states(
|
|||
}
|
||||
}
|
||||
/* If an input does not support fields, this should be reflected in all Group Input nodes. */
|
||||
for (const bNode *node : tree.nodes_by_type("NodeGroupInput")) {
|
||||
for (const bNode *node : tree.group_input_nodes()) {
|
||||
for (const bNodeSocket *output_socket : node->output_sockets().drop_back(1)) {
|
||||
SocketFieldState &state = field_state_by_socket_id[output_socket->index_in_tree()];
|
||||
const bool supports_field = new_inferencing_interface.inputs[output_socket->index()] !=
|
||||
|
|
|
@ -634,6 +634,8 @@ typedef struct bNodeTree {
|
|||
bool has_undefined_nodes_or_sockets() const;
|
||||
/** Get the active group output node. */
|
||||
const bNode *group_output_node() const;
|
||||
/** Get all input nodes of the node group. */
|
||||
blender::Span<const bNode *> group_input_nodes() const;
|
||||
#endif
|
||||
} bNodeTree;
|
||||
|
||||
|
|
|
@ -1401,7 +1401,7 @@ static void attribute_search_update_fn(
|
|||
}
|
||||
}
|
||||
else {
|
||||
for (const bNode *node : nmd->node_group->nodes_by_type("NodeGroupInput")) {
|
||||
for (const bNode *node : nmd->node_group->group_input_nodes()) {
|
||||
for (const bNodeSocket *socket : node->output_sockets()) {
|
||||
if (socket->type == SOCK_GEOMETRY) {
|
||||
sockets_to_check.append(socket);
|
||||
|
|
|
@ -115,7 +115,7 @@ Vector<DOutputSocket> DInputSocket::get_corresponding_group_input_sockets() cons
|
|||
BLI_assert(child_context != nullptr);
|
||||
|
||||
const bNodeTree &child_tree = child_context->btree();
|
||||
Span<const bNode *> group_input_nodes = child_tree.nodes_by_type("NodeGroupInput");
|
||||
Span<const bNode *> group_input_nodes = child_tree.group_input_nodes();
|
||||
const int socket_index = bsocket_->index();
|
||||
Vector<DOutputSocket> sockets;
|
||||
for (const bNode *group_input_node : group_input_nodes) {
|
||||
|
|
Loading…
Reference in New Issue