22 {0,
nullptr, 0,
nullptr,
nullptr}};
27 {0,
nullptr, 0,
nullptr,
nullptr}};
31# include <fmt/format.h>
49extern FunctionRNA rna_NodeTreeInterfaceSocket_draw_func;
50extern FunctionRNA rna_NodeTreeInterfaceSocket_init_socket_func;
51extern FunctionRNA rna_NodeTreeInterfaceSocket_from_socket_func;
79 return &RNA_NodeTreeInterfaceSocket;
82 return &RNA_NodeTreeInterfacePanel;
84 return &RNA_NodeTreeInterfaceItem;
88static std::optional<std::string> rna_NodeTreeInterfaceItem_path(
const PointerRNA *
ptr)
96 ntree->ensure_interface_cache();
97 for (
const int index : ntree->interface_items().index_range()) {
98 if (ntree->interface_items()[index] == item) {
99 return fmt::format(
"interface.items_tree[{}]", index);
114static int rna_NodeTreeInterfaceItem_position_get(
PointerRNA *
ptr)
121static int rna_NodeTreeInterfaceItem_index_get(
PointerRNA *
ptr)
128static bool rna_NodeTreeInterfaceSocket_unregister(
Main * ,
StructRNA *type)
145static void rna_NodeTreeInterfaceSocket_draw_builtin(
ID *
id,
156static void rna_NodeTreeInterfaceSocket_draw_custom(
ID *
id,
163 if (typeinfo ==
nullptr) {
169 FunctionRNA *func = &rna_NodeTreeInterfaceSocket_draw_func;
180static void rna_NodeTreeInterfaceSocket_init_socket_builtin(
185 const char *data_path)
193static void rna_NodeTreeInterfaceSocket_init_socket_custom(
198 const char *data_path)
202 if (typeinfo ==
nullptr) {
209 FunctionRNA *func = &rna_NodeTreeInterfaceSocket_init_socket_func;
221static void rna_NodeTreeInterfaceSocket_from_socket_builtin(
230static void rna_NodeTreeInterfaceSocket_from_socket_custom(
238 if (typeinfo ==
nullptr) {
244 FunctionRNA *func = &rna_NodeTreeInterfaceSocket_from_socket_func;
255static StructRNA *rna_NodeTreeInterfaceSocket_register(
Main * ,
258 const char *identifier,
269 nullptr, &RNA_NodeTreeInterfaceSocket, &dummy_socket);
272 bool have_function[3];
273 if (validate(&dummy_socket_ptr, data, have_function) != 0) {
285 st = MEM_cnew<blender::bke::bNodeSocketType>(__func__);
300 &
BLENDER_RNA, identifier, &RNA_NodeTreeInterfaceSocket);
306 st->
interface_draw = (have_function[0]) ? rna_NodeTreeInterfaceSocket_draw_custom : nullptr;
327static void rna_NodeTreeInterfaceSocket_identifier_get(
PointerRNA *
ptr,
char *value)
333static int rna_NodeTreeInterfaceSocket_identifier_length(
PointerRNA *
ptr)
339static int rna_NodeTreeInterfaceSocket_socket_type_get(
PointerRNA *
ptr)
345static void rna_NodeTreeInterfaceSocket_socket_type_set(
PointerRNA *
ptr,
int value)
351 socket->set_socket_type(typeinfo->
idname);
375 if (is_socket_type_supported(ntree_type, socket_type)) {
383static bool rna_NodeTreeInterfaceSocket_socket_type_poll(
387 return is_socket_type_supported(ntreetype, socket_type);
390static const EnumPropertyItem *rna_NodeTreeInterfaceSocket_socket_type_itemf(
400 ntree->
typeinfo, rna_NodeTreeInterfaceSocket_socket_type_poll, r_free);
403static const EnumPropertyItem *rna_NodeTreeInterfaceSocket_default_input_itemf(
421 N_(
"The node socket's default value")};
431 N_(
"The index from the context")};
438 N_(
"The \"id\" attribute if available, otherwise the index")};
446 N_(
"The geometry's normal direction")};
452 N_(
"The position from the context")};
458 "INSTANCE_TRANSFORM",
460 N_(
"Instance Transform"),
461 N_(
"Transformation of each instance from the geometry context")};
470static const EnumPropertyItem *rna_NodeTreeInterfaceSocket_attribute_domain_itemf(
492 ptr->
owner_id, &RNA_NodeTreeInterfaceItem, interface->active_item());
496static void rna_NodeTreeInterfaceItems_active_set(
PointerRNA *
ptr,
502 interface->active_item_set(item);
511 const char *description,
513 int socket_type_enum,
516 if (parent !=
nullptr && !interface->find_item(parent->
item)) {
522 if (typeinfo ==
nullptr) {
528 if (!is_socket_type_supported(ntree->
typeinfo, typeinfo)) {
529 typeinfo = find_supported_socket_type(ntree->
typeinfo);
530 if (typeinfo ==
nullptr) {
535 const char *socket_type = typeinfo->
idname;
538 name, description, socket_type,
flag, parent);
540 if (socket ==
nullptr) {
556 const char *description,
563 name ? name :
"", description ? description :
"",
flag, nullptr);
565 if (panel ==
nullptr) {
585 if (parent !=
nullptr) {
586 if (!interface->find_item(parent->
item)) {
598 if (parent ==
nullptr) {
601 const int index = parent->items().as_span().first_index_try(item);
602 if (!parent->items().index_range().contains(index)) {
608 if (item_copy ==
nullptr) {
628 return rna_NodeTreeInterfaceItems_copy_to_parent(
id, interface, bmain, reports, item, parent);
631static void rna_NodeTreeInterfaceItems_remove(
ID *
id,
635 bool move_content_to_parent)
637 interface->remove_item(*item, move_content_to_parent);
646 interface->clear_items();
653static void rna_NodeTreeInterfaceItems_move(
ID *
id,
659 interface->move_item(*item, to_position);
666static void rna_NodeTreeInterfaceItems_move_to_parent(
ID *
id,
681 interface->move_item_to_parent(*item, parent, to_position);
702 if (subtypes.
contains(item->value)) {
707 if (items_count == 0) {
716static const EnumPropertyItem *rna_NodeTreeInterfaceSocketFloat_subtype_itemf(
732void rna_NodeTreeInterfaceSocketFloat_default_value_range(
741 if (dval->
max < dval->
min) {
747 *softmin = dval->
min;
748 *softmax = dval->
max;
759void rna_NodeTreeInterfaceSocketInt_default_value_range(
768 if (dval->
max < dval->
min) {
774 *softmin = dval->
min;
775 *softmax = dval->
max;
778static const EnumPropertyItem *rna_NodeTreeInterfaceSocketVector_subtype_itemf(
791void rna_NodeTreeInterfaceSocketVector_default_value_range(
797 if (dval->
max < dval->
min) {
803 *softmin = dval->
min;
804 *softmax = dval->
max;
807static const EnumPropertyItem *rna_NodeTreeInterfaceSocketString_subtype_itemf(
817 rna_NodeTreeInterfaceItem_update(bmain, scene,
ptr);
820static bool rna_NodeTreeInterfaceSocketMaterial_default_value_poll(
PointerRNA * ,
835 ntree->ensure_interface_cache();
839 ntree->interface_items().size(),
844static int rna_NodeTreeInterface_items_length(
PointerRNA *
ptr)
851 ntree->ensure_interface_cache();
852 return ntree->interface_items().size();
862 ntree->ensure_interface_cache();
863 if (!ntree->interface_items().index_range().contains(index)) {
868 ptr->
owner_id, &RNA_NodeTreeInterfaceItem, ntree->interface_items()[index]);
872static bool rna_NodeTreeInterface_items_lookup_string(
PointerRNA *
ptr,
881 ntree->ensure_interface_cache();
916 if (!data->enum_items) {
945 prop,
"rna_NodeTreeInterfaceItem_parent_get",
nullptr,
nullptr,
nullptr);
961 prop,
"Index",
"Global index of the item among all items in the interface");
971 srna =
RNA_def_struct(brna,
"NodeTreeInterfaceSocket",
"NodeTreeInterfaceItem");
975 "rna_NodeTreeInterfaceSocket_register",
976 "rna_NodeTreeInterfaceSocket_unregister",
987 "rna_NodeTreeInterfaceSocket_identifier_get",
988 "rna_NodeTreeInterfaceSocket_identifier_length",
1001 "rna_NodeTreeInterfaceSocket_socket_type_get",
1002 "rna_NodeTreeInterfaceSocket_socket_type_set",
1003 "rna_NodeTreeInterfaceSocket_socket_type_itemf");
1006 prop,
"Socket Type",
"Type of the socket generated by this interface item");
1019 prop,
"Hide Value",
"Hide the socket input value even when the socket is not connected");
1027 "Don't show the input value in the geometry nodes modifier interface");
1034 prop,
"Single Value",
"Only allow single value inputs rather than fields");
1041 "Is Inspect Output",
1042 "Take link out of node group to connect to root tree output node");
1049 prop,
"Layer Selection",
"Take Grease Pencil Layer or Layer Group as selection field");
1055 prop,
nullptr,
nullptr,
"rna_NodeTreeInterfaceSocket_attribute_domain_itemf");
1059 "Attribute domain used by the geometry nodes modifier to create an attribute output");
1065 "Default Attribute",
1066 "The attribute name used by default when the node group is used by a "
1067 "geometry nodes modifier");
1075 "Input to use when the socket is unconnected. Requires \"Hide Value\".");
1077 prop,
nullptr,
nullptr,
"rna_NodeTreeInterfaceSocket_default_input_itemf");
1100 parm =
RNA_def_pointer(func,
"node",
"Node",
"Node",
"Node of the socket to initialize");
1102 parm =
RNA_def_pointer(func,
"socket",
"NodeSocket",
"Socket",
"Socket to initialize");
1105 func,
"data_path",
nullptr, 0,
"Data Path",
"Path to specialized socket data");
1111 parm =
RNA_def_pointer(func,
"node",
"Node",
"Node",
"Node of the original socket");
1113 parm =
RNA_def_pointer(func,
"socket",
"NodeSocket",
"Socket",
"Original socket");
1122 srna =
RNA_def_struct(brna,
"NodeTreeInterfacePanel",
"NodeTreeInterfaceItem");
1151 prop,
"Persistent Identifier",
"Unique identifier for this panel within this node tree");
1171 "rna_NodeTreeInterfaceItems_active_get",
1172 "rna_NodeTreeInterfaceItems_active_set",
1178 func =
RNA_def_function(srna,
"new_socket",
"rna_NodeTreeInterfaceItems_new_socket");
1181 parm =
RNA_def_string(func,
"name",
nullptr, 0,
"Name",
"Name of the socket");
1183 RNA_def_string(func,
"description",
nullptr, 0,
"Description",
"Description of the socket");
1188 "Input/Output Type",
1189 "Create an input or output socket");
1195 "Type of socket generated on nodes");
1198 parm,
nullptr,
nullptr,
"rna_NodeTreeInterfaceSocket_socket_type_itemf");
1200 func,
"parent",
"NodeTreeInterfacePanel",
"Parent",
"Panel to add the socket in");
1202 parm =
RNA_def_pointer(func,
"item",
"NodeTreeInterfaceSocket",
"Socket",
"New socket");
1205 func =
RNA_def_function(srna,
"new_panel",
"rna_NodeTreeInterfaceItems_new_panel");
1208 parm =
RNA_def_string(func,
"name",
nullptr, 0,
"Name",
"Name of the new panel");
1209 RNA_def_string(func,
"description",
nullptr, 0,
"Description",
"Description of the panel");
1211 func,
"default_closed",
false,
"Default Closed",
"Panel is closed by default on new nodes");
1214 parm =
RNA_def_pointer(func,
"item",
"NodeTreeInterfacePanel",
"Panel",
"New panel");
1220 parm =
RNA_def_pointer(func,
"item",
"NodeTreeInterfaceItem",
"Item",
"Item to copy");
1224 func,
"item_copy",
"NodeTreeInterfaceItem",
"Item Copy",
"Copy of the item");
1227 func =
RNA_def_function(srna,
"remove",
"rna_NodeTreeInterfaceItems_remove");
1230 parm =
RNA_def_pointer(func,
"item",
"NodeTreeInterfaceItem",
"Item",
"The item to remove");
1234 "move_content_to_parent",
1237 "If the item is a panel, move the contents to the parent instead of deleting it");
1239 func =
RNA_def_function(srna,
"clear",
"rna_NodeTreeInterfaceItems_clear");
1246 parm =
RNA_def_pointer(func,
"item",
"NodeTreeInterfaceItem",
"Item",
"The item to move");
1254 "Target position for the item in its current panel",
1259 func =
RNA_def_function(srna,
"move_to_parent",
"rna_NodeTreeInterfaceItems_move_to_parent");
1262 parm =
RNA_def_pointer(func,
"item",
"NodeTreeInterfaceItem",
"Item",
"The item to move");
1265 func,
"parent",
"NodeTreeInterfacePanel",
"Parent",
"New parent of the item");
1273 "Target position for the item in the new parent panel",
1286 srna,
"Node Tree Interface",
"Declaration of sockets and ui panels of a node group");
1291 "rna_NodeTreeInterface_items_begin",
1292 "rna_iterator_array_next",
1293 "rna_iterator_array_end",
1294 "rna_iterator_array_dereference_get",
1295 "rna_NodeTreeInterface_items_length",
1296 "rna_NodeTreeInterface_items_lookup_int",
1297 "rna_NodeTreeInterface_items_lookup_string",
#define NODE_SOCKET_TYPES_BEGIN(stype)
#define NODE_SOCKET_TYPES_END
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BLI_kdtree_nd_ free(KDTree *tree)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define SET_FLAG_FROM_TEST(value, test, flag)
NodeTreeInterfacePanelFlag
@ NODE_INTERFACE_PANEL_ALLOW_CHILD_PANELS
@ NODE_INTERFACE_PANEL_DEFAULT_CLOSED
NodeTreeInterfaceSocketFlag
@ NODE_INTERFACE_SOCKET_OUTPUT
@ NODE_INTERFACE_SOCKET_HIDE_IN_MODIFIER
@ NODE_INTERFACE_SOCKET_INPUT
@ NODE_INTERFACE_SOCKET_SINGLE_VALUE_ONLY
@ NODE_INTERFACE_SOCKET_INSPECT
@ NODE_INTERFACE_SOCKET_LAYER_SELECTION
@ 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
@ GEO_NODE_DEFAULT_INPUT_VALUE
@ GEO_NODE_DEFAULT_FIELD_INPUT_INSTANCE_TRANSFORM_FIELD
@ RPT_ERROR_INVALID_INPUT
void ED_node_tree_propagate_change(const bContext *C, Main *bmain, bNodeTree *ntree)
const EnumPropertyItem * RNA_node_enum_definition_itemf(const blender::bke::RuntimeNodeEnumItems &enum_items, bool *r_free)
int rna_node_socket_idname_to_enum(const char *idname)
blender::bke::bNodeSocketType * rna_node_socket_type_from_enum(int value)
const EnumPropertyItem * rna_node_socket_type_itemf(void *data, bool(*poll)(void *data, blender::bke::bNodeSocketType *), bool *r_free)
int(*)(PointerRNA *ptr, void *data, bool *have_function) StructValidateFunc
void(*)(void *data) StructFreeFunc
int(*)(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *list) StructCallbackFunc
@ PROPOVERRIDE_NO_COMPARISON
bool contains(const Key &key) const
void MEM_freeN(void *vmemh)
T & get_item_as(bNodeTreeInterfaceItem &item)
bNodeSocketType * node_socket_type_find(const char *idname)
void node_register_socket_type(bNodeSocketType *stype)
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
void * RNA_struct_blender_type_get(StructRNA *srna)
void RNA_parameter_list_free(ParameterList *parms)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value)
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *, FunctionRNA *func)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
const EnumPropertyItem rna_enum_attribute_domain_items[]
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
StructRNA * RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *rna_ext)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void rna_def_node_socket_interface_subtypes(BlenderRNA *brna)
static void rna_def_node_tree_interface_items_api(StructRNA *srna)
static const EnumPropertyItem node_tree_interface_socket_in_out_items[]
const EnumPropertyItem rna_enum_node_tree_interface_item_type_items[]
static void rna_def_node_interface_item(BlenderRNA *brna)
void RNA_def_node_tree_interface(BlenderRNA *brna)
static void rna_def_node_interface_socket(BlenderRNA *brna)
static void rna_def_node_interface_panel(BlenderRNA *brna)
static void rna_def_node_tree_interface(BlenderRNA *brna)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
const EnumPropertyItem rna_enum_property_subtype_items[]
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
struct MaterialGPencilStyle * gp_style
bNodeTreeInterfaceItem item
bNodeTreeInterfaceItem item
bNodeTreeInterfacePanel root_panel
bNodeTreeRuntimeHandle * runtime
bNodeTreeTypeHandle * typeinfo
bNodeTreeInterface tree_interface
ExtensionRNA ext_interface
void(* interface_init_socket)(ID *id, const bNodeTreeInterfaceSocket *interface_socket, bNode *node, bNodeSocket *socket, const char *data_path)
void(* free_self)(bNodeSocketType *stype)
void(* interface_draw)(ID *id, bNodeTreeInterfaceSocket *socket, bContext *C, uiLayout *layout)
void(* interface_from_socket)(ID *id, bNodeTreeInterfaceSocket *interface_socket, const bNode *node, const bNodeSocket *socket)
bool(* valid_socket_type)(bNodeTreeType *ntreetype, bNodeSocketType *socket_type)
void WM_main_add_notifier(uint type, void *reference)