22 const bNode *node =
b.node_or_null();
24 if (node !=
nullptr) {
26 b.add_input(type,
"List").structure_type(StructureType::List).hide_value();
31 if (node !=
nullptr) {
33 b.add_output(type,
"Value").dependent_field({1});
48 bNode &node =
params.add_node(
"GeometryNodeListGetItem");
56 if (!
U.experimental.use_geometry_nodes_lists) {
61 if (
params.node_tree().typeinfo->validate_link(socket_type,
SOCK_INT)) {
73 mf::Signature signature_;
78 mf::SignatureBuilder builder{
"Sample Index", signature_};
79 builder.single_input<
int>(
"Index");
80 builder.single_output(
"Value", list_->cpp_type());
81 this->set_signature(&signature_);
89 if (
const auto *array_data = std::get_if<nodes::List::ArrayData>(&
data)) {
90 const GSpan span(list_->cpp_type(), array_data->data, list_->size());
93 else if (
const auto *single_data = std::get_if<nodes::List::SingleData>(&
data)) {
94 list_->cpp_type().fill_construct_indices(single_data->value, dst.data(),
mask);
123 params.set_default_remaining_outputs();
127 std::string error_message;
130 std::make_shared<SampleIndexFunction>(std::move(list)),
136 params.set_default_remaining_outputs();
141 params.set_output(
"Value", std::move(output_value));
148 ntype.
ui_name =
"Get List Item";
#define NODE_CLASS_CONVERTER
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
BMesh const char void * data
static GVArray from_span(GSpan span)
std::variant< ArrayData, SingleData > DataVariant
StructureType structure_type
SampleIndexFunction(ListPtr list)
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
eNodeSocketDatatype socket_type
const StringRef socket_name
void operator()(LinkSearchOpParams ¶ms)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void copy_with_checked_indices(const GVArray &src, const VArray< int > &indices, const IndexMask &mask, GMutableSpan dst)
void node_register_type(bNodeType &ntype)
static void node_declare(NodeDeclarationBuilder &b)
static void node_geo_exec(GeoNodeExecParams params)
static void node_register()
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_rna(StructRNA *srna)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
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)
ImplicitSharingPtr< List > ListPtr
bool execute_multi_function_on_value_variant(const MultiFunction &fn, const std::shared_ptr< MultiFunction > &owned_fn, const Span< SocketValueVariant * > input_values, const Span< SocketValueVariant * > output_values, GeoNodesUserData *user_data, std::string &r_error_message)
bool socket_type_supports_fields(const eNodeSocketDatatype socket_type)
const EnumPropertyItem * enum_items_filter(const EnumPropertyItem *original_item_array, FunctionRef< bool(const EnumPropertyItem &item)> fn)
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)