14#include "RNA_prototypes.hh"
27 b.use_custom_socket_order();
28 b.allow_any_socket_order();
33 .description(
"The number of elements in the list");
50 b.add_input(type, name,
UString(input_identifier))
51 .structure_type(StructureType::Field)
53 b.add_output(type, name,
UString(output_identifier))
54 .structure_type(StructureType::List)
55 .align_with_previous()
56 .description(
"Output list with evaluated field values");
60 .structure_type(StructureType::Field)
61 .custom_draw(socket_items::ui::draw_extend_socket_fn<FieldToListItemsAccessor>());
63 .structure_type(StructureType::List)
64 .align_with_previous();
72 socket_items::ui::draw_items_list_with_operators<ItemsAccessor>(
C, panel, tree,
node);
73 socket_items::ui::draw_active_item_props<ItemsAccessor>(tree,
node, [&](
PointerRNA *item_ptr) {
74 panel->use_property_split_set(
true);
75 panel->use_property_decorate_set(
false);
76 panel->prop(item_ptr,
"socket_type",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
136 const int item_i = required_items[i];
138 items[item_i].socket_type);
141 if (!expected_type || field.
cpp_type() != *expected_type) {
146 fields.
append(std::move(field));
151 const CPPType &cpp_type = fields[i].cpp_type();
159 const_cast<void *
>(std::get<GList::ArrayData>(lists[i]->
data()).
data),
167 const int item_i = required_items[i];
175 node->storage = MEM_new<GeometryNodeFieldToList>(__func__);
187 auto *dst_storage = MEM_new<GeometryNodeFieldToList>(__func__, src_storage);
188 dst_node->
storage = dst_storage;
218 return node.input_by_identifier(output_socket.identifier_ustr());
225 ntype.
ui_name =
"Field to List";
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
constexpr IndexRange index_range() const
void append(const T &value)
IndexRange index_range() const
void reserve(const int64_t min_capacity)
int add_with_destination(GField field, GVMutableArray dst)
const CPPType & cpp_type() const
static ArrayData ForUninitialized(const CPPType &type, int64_t size)
static GListPtr create(const CPPType &type, DataVariant data, const int64_t size)
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
void error_message_add(const NodeWarningType type, StringRef message) const
T extract_input(const UString identifier)
bool output_is_required(const UString identifier) const
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)
void update_and_connect_available_socket_by_identifier(bNode &new_node, UString socket_identifier)
#define storage(slot, qualifiers)
void node_register_type(bNodeType &ntype)
const CPPType * socket_type_to_geo_nodes_base_cpp_type(eNodeSocketDatatype type)
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))
static void node_blend_write(const bNodeTree &, const bNode &node, BlendWriter &writer)
static void node_declare(NodeDeclarationBuilder &b)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
static void node_geo_exec(GeoNodeExecParams params)
static void node_init(bNodeTree *, bNode *node)
static void node_register()
static void node_gather_link_search_ops(GatherLinkSearchOpParams ¶ms)
static void node_operators()
static void node_free_storage(bNode *node)
FieldToListItemsAccessor ItemsAccessor
static const bNodeSocket * node_internally_linked_input(const bNodeTree &, const bNode &node, const bNodeSocket &output_socket)
static void node_blend_read(bNodeTree &, bNode &node, BlendDataReader &reader)
static void node_layout_ex(ui::Layout &layout, bContext *C, PointerRNA *ptr)
static bool node_insert_link(bke::NodeInsertLinkParams ¶ms)
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 MEM_delete_void(void *vmemh)
BMesh const char void * data
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void write_string(const char *data)
eNodeSocketDatatype socket_type
bke::bNodeTreeType * typeinfo
bool(*) validate_link(eNodeSocketDatatype from, eNodeSocketDatatype to)
NodeInternallyLinkedInputFunction internally_linked_input
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 bool supports_socket_type(const eNodeSocketDatatype socket_type, const int)
static StructRNA ** item_srna
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static std::string output_socket_identifier_for_item(const GeometryNodeFieldToListItem &item)
GeometryNodeFieldToListItem ItemT
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static std::string input_socket_identifier_for_item(const GeometryNodeFieldToListItem &item)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)