59 :
name_(std::move(name)),
72 virtual bool exists(
const void *owner)
const = 0;
110 UNUSED_VARS(owner, attribute_id, domain, data_type, initializer);
135 : domain_(domain), custom_data_access_(custom_data_access)
162 return ((1ULL << data_type) & supported_types_mask) != 0;
174 using UpdateOnChange = void (*)(
void *owner);
176 const UpdateOnChange update_on_change_;
184 const UpdateOnChange update_on_change,
189 custom_data_access_(custom_data_access),
190 update_on_change_(update_on_change)
197 bool try_create(
void *owner,
const AttributeInit &initializer)
const final;
198 bool exists(
const void *owner)
const final;
201 bool layer_exists(
const CustomData &custom_data)
const;
234 builtin_attribute_providers_.
add_new(provider->name(), provider);
235 supported_domains_.
add(provider->domain());
238 provider->foreach_domain([&](
AttrDomain domain) { supported_domains_.
add(domain); });
244 return builtin_attribute_providers_;
249 return dynamic_attribute_providers_;
254 return supported_domains_;
258namespace attribute_accessor_functions {
260template<const ComponentAttributeProv
iders &prov
iders>
267 return providers.builtin_attribute_providers().contains_as(name);
270template<const ComponentAttributeProv
iders &prov
iders>
276 providers.builtin_attribute_providers().lookup_default_as(name,
nullptr))
278 return provider->try_get_for_read(owner);
282 GAttributeReader attribute = provider->try_get_for_read(owner, attribute_id);
290template<const ComponentAttributeProv
iders &prov
iders>
298 if (provider->exists(owner)) {
299 const auto get_fn = [&]() {
return provider->try_get_for_read(owner); };
300 AttributeIter iter{provider->
name(), provider->domain(), provider->data_type(), get_fn};
301 iter.is_builtin =
true;
302 iter.accessor = &accessor;
304 if (iter.is_stopped()) {
307 handled_attribute_ids.
add(iter.name);
311 const bool continue_loop = provider->foreach_attribute(owner, [&](
const AttributeIter &iter) {
312 if (handled_attribute_ids.
add(iter.
name)) {
317 if (!continue_loop) {
323template<const ComponentAttributeProv
iders &prov
iders>
331 providers.builtin_attribute_providers().lookup_default_as(attribute_id,
nullptr);
338template<const ComponentAttributeProv
iders &prov
iders>
344 providers.builtin_attribute_providers().lookup_default_as(name,
nullptr))
346 return provider->try_get_for_write(owner);
350 GAttributeWriter attribute = provider->try_get_for_write(owner, attribute_id);
358template<const ComponentAttributeProv
iders &prov
iders>
364 providers.builtin_attribute_providers().lookup_default_as(name,
nullptr))
366 return provider->try_delete(owner);
370 if (provider->try_delete(owner, attribute_id)) {
377template<const ComponentAttributeProv
iders &prov
iders>
378inline bool add(
void *owner,
387 providers.builtin_attribute_providers().lookup_default_as(name,
nullptr))
389 if (provider->domain() != domain) {
392 if (provider->data_type() != data_type) {
395 return provider->try_create(owner, initializer);
399 if (provider->try_create(owner, attribute_id, domain, data_type, initializer)) {
406template<const ComponentAttributeProv
iders &prov
iders>
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
void add_new(const Key &key, const Value &value)
const AttributeAccessor * accessor
virtual bool try_delete(void *owner) const =0
AttrDomain domain() const
virtual bool try_create(void *onwer, const AttributeInit &initializer) const =0
virtual GAttributeReader try_get_for_read(const void *owner) const =0
const AttributeValidator validator_
const eCustomDataType data_type_
virtual GAttributeWriter try_get_for_write(void *owner) const =0
virtual bool exists(const void *owner) const =0
eCustomDataType data_type() const
const GPointer default_value_
AttributeValidator validator() const
StringRefNull name() const
const DeletableEnum deletable_
BuiltinAttributeProvider(std::string name, const AttrDomain domain, const eCustomDataType data_type, const DeletableEnum deletable, AttributeValidator validator={}, const GPointer default_value={})
GAttributeWriter try_get_for_write(void *owner) const final
bool try_create(void *owner, const AttributeInit &initializer) const final
bool try_delete(void *owner) const final
BuiltinCustomDataLayerProvider(std::string attribute_name, const AttrDomain domain, const eCustomDataType data_type, const DeletableEnum deletable, const CustomDataAccessInfo custom_data_access, const UpdateOnChange update_on_change, const AttributeValidator validator={}, const GPointer default_value={})
bool exists(const void *owner) const final
GAttributeReader try_get_for_read(const void *owner) const final
Span< const DynamicAttributesProvider * > dynamic_attribute_providers() const
const Map< std::string, const BuiltinAttributeProvider * > & builtin_attribute_providers() const
ComponentAttributeProviders(Span< const BuiltinAttributeProvider * > builtin_attribute_providers, Span< const DynamicAttributesProvider * > dynamic_attribute_providers)
Span< AttrDomain > supported_domains() const
GAttributeWriter try_get_for_write(void *owner, StringRef attribute_id) const final
CustomDataAttributeProvider(const AttrDomain domain, const CustomDataAccessInfo custom_data_access)
bool try_delete(void *owner, StringRef attribute_id) const final
GAttributeReader try_get_for_read(const void *owner, StringRef attribute_id) const final
bool foreach_attribute(const void *owner, FunctionRef< void(const AttributeIter &)> fn) const final
bool try_create(void *owner, StringRef attribute_id, AttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer) const final
void foreach_domain(const FunctionRef< void(AttrDomain)> callback) const final
virtual bool try_create(void *owner, const StringRef attribute_id, const AttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer) const
virtual GAttributeReader try_get_for_read(const void *owner, StringRef attribute_id) const =0
virtual GAttributeWriter try_get_for_write(void *owner, StringRef attribute_id) const =0
virtual bool try_delete(void *owner, StringRef attribute_id) const =0
virtual void foreach_domain(const FunctionRef< void(AttrDomain)> callback) const =0
virtual bool foreach_attribute(const void *owner, FunctionRef< void(const AttributeIter &)> fn) const =0
DEGForeachIDComponentCallback callback
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
AttributeAccessorFunctions accessor_functions_for_providers()
bool is_builtin(const void *, const StringRef attribute_id)
AttributeValidator lookup_validator(const void *, const blender::StringRef attribute_id)
bool remove(void *owner, const StringRef attribute_id)
GAttributeReader lookup(const void *owner, const StringRef attribute_id)
void foreach_attribute(const void *owner, const FunctionRef< void(const AttributeIter &)> fn, const AttributeAccessor &accessor)
GAttributeWriter lookup_for_write(void *owner, const StringRef attribute_id)
bool add(void *owner, const StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer)
bool attribute_name_is_anonymous(const StringRef name)
unsigned __int64 uint64_t
void(*)(void *owner) UpdateCustomDataPointers
CustomData *(*)(void *owner) CustomDataGetter
GetElementNum get_element_num
ConstCustomDataGetter get_const_custom_data
const CustomData *(*)(const void *owner) ConstCustomDataGetter
CustomDataGetter get_custom_data
int(*)(const void *owner) GetElementNum