58 switch (stemp->
type) {
141 if (stemp_first ==
nullptr) {
143 nextsock = sock->
next;
150 while (stemp->
type != -1) {
156 nextsock = sock->
next;
162 if (socklist->
first) {
166 while (stemp->
type != -1) {
173 while (stemp->
type != -1) {
188 const bool hide_new_sockets)
191 bNodeSocket *old_socket_with_same_identifier =
nullptr;
196 old_socket_with_same_identifier = &old_socket;
201 if (old_socket_with_same_identifier ==
nullptr) {
203 new_socket = &socket_decl.
build(ntree, node);
207 STRNCPY(old_socket_with_same_identifier->
name, socket_decl.
name.c_str());
208 if (socket_decl.
matches(*old_socket_with_same_identifier)) {
210 new_socket = old_socket_with_same_identifier;
214 old_socket_with_same_identifier->
identifier[0] =
'\0';
215 new_socket = &socket_decl.
update_or_build(ntree, node, *old_socket_with_same_identifier);
217 if (new_socket == old_socket_with_same_identifier) {
224 if (link->fromsock == old_socket_with_same_identifier) {
225 link->fromsock = new_socket;
227 else if (link->tosock == old_socket_with_same_identifier) {
228 link->tosock = new_socket;
231 for (
bNodeLink &internal_link : node.runtime->internal_links) {
232 if (internal_link.fromsock == old_socket_with_same_identifier) {
233 internal_link.fromsock = new_socket;
235 else if (internal_link.tosock == old_socket_with_same_identifier) {
236 internal_link.tosock = new_socket;
242 new_socket->
flag, old_socket_with_same_identifier->is_hidden(),
SOCK_HIDDEN);
244 new_sockets.
add_new(new_socket);
258 old_panel_with_same_identifier = &old_panel;
263 if (old_panel_with_same_identifier ==
nullptr) {
265 panel_decl.
build(new_panel);
268 if (panel_decl.
matches(*old_panel_with_same_identifier)) {
270 new_panel = *old_panel_with_same_identifier;
274 old_panel_with_same_identifier->
identifier = -1;
275 panel_decl.
update_or_build(*old_panel_with_same_identifier, new_panel);
279 const int64_t old_panel_index = old_panel_with_same_identifier - old_panels.
begin();
293 if (socket.
type == socket_decl->socket_type) {
294 return socket_decl->identifier.c_str();
305 for (
const char *identifier_prefix : identifier_prefixes) {
350 return "From_Min_FLOAT3";
353 return "From_Max_FLOAT3";
356 return "To_Min_FLOAT3";
359 return "To_Max_FLOAT3";
362 return "Steps_FLOAT3";
380 if (socket->is_available()) {
382 node, *socket, node_decl.
inputs))
384 STRNCPY(socket->identifier, new_identifier);
389 if (socket->is_available()) {
391 node, *socket, node_decl.
outputs))
393 STRNCPY(socket->identifier, new_identifier);
408 return extension_socket->is_hidden();
416 const bool do_id_user)
418 if (!node.runtime->forward_compatible_versioning_done) {
420 node.runtime->forward_compatible_versioning_done =
true;
424 int new_num_panels = 0;
433 old_inputs.
append(socket);
438 old_outputs.
append(socket);
447 node.num_panel_states = new_num_panels;
448 node.panel_states_array = MEM_cnew_array<bNodePanelState>(new_num_panels, __func__);
458 if (socket_decl->in_out ==
SOCK_IN) {
462 refresh_node_socket(ntree, node, *socket_decl, old_outputs, new_outputs, hide_new_sockets);
475 if (!new_inputs.
contains(old_socket)) {
480 if (!new_outputs.
contains(old_socket)) {
504 if (!node_decl.
matches(node)) {
512 if (node.typeinfo->declare) {
513 if (node.typeinfo->static_declaration->is_context_dependent) {
514 if (!node.runtime->declaration) {
525 return ELEM(socket_type,
546 if (ntype ==
nullptr) {
551 refresh_node(*ntree, *node, *node->
runtime->declaration, do_id_user);
563 if (ntype->
outputs && ntype->
outputs[0].
type >= 0 && node->type != CMP_NODE_R_LAYERS) {
609 static float default_value[] = {0.0f, 0.0f, 0.0f};
620 static float default_value[] = {0.0f, 0.0f, 0.0f, 1.0f};
630 dval->
value[0] =
'\0';
644 dval->
value =
nullptr;
651 dval->
value =
nullptr;
658 "node socket value object");
659 dval->
value =
nullptr;
666 "node socket value texture");
667 dval->
value =
nullptr;
674 "node socket value material");
675 dval->
value =
nullptr;
802 if (to->type != from->type) {
807 if (!from->default_value) {
813 if (from->label[0] !=
'\0') {
814 STRNCPY(to->name, from->label);
845 iosock->init_from_socket_instance(sock);
859 stype = MEM_cnew<bke::bNodeSocketType>(
"node socket C type");
899 const char *socket_idname =
"NodeSocketVirtual";
903 stype = MEM_cnew<bke::bNodeSocketType>(
"node socket C type");
#define FN_NODE_RANDOM_VALUE
#define SH_NODE_MAP_RANGE
void BKE_ntree_update_tag_socket_new(bNodeTree *ntree, bNodeSocket *socket)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
int bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
#define STRNCPY(dst, src)
#define STREQLEN(a, b, n)
#define SET_FLAG_FROM_TEST(value, test, flag)
Object groups, one object can be in many groups at once.
Read Guarded memory(de)allocation.
static const CPPType & get()
void add_new(const Key &key)
bool contains(const Key &key) const
void remove_and_reorder(const int64_t index)
void append(const T &value)
IndexRange index_range() const
bool skip_updating_sockets
Vector< ItemDeclarationPtr > items
Vector< SocketDeclaration * > inputs
bool matches(const bNode &node) const
Vector< SocketDeclaration * > outputs
void update_or_build(const bNodePanelState &old_panel, bNodePanelState &new_panel) const
bool matches(const bNodePanelState &panel) const
void build(bNodePanelState &panel) const
virtual bool matches(const bNodeSocket &socket) const =0
virtual bNodeSocket & update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const
virtual bNodeSocket & build(bNodeTree &ntree, bNode &node) const =0
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void MEM_freeN(void *vmemh)
void node_socket_declarations_update(bNode *node)
void node_modify_socket_type_static(bNodeTree *ntree, bNode *node, bNodeSocket *sock, int type, int subtype)
bool node_declaration_ensure_on_outdated_node(bNodeTree *ntree, bNode *node)
const char * node_socket_sub_type_label(int subtype)
bNodeSocket * node_add_static_socket(bNodeTree *ntree, bNode *node, eNodeSocketInOut in_out, int type, int subtype, const char *identifier, const char *name)
void node_remove_socket(bNodeTree *ntree, bNode *node, bNodeSocket *sock)
void node_register_socket_type(bNodeSocketType *stype)
const char * node_static_socket_type(int type, int subtype)
const char * node_static_socket_label(int type, int subtype)
void node_remove_socket_ex(bNodeTree *ntree, bNode *node, bNodeSocket *sock, bool do_id_user)
const char * node_static_socket_interface_type_new(int type, int subtype)
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
std::unique_ptr< SocketDeclaration > SocketDeclarationPtr
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node)
void build_node_declaration(const bke::bNodeType &typeinfo, NodeDeclaration &r_declaration, const bNodeTree *ntree, const bNode *node)
std::unique_ptr< ItemDeclaration > ItemDeclarationPtr
static void do_forward_compat_versioning(bNode &node, const NodeDeclaration &node_decl)
static void refresh_node_sockets_and_panels(bNodeTree &ntree, bNode &node, const NodeDeclaration &node_decl, const bool do_id_user)
static void refresh_node_socket(bNodeTree &ntree, bNode &node, const SocketDeclaration &socket_decl, Vector< bNodeSocket * > &old_sockets, VectorSet< bNodeSocket * > &new_sockets, const bool hide_new_sockets)
bool socket_type_supports_fields(const eNodeSocketDatatype socket_type)
static bool hide_new_group_input_sockets(const bNode &node)
static void refresh_node_panel(const PanelDeclaration &panel_decl, Vector< bNodePanelState > &old_panels, bNodePanelState &new_panel)
static const char * get_identifier_from_decl(const char *identifier_prefix, const bNodeSocket &socket, const Span< const SocketDeclaration * > socket_decls)
bool socket_type_supports_grids(const eNodeSocketDatatype socket_type)
static const char * get_current_socket_identifier_for_future_socket(const bNode &node, const bNodeSocket &socket, const Span< const SocketDeclaration * > socket_decls)
static void refresh_node(bNodeTree &ntree, bNode &node, blender::nodes::NodeDeclaration &node_decl, bool do_id_user)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
static bke::bNodeSocketType * make_socket_type_matrix()
static bke::bNodeSocketType * make_socket_type_rotation()
static void verify_socket_template_list(bNodeTree *ntree, bNode *node, eNodeSocketInOut in_out, ListBase *socklist, bke::bNodeSocketTemplate *stemp_first)
void node_socket_init_default_value(bNodeSocket *sock)
static void standard_node_socket_interface_init_socket(ID *, const bNodeTreeInterfaceSocket *interface_socket, bNode *, bNodeSocket *sock, const char *)
static bke::bNodeSocketType * make_socket_type_float(PropertySubType subtype)
static bke::bNodeSocketType * make_socket_type_texture()
static bke::bNodeSocketType * make_socket_type_object()
void ED_init_standard_node_socket_type(bke::bNodeSocketType *)
bNodeSocket * node_add_socket_from_template(bNodeTree *ntree, bNode *node, bke::bNodeSocketTemplate *stemp, eNodeSocketInOut in_out)
static bNodeSocket * verify_socket_template(bNodeTree *ntree, bNode *node, eNodeSocketInOut in_out, ListBase *socklist, bke::bNodeSocketTemplate *stemp)
void node_socket_copy_default_value(bNodeSocket *to, const bNodeSocket *from)
static bke::bNodeSocketType * make_socket_type_rgba()
static bke::bNodeSocketType * make_socket_type_int(PropertySubType subtype)
static void standard_node_socket_interface_from_socket(ID *, bNodeTreeInterfaceSocket *iosock, const bNode *, const bNodeSocket *sock)
static bke::bNodeSocketType * make_socket_type_geometry()
static bke::bNodeSocketType * make_socket_type_menu()
static bke::bNodeSocketType * make_socket_type_image()
static bke::bNodeSocketType * make_socket_type_collection()
void ED_init_node_socket_type_virtual(bke::bNodeSocketType *)
static bke::bNodeSocketType * make_standard_socket_type(int type, int subtype)
void node_verify_sockets(bNodeTree *ntree, bNode *node, bool do_id_user)
static bke::bNodeSocketType * make_socket_type_material()
static bke::bNodeSocketType * make_socket_type_bool()
static bke::bNodeSocketType * make_socket_type_vector(PropertySubType subtype)
void register_standard_node_socket_types()
void node_socket_init_default_value_data(eNodeSocketDatatype datatype, int subtype, void **data)
static bke::bNodeSocketType * make_socket_type_string(PropertySubType subtype)
void node_socket_copy_default_value_data(eNodeSocketDatatype datatype, void *to, const void *from)
static bke::bNodeSocketType * make_socket_type_virtual()
StructRNA * RNA_struct_find(const char *identifier)
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
struct Collection * value
bNodeSocketTypeHandle * typeinfo
struct bNodeSocket * next
bNodeTreeRuntimeHandle * runtime
static MatBase identity()
Compact definition of a node socket.
ExtensionRNA ext_interface
const blender::CPPType * geometry_nodes_cpp_type
SocketGetCPPValueFunction get_base_cpp_value
void(* interface_init_socket)(ID *id, const bNodeTreeInterfaceSocket *interface_socket, bNode *node, bNodeSocket *socket, const char *data_path)
void(* free_self)(bNodeSocketType *stype)
bool use_link_limits_of_type
const void * geometry_nodes_default_cpp_value
SocketGetGeometryNodesCPPValueFunction get_geometry_nodes_cpp_value
const blender::CPPType * base_cpp_type
void(* interface_from_socket)(ID *id, bNodeTreeInterfaceSocket *interface_socket, const bNode *node, const bNodeSocket *socket)
bNodeSocketTemplate * inputs
bNodeSocketTemplate * outputs
NodeDeclareFunction declare
static QuaternionBase identity()