26#include <fmt/format.h>
34 b.use_custom_socket_order();
35 b.allow_any_socket_order();
36 b.add_default_layout();
40 .
description(
"Geometry to store a new attribute with the given name on");
41 b.add_output<
decl::Geometry>(
"Geometry"_ustr).propagate_all_geometry().align_with_previous();
45 .evaluated_geometry_field();
48 if (
node !=
nullptr) {
51 b.add_input(data_type,
"Value"_ustr).evaluated_geometry_field();
84 node_storage(
node).data_type = *type;
97 if (name ==
"fill_id") {
106 else if (
ELEM(name,
"uv_rotation",
"uv_translation",
"uv_scale",
"uv_shear")) {
120 const std::string name = params.
extract_input<std::string>(
"Name"_ustr);
123 params.
set_output(
"Geometry"_ustr, std::move(geometry_set));
128 params.
set_output(
"Geometry"_ustr, std::move(geometry_set));
133 TIP_(
"Anonymous attributes cannot be created here"));
134 params.
set_output(
"Geometry"_ustr, std::move(geometry_set));
158 std::atomic<bool> failure =
false;
161 if (domain == AttrDomain::Instance) {
191 if (geometry_set.
has(type)) {
212 const char *domain_name =
nullptr;
214 const char *type_name =
nullptr;
216 const std::string message = fmt::format(
218 RPT_(
"Failed to write to attribute \"{}\" with domain \"{}\" and type \"{}\"")),
225 params.
set_output(
"Geometry"_ustr, std::move(geometry_set));
234 "Type of data stored in attribute",
247 "Which domain to store the data in",
250 int(AttrDomain::Point));
259 ntype.
ui_name =
"Store Named Attribute";
261 "Store the result of a field on a geometry as an attribute with the specified name";
265 "NodeGeometryStoreNamedAttribute",
Low-level operations for grease pencil.
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_ATTRIBUTE
#define GEO_NODE_STORE_NAMED_ATTRIBUTE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
GVArray try_convert(GVArray varray, const CPPType &to_type) const
int attribute_domain_size(AttrDomain domain) const
int instances_num() const
void tag_texture_matrices_changed()
void set_selection(Field< bool > selection)
int add_with_destination(GField field, GVMutableArray dst)
const bke::bNodeType & node_type() const
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
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)
void used_named_attribute(StringRef attribute_name, NamedAttributeUsage usage)
const bNode & node() const
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)
Vector< SocketDeclaration * > inputs
Vector< SocketDeclaration * > outputs
#define storage(slot, qualifiers)
bool attribute_name_is_anonymous(const StringRef name)
bool try_capture_field_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, const StringRef name, AttrDomain domain, const fn::Field< bool > &selection, const fn::GField &field)
const DataTypeConversions & get_implicit_type_conversions()
bool allow_procedural_attribute_access(StringRef attribute_name)
std::optional< AttrType > custom_data_type_to_attr_type(eCustomDataType data_type)
void node_register_type(bNodeType &ntype)
const char * no_procedural_access_message
void mesh_ensure_default_uv_attribute_on_add(Mesh &mesh, StringRef name, AttrDomain domain, bke::AttrType data_type)
void mesh_ensure_default_color_attribute_on_add(Mesh &mesh, StringRef name, AttrDomain domain, bke::AttrType data_type)
VMutableArray< float3 > instance_position_varray_for_write(Instances &instances)
const CPPType & attribute_type_to_cpp_type(AttrType 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))
std::optional< eCustomDataType > socket_type_to_custom_data_type(eNodeSocketDatatype type)
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
BLI_INLINE Texture * wrap(MTLTexture *texture)
bool generic_attribute_type_supported(const EnumPropertyItem &item)
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)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void grease_pencil_add_missing_update_tags(const std::string &name, GeometrySet &geometry_set)
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)
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
BMesh const char void * data
const EnumPropertyItem rna_enum_attribute_type_items[]
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
const EnumPropertyItem rna_enum_attribute_domain_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
GreasePencil * get_grease_pencil_for_write()
Mesh * get_mesh_for_write()
static constexpr int _160
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
nodes::NodeDeclaration * static_declaration
void use_property_decorate_set(bool is_decorate)
void use_property_split_set(bool is_sep)
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)