21#include "RNA_prototypes.hh"
46 auto &input =
b.add_input(data_type,
UString(std::to_string(i)),
UString(identifier));
47 input.structure_type(StructureType::Dynamic);
49 input.optional_label(
ELEM(data_type,
62 .structure_type(StructureType::Dynamic)
63 .custom_draw(socket_items::ui::draw_extend_socket_fn<ItemsAccessor>());
65 b.add_output(data_type,
"List"_ustr)
66 .structure_type(StructureType::List)
68 .description(
"List with one element per item");
81 panel->op(
"node.combine_list_item_add",
IFACE_(
"Add Item"), ICON_ADD);
85 row->
label(
node.input_socket(i).name, ICON_NONE);
86 PointerRNA op_ptr = row->
op(
"node.combine_list_item_remove",
"", ICON_REMOVE);
103 data->next_identifier = 0;
105 const int default_items_num = 1;
106 data->items = MEM_new_array<CombineListItem>(default_items_num, __func__);
107 for (
const int i :
IndexRange(default_items_num)) {
108 data->items[i].identifier =
data->next_identifier++;
110 data->items_num = default_items_num;
129 node_storage(
node).data_type = other_type;
136 node_storage(
node).data_type = other_type;
160 const bool all_single = std::all_of(
162 return value.is_single();
169 void *value_ptr = values[i].get_if(*cpp_type);
215 auto *dst_storage = MEM_new<NodeCombineList>(__func__,
dna::shallow_copy(src_storage));
216 dst_node->
storage = dst_storage;
242 ntype.
ui_name =
"Combine List";
243 ntype.
ui_description =
"Combine an arbitrary number of values into a list";
286MutableSpan<CombineListItem> NodeCombineList::items_span()
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
void move_construct(void *src, void *dst) const
constexpr IndexRange()=default
constexpr MutableSpan()=default
constexpr int64_t size() const
constexpr IndexRange index_range() const
static GListPtr from_garray(GArray<> array)
static GListPtr from_container(ContainerT &&container)
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
const bNodeTree & node_tree() const
const bNodeSocket & other_socket() const
eNodeSocketInOut in_out() const
T extract_input(const UString identifier)
const bNode & node() const
void set_default_remaining_outputs()
void set_output(const UString identifier, T &&value)
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)
const CPPType * socket_type_to_geo_nodes_base_cpp_type(eNodeSocketDatatype type)
bNodeSocketType * node_socket_type_find_static(int type, int subtype=0)
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_declare(NodeDeclarationBuilder &b)
static void node_blend_write(const bNodeTree &, const bNode &node, BlendWriter &writer)
static void node_blend_read(bNodeTree &, bNode &node, BlendDataReader &reader)
CombineListItemsAccessor ItemsAccessor
static void node_layout_ex(ui::Layout &layout, bContext *C, PointerRNA *ptr)
static bool node_insert_link(bke::NodeInsertLinkParams ¶ms)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_geo_exec(GeoNodeExecParams params)
static void node_init(bNodeTree *, bNode *node)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
static void node_operators()
static void node_free_storage(bNode *node)
static void node_register()
static const EnumPropertyItem * data_type_items_callback(bContext *, PointerRNA *ptr, PropertyRNA *, bool *r_free)
static void node_rna(StructRNA *srna)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
void make_add_item_operator()
void make_remove_item_by_index_operator()
void make_move_item_operator()
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)
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)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
const EnumPropertyItem * enum_items_filter(const EnumPropertyItem *original_item_array, FunctionRef< bool(const EnumPropertyItem &item)> fn)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
BMesh const char void * data
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
bke::bNodeTreeType * typeinfo
bool(*) valid_socket_type(bNodeTreeType *ntreetype, bNodeSocketType *socket_type)
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
NodeBlendWriteFunction blend_write_storage_content
void(*) register_operators()
std::string ui_description
NodeBlendDataReadFunction blend_data_read_storage_content
NodeGeometryExecFunction geometry_node_execute
void(*) draw_buttons_ex(ui::Layout &, bContext *C, PointerRNA *ptr)
void(*) initfunc(bNodeTree *ntree, bNode *node)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
bool ignore_inferred_input_socket_visibility
bool(*) insert_link(NodeInsertLinkParams ¶ms)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static std::string socket_identifier_for_item(const CombineListItem &item)
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static StructRNA ** item_srna
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
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)
Layout & column(bool align)