Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/attribute_access_intern.hh
| Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | bool foreach_attribute(const GeometryComponent &component, | ||||
| const AttributeForeachCallback callback) const final; | const AttributeForeachCallback callback) const final; | ||||
| void foreach_domain(const FunctionRef<void(AttributeDomain)> callback) const final; | void foreach_domain(const FunctionRef<void(AttributeDomain)> callback) const final; | ||||
| }; | }; | ||||
| /** | /** | ||||
| * This provider is used to provide access to builtin attributes. It supports making internal types | * This provider is used to provide access to builtin attributes. It supports making internal types | ||||
| * available as different types. For example, the vertex position attribute is stored as part of | * available as different types. For example, the vertex position attribute is stored as part of | ||||
| * the #MVert struct, but is exposed as float3 attribute. | * the #MVert struct, but is exposed as float3 attribute. | ||||
| * | |||||
| * It also supports named builtin attributes, and will look up attributes in #CustomData by name | |||||
| * if the stored type is the same as the attribute type. | |||||
| */ | */ | ||||
| class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider { | class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider { | ||||
| using AsReadAttribute = GVArrayPtr (*)(const void *data, const int domain_size); | using AsReadAttribute = GVArrayPtr (*)(const void *data, const int domain_size); | ||||
| using AsWriteAttribute = GVMutableArrayPtr (*)(void *data, const int domain_size); | using AsWriteAttribute = GVMutableArrayPtr (*)(void *data, const int domain_size); | ||||
| using UpdateOnRead = void (*)(const GeometryComponent &component); | using UpdateOnRead = void (*)(const GeometryComponent &component); | ||||
| using UpdateOnWrite = void (*)(GeometryComponent &component); | using UpdateOnWrite = void (*)(GeometryComponent &component); | ||||
| const CustomDataType stored_type_; | const CustomDataType stored_type_; | ||||
| const CustomDataAccessInfo custom_data_access_; | const CustomDataAccessInfo custom_data_access_; | ||||
| const AsReadAttribute as_read_attribute_; | const AsReadAttribute as_read_attribute_; | ||||
| const AsWriteAttribute as_write_attribute_; | const AsWriteAttribute as_write_attribute_; | ||||
| const UpdateOnWrite update_on_write_; | const UpdateOnWrite update_on_write_; | ||||
| bool stored_as_named_attribute_; | |||||
| public: | public: | ||||
| BuiltinCustomDataLayerProvider(std::string attribute_name, | BuiltinCustomDataLayerProvider(std::string attribute_name, | ||||
| const AttributeDomain domain, | const AttributeDomain domain, | ||||
| const CustomDataType attribute_type, | const CustomDataType attribute_type, | ||||
| const CustomDataType stored_type, | const CustomDataType stored_type, | ||||
| const CreatableEnum creatable, | const CreatableEnum creatable, | ||||
| const WritableEnum writable, | const WritableEnum writable, | ||||
| const DeletableEnum deletable, | const DeletableEnum deletable, | ||||
| const CustomDataAccessInfo custom_data_access, | const CustomDataAccessInfo custom_data_access, | ||||
| const AsReadAttribute as_read_attribute, | const AsReadAttribute as_read_attribute, | ||||
| const AsWriteAttribute as_write_attribute, | const AsWriteAttribute as_write_attribute, | ||||
| const UpdateOnWrite update_on_write) | const UpdateOnWrite update_on_write) | ||||
| : BuiltinAttributeProvider( | : BuiltinAttributeProvider( | ||||
| std::move(attribute_name), domain, attribute_type, creatable, writable, deletable), | std::move(attribute_name), domain, attribute_type, creatable, writable, deletable), | ||||
| stored_type_(stored_type), | stored_type_(stored_type), | ||||
| custom_data_access_(custom_data_access), | custom_data_access_(custom_data_access), | ||||
| as_read_attribute_(as_read_attribute), | as_read_attribute_(as_read_attribute), | ||||
| as_write_attribute_(as_write_attribute), | as_write_attribute_(as_write_attribute), | ||||
| update_on_write_(update_on_write) | update_on_write_(update_on_write), | ||||
| stored_as_named_attribute_(data_type_ == stored_type_) | |||||
| { | { | ||||
| } | } | ||||
| GVArrayPtr try_get_for_read(const GeometryComponent &component) const final; | GVArrayPtr try_get_for_read(const GeometryComponent &component) const final; | ||||
| GVMutableArrayPtr try_get_for_write(GeometryComponent &component) const final; | GVMutableArrayPtr try_get_for_write(GeometryComponent &component) const final; | ||||
| bool try_delete(GeometryComponent &component) const final; | bool try_delete(GeometryComponent &component) const final; | ||||
| bool try_create(GeometryComponent &component, const AttributeInit &initializer) const final; | bool try_create(GeometryComponent &component, const AttributeInit &initializer) const final; | ||||
| bool exists(const GeometryComponent &component) const final; | bool exists(const GeometryComponent &component) const final; | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||