59 switch (stemp->
type) {
70 dval->
min = int(stemp->
min);
71 dval->
max = int(stemp->
max);
143 if (stemp_first ==
nullptr) {
145 nextsock = sock->
next;
152 while (stemp->
type != -1) {
158 nextsock = sock->
next;
164 if (socklist->
first) {
168 while (stemp->
type != -1) {
175 while (stemp->
type != -1) {
190 const bool hide_new_sockets)
193 bNodeSocket *old_socket_with_same_identifier =
nullptr;
198 old_socket_with_same_identifier = &old_socket;
203 if (old_socket_with_same_identifier ==
nullptr) {
205 new_socket = &socket_decl.
build(ntree, node);
210 if (socket_decl.
matches(*old_socket_with_same_identifier)) {
212 new_socket = old_socket_with_same_identifier;
216 old_socket_with_same_identifier->
identifier[0] =
'\0';
217 new_socket = &socket_decl.
update_or_build(ntree, node, *old_socket_with_same_identifier);
219 if (new_socket == old_socket_with_same_identifier) {
226 if (link->fromsock == old_socket_with_same_identifier) {
227 link->fromsock = new_socket;
229 else if (link->tosock == old_socket_with_same_identifier) {
230 link->tosock = new_socket;
234 if (internal_link.
fromsock == old_socket_with_same_identifier) {
235 internal_link.
fromsock = new_socket;
237 else if (internal_link.
tosock == old_socket_with_same_identifier) {
238 internal_link.
tosock = new_socket;
244 new_socket->
flag, old_socket_with_same_identifier->is_user_hidden(),
SOCK_HIDDEN);
246 new_sockets.
add_new(new_socket);
260 old_panel_with_same_identifier = &old_panel;
265 if (old_panel_with_same_identifier ==
nullptr) {
267 panel_decl.
build(new_panel);
270 if (panel_decl.
matches(*old_panel_with_same_identifier)) {
272 new_panel = *old_panel_with_same_identifier;
276 old_panel_with_same_identifier->
identifier = -1;
277 panel_decl.
update_or_build(*old_panel_with_same_identifier, new_panel);
281 const int64_t old_panel_index = old_panel_with_same_identifier - old_panels.
begin();
295 if (socket.
type == socket_decl->socket_type) {
296 return socket_decl->identifier.c_str();
307 for (
const char *identifier_prefix : identifier_prefixes) {
352 return "From_Min_FLOAT3";
355 return "From_Max_FLOAT3";
358 return "To_Min_FLOAT3";
361 return "To_Max_FLOAT3";
364 return "Steps_FLOAT3";
382 if (socket->is_available()) {
384 node, *socket, node_decl.
inputs))
391 if (socket->is_available()) {
393 node, *socket, node_decl.
outputs))
410 return extension_socket->is_user_hidden();
418 const bool do_id_user)
420 if (!node.
runtime->forward_compatible_versioning_done) {
422 node.
runtime->forward_compatible_versioning_done =
true;
426 int new_num_panels = 0;
435 old_inputs.
append(socket);
440 old_outputs.
append(socket);
460 if (socket_decl->in_out ==
SOCK_IN) {
464 refresh_node_socket(ntree, node, *socket_decl, old_outputs, new_outputs, hide_new_sockets);
477 if (!new_inputs.
contains(old_socket)) {
482 if (!new_outputs.
contains(old_socket)) {
506 if (!node_decl.
matches(node)) {
515 if (node.
typeinfo->static_declaration->is_context_dependent) {
516 if (!node.
runtime->declaration) {
527 return ELEM(socket_type,
545 switch (socket_type) {
576 if (ntype ==
nullptr) {
581 refresh_node(*ntree, *node, *node->
runtime->declaration, do_id_user);
628 "node socket value bool");
640 static float default_value[] = {0.0f, 0.0f, 0.0f};
642 "node socket value vector");
653 static float default_value[] = {0.0f, 0.0f, 0.0f, 1.0f};
662 "node socket value string");
664 dval->
value[0] =
'\0';
678 "node socket value object");
679 dval->
value =
nullptr;
686 dval->
value =
nullptr;
693 "node socket value object");
694 dval->
value =
nullptr;
701 "node socket value texture");
702 dval->
value =
nullptr;
709 "node socket value material");
710 dval->
value =
nullptr;
851 if (from->
label[0] !=
'\0') {
882 iosock->init_from_socket_instance(sock);
892 type, subtype, dimensions);
898 stype = MEM_new<bke::bNodeSocketType>(__func__);
900 stype->
idname = socket_idname;
901 stype->
label = socket_label;
938 const char *socket_idname =
"NodeSocketVirtual";
942 stype = MEM_new<bke::bNodeSocketType>(__func__);
944 stype->
idname = socket_idname;
1154 static_cast<Object *
>(
nullptr));
1219 static_cast<Image *
>(
nullptr));
#define FN_NODE_RANDOM_VALUE
#define SH_NODE_MAP_RANGE
#define CMP_NODE_R_LAYERS
void BKE_ntree_update_tag_socket_new(bNodeTree *ntree, bNodeSocket *socket)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkbefore(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_UTF8(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.
BMesh const char void * data
static SocketValueVariant From(T &&value)
static const CPPType & get()
constexpr const char * c_str() const
bool contains(const Key &key) const
void add_new(const Key &key)
void remove_and_reorder(const int64_t index)
void append(const T &value)
IndexRange index_range() const
bool skip_updating_sockets
Vector< SocketDeclaration * > inputs
bool matches(const bNode &node) const
Vector< SocketDeclaration * > outputs
Vector< ItemDeclarationPtr > all_items
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
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void node_socket_declarations_update(bNode *node)
void node_modify_socket_type_static(bNodeTree *ntree, bNode *node, bNodeSocket *sock, int type, int subtype)
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
std::optional< StringRefNull > node_static_socket_interface_type_new(int type, int subtype, std::optional< int > dimensions=std::nullopt)
bool node_declaration_ensure_on_outdated_node(bNodeTree &ntree, bNode &node)
void node_register_socket_type(bNodeSocketType &stype)
bNodeSocket * node_add_static_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out, int type, int subtype, StringRefNull identifier, StringRefNull name)
void node_remove_socket_ex(bNodeTree &ntree, bNode &node, bNodeSocket &sock, bool do_id_user)
std::optional< StringRefNull > node_static_socket_label(int type, int subtype)
std::optional< StringRefNull > node_static_socket_type(int type, int subtype, std::optional< int > dimensions=std::nullopt)
StringRefNull node_socket_sub_type_label(int subtype)
QuaternionBase< float > Quaternion
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
EulerXYZBase< float > EulerXYZ
ImplicitSharingPtr< Bundle > BundlePtr
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)
ImplicitSharingPtr< Closure > ClosurePtr
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)
bool socket_type_always_single(const eNodeSocketDatatype socket_type)
static void refresh_node(bNodeTree &ntree, bNode &node, blender::nodes::NodeDeclaration &node_decl, bool do_id_user)
MatBase< float, 4, 4 > float4x4
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 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_standard_socket_type(const eNodeSocketDatatype type, int subtype, std::optional< int > dimensions=std::nullopt)
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 void standard_node_socket_interface_init_socket(ID *, const bNodeTreeInterfaceSocket *interface_socket, bNode *, bNodeSocket *sock, StringRefNull)
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_socket_type_bundle()
static bke::bNodeSocketType * make_socket_type_vector(PropertySubType subtype, const int dimensions)
static bke::bNodeSocketType * make_socket_type_closure()
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()
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
bNodeTypeHandle * typeinfo
bNodePanelState * panel_states_array
bNodeRuntimeHandle * runtime
static MatBase identity()
Compact definition of a node socket.
ExtensionRNA ext_interface
SocketGetCPPValueFunction get_base_cpp_value
std::string subtype_label
void(* interface_init_socket)(ID *id, const bNodeTreeInterfaceSocket *interface_socket, bNode *node, bNodeSocket *socket, StringRefNull data_path)
void(* free_self)(bNodeSocketType *stype)
bool use_link_limits_of_type
SocketGetGeometryNodesCPPValueFunction get_geometry_nodes_cpp_value
const SocketValueVariant * geometry_nodes_default_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()