27 if (
node !=
nullptr) {
29 b.add_input(data_type,
"Value"_ustr)
30 .structure_type(StructureType::Field)
31 .description(
"The values the minimum and maximum will be calculated from");
34 b.add_input<
decl::Int>(
"Group ID"_ustr,
"Group Index"_ustr)
35 .structure_type(StructureType::Field)
37 .description(
"An index used to group values together for multiple separate operations");
39 if (
node !=
nullptr) {
41 b.add_output(data_type,
"Min"_ustr)
42 .structure_type(StructureType::Field)
43 .propagate_references()
44 .description(
"The lowest value in each group");
45 b.add_output(data_type,
"Max"_ustr)
46 .structure_type(StructureType::Field)
47 .propagate_references()
48 .description(
"The highest value in each group");
68 switch (socket.
type) {
105 node.custom1 = *type;
115 node.custom1 = *type;
124 if constexpr (std::is_same_v<T, float3>) {
125 return float3(std::numeric_limits<float>::max());
128 return std::numeric_limits<T>::max();
133 if constexpr (std::is_same_v<T, float3>) {
134 return float3(std::numeric_limits<float>::lowest());
137 return std::numeric_limits<T>::lowest();
155 input_(std::move(input)),
156 group_index_(std::move(group_index)),
157 source_domain_(source_domain),
158 operation_(operation)
167 if (domain_size == 0) {
173 evaluator.
add(input_);
174 evaluator.
add(group_index_);
200 outputs[i] = results.
lookup(group_indices[i]);
221 outputs[i] = results.
lookup(group_indices[i]);
228 return attributes.
adapt_domain(std::move(g_outputs), source_domain_, context.domain());
239 static constexpr int8_t id = 0;
242 hash.add(deep_hash_cache.
ensure(group_index_));
243 hash.add(source_domain_);
244 hash.add(operation_);
250 return source_domain_;
275 {
CD_PROP_FLOAT,
"FLOAT", ICON_NODE_SOCKET_FLOAT,
"Float",
"Floating-point value"},
276 {
CD_PROP_INT32,
"INT", ICON_NODE_SOCKET_INT,
"Integer",
"32-bit integer"},
279 ICON_NODE_SOCKET_VECTOR,
281 "3D vector with floating-point values"},
282 {0,
nullptr, 0,
nullptr,
nullptr},
288 "Type of data the outputs are calculated from",
299 int(AttrDomain::Point),
309 ntype.
ui_name =
"Field Min & Max";
310 ntype.
ui_description =
"Calculate the minimum and maximum of a given field";
#define NODE_CLASS_CONVERTER
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
void to_static_type(Fn &&fn) const
const CPPType & type() const
VArray< T > typed() const
const Value & lookup(const Key &key) const
Value & lookup_or_add(const Key &key, const Value &value)
IndexRange index_range() const
static VArray from_single(T value, const int64_t size)
static VArray from_container(ContainerT container)
GVArray adapt_domain(const GVArray &varray, const AttrDomain from_domain, const AttrDomain to_domain) const
int domain_size(const AttrDomain domain) const
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) const
static GField from_input(Args &&...args)
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
T extract_input(const UString identifier)
bool output_is_required(const UString identifier) const
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
void node_register_type(bNodeType &ntype)
T min(const T &a, const T &b)
T max(const T &a, const T &b)
static void node_init(bNodeTree *, bNode *node)
static void node_rna(StructRNA *srna)
static std::optional< eCustomDataType > node_type_from_other_socket(const bNodeSocket &socket)
static void node_register()
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_declare(NodeDeclarationBuilder &b)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_geo_exec(GeoNodeExecParams params)
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)
VecBase< float, 3 > float3
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
const EnumPropertyItem rna_enum_attribute_domain_items[]
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
nodes::NodeDeclaration * static_declaration
UniqueHash ensure(const GFieldRef &field)
static const T max_initial_value
static const T min_initial_value
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)