29 if (
node !=
nullptr) {
35 &
b.add_input<
decl::Vector>(
"Value"_ustr).default_value({1.0f, 1.0f, 1.0f});
38 value_declaration = &
b.add_input<
decl::Float>(
"Value"_ustr).default_value(1.0f);
41 value_declaration = &
b.add_input<
decl::Int>(
"Value"_ustr).default_value(1);
54 b.add_input<
decl::Int>(
"Group ID"_ustr,
"Group Index"_ustr)
57 .description(
"An index used to group values together for multiple separate accumulations");
59 if (
node !=
nullptr) {
61 b.add_output(data_type,
"Leading"_ustr)
62 .structure_type(StructureType::Field)
63 .propagate_references()
65 "The running total of values in the corresponding group, starting at the first value");
66 b.add_output(data_type,
"Trailing"_ustr)
67 .structure_type(StructureType::Field)
68 .propagate_references()
69 .description(
"The running total of values in the corresponding group, starting at zero");
70 b.add_output(data_type,
"Total"_ustr)
71 .structure_type(StructureType::Field)
72 .propagate_references()
73 .description(
"The total of all of the values in the corresponding group");
95 switch (socket.
type) {
126 node_storage(
node).data_type = *type;
134 node_storage(
node).data_type = *type;
142 node_storage(
node).data_type = *type;
152 node_storage(
node).data_type = *type;
161 if constexpr (std::is_same_v<T, float4x4>) {
171 if constexpr (std::is_same_v<T, float4x4>) {
193 input_(std::move(input)),
194 group_index_(std::move(group_index)),
195 source_domain_(source_domain),
196 accumulation_mode_(accumulation_mode)
205 if (domain_size == 0) {
211 evaluator.
add(input_);
212 evaluator.
add(group_index_);
228 outputs[i] = accumulation;
233 outputs[i] = accumulation;
245 outputs[i] = accumulation_value;
252 outputs[i] = accumulation_value;
261 return attributes.
adapt_domain(std::move(g_output), source_domain_, context.domain());
272 static constexpr int8_t id = 0;
275 hash.add(deep_hash_cache.
ensure(group_index_));
276 hash.add(source_domain_);
277 hash.add(accumulation_mode_);
283 return source_domain_;
296 input_(std::move(input)),
297 group_index_(std::move(group_index)),
298 source_domain_(source_domain)
307 if (domain_size == 0) {
313 evaluator.
add(input_);
314 evaluator.
add(group_index_);
339 outputs[i] = accumulations.
lookup(group_indices[i]);
345 return attributes.
adapt_domain(std::move(g_outputs), source_domain_, context.domain());
356 static constexpr int8_t id = 0;
359 hash.add(deep_hash_cache.
ensure(group_index_));
360 hash.add(source_domain_);
366 return source_domain_;
399 {
CD_PROP_FLOAT,
"FLOAT", ICON_NODE_SOCKET_FLOAT,
"Float",
"Add floating point values"},
400 {
CD_PROP_INT32,
"INT", ICON_NODE_SOCKET_INT,
"Integer",
"Add integer values"},
401 {
CD_PROP_FLOAT3,
"FLOAT_VECTOR", ICON_NODE_SOCKET_VECTOR,
"Vector",
"Add 3D vector values"},
404 ICON_NODE_SOCKET_MATRIX,
406 "Multiply transformation matrices"},
407 {0,
nullptr, 0,
nullptr,
nullptr},
413 "Type of data that is accumulated",
424 int(AttrDomain::Point),
433 ntype.
ui_name =
"Accumulate Field";
435 "Add the values of an evaluated field together and output the running total for each "
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_ACCUMULATE_FIELD
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
#define BLI_assert_unreachable()
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
BaseSocketDeclarationBuilder & structure_type(StructureType structure_type)
BaseSocketDeclarationBuilder & description(std::string value="")
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
StructureType structure_type
#define storage(slot, qualifiers)
void node_register_type(bNodeType &ntype)
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))
static void node_register()
static void node_declare(NodeDeclarationBuilder &b)
static void node_rna(StructRNA *srna)
static std::optional< eCustomDataType > node_type_from_other_socket(const bNodeSocket &socket)
static void node_init(bNodeTree *, bNode *node)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
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)
MatBase< float, 4, 4 > float4x4
BMesh const char void * data
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
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
static MatBase identity()
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
UniqueHash ensure(const GFieldRef &field)
static const T initial_value
static T accumulate(const T &a, const T &b)
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)