57 if (socket->identifier == identifier) {
80 label, (node->id) ? node->id->name + 2 :
IFACE_(
"Missing Data-Block"), label_maxncpy);
124 const char **r_disabled_hint)
126 if (!node->typeinfo->poll(node->typeinfo, nodetree, r_disabled_hint)) {
142 if (group->id.asset_data) {
143 if (group->id.asset_data->description) {
147 if (!group->description) {
150 return group->description;
155 const char **r_disabled_hint)
160 if (grouptree ==
nullptr) {
164 if (nodetree == grouptree) {
165 if (r_disabled_hint) {
166 *r_disabled_hint =
RPT_(
"Nesting a node group inside of itself is not allowed");
170 if (nodetree->
type != grouptree->
type) {
171 if (r_disabled_hint) {
172 *r_disabled_hint =
RPT_(
"Node group has different type");
177 for (
const bNode *node : grouptree->all_nodes()) {
178 if (node->typeinfo->poll_instance &&
179 !node->typeinfo->poll_instance(node, nodetree, r_disabled_hint))
192 const int item_index = tree_interface.find_item_index(io_socket.
item);
197 if (node.id ==
nullptr) {
200 if (
GS(node.id->name) !=
ID_NT) {
214static std::function<void(
bNode &node,
bNodeSocket &socket,
const char *data_path)>
217 const int item_index = interface.find_item_index(io_socket.
item);
222 if (node.id ==
nullptr) {
225 if (
GS(node.id->name) !=
ID_NT) {
259 std::unique_ptr<decl::Float> decl = std::make_unique<decl::Float>();
261 decl->default_value = value.value;
262 decl->soft_min_value = value.min;
263 decl->soft_max_value = value.max;
264 dst = std::move(decl);
269 std::unique_ptr<decl::Vector> decl = std::make_unique<decl::Vector>();
271 decl->default_value = value.value;
272 decl->soft_min_value = value.min;
273 decl->soft_max_value = value.max;
274 dst = std::move(decl);
279 std::unique_ptr<decl::Color> decl = std::make_unique<decl::Color>();
280 decl->default_value = value.value;
281 dst = std::move(decl);
285 std::unique_ptr<decl::Shader> decl = std::make_unique<decl::Shader>();
286 dst = std::move(decl);
291 std::unique_ptr<decl::Bool> decl = std::make_unique<decl::Bool>();
292 decl->default_value = value.value;
293 dst = std::move(decl);
299 std::unique_ptr<decl::Rotation> decl = std::make_unique<decl::Rotation>();
301 dst = std::move(decl);
305 std::unique_ptr<decl::Matrix> decl = std::make_unique<decl::Matrix>();
306 dst = std::move(decl);
311 std::unique_ptr<decl::Int> decl = std::make_unique<decl::Int>();
313 decl->default_value = value.value;
314 decl->soft_min_value = value.min;
315 decl->soft_max_value = value.max;
316 dst = std::move(decl);
321 std::unique_ptr<decl::String> decl = std::make_unique<decl::String>();
322 decl->default_value = value.value;
324 dst = std::move(decl);
329 std::unique_ptr<decl::Menu> decl = std::make_unique<decl::Menu>();
330 decl->default_value = value.value;
331 dst = std::move(decl);
335 auto value = std::make_unique<decl::Object>();
337 dst = std::move(value);
341 auto value = std::make_unique<decl::Image>();
343 dst = std::move(value);
347 dst = std::make_unique<decl::Geometry>();
350 auto value = std::make_unique<decl::Collection>();
352 dst = std::move(value);
356 auto value = std::make_unique<decl::Texture>();
358 dst = std::move(value);
362 auto value = std::make_unique<decl::Material>();
364 dst = std::move(value);
368 auto value = std::make_unique<decl::Custom>();
371 dst = std::move(value);
377 auto value = std::make_unique<decl::Custom>();
380 dst = std::move(value);
382 dst->name = io_socket.
name ? io_socket.
name :
"";
384 dst->in_out = in_out;
385 dst->socket_type = datatype;
396 int num_child_decls = 0;
399 case NODE_INTERFACE_PANEL:
402 case NODE_INTERFACE_SOCKET:
403 const bNodeTreeInterfaceSocket &socket =
404 reinterpret_cast<const bNodeTreeInterfaceSocket &>(item);
405 if (socket.flag & NODE_INTERFACE_SOCKET_INPUT) {
415 return num_child_decls;
427 dst->name = io_panel.
name ? io_panel.
name :
"";
439 implicit_field_inputs::normal);
444 implicit_field_inputs::position);
451 implicit_field_inputs::index);
456 implicit_field_inputs::id_or_index);
462 implicit_field_inputs::instance_transform);
469 const bNode *node =
b.node_or_null();
470 if (node ==
nullptr) {
502 r_declaration.
outputs.append(output_decl.get());
503 r_declaration.
items.
append(std::move(output_decl));
506 r_declaration.
inputs.append(input_decl.get());
524 group->ensure_interface_cache();
527 *group->runtime->field_inferencing_interface;
528 for (
const int i : inputs.index_range()) {
534 for (
const int i : r_declaration.
outputs.index_range()) {
535 r_declaration.
outputs[i]->output_field_dependency = field_interface.
outputs[i];
550 NodeFrame *data = MEM_cnew<NodeFrame>(
"frame node storage");
551 node->storage =
data;
555 data->label_size = 20;
582 const bNode *node =
b.node_or_null();
583 if (node ==
nullptr) {
595 NodeReroute *data = MEM_cnew<NodeReroute>(__func__);
596 STRNCPY(data->type_idname,
"NodeSocketColor");
597 node->storage =
data;
622 nodes_to_check.
push(link->tonode);
625 nodes_to_check.
push(link->fromnode);
629 while (!nodes_to_check.
is_empty()) {
630 bNode *reroute_node = nodes_to_check.
pop();
632 if (r_reroute_types.
add(reroute_node, current_type)) {
635 nodes_to_check.
push(link->fromnode);
640 nodes_to_check.
push(link->tonode);
655 if (link->fromsock ==
nullptr || link->tosock ==
nullptr) {
662 nodes_linked_with_reroutes.
add(link->fromnode);
665 nodes_linked_with_reroutes.
add(link->tonode);
667 links_map.
add(link->fromsock, link);
668 links_map.
add(link->tosock, link);
675 for (
bNode *start_node : nodes_linked_with_reroutes) {
683 for (
bNode *start_node : nodes_linked_with_reroutes) {
690 for (
const auto item : reroute_types.
items()) {
691 bNode *reroute_node = item.key;
701 ntree->ensure_topology_cache();
703 for (
const bNodeSocket *socket : node->output_sockets()) {
704 for (
const bNodeLink *link : socket->directly_linked_links()) {
705 nodes_to_check.
push(link->tonode);
708 while (!nodes_to_check.
is_empty()) {
709 const bNode *next_node = nodes_to_check.
pop();
710 for (
const bNodeSocket *socket : next_node->output_sockets()) {
711 for (
const bNodeLink *link : socket->directly_linked_links()) {
717 nodes_to_check.
push(link->tonode);
734 if (
STREQ(sock->identifier, identifier)) {
752 case NODE_INTERFACE_SOCKET: {
753 const bNodeTreeInterfaceSocket &socket =
754 node_interface::get_item_as<bNodeTreeInterfaceSocket>(item);
755 if (socket.flag & NODE_INTERFACE_SOCKET_INPUT) {
756 SocketDeclarationPtr socket_decl = declaration_for_interface_socket(
757 *node_tree, socket, SOCK_OUT);
758 r_declaration.outputs.append(socket_decl.get());
759 r_declaration.items.append(std::move(socket_decl));
767 r_declaration.outputs.append(extend_decl.get());
768 r_declaration.items.append(std::move(extend_decl));
780 case NODE_INTERFACE_SOCKET: {
781 const bNodeTreeInterfaceSocket &socket =
782 node_interface::get_item_as<bNodeTreeInterfaceSocket>(item);
783 if (socket.flag & NODE_INTERFACE_SOCKET_OUTPUT) {
784 SocketDeclarationPtr socket_decl = declaration_for_interface_socket(
785 *node_tree, socket, SOCK_IN);
786 r_declaration.inputs.append(socket_decl.get());
787 r_declaration.items.append(std::move(socket_decl));
794 SocketDeclarationPtr extend_decl = decl::create_extend_declaration(
SOCK_IN);
795 r_declaration.inputs.append(extend_decl.get());
796 r_declaration.items.append(std::move(extend_decl));
860 if (
STREQ(sock->identifier, identifier)) {
#define NODE_CLASS_OUTPUT
#define NODE_CLASS_INTERFACE
#define NODE_CLASS_CONVERTER
#define NODE_CLASS_GEOMETRY
#define NODE_GROUP_OUTPUT
#define NODE_CLASS_DISTORT
#define NODE_CLASS_OP_VECTOR
#define NODE_CLASS_LAYOUT
#define NODE_CLASS_OP_COLOR
#define NODE_CLASS_OP_FILTER
#define NODE_CLASS_ATTRIBUTE
#define NODE_CLASS_TEXTURE
#define NODE_CLASS_SHADER
#define NODE_CLASS_SCRIPT
#define LISTBASE_FOREACH(type, var, list)
#define STRNCPY(dst, src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define ID_IS_LINKED(_id)
@ NODE_INTERFACE_PANEL_DEFAULT_CLOSED
@ NODE_INTERFACE_SOCKET_OUTPUT
@ NODE_INTERFACE_SOCKET_INPUT
@ NODE_INTERFACE_SOCKET_COMPACT
@ NODE_INTERFACE_SOCKET_HIDE_VALUE
@ GEO_NODE_DEFAULT_FIELD_INPUT_POSITION_FIELD
@ GEO_NODE_DEFAULT_FIELD_INPUT_NORMAL_FIELD
@ GEO_NODE_DEFAULT_FIELD_INPUT_ID_INDEX_FIELD
@ GEO_NODE_DEFAULT_FIELD_INPUT_INDEX_FIELD
Read Guarded memory(de)allocation.
bool add(const Key &key, const Value &value)
ItemIterator items() const
Span< Value > lookup(const Key &key) const
void add(const Key &key, const Value &value)
void push(const T &value)
constexpr bool startswith(StringRef prefix) const
constexpr const char * c_str() const
void append(const T &value)
bool skip_updating_sockets
Vector< ItemDeclarationPtr > items
Vector< SocketDeclaration * > inputs
Vector< SocketDeclaration * > outputs
bool use_custom_socket_order
eNodeSocketDatatype socket_type
std::unique_ptr< ImplicitInputValueFn > implicit_input_fn
InputSocketFieldType input_field_type
local_group_size(16, 16) .push_constant(Type b
void MEM_freeN(void *vmemh)
T & get_item_as(bNodeTreeInterfaceItem &item)
T & get_socket_data_as(bNodeTreeInterfaceSocket &item)
bNodeTreeInterfaceSocket * add_interface_socket_from_node(bNodeTree &ntree, const bNode &from_node, const bNodeSocket &from_sock, const StringRef socket_type, const StringRef name)
bool node_is_connected_to_output(const bNodeTree *ntree, const bNode *node)
bool node_group_poll(const bNodeTree *nodetree, const bNodeTree *grouptree, const char **r_disabled_hint)
bNodeSocketType * node_socket_type_find(const char *idname)
void node_type_size(bNodeType *ntype, int width, int minwidth, int maxwidth)
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
void node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
EulerXYZBase< float > EulerXYZ
SocketDeclarationPtr create_extend_declaration(const eNodeSocketInOut in_out)
static void group_input_declare(NodeDeclarationBuilder &b)
static std::function< ID *(const bNode &node)> get_default_id_getter(const bNodeTreeInterface &tree_interface, const bNodeTreeInterfaceSocket &io_socket)
std::unique_ptr< SocketDeclaration > SocketDeclarationPtr
static bool group_input_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
static int count_panel_declaration_children(const bNodeTreeInterfacePanel &io_panel)
static SocketDeclarationPtr declaration_for_interface_socket(const bNodeTree &ntree, const bNodeTreeInterfaceSocket &io_socket, const eNodeSocketInOut in_out)
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node)
static std::function< void(bNode &node, bNodeSocket &socket, const char *data_path)> get_init_socket_fn(const bNodeTreeInterface &interface, const bNodeTreeInterfaceSocket &io_socket)
void node_group_declare(NodeDeclarationBuilder &b)
std::unique_ptr< PanelDeclaration > PanelDeclarationPtr
static void group_output_declare(NodeDeclarationBuilder &b)
static PanelDeclarationPtr declaration_for_interface_panel(const bNodeTree &, const bNodeTreeInterfacePanel &io_panel)
static bool group_output_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
static void set_default_input_field(const bNodeTreeInterfaceSocket &input, SocketDeclaration &decl)
VecBase< float, 3 > float3
bNodeSocket * node_group_input_find_socket(bNode *node, const char *identifier)
static bNodeSocket * find_matching_socket(ListBase &sockets, StringRef identifier)
int node_group_ui_class(const bNode *node)
static void propagate_reroute_type_from_start_socket(bNodeSocket *start_socket, const MultiValueMap< bNodeSocket *, bNodeLink * > &links_map, Map< bNode *, const blender::bke::bNodeSocketType * > &r_reroute_types)
void register_node_type_group_output()
void node_group_label(const bNodeTree *, const bNode *node, char *label, int label_maxncpy)
void register_node_type_group_input()
void ntree_update_reroute_nodes(bNodeTree *ntree)
static void node_frame_init(bNodeTree *, bNode *node)
bool node_group_poll_instance(const bNode *node, const bNodeTree *nodetree, const char **r_disabled_hint)
static void node_reroute_init(bNodeTree *, bNode *node)
void register_node_type_frame()
bNodeSocket * node_group_find_output_socket(bNode *groupnode, const char *identifier)
bNodeSocket * node_group_output_find_socket(bNode *node, const char *identifier)
static void node_reroute_declare(blender::nodes::NodeDeclarationBuilder &b)
std::string node_group_ui_description(const bNode &node)
bNodeSocket * node_group_find_input_socket(bNode *groupnode, const char *identifier)
void register_node_type_reroute()
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
struct AssetMetaData * asset_data
bNodeSocketTypeHandle * typeinfo
bNodeTreeInterfaceItem item
bNodeTreeInterface tree_interface
void(* interface_init_socket)(ID *id, const bNodeTreeInterfaceSocket *interface_socket, bNode *node, bNodeSocket *socket, const char *data_path)
void(* initfunc)(bNodeTree *ntree, bNode *node)
bool(* insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link)
NodeDeclareFunction declare
void(* free_self)(bNodeType *ntype)
Vector< OutputFieldDependency > outputs
Vector< InputSocketFieldType > inputs