Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/attribute_access_intern.hh
| Show First 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | public: | ||||
| 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; | ||||
| }; | }; | ||||
| /** | /** | ||||
| * 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 | |||||
| * the #MVert struct, but is exposed as float3 attribute. | |||||
| */ | |||||
| class BuiltinNamedCustomDataLayerProvider final : public BuiltinAttributeProvider { | |||||
| using AsReadAttribute = GVArrayPtr (*)(const void *data, const int domain_size); | |||||
| using AsWriteAttribute = GVMutableArrayPtr (*)(void *data, const int domain_size); | |||||
| using UpdateOnRead = void (*)(const GeometryComponent &component); | |||||
| using UpdateOnWrite = void (*)(GeometryComponent &component); | |||||
| const CustomDataAccessInfo custom_data_access_; | |||||
| const AsReadAttribute as_read_attribute_; | |||||
| const AsWriteAttribute as_write_attribute_; | |||||
| const UpdateOnWrite update_on_write_; | |||||
| public: | |||||
| BuiltinNamedCustomDataLayerProvider(std::string attribute_name, | |||||
| const AttributeDomain domain, | |||||
| const CustomDataType attribute_type, | |||||
| const CreatableEnum creatable, | |||||
| const DeletableEnum deletable, | |||||
| const CustomDataAccessInfo custom_data_access, | |||||
| const AsReadAttribute as_read_attribute, | |||||
| const AsWriteAttribute as_write_attribute, | |||||
| const UpdateOnWrite update_on_write) | |||||
| : BuiltinAttributeProvider(std::move(attribute_name), | |||||
| domain, | |||||
| attribute_type, | |||||
| creatable, | |||||
| WritableEnum::Writable, | |||||
| deletable), | |||||
| custom_data_access_(custom_data_access), | |||||
| as_read_attribute_(as_read_attribute), | |||||
| as_write_attribute_(as_write_attribute), | |||||
| update_on_write_(update_on_write) | |||||
| { | |||||
| } | |||||
| GVArrayPtr try_get_for_read(const GeometryComponent &component) const final; | |||||
| GVMutableArrayPtr try_get_for_write(GeometryComponent &component) const final; | |||||
| bool try_delete(GeometryComponent &component) const final; | |||||
| bool try_create(GeometryComponent &component, const AttributeInit &initializer) const final; | |||||
| bool exists(const GeometryComponent &component) const final; | |||||
| }; | |||||
| /** | |||||
| * This is a container for multiple attribute providers that are used by one geometry component | * This is a container for multiple attribute providers that are used by one geometry component | ||||
| * type (e.g. there is a set of attribute providers for mesh components). | * type (e.g. there is a set of attribute providers for mesh components). | ||||
| */ | */ | ||||
| class ComponentAttributeProviders { | class ComponentAttributeProviders { | ||||
| private: | private: | ||||
| /** | /** | ||||
| * Builtin attribute providers are identified by their name. Attribute names that are in this | * Builtin attribute providers are identified by their name. Attribute names that are in this | ||||
| * map will only be accessed using builtin attribute providers. Therefore, these providers have | * map will only be accessed using builtin attribute providers. Therefore, these providers have | ||||
| ▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines | |||||