Since a year and a half ago we've been switching to a new way to represent what sockets a node should have called "declarations" that's easier to use, clearer, and more flexible for upcoming features like dynamic socket counts or generic type sockets. All builtin nodes with a static set of sockets have switched, but one missing area has been group nodes and group input/output nodes. These nodes have **dynamic** declarations which change based on their properties or the group they're inside of. This patch addresses that, in preparation for using the same dynamic declaration feature for simulation nodes. Generally there shouldn't be user-visible differences, but one benefit is that user-created socket descriptions are now visible directly in the node editor for group nodes and group input/output nodes. The commit contains a few changes: - Add a node type callback for building dynamic declarations with different arguments - Add an `Extend` socket declaration for the "virtual" sockets used for connecting new links - A similar `Custom` socket declaration is used for addon-defined socket - Simplify the node update loop to use the declaration to build update sockets - Replace the "group update" functions with the declaration building - Move the node group input/output link creation to link drag operator - Make the field status part of group node declarations (not for group input/output nodes though) - Some fixes for declarations to make them update and build properly Differential Revision: https://developer.blender.org/D16850
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2007 Blender Foundation. All rights reserved. */
|
|
|
|
/** \file
|
|
* \ingroup nodes
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "DNA_listBase.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
#include "BKE_node.h"
|
|
|
|
#include "RNA_types.h"
|
|
|
|
struct bNode;
|
|
struct bNodeTree;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree,
|
|
struct bNode *node,
|
|
struct bNodeSocketTemplate *stemp,
|
|
eNodeSocketInOut in_out);
|
|
|
|
void node_verify_sockets(struct bNodeTree *ntree, struct bNode *node, bool do_id_user);
|
|
|
|
void node_socket_init_default_value(struct bNodeSocket *sock);
|
|
void node_socket_copy_default_value(struct bNodeSocket *to, const struct bNodeSocket *from);
|
|
void register_standard_node_socket_types(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
|
|
namespace blender::nodes {
|
|
|
|
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node);
|
|
|
|
} // namespace blender::nodes
|
|
|
|
#endif
|