17#include "RNA_prototypes.hh"
52 bNode *current_node =
static_cast<bNode *
>(current_node_ptr->
data);
62 if (!zone->output_node) {
65 bNode &output_node =
const_cast<bNode &
>(*zone->output_node);
67 current_node_ptr->
owner_id, &RNA_Node, &output_node);
69 static const uiListType *state_items_list = []() {
70 uiListType *list = MEM_cnew<uiListType>(__func__);
71 STRNCPY(list->idname,
"DATA_UL_repeat_zone_state");
97 uiItemO(add_remove_col,
"", ICON_ADD,
"node.repeat_zone_item_add");
98 uiItemO(add_remove_col,
"", ICON_REMOVE,
"node.repeat_zone_item_remove");
102 uiItemEnumO(up_down_col,
"node.repeat_zone_item_move",
"", ICON_TRIA_UP,
"direction", 0);
103 uiItemEnumO(up_down_col,
"node.repeat_zone_item_move",
"", ICON_TRIA_DOWN,
"direction", 1);
107 if (storage.active_index >= 0 && storage.active_index < storage.items_num) {
108 NodeRepeatItem &active_item = storage.items[storage.active_index];
120namespace repeat_input_node {
126 b.use_custom_socket_order();
127 b.allow_any_socket_order();
129 .description(
"Index of the current iteration. Starts counting at zero");
132 const bNode *node =
b.node_or_null();
140 for (
const int i :
IndexRange(output_storage.items_num)) {
145 auto &input_decl =
b.add_input(socket_type, name, identifier)
148 auto &output_decl =
b.add_output(socket_type, name, identifier).align_with_previous();
150 input_decl.supports_field();
151 output_decl.dependent_field({input_decl.index()});
157 b.add_output<
decl::Extend>(
"",
"__extend__").align_with_previous();
164 data->output_node_id = 0;
165 node->storage =
data;
171 const int label_maxncpy)
178 bNode *output_node = ntree->node_by_id(node_storage(*node).output_node_id);
183 *ntree, *node, *output_node, *link);
205namespace repeat_output_node {
211 b.use_custom_socket_order();
212 b.allow_any_socket_order();
214 const bNode *node =
b.node_or_null();
222 auto &input_decl =
b.add_input(socket_type, name, identifier)
225 auto &output_decl =
b.add_output(socket_type, name, identifier).align_with_previous();
227 input_decl.supports_field();
228 output_decl.dependent_field({input_decl.index()});
233 b.add_output<
decl::Extend>(
"",
"__extend__").align_with_previous();
240 data->next_identifier = 0;
242 data->items = MEM_cnew_array<NodeRepeatItem>(1, __func__);
245 data->items[0].identifier = data->next_identifier++;
248 node->storage =
data;
260 auto *dst_storage = MEM_cnew<NodeGeometryRepeatOutput>(__func__, src_storage);
261 dst_node->
storage = dst_storage;
269 *ntree, *node, *node, *link);
275 ot,
"Remove Repeat Zone Item", __func__,
"Remove active repeat zone item");
281 ot,
"Add Repeat Zone Item", __func__,
"Add repeat zone item");
287 ot,
"Move Repeat Zone Item", __func__,
"Move active repeat zone item");
#define NODE_CLASS_INTERFACE
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_REPEAT_OUTPUT
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define STRNCPY(dst, src)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void BLO_write_string(BlendWriter *writer, const char *data_ptr)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
#define BLO_read_struct_array(reader, struct_name, array_size, ptr_p)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int icon, const char *propname, int value)
void uiTemplateList(uiLayout *layout, const bContext *C, const char *listtype_name, const char *list_id, PointerRNA *dataptr, const char *propname, PointerRNA *active_dataptr, const char *active_propname, const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns, enum uiTemplateListFlags flags)
PanelLayout uiLayoutPanel(const bContext *C, uiLayout *layout, const char *idname, bool default_closed)
void uiTemplateNodeSocket(uiLayout *layout, bContext *C, const float color[4])
void uiLayoutSetEmboss(uiLayout *layout, eUIEmbossType emboss)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
@ UI_TEMPLATE_LIST_FLAG_NONE
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
const bNodeTreeZone * get_zone_by_node(const int32_t node_id) const
local_group_size(16, 16) .push_constant(Type b
void MEM_freeN(void *vmemh)
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)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
static void NODE_OT_repeat_zone_item_move(wmOperatorType *ot)
static void NODE_OT_repeat_zone_item_remove(wmOperatorType *ot)
static void node_free_storage(bNode *node)
static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
static void node_register()
static void NODE_OT_repeat_zone_item_add(wmOperatorType *ot)
static void node_declare(NodeDeclarationBuilder &b)
static void node_operators()
static void node_init(bNodeTree *, bNode *node)
static void draw_repeat_state_item(uiList *, const bContext *C, uiLayout *layout, PointerRNA *, PointerRNA *itemptr, int, PointerRNA *, const char *, int, int)
static void node_layout_ex(uiLayout *layout, bContext *C, PointerRNA *current_node_ptr)
void move_active_item(wmOperatorType *ot, const char *name, const char *idname, const char *description)
void remove_active_item(wmOperatorType *ot, const char *name, const char *idname, const char *description)
void add_item(wmOperatorType *ot, const char *name, const char *idname, const char *description)
void destruct_array(bNode &node)
void copy_array(const bNode &src_node, bNode &dst_node)
bool try_add_item_via_any_extend_socket(bNodeTree &ntree, bNode &extend_node, bNode &storage_node, bNodeLink &link, const std::optional< StringRef > socket_identifier=std::nullopt)
bool socket_type_supports_fields(const eNodeSocketDatatype socket_type)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
void(* draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
bool(* insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link)
NodeDeclareFunction declare
void(* register_operators)()
static StructRNA * item_srna
static void blend_write(BlendWriter *writer, const bNode &node)
static void blend_read_data(BlendDataReader *reader, bNode &node)
static std::string socket_identifier_for_item(const NodeRepeatItem &item)
char idname[BKE_ST_MAXNAME]
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
bool WM_uilisttype_add(uiListType *ult)