36 const std::string pattern =
params.extract_input<std::string>(
"Name");
37 if (pattern.empty()) {
38 params.set_output(
"Geometry", std::move(geometry_set));
44 const int wildcard_count =
Span(pattern.c_str(), pattern.size()).
count(
'*');
45 if (wildcard_count == 0) {
48 else if (wildcard_count >= 2) {
49 params.error_message_add(NodeWarningType::Info,
50 TIP_(
"Only one * is supported in the pattern"));
51 params.set_output(
"Geometry", std::move(geometry_set));
59 const int wildcard_index = pattern.
find(
'*');
73 if (!geometry_set.
has(type)) {
80 switch (pattern_mode) {
82 if (read_only_component.
attributes()->contains(pattern)) {
83 attributes_to_remove.
append(pattern);
93 if (attribute_name.
startswith(wildcard_prefix) &&
94 attribute_name.
endswith(wildcard_suffix))
96 attributes_to_remove.
append(attribute_name);
103 if (attributes_to_remove.
is_empty()) {
108 for (
const StringRef attribute_name : attributes_to_remove) {
113 removed_attributes.
add(attribute_name);
116 failed_attributes.
add(attribute_name);
122 for (
const StringRef attribute_name : removed_attributes) {
123 params.used_named_attribute(attribute_name, NamedAttributeUsage::Remove);
126 if (!failed_attributes.
is_empty()) {
128 for (
const StringRef attribute_name : failed_attributes) {
129 quoted_attribute_names.
append(fmt::format(
"\"{}\"", attribute_name));
131 const std::string message = fmt::format(
TIP_(
"Cannot remove built-in attributes: {}"),
132 fmt::join(quoted_attribute_names,
", "));
133 params.error_message_add(NodeWarningType::Warning, message);
136 const std::string message = fmt::format(
TIP_(
"Attribute does not exist: \"{}\""), pattern);
137 params.error_message_add(NodeWarningType::Warning, message);
140 params.set_output(
"Geometry", std::move(geometry_set));
150 "Remove the one attribute with the given name"},
155 "Remove all attributes that match the pattern which is allowed to contain a single "
157 {0,
nullptr, 0,
nullptr,
nullptr},
162 "How the attributes to remove are chosen",
#define NODE_CLASS_ATTRIBUTE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
constexpr int64_t count(const T &value) const
constexpr int64_t find(char c, int64_t pos=0) const
constexpr StringRef substr(int64_t start, int64_t size) const
constexpr bool startswith(StringRef prefix) const
constexpr bool endswith(StringRef suffix) const
void append(const T &value)
virtual std::optional< AttributeAccessor > attributes() const
virtual std::optional< MutableAttributeAccessor > attributes_for_write()
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
bool attribute_name_is_anonymous(const StringRef name)
bool allow_procedural_attribute_access(StringRef attribute_name)
void node_type_size(bNodeType *ntype, int width, int minwidth, int maxwidth)
void node_register_type(bNodeType *ntype)
static void node_declare(NodeDeclarationBuilder &b)
static void node_geo_exec(GeoNodeExecParams params)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_rna(StructRNA *srna)
static void node_register()
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)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
bool has(const GeometryComponent::Type component_type) const
const GeometryComponent * get_component(GeometryComponent::Type component_type) const
void modify_geometry_sets(ForeachSubGeometryCallback callback)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare