Blender  V3.3
node_common.cc File Reference
#include <cstddef>
#include <cstring>
#include "DNA_node_types.h"
#include "BLI_listbase.h"
#include "BLI_map.hh"
#include "BLI_multi_value_map.hh"
#include "BLI_set.hh"
#include "BLI_stack.hh"
#include "BLI_string.h"
#include "BLI_string_ref.hh"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_node.h"
#include "BKE_node_tree_update.h"
#include "RNA_types.h"
#include "MEM_guardedalloc.h"
#include "NOD_common.h"
#include "node_common.h"
#include "node_util.h"

Go to the source code of this file.

Functions

Node Group
static bNodeSocketfind_matching_socket (ListBase &sockets, StringRef identifier)
 
bNodeSocketnode_group_find_input_socket (bNode *groupnode, const char *identifier)
 
bNodeSocketnode_group_find_output_socket (bNode *groupnode, const char *identifier)
 
void node_group_label (const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
 
bool node_group_poll_instance (bNode *node, bNodeTree *nodetree, const char **disabled_hint)
 
bool nodeGroupPoll (bNodeTree *nodetree, bNodeTree *grouptree, const char **r_disabled_hint)
 
static void add_new_socket_from_interface (bNodeTree &node_tree, bNode &node, const bNodeSocket &interface_socket, const eNodeSocketInOut in_out)
 
static void update_socket_to_match_interface (bNodeTree &node_tree, bNode &node, bNodeSocket &socket_to_update, const bNodeSocket &interface_socket)
 
static void group_verify_socket_list (bNodeTree &node_tree, bNode &node, const ListBase &interface_sockets, ListBase &verify_lb, const eNodeSocketInOut in_out, const bool ensure_extend_socket_exists)
 
void node_group_update (struct bNodeTree *ntree, struct bNode *node)
 
Node Frame
static void node_frame_init (bNodeTree *UNUSED(ntree), bNode *node)
 
void register_node_type_frame ()
 
Node Re-Route
static void node_reroute_init (bNodeTree *ntree, bNode *node)
 
void register_node_type_reroute ()
 
static void propagate_reroute_type_from_start_socket (bNodeSocket *start_socket, const MultiValueMap< bNodeSocket *, bNodeLink * > &links_map, Map< bNode *, const bNodeSocketType * > &r_reroute_types)
 
void ntree_update_reroute_nodes (bNodeTree *ntree)
 
static bool node_is_connected_to_output_recursive (bNodeTree *ntree, bNode *node)
 
bool BKE_node_is_connected_to_output (bNodeTree *ntree, bNode *node)
 
void BKE_node_tree_unlink_id (ID *id, struct bNodeTree *ntree)
 
Node #GROUP_INPUT / #GROUP_OUTPUT
static bool is_group_extension_socket (const bNode *node, const bNodeSocket *socket)
 
static void node_group_input_init (bNodeTree *ntree, bNode *node)
 
bNodeSocketnode_group_input_find_socket (bNode *node, const char *identifier)
 
void node_group_input_update (bNodeTree *ntree, bNode *node)
 
void register_node_type_group_input ()
 
static void node_group_output_init (bNodeTree *ntree, bNode *node)
 
bNodeSocketnode_group_output_find_socket (bNode *node, const char *identifier)
 
void node_group_output_update (bNodeTree *ntree, bNode *node)
 
void register_node_type_group_output ()
 

Function Documentation

◆ add_new_socket_from_interface()

static void add_new_socket_from_interface ( bNodeTree node_tree,
bNode node,
const bNodeSocket interface_socket,
const eNodeSocketInOut  in_out 
)
static

◆ BKE_node_is_connected_to_output()

bool BKE_node_is_connected_to_output ( bNodeTree ntree,
bNode node 
)

◆ BKE_node_tree_unlink_id()

void BKE_node_tree_unlink_id ( ID id,
struct bNodeTree ntree 
)

Definition at line 417 of file node_common.cc.

References ListBase::first, node, bNodeTree::nodes, and ntree.

◆ find_matching_socket()

static bNodeSocket* find_matching_socket ( ListBase sockets,
StringRef  identifier 
)
static

◆ group_verify_socket_list()

static void group_verify_socket_list ( bNodeTree node_tree,
bNode node,
const ListBase interface_sockets,
ListBase verify_lb,
const eNodeSocketInOut  in_out,
const bool  ensure_extend_socket_exists 
)
static

Used for group nodes and group input/output nodes to update the list of input or output sockets on a node to match the provided interface. Assumes that verify_lb is the node's matching input or output socket list, depending on whether the node is a group input/output or a group node.

Definition at line 156 of file node_common.cc.

References add_new_socket_from_interface(), BKE_ntree_update_tag_interface(), BLI_addtail(), BLI_listbase_clear(), BLI_remlink(), find_matching_socket(), bNodeSocket::identifier, ListBase::last, LISTBASE_FOREACH, LISTBASE_FOREACH_INDEX, LISTBASE_FOREACH_MUTABLE, node, nodeAddSocket(), nodeRemoveSocket(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), STREQ, and update_socket_to_match_interface().

Referenced by node_group_input_update(), node_group_output_update(), and node_group_update().

◆ is_group_extension_socket()

static bool is_group_extension_socket ( const bNode node,
const bNodeSocket socket 
)
static

◆ node_frame_init()

static void node_frame_init ( bNodeTree UNUSEDntree,
bNode node 
)
static

Definition at line 236 of file node_common.cc.

References data, node, and NODE_FRAME_SHRINK.

Referenced by register_node_type_frame().

◆ node_group_find_input_socket()

bNodeSocket* node_group_find_input_socket ( bNode groupnode,
const char *  identifier 
)

◆ node_group_find_output_socket()

bNodeSocket* node_group_find_output_socket ( bNode groupnode,
const char *  identifier 
)

◆ node_group_input_find_socket()

bNodeSocket* node_group_input_find_socket ( bNode node,
const char *  identifier 
)

◆ node_group_input_init()

static void node_group_input_init ( bNodeTree ntree,
bNode node 
)
static

Definition at line 439 of file node_common.cc.

References node, node_group_input_update(), and ntree.

Referenced by register_node_type_group_input().

◆ node_group_input_update()

void node_group_input_update ( bNodeTree ntree,
bNode node 
)

◆ node_group_label()

void node_group_label ( const bNodeTree UNUSEDntree,
const bNode node,
char *  label,
int  maxlen 
)

◆ node_group_output_find_socket()

bNodeSocket* node_group_output_find_socket ( bNode node,
const char *  identifier 
)

◆ node_group_output_init()

static void node_group_output_init ( bNodeTree ntree,
bNode node 
)
static

Definition at line 531 of file node_common.cc.

References node, node_group_output_update(), and ntree.

Referenced by register_node_type_group_output().

◆ node_group_output_update()

void node_group_output_update ( bNodeTree ntree,
bNode node 
)

◆ node_group_poll_instance()

bool node_group_poll_instance ( bNode node,
bNodeTree nodetree,
const char **  disabled_hint 
)

◆ node_group_update()

void node_group_update ( struct bNodeTree ntree,
struct bNode node 
)

◆ node_is_connected_to_output_recursive()

static bool node_is_connected_to_output_recursive ( bNodeTree ntree,
bNode node 
)
static

◆ node_reroute_init()

static void node_reroute_init ( bNodeTree ntree,
bNode node 
)
static

Definition at line 267 of file node_common.cc.

References node, nodeAddStaticSocket(), ntree, PROP_NONE, SOCK_IN, SOCK_OUT, and SOCK_RGBA.

Referenced by register_node_type_reroute().

◆ nodeGroupPoll()

bool nodeGroupPoll ( bNodeTree nodetree,
bNodeTree grouptree,
const char **  r_disabled_hint 
)

◆ ntree_update_reroute_nodes()

void ntree_update_reroute_nodes ( struct bNodeTree ntree)

◆ propagate_reroute_type_from_start_socket()

static void propagate_reroute_type_from_start_socket ( bNodeSocket start_socket,
const MultiValueMap< bNodeSocket *, bNodeLink * > &  links_map,
Map< bNode *, const bNodeSocketType * > &  r_reroute_types 
)
static

◆ register_node_type_frame()

void register_node_type_frame ( void  )

◆ register_node_type_group_input()

void register_node_type_group_input ( void  )

◆ register_node_type_group_output()

void register_node_type_group_output ( void  )

◆ register_node_type_reroute()

void register_node_type_reroute ( void  )

◆ update_socket_to_match_interface()

static void update_socket_to_match_interface ( bNodeTree node_tree,
bNode node,
bNodeSocket socket_to_update,
const bNodeSocket interface_socket 
)
static