29 const bNode *node =
b.node_or_null();
30 b.use_custom_socket_order();
31 b.allow_any_socket_order();
34 b.add_output<
decl::Geometry>(
"Geometry").propagate_all().align_with_previous();
35 if (node !=
nullptr) {
41 const std::string input_identifier =
43 const std::string output_identifier =
45 b.add_input(data_type, item.name, input_identifier)
48 b.add_output(data_type, item.name, output_identifier).field_on_all().align_with_previous();
52 b.add_output<
decl::Extend>(
"",
"__extend__").align_with_previous();
65 data->domain =
int8_t(AttrDomain::Point);
91 uiListType *list = MEM_cnew<uiListType>(__func__);
92 STRNCPY(list->idname,
"NODE_UL_capture_items_list");
101 C, layout,
"capture_attribute_items",
false,
TIP_(
"Capture Items")))
122 uiItemO(add_remove_col,
"", ICON_ADD,
"node.capture_attribute_item_add");
123 uiItemO(add_remove_col,
"", ICON_REMOVE,
"node.capture_attribute_item_remove");
128 up_down_col,
"node.capture_attribute_item_move",
"", ICON_TRIA_UP,
"direction", 0);
130 up_down_col,
"node.capture_attribute_item_move",
"", ICON_TRIA_DOWN,
"direction", 1);
133 auto &storage = node_storage(node);
134 if (storage.active_index >= 0 && storage.active_index < storage.capture_items_num) {
136 storage.capture_items[storage.active_index];
150 ot,
"Add Capture Attribute Item", __func__,
"Add capture attribute item");
156 ot,
"Remove Capture Attribute Item", __func__,
"Remove active capture attribute item");
162 ot,
"Move Capture Attribute Item", __func__,
"Move active capture attribute item");
177 if (!attributes.has_value()) {
195 for (
const std::string &unused_id : unused_ids) {
196 attributes->
remove(unused_id);
204 if (!
params.output_is_required(
"Geometry")) {
206 NodeWarningType::Info,
207 TIP_(
"The attribute output cannot be used without the geometry output"));
208 params.set_default_remaining_outputs();
213 const AttrDomain domain = AttrDomain(storage.
domain);
222 const std::string input_identifier =
224 const std::string output_identifier =
226 std::optional<std::string> attribute_id =
params.get_output_anonymous_attribute_id_if_needed(
231 used_attribute_ids_set.
add(*attribute_id);
232 fields.append(
params.extract_input<
GField>(input_identifier));
233 attribute_id_ptrs.
append(std::move(*attribute_id));
237 if (fields.is_empty()) {
238 params.set_output(
"Geometry", geometry_set);
239 params.set_default_remaining_outputs();
244 for (
const int i : attribute_id_ptrs.
index_range()) {
245 attribute_ids[i] = attribute_id_ptrs[i];
253 params.get_attribute_filter(
"Geometry"), used_attribute_ids_set, component);
257 if (domain == AttrDomain::Instance) {
270 if (geometry_set.
has(type)) {
277 params.set_output(
"Geometry", geometry_set);
283 *ntree, *node, *node, *link);
297 dst_node->
storage = dst_storage;
307 bNode &node =
params.add_node(
"GeometryNodeCaptureAttribute");
308 params.connect_available_socket(node,
"Geometry");
316 bNode &node =
params.add_node(
"GeometryNodeCaptureAttribute");
318 node, type,
params.socket.name);
319 params.update_and_connect_available_socket(node,
params.socket.name);
356 Span(storage.capture_items, storage.capture_items_num))
368 Span(storage.capture_items, storage.capture_items_num))
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_CAPTURE_ATTRIBUTE
#define NODE_CLASS_ATTRIBUTE
#define STRNCPY(dst, src)
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)
bool contains(const Key &key) const
void append(const T &value)
void remove(const int64_t index)
IndexRange index_range() const
virtual std::optional< MutableAttributeAccessor > attributes_for_write()
local_group_size(16, 16) .push_constant(Type b
void MEM_freeN(void *vmemh)
bool attribute_name_is_anonymous(const StringRef name)
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)
bool try_capture_fields_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, Span< StringRef > attribute_ids, AttrDomain domain, const fn::Field< bool > &selection, Span< fn::GField > fields)
static void node_operators()
static void node_free_storage(bNode *node)
static void draw_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 *ptr)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void node_init(bNodeTree *, bNode *node)
static void clean_unused_attributes(const AttributeFilter &attribute_filter, const Set< StringRef > &keep, GeometryComponent &component)
static void NODE_OT_capture_attribute_item_remove(wmOperatorType *ot)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_register()
static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
static void NODE_OT_capture_attribute_item_add(wmOperatorType *ot)
static void NODE_OT_capture_attribute_item_move(wmOperatorType *ot)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
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)
Accessor::ItemT * add_item_with_socket_type_and_name(bNode &node, const eNodeSocketDatatype socket_type, const char *name)
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)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
NodeGeometryAttributeCaptureItem * capture_items
bool allow_skip(const StringRef name) const
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
bool has(const GeometryComponent::Type component_type) const
bool has_instances() const
void modify_geometry_sets(ForeachSubGeometryCallback callback)
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(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 bool supports_socket_type(const eNodeSocketDatatype socket_type)
static std::string input_socket_identifier_for_item(const NodeGeometryAttributeCaptureItem &item)
static void blend_read_data(BlendDataReader *reader, bNode &node)
static std::string output_socket_identifier_for_item(const NodeGeometryAttributeCaptureItem &item)
static void blend_write(BlendWriter *writer, const bNode &node)
char idname[BKE_ST_MAXNAME]
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
bool WM_uilisttype_add(uiListType *ult)