18#include "RNA_prototypes.hh"
37 bNode *current_node =
static_cast<bNode *
>(current_node_ptr->
data);
52 current_node_ptr->
owner_id, RNA_Node, &output_node);
55 socket_items::ui::draw_items_list_with_operators<RepeatItemsAccessor>(
56 C, panel, ntree, output_node);
57 socket_items::ui::draw_active_item_props<RepeatItemsAccessor>(
58 ntree, output_node, [&](
PointerRNA *item_ptr) {
59 panel->use_property_split_set(
true);
60 panel->use_property_decorate_set(
false);
61 panel->prop(item_ptr,
"socket_type",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
65 layout.
prop(&output_node_ptr,
"inspection_index",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
74 b.use_custom_socket_order();
75 b.allow_any_socket_order();
77 .description(
"Index of the current iteration. Starts counting at zero");
78 b.add_input<
decl::Int>(
"Iterations"_ustr).
min(0).default_value(1);
84 if (
const bNode *output_node = tree->node_by_id(
storage.output_node_id)) {
86 output_node->storage);
87 for (
const int i :
IndexRange(output_storage.items_num)) {
92 auto &input_decl =
b.add_input(socket_type, name, identifier)
95 .structure_type(StructureType::Dynamic);
96 b.add_output(socket_type, name, identifier)
97 .align_with_previous()
98 .propagate_all({input_decl.index()})
99 .inferred_structure_type({input_decl.index()})
100 .structure_type(StructureType::Dynamic);
105 .structure_type(StructureType::Dynamic)
106 .custom_draw(socket_items::ui::draw_extend_socket_fn<RepeatItemsAccessor>());
108 .structure_type(StructureType::Dynamic)
109 .align_with_previous();
116 data->output_node_id = 0;
123 const int label_maxncpy)
130 bNode *output_node = params.
ntree.node_by_id(node_storage(params.
node).output_node_id);
144 int zone_id = node_storage(*node).output_node_id;
152 ntype.
ui_name =
"Repeat Input";
177 b.use_custom_socket_order();
178 b.allow_any_socket_order();
188 auto &input_decl =
b.add_input(socket_type, name, identifier)
191 .structure_type(StructureType::Dynamic);
192 b.add_output(socket_type, name, identifier)
193 .align_with_previous()
194 .propagate_all({input_decl.index()})
195 .inferred_structure_type({input_decl.index()})
196 .structure_type(StructureType::Dynamic);
200 .structure_type(StructureType::Dynamic)
201 .custom_draw(socket_items::ui::draw_extend_socket_fn<RepeatItemsAccessor>());
203 .structure_type(StructureType::Dynamic)
204 .align_with_previous();
211 data->next_identifier = 0;
214 data->items = MEM_new_array<NodeRepeatItem>(1, __func__);
217 data->items[0].identifier =
data->next_identifier++;
233 auto *dst_storage = MEM_new<NodeGeometryRepeatOutput>(__func__,
dna::shallow_copy(src_storage));
234 dst_node->
storage = dst_storage;
260 bNode &input_node = params.
add_node(
"GeometryNodeRepeatInput"_ustr);
261 bNode &output_node = params.
add_node(
"GeometryNodeRepeatOutput"_ustr);
272 bNode &input_node = params.add_node(
"GeometryNodeRepeatInput"_ustr);
273 bNode &output_node = params.add_node(
"GeometryNodeRepeatOutput"_ustr);
280 const UString name(params.socket.name);
286 params.connect_available_socket_by_identifier(
288 params.
node_tree.ensure_topology_cache();
291 input_node.output_socket(1),
293 output_node.input_socket(0));
313 int zone_id =
node->identifier;
321 ntype.
ui_name =
"Repeat Output";
365MutableSpan<NodeRepeatItem> NodeGeometryRepeatOutput::items_span()
#define NODE_CLASS_INTERFACE
#define GEO_NODE_REPEAT_OUTPUT
#define GEO_NODE_REPEAT_INPUT
#define BLT_I18NCONTEXT_ID_NODETREE
#define CTX_IFACE_(context, msgid)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
constexpr IndexRange()=default
constexpr MutableSpan()=default
const char * c_str() const
std::optional< int > output_node_id
const bNode * output_node() const
const bNodeTreeZone * get_zone_by_node(const int32_t node_id) const
const bNodeTree & node_tree() const
const bNodeSocket & other_socket() const
void add_item_full_name(std::string name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
eNodeSocketInOut in_out() const
void update_and_connect_available_socket(bNode &new_node, UString socket_name)
bNode & add_node(UString idname)
#define storage(slot, qualifiers)
void node_register_type(bNodeType &ntype)
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
NODE_STORAGE_FUNCS(NodeGeometryRepeatOutput)
static void node_blend_read(bNodeTree &, bNode &node, BlendDataReader &reader)
static void node_free_storage(bNode *node)
static int node_shader_fn(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_blend_write(const bNodeTree &, const bNode &node, BlendWriter &writer)
static void node_register()
static void node_declare(NodeDeclarationBuilder &b)
static void node_operators()
static bool node_insert_link(bke::NodeInsertLinkParams ¶ms)
static void node_init(bNodeTree *tree, bNode *node)
static void node_layout_ex(ui::Layout &layout, bContext *C, PointerRNA *current_node_ptr)
void make_common_operators()
void blend_write(BlendWriter *writer, const bNode &node)
void destruct_array(bNode &node)
void blend_read_data(BlendDataReader *reader, bNode &node)
void copy_array(const bNode &src_node, bNode &dst_node)
Accessor::ItemT * add_item_with_socket_type_and_name(bNodeTree &ntree, bNode &node, const eNodeSocketDatatype socket_type, const char *name, std::optional< int > dimensions=std::nullopt)
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, typename Accessor::ItemT **r_new_item=nullptr)
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node, Main *bmain)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
bool GPU_stack_link_zone(GPUMaterial *material, const bNode *bnode, const char *name, GPUNodeStack *in, GPUNodeStack *out, int zone_index, bool is_zone_end, int in_argument_count, int out_argument_count)
void sh_geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
BMesh const char void * data
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
#define UI_MENU_ARROW_SEP
void write_string(const char *data)
eNodeSocketDatatype socket_type
NodeBlendWriteFunction blend_write_storage_content
void(*) register_operators()
NodeBlendDataReadFunction blend_data_read_storage_content
void(*) labelfunc(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
NodeGPUExecFunction gpu_fn
void(*) draw_buttons_ex(ui::Layout &, bContext *C, PointerRNA *ptr)
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
bool(*) insert_link(NodeInsertLinkParams ¶ms)
static StructRNA ** item_srna
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static bool supports_socket_type(const eNodeSocketDatatype socket_type, const int ntree_type)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static std::string socket_identifier_for_item(const NodeRepeatItem &item)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)