24#include <fmt/format.h>
32 const bNode *node =
b.node_or_null();
38 if (node !=
nullptr) {
41 b.add_input(data_type,
"Value").field_on_all();
59 data->domain =
int8_t(AttrDomain::Point);
75 bNode &node =
params.add_node(
"GeometryNodeStoreNamedAttribute");
76 node_storage(node).data_type = *type;
77 params.update_and_connect_available_socket(node,
"Value");
86 const std::string name =
params.extract_input<std::string>(
"Name");
89 params.set_output(
"Geometry", std::move(geometry_set));
94 params.set_output(
"Geometry", std::move(geometry_set));
98 params.error_message_add(NodeWarningType::Info,
99 TIP_(
"Anonymous attributes can't be created here"));
100 params.set_output(
"Geometry", std::move(geometry_set));
104 params.used_named_attribute(name, NamedAttributeUsage::Write);
108 const AttrDomain domain = AttrDomain(storage.
domain);
118 std::atomic<bool> failure =
false;
121 if (domain == AttrDomain::Instance) {
133 evaluator.evaluate();
151 if (geometry_set.
has(type)) {
168 const char *domain_name =
nullptr;
170 const char *type_name =
nullptr;
172 const std::string message = fmt::format(
173 TIP_(
"Failed to write to attribute \"{}\" with domain \"{}\" and type \"{}\""),
177 params.error_message_add(NodeWarningType::Warning, message);
180 params.set_output(
"Geometry", std::move(geometry_set));
189 "Type of data stored in attribute",
202 "Which domain to store the data in",
205 int(AttrDomain::Point));
215 "NodeGeometryStoreNamedAttribute",
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_ATTRIBUTE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
GVArray try_convert(GVArray varray, const CPPType &to_type) const
int attribute_domain_size(AttrDomain domain) const
void set_selection(Field< bool > selection)
Vector< SocketDeclaration * > inputs
Vector< SocketDeclaration * > outputs
local_group_size(16, 16) .push_constant(Type b
bool attribute_name_is_anonymous(const StringRef name)
const DataTypeConversions & get_implicit_type_conversions()
bool allow_procedural_attribute_access(StringRef attribute_name)
const char * no_procedural_access_message
void mesh_ensure_default_color_attribute_on_add(Mesh &mesh, StringRef id, AttrDomain domain, eCustomDataType data_type)
bool try_capture_field_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, const StringRef attribute_id, AttrDomain domain, const fn::Field< bool > &selection, const fn::GField &field)
void node_type_size(bNodeType *ntype, int width, int minwidth, int maxwidth)
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)
const CPPType * custom_data_type_to_cpp_type(eCustomDataType type)
VMutableArray< float3 > instance_position_varray_for_write(Instances &instances)
std::optional< eCustomDataType > socket_type_to_custom_data_type(eNodeSocketDatatype type)
bool generic_attribute_type_supported(const EnumPropertyItem &item)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_init(bNodeTree *, bNode *node)
static void node_geo_exec(GeoNodeExecParams params)
static void node_register()
static void node_rna(StructRNA *srna)
static void node_declare(NodeDeclarationBuilder &b)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
void search_link_ops_for_declarations(GatherLinkSearchOpParams ¶ms, Span< SocketDeclaration * > declarations)
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)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
const EnumPropertyItem rna_enum_attribute_domain_items[]
const EnumPropertyItem rna_enum_attribute_type_items[]
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
Instances * get_instances_for_write()
bool has(const GeometryComponent::Type component_type) const
bool has_instances() const
void modify_geometry_sets(ForeachSubGeometryCallback callback)
Mesh * get_mesh_for_write()
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare