Blender V4.5
blender::nodes::socket_usage_inference Namespace Reference

Classes

struct  SocketUsageInferencer
struct  SocketUsage

Functions

static bool input_may_affect_visibility (const bNodeTreeInterfaceSocket &socket)
static bool input_may_affect_visibility (const bNodeSocket &socket)
Array< SocketUsageinfer_all_input_sockets_usage (const bNodeTree &tree)
void infer_group_interface_inputs_usage (const bNodeTree &group, const Span< GPointer > group_input_values, const MutableSpan< SocketUsage > r_input_usages)
void infer_group_interface_inputs_usage (const bNodeTree &group, Span< const bNodeSocket * > input_sockets, MutableSpan< SocketUsage > r_input_usages)
void infer_group_interface_inputs_usage (const bNodeTree &group, const PropertiesVectorSet &properties, MutableSpan< SocketUsage > r_input_usages)

Function Documentation

◆ infer_all_input_sockets_usage()

Array< SocketUsage > blender::nodes::socket_usage_inference::infer_all_input_sockets_usage ( const bNodeTree & tree)

Get a boolean value for each input socket in the given tree that indicates whether that input is used. It is assumed that all output sockets in the tree are used.

Definition at line 1391 of file socket_usage_inference.cc.

References i, blender::Span< T >::index_range(), blender::nodes::socket_usage_inference::SocketUsageInferencer::is_socket_used(), blender::nodes::socket_usage_inference::SocketUsageInferencer::mark_top_level_node_outputs_as_used(), blender::threading::parallel_for(), blender::Span< T >::size(), and tree.

Referenced by ensure_inference_usage_cache().

◆ infer_group_interface_inputs_usage() [1/3]

void blender::nodes::socket_usage_inference::infer_group_interface_inputs_usage ( const bNodeTree & group,
const PropertiesVectorSet & properties,
MutableSpan< SocketUsage > r_input_usages )

Same as above, but automatically retrieves the input values from the given properties. This is used with the geometry nodes modifier and node tools.

Definition at line 1542 of file socket_usage_inference.cc.

References blender::nodes::get_geometry_nodes_input_base_values(), and infer_group_interface_inputs_usage().

◆ infer_group_interface_inputs_usage() [2/3]

void blender::nodes::socket_usage_inference::infer_group_interface_inputs_usage ( const bNodeTree & group,
Span< GPointer > group_input_values,
MutableSpan< SocketUsage > r_input_usages )

Get a boolean value for each node group input that indicates whether that input is used by the outputs. The result can be used to e.g. gray out or hide individual inputs that are unused.

Parameters
groupThe node group that is called.
group_input_valuesAn optional input value for each node group input. The type is expected to be bNodeSocketType::base_cpp_type. If the input value for a socket is not known or can't be represented as base type, null has to be passed instead.
r_input_usagesThe destination array where the inferred usages are written.

Definition at line 1442 of file socket_usage_inference.cc.

References blender::MutableSpan< T >::begin(), blender::MutableSpan< T >::end(), blender::MutableSpan< T >::fill(), i, infer_group_interface_inputs_usage(), input_may_affect_visibility(), blender::nodes::socket_usage_inference::SocketUsageInferencer::is_group_input_used(), blender::nodes::socket_usage_inference::SocketUsageInferencer::is_socket_used(), blender::nodes::socket_usage_inference::SocketUsage::is_used, blender::nodes::socket_usage_inference::SocketUsage::is_visible, and blender::Span< T >::size().

Referenced by blender::nodes::draw_geometry_nodes_modifier_ui(), blender::nodes::draw_geometry_nodes_operator_redo_ui(), blender::nodes::gizmos::foreach_active_gizmo_exposed_to_modifier(), infer_group_interface_inputs_usage(), infer_group_interface_inputs_usage(), and infer_group_interface_inputs_usage().

◆ infer_group_interface_inputs_usage() [3/3]

void blender::nodes::socket_usage_inference::infer_group_interface_inputs_usage ( const bNodeTree & group,
Span< const bNodeSocket * > input_sockets,
MutableSpan< SocketUsage > r_input_usages )

◆ input_may_affect_visibility() [1/2]

bool blender::nodes::socket_usage_inference::input_may_affect_visibility ( const bNodeSocket & socket)
static

Definition at line 1386 of file socket_usage_inference.cc.

References SOCK_MENU, and bNodeSocket::type.

◆ input_may_affect_visibility() [2/2]

bool blender::nodes::socket_usage_inference::input_may_affect_visibility ( const bNodeTreeInterfaceSocket & socket)
static