diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-01 07:38:06 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-01 08:38:48 +0300 |
commit | 44bac4c8ccf19cb5941435115b8f89a9d14e9c23 (patch) | |
tree | 2bd7698ca3e1e382b078e274566dbad0ae82214c /source/blender/blenkernel/intern | |
parent | ca346d2176737b6aa296617452a8a6cacb7a970a (diff) |
Cleanup: use 'e' prefix for enum types
- CustomDataType -> eCustomDataType
- CustomDataMask -> eCustomDataMask
- AttributeDomain -> eAttrDomain
- NamedAttributeUsage -> eNamedAttrUsage
Diffstat (limited to 'source/blender/blenkernel/intern')
19 files changed, 192 insertions, 194 deletions
diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc index 584035ddb85..fedcfc5c721 100644 --- a/source/blender/blenkernel/intern/attribute.cc +++ b/source/blender/blenkernel/intern/attribute.cc @@ -183,7 +183,7 @@ bool BKE_id_attribute_calc_unique_name(ID *id, const char *name, char *outname) } CustomDataLayer *BKE_id_attribute_new( - ID *id, const char *name, const int type, const AttributeDomain domain, ReportList *reports) + ID *id, const char *name, const int type, const eAttrDomain domain, ReportList *reports) { DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); @@ -264,7 +264,7 @@ bool BKE_id_attribute_remove(ID *id, CustomDataLayer *layer, ReportList *reports CustomDataLayer *BKE_id_attribute_find(const ID *id, const char *name, const int type, - const AttributeDomain domain) + const eAttrDomain domain) { DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); @@ -286,14 +286,14 @@ CustomDataLayer *BKE_id_attribute_find(const ID *id, CustomDataLayer *BKE_id_attribute_search(const ID *id, const char *name, - const CustomDataMask type_mask, - const AttributeDomainMask domain_mask) + const eCustomDataMask type_mask, + const eAttrDomainMask domain_mask) { DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); - for (AttributeDomain domain = ATTR_DOMAIN_POINT; domain < ATTR_DOMAIN_NUM; - domain = static_cast<AttributeDomain>((static_cast<int>(domain)) + 1)) { + for (eAttrDomain domain = ATTR_DOMAIN_POINT; domain < ATTR_DOMAIN_NUM; + domain = static_cast<eAttrDomain>((static_cast<int>(domain)) + 1)) { if (!(domain_mask & ATTR_DOMAIN_AS_MASK(domain))) { continue; } @@ -314,7 +314,7 @@ CustomDataLayer *BKE_id_attribute_search(const ID *id, return NULL; } -int BKE_id_attributes_length(const ID *id, AttributeDomainMask domain_mask, CustomDataMask mask) +int BKE_id_attributes_length(const ID *id, eAttrDomainMask domain_mask, eCustomDataMask mask) { DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); @@ -332,7 +332,7 @@ int BKE_id_attributes_length(const ID *id, AttributeDomainMask domain_mask, Cust return length; } -AttributeDomain BKE_id_attribute_domain(const ID *id, const CustomDataLayer *layer) +eAttrDomain BKE_id_attribute_domain(const ID *id, const CustomDataLayer *layer) { DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); @@ -341,12 +341,12 @@ AttributeDomain BKE_id_attribute_domain(const ID *id, const CustomDataLayer *lay CustomData *customdata = info[domain].customdata; if (customdata && ARRAY_HAS_ITEM((CustomDataLayer *)layer, customdata->layers, customdata->totlayer)) { - return static_cast<AttributeDomain>(domain); + return static_cast<eAttrDomain>(domain); } } BLI_assert_msg(0, "Custom data layer not found in geometry"); - return static_cast<AttributeDomain>(ATTR_DOMAIN_POINT); + return static_cast<eAttrDomain>(ATTR_DOMAIN_POINT); } int BKE_id_attribute_data_length(ID *id, CustomDataLayer *layer) @@ -489,8 +489,8 @@ CustomData *BKE_id_attributes_iterator_next_domain(ID *id, CustomDataLayer *laye CustomDataLayer *BKE_id_attribute_from_index(ID *id, int lookup_index, - AttributeDomainMask domain_mask, - CustomDataMask layer_mask) + eAttrDomainMask domain_mask, + eCustomDataMask layer_mask) { DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); @@ -523,27 +523,27 @@ CustomDataLayer *BKE_id_attribute_from_index(ID *id, /** Get list of domain types but with ATTR_DOMAIN_FACE and * ATTR_DOMAIN_CORNER swapped. */ -static void get_domains_types(AttributeDomain domains[ATTR_DOMAIN_NUM]) +static void get_domains_types(eAttrDomain domains[ATTR_DOMAIN_NUM]) { for (const int i : IndexRange(ATTR_DOMAIN_NUM)) { - domains[i] = static_cast<AttributeDomain>(i); + domains[i] = static_cast<eAttrDomain>(i); } /* Swap corner and face. */ - SWAP(AttributeDomain, domains[ATTR_DOMAIN_FACE], domains[ATTR_DOMAIN_CORNER]); + SWAP(eAttrDomain, domains[ATTR_DOMAIN_FACE], domains[ATTR_DOMAIN_CORNER]); } int BKE_id_attribute_to_index(const ID *id, const CustomDataLayer *layer, - AttributeDomainMask domain_mask, - CustomDataMask layer_mask) + eAttrDomainMask domain_mask, + eCustomDataMask layer_mask) { if (!layer) { return -1; } DomainInfo info[ATTR_DOMAIN_NUM]; - AttributeDomain domains[ATTR_DOMAIN_NUM]; + eAttrDomain domains[ATTR_DOMAIN_NUM]; get_domains_types(domains); get_domains(id, info); @@ -575,11 +575,11 @@ int BKE_id_attribute_to_index(const ID *id, CustomDataLayer *BKE_id_attribute_subset_active_get(const ID *id, int active_flag, - AttributeDomainMask domain_mask, - CustomDataMask mask) + eAttrDomainMask domain_mask, + eCustomDataMask mask) { DomainInfo info[ATTR_DOMAIN_NUM]; - AttributeDomain domains[ATTR_DOMAIN_NUM]; + eAttrDomain domains[ATTR_DOMAIN_NUM]; get_domains_types(domains); get_domains(id, info); @@ -613,17 +613,17 @@ CustomDataLayer *BKE_id_attribute_subset_active_get(const ID *id, void BKE_id_attribute_subset_active_set(ID *id, CustomDataLayer *layer, int active_flag, - AttributeDomainMask domain_mask, - CustomDataMask mask) + eAttrDomainMask domain_mask, + eCustomDataMask mask) { DomainInfo info[ATTR_DOMAIN_NUM]; - AttributeDomain domains[ATTR_DOMAIN_NUM]; + eAttrDomain domains[ATTR_DOMAIN_NUM]; get_domains_types(domains); get_domains(id, info); for (int i = 0; i < ATTR_DOMAIN_NUM; i++) { - AttributeDomainMask domain_mask2 = (AttributeDomainMask)(1 << domains[i]); + eAttrDomainMask domain_mask2 = (eAttrDomainMask)(1 << domains[i]); if (!(domain_mask2 & domain_mask) || !info[domains[i]].customdata) { continue; diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index e487bf4acf6..bc146d87e4c 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -63,7 +63,7 @@ bool allow_procedural_attribute_access(StringRef attribute_name) return !attribute_name.startswith(".selection"); } -static int attribute_data_type_complexity(const CustomDataType data_type) +static int attribute_data_type_complexity(const eCustomDataType data_type) { switch (data_type) { case CD_PROP_BOOL: @@ -93,12 +93,12 @@ static int attribute_data_type_complexity(const CustomDataType data_type) } } -CustomDataType attribute_data_type_highest_complexity(Span<CustomDataType> data_types) +eCustomDataType attribute_data_type_highest_complexity(Span<eCustomDataType> data_types) { int highest_complexity = INT_MIN; - CustomDataType most_complex_type = CD_PROP_COLOR; + eCustomDataType most_complex_type = CD_PROP_COLOR; - for (const CustomDataType data_type : data_types) { + for (const eCustomDataType data_type : data_types) { const int complexity = attribute_data_type_complexity(data_type); if (complexity > highest_complexity) { highest_complexity = complexity; @@ -113,7 +113,7 @@ CustomDataType attribute_data_type_highest_complexity(Span<CustomDataType> data_ * \note Generally the order should mirror the order of the domains * established in each component's ComponentAttributeProviders. */ -static int attribute_domain_priority(const AttributeDomain domain) +static int attribute_domain_priority(const eAttrDomain domain) { switch (domain) { case ATTR_DOMAIN_INSTANCE: @@ -135,12 +135,12 @@ static int attribute_domain_priority(const AttributeDomain domain) } } -AttributeDomain attribute_domain_highest_priority(Span<AttributeDomain> domains) +eAttrDomain attribute_domain_highest_priority(Span<eAttrDomain> domains) { int highest_priority = INT_MIN; - AttributeDomain highest_priority_domain = ATTR_DOMAIN_CORNER; + eAttrDomain highest_priority_domain = ATTR_DOMAIN_CORNER; - for (const AttributeDomain domain : domains) { + for (const eAttrDomain domain : domains) { const int priority = attribute_domain_priority(domain); if (priority > highest_priority) { highest_priority = priority; @@ -191,7 +191,7 @@ static AttributeIDRef attribute_id_from_custom_data_layer(const CustomDataLayer } static bool add_builtin_type_custom_data_layer_from_init(CustomData &custom_data, - const CustomDataType data_type, + const eCustomDataType data_type, const int domain_num, const AttributeInit &initializer) { @@ -226,7 +226,7 @@ static bool add_builtin_type_custom_data_layer_from_init(CustomData &custom_data } static void *add_generic_custom_data_layer(CustomData &custom_data, - const CustomDataType data_type, + const eCustomDataType data_type, const eCDAllocType alloctype, void *layer_data, const int domain_num, @@ -245,7 +245,7 @@ static void *add_generic_custom_data_layer(CustomData &custom_data, static bool add_custom_data_layer_from_attribute_init(const AttributeIDRef &attribute_id, CustomData &custom_data, - const CustomDataType data_type, + const eCustomDataType data_type, const int domain_num, const AttributeInit &initializer) { @@ -459,7 +459,7 @@ ReadAttributeLookup CustomDataAttributeProvider::try_get_for_read( if (!custom_data_layer_matches_attribute_id(layer, attribute_id)) { continue; } - const CPPType *type = custom_data_type_to_cpp_type((CustomDataType)layer.type); + const CPPType *type = custom_data_type_to_cpp_type((eCustomDataType)layer.type); if (type == nullptr) { continue; } @@ -488,7 +488,7 @@ WriteAttributeLookup CustomDataAttributeProvider::try_get_for_write( CustomData_duplicate_referenced_layer_anonymous( custom_data, layer.type, &attribute_id.anonymous_id(), domain_num); } - const CPPType *type = custom_data_type_to_cpp_type((CustomDataType)layer.type); + const CPPType *type = custom_data_type_to_cpp_type((eCustomDataType)layer.type); if (type == nullptr) { continue; } @@ -508,7 +508,7 @@ bool CustomDataAttributeProvider::try_delete(GeometryComponent &component, const int domain_num = component.attribute_domain_num(domain_); for (const int i : IndexRange(custom_data->totlayer)) { const CustomDataLayer &layer = custom_data->layers[i]; - if (this->type_is_supported((CustomDataType)layer.type) && + if (this->type_is_supported((eCustomDataType)layer.type) && custom_data_layer_matches_attribute_id(layer, attribute_id)) { CustomData_free_layer(custom_data, layer.type, domain_num, i); return true; @@ -519,8 +519,8 @@ bool CustomDataAttributeProvider::try_delete(GeometryComponent &component, bool CustomDataAttributeProvider::try_create(GeometryComponent &component, const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type, + const eAttrDomain domain, + const eCustomDataType data_type, const AttributeInit &initializer) const { if (domain_ != domain) { @@ -552,7 +552,7 @@ bool CustomDataAttributeProvider::foreach_attribute(const GeometryComponent &com return true; } for (const CustomDataLayer &layer : Span(custom_data->layers, custom_data->totlayer)) { - const CustomDataType data_type = (CustomDataType)layer.type; + const eCustomDataType data_type = (eCustomDataType)layer.type; if (this->type_is_supported(data_type)) { AttributeMetaData meta_data{domain_, data_type}; const AttributeIDRef attribute_id = attribute_id_from_custom_data_layer(layer); @@ -650,7 +650,7 @@ bool NamedLegacyCustomDataProvider::foreach_attribute( } void NamedLegacyCustomDataProvider::foreach_domain( - const FunctionRef<void(AttributeDomain)> callback) const + const FunctionRef<void(eAttrDomain)> callback) const { callback(domain_); } @@ -693,7 +693,7 @@ std::optional<GSpan> CustomDataAttributes::get_for_read(const AttributeIDRef &at { for (const CustomDataLayer &layer : Span(data.layers, data.totlayer)) { if (custom_data_layer_matches_attribute_id(layer, attribute_id)) { - const CPPType *cpp_type = custom_data_type_to_cpp_type((CustomDataType)layer.type); + const CPPType *cpp_type = custom_data_type_to_cpp_type((eCustomDataType)layer.type); BLI_assert(cpp_type != nullptr); return GSpan(*cpp_type, layer.data, size_); } @@ -702,7 +702,7 @@ std::optional<GSpan> CustomDataAttributes::get_for_read(const AttributeIDRef &at } GVArray CustomDataAttributes::get_for_read(const AttributeIDRef &attribute_id, - const CustomDataType data_type, + const eCustomDataType data_type, const void *default_value) const { const CPPType *type = blender::bke::custom_data_type_to_cpp_type(data_type); @@ -726,7 +726,7 @@ std::optional<GMutableSpan> CustomDataAttributes::get_for_write(const AttributeI { for (CustomDataLayer &layer : MutableSpan(data.layers, data.totlayer)) { if (custom_data_layer_matches_attribute_id(layer, attribute_id)) { - const CPPType *cpp_type = custom_data_type_to_cpp_type((CustomDataType)layer.type); + const CPPType *cpp_type = custom_data_type_to_cpp_type((eCustomDataType)layer.type); BLI_assert(cpp_type != nullptr); return GMutableSpan(*cpp_type, layer.data, size_); } @@ -735,7 +735,7 @@ std::optional<GMutableSpan> CustomDataAttributes::get_for_write(const AttributeI } bool CustomDataAttributes::create(const AttributeIDRef &attribute_id, - const CustomDataType data_type) + const eCustomDataType data_type) { void *result = add_generic_custom_data_layer( data, data_type, CD_DEFAULT, nullptr, size_, attribute_id); @@ -743,7 +743,7 @@ bool CustomDataAttributes::create(const AttributeIDRef &attribute_id, } bool CustomDataAttributes::create_by_move(const AttributeIDRef &attribute_id, - const CustomDataType data_type, + const eCustomDataType data_type, void *buffer) { void *result = add_generic_custom_data_layer( @@ -776,10 +776,10 @@ void CustomDataAttributes::clear() } bool CustomDataAttributes::foreach_attribute(const AttributeForeachCallback callback, - const AttributeDomain domain) const + const eAttrDomain domain) const { for (const CustomDataLayer &layer : Span(data.layers, data.totlayer)) { - AttributeMetaData meta_data{domain, (CustomDataType)layer.type}; + AttributeMetaData meta_data{domain, (eCustomDataType)layer.type}; const AttributeIDRef attribute_id = attribute_id_from_custom_data_layer(layer); if (!callback(attribute_id, meta_data)) { return false; @@ -819,7 +819,7 @@ const blender::bke::ComponentAttributeProviders *GeometryComponent::get_attribut return nullptr; } -bool GeometryComponent::attribute_domain_supported(const AttributeDomain domain) const +bool GeometryComponent::attribute_domain_supported(const eAttrDomain domain) const { using namespace blender::bke; const ComponentAttributeProviders *providers = this->get_attribute_providers(); @@ -829,7 +829,7 @@ bool GeometryComponent::attribute_domain_supported(const AttributeDomain domain) return providers->supported_domains().contains(domain); } -int GeometryComponent::attribute_domain_num(const AttributeDomain UNUSED(domain)) const +int GeometryComponent::attribute_domain_num(const eAttrDomain UNUSED(domain)) const { return 0; } @@ -877,8 +877,8 @@ blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read( blender::GVArray GeometryComponent::attribute_try_adapt_domain_impl( const blender::GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const + const eAttrDomain from_domain, + const eAttrDomain to_domain) const { if (from_domain == to_domain) { return varray; @@ -949,8 +949,8 @@ void GeometryComponent::attributes_remove_anonymous() } bool GeometryComponent::attribute_try_create(const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type, + const eAttrDomain domain, + const eCustomDataType data_type, const AttributeInit &initializer) { using namespace blender::bke; @@ -1087,8 +1087,8 @@ static blender::GVArray try_adapt_data_type(blender::GVArray varray, blender::GVArray GeometryComponent::attribute_try_get_for_read( const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type) const + const eAttrDomain domain, + const eCustomDataType data_type) const { blender::bke::ReadAttributeLookup attribute = this->attribute_try_get_for_read(attribute_id); if (!attribute) { @@ -1116,7 +1116,7 @@ blender::GVArray GeometryComponent::attribute_try_get_for_read( } blender::GVArray GeometryComponent::attribute_try_get_for_read(const AttributeIDRef &attribute_id, - const AttributeDomain domain) const + const eAttrDomain domain) const { if (!this->attribute_domain_supported(domain)) { return {}; @@ -1135,7 +1135,7 @@ blender::GVArray GeometryComponent::attribute_try_get_for_read(const AttributeID } blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read( - const AttributeIDRef &attribute_id, const CustomDataType data_type) const + const AttributeIDRef &attribute_id, const eCustomDataType data_type) const { blender::bke::ReadAttributeLookup attribute = this->attribute_try_get_for_read(attribute_id); if (!attribute) { @@ -1152,8 +1152,8 @@ blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read( } blender::GVArray GeometryComponent::attribute_get_for_read(const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type, + const eAttrDomain domain, + const eCustomDataType data_type, const void *default_value) const { blender::GVArray varray = this->attribute_try_get_for_read(attribute_id, domain, data_type); @@ -1214,8 +1214,8 @@ static void save_output_attribute(OutputAttribute &output_attribute) else { attribute_id = varray.anonymous_attribute_id.extract(); } - const AttributeDomain domain = output_attribute.domain(); - const CustomDataType data_type = output_attribute.custom_data_type(); + const eAttrDomain domain = output_attribute.domain(); + const eCustomDataType data_type = output_attribute.custom_data_type(); const CPPType &cpp_type = output_attribute.cpp_type(); component.attribute_try_delete(attribute_id); @@ -1252,8 +1252,8 @@ static std::function<void(OutputAttribute &)> get_simple_output_attribute_save_m static OutputAttribute create_output_attribute(GeometryComponent &component, const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type, + const eAttrDomain domain, + const eCustomDataType data_type, const bool ignore_old_values, const void *default_value) { @@ -1358,17 +1358,15 @@ static OutputAttribute create_output_attribute(GeometryComponent &component, } OutputAttribute GeometryComponent::attribute_try_get_for_output(const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type, + const eAttrDomain domain, + const eCustomDataType data_type, const void *default_value) { return create_output_attribute(*this, attribute_id, domain, data_type, false, default_value); } OutputAttribute GeometryComponent::attribute_try_get_for_output_only( - const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type) + const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type) { return create_output_attribute(*this, attribute_id, domain, data_type, true, nullptr); } @@ -1382,17 +1380,17 @@ GVArray GeometryFieldInput::get_varray_for_context(const fn::FieldContext &conte if (const GeometryComponentFieldContext *geometry_context = dynamic_cast<const GeometryComponentFieldContext *>(&context)) { const GeometryComponent &component = geometry_context->geometry_component(); - const AttributeDomain domain = geometry_context->domain(); + const eAttrDomain domain = geometry_context->domain(); return this->get_varray_for_context(component, domain, mask); } return {}; } GVArray AttributeFieldInput::get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + const eAttrDomain domain, IndexMask UNUSED(mask)) const { - const CustomDataType data_type = cpp_type_to_custom_data_type(*type_); + const eCustomDataType data_type = cpp_type_to_custom_data_type(*type_); return component.attribute_try_get_for_read(name_, domain, data_type); } @@ -1416,7 +1414,7 @@ bool AttributeFieldInput::is_equal_to(const fn::FieldNode &other) const return false; } -static StringRef get_random_id_attribute_name(const AttributeDomain domain) +static StringRef get_random_id_attribute_name(const eAttrDomain domain) { switch (domain) { case ATTR_DOMAIN_POINT: @@ -1428,7 +1426,7 @@ static StringRef get_random_id_attribute_name(const AttributeDomain domain) } GVArray IDAttributeFieldInput::get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + const eAttrDomain domain, IndexMask mask) const { @@ -1461,10 +1459,10 @@ bool IDAttributeFieldInput::is_equal_to(const fn::FieldNode &other) const } GVArray AnonymousAttributeFieldInput::get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + const eAttrDomain domain, IndexMask UNUSED(mask)) const { - const CustomDataType data_type = cpp_type_to_custom_data_type(*type_); + const eCustomDataType data_type = cpp_type_to_custom_data_type(*type_); return component.attribute_try_get_for_read(anonymous_id_.get(), domain, data_type); } diff --git a/source/blender/blenkernel/intern/attribute_access_intern.hh b/source/blender/blenkernel/intern/attribute_access_intern.hh index f0f47cb7a11..ac43754dd1a 100644 --- a/source/blender/blenkernel/intern/attribute_access_intern.hh +++ b/source/blender/blenkernel/intern/attribute_access_intern.hh @@ -47,16 +47,16 @@ class BuiltinAttributeProvider { protected: const std::string name_; - const AttributeDomain domain_; - const CustomDataType data_type_; + const eAttrDomain domain_; + const eCustomDataType data_type_; const CreatableEnum createable_; const WritableEnum writable_; const DeletableEnum deletable_; public: BuiltinAttributeProvider(std::string name, - const AttributeDomain domain, - const CustomDataType data_type, + const eAttrDomain domain, + const eCustomDataType data_type, const CreatableEnum createable, const WritableEnum writable, const DeletableEnum deletable) @@ -81,12 +81,12 @@ class BuiltinAttributeProvider { return name_; } - AttributeDomain domain() const + eAttrDomain domain() const { return domain_; } - CustomDataType data_type() const + eCustomDataType data_type() const { return data_type_; } @@ -106,8 +106,8 @@ class DynamicAttributesProvider { const AttributeIDRef &attribute_id) const = 0; virtual bool try_create(GeometryComponent &UNUSED(component), const AttributeIDRef &UNUSED(attribute_id), - const AttributeDomain UNUSED(domain), - const CustomDataType UNUSED(data_type), + const eAttrDomain UNUSED(domain), + const eCustomDataType UNUSED(data_type), const AttributeInit &UNUSED(initializer)) const { /* Some providers should not create new attributes. */ @@ -116,7 +116,7 @@ class DynamicAttributesProvider { virtual bool foreach_attribute(const GeometryComponent &component, const AttributeForeachCallback callback) const = 0; - virtual void foreach_domain(const FunctionRef<void(AttributeDomain)> callback) const = 0; + virtual void foreach_domain(const FunctionRef<void(eAttrDomain)> callback) const = 0; }; /** @@ -128,11 +128,11 @@ class CustomDataAttributeProvider final : public DynamicAttributesProvider { CD_MASK_PROP_FLOAT3 | CD_MASK_PROP_INT32 | CD_MASK_PROP_COLOR | CD_MASK_PROP_BOOL | CD_MASK_PROP_INT8 | CD_MASK_PROP_BYTE_COLOR; - const AttributeDomain domain_; + const eAttrDomain domain_; const CustomDataAccessInfo custom_data_access_; public: - CustomDataAttributeProvider(const AttributeDomain domain, + CustomDataAttributeProvider(const eAttrDomain domain, const CustomDataAccessInfo custom_data_access) : domain_(domain), custom_data_access_(custom_data_access) { @@ -148,20 +148,20 @@ class CustomDataAttributeProvider final : public DynamicAttributesProvider { bool try_create(GeometryComponent &component, const AttributeIDRef &attribute_id, - AttributeDomain domain, - const CustomDataType data_type, + eAttrDomain domain, + const eCustomDataType data_type, const AttributeInit &initializer) const final; bool foreach_attribute(const GeometryComponent &component, const AttributeForeachCallback callback) const final; - void foreach_domain(const FunctionRef<void(AttributeDomain)> callback) const final + void foreach_domain(const FunctionRef<void(eAttrDomain)> callback) const final { callback(domain_); } private: - bool type_is_supported(CustomDataType data_type) const + bool type_is_supported(eCustomDataType data_type) const { return ((1ULL << data_type) & supported_types_mask) != 0; } @@ -174,17 +174,17 @@ class NamedLegacyCustomDataProvider final : public DynamicAttributesProvider { private: using AsReadAttribute = GVArray (*)(const void *data, int domain_num); using AsWriteAttribute = GVMutableArray (*)(void *data, int domain_num); - const AttributeDomain domain_; - const CustomDataType attribute_type_; - const CustomDataType stored_type_; + const eAttrDomain domain_; + const eCustomDataType attribute_type_; + const eCustomDataType stored_type_; const CustomDataAccessInfo custom_data_access_; const AsReadAttribute as_read_attribute_; const AsWriteAttribute as_write_attribute_; public: - NamedLegacyCustomDataProvider(const AttributeDomain domain, - const CustomDataType attribute_type, - const CustomDataType stored_type, + NamedLegacyCustomDataProvider(const eAttrDomain domain, + const eCustomDataType attribute_type, + const eCustomDataType stored_type, const CustomDataAccessInfo custom_data_access, const AsReadAttribute as_read_attribute, const AsWriteAttribute as_write_attribute) @@ -204,7 +204,7 @@ class NamedLegacyCustomDataProvider final : public DynamicAttributesProvider { bool try_delete(GeometryComponent &component, const AttributeIDRef &attribute_id) const final; bool foreach_attribute(const GeometryComponent &component, const AttributeForeachCallback callback) const final; - void foreach_domain(const FunctionRef<void(AttributeDomain)> callback) const final; + void foreach_domain(const FunctionRef<void(eAttrDomain)> callback) const final; }; template<typename T> GVArray make_array_read_attribute(const void *data, const int domain_num) @@ -230,7 +230,7 @@ class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider { using AsWriteAttribute = GVMutableArray (*)(void *data, int domain_num); using UpdateOnRead = void (*)(const GeometryComponent &component); using UpdateOnWrite = void (*)(GeometryComponent &component); - const CustomDataType stored_type_; + const eCustomDataType stored_type_; const CustomDataAccessInfo custom_data_access_; const AsReadAttribute as_read_attribute_; const AsWriteAttribute as_write_attribute_; @@ -239,9 +239,9 @@ class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider { public: BuiltinCustomDataLayerProvider(std::string attribute_name, - const AttributeDomain domain, - const CustomDataType attribute_type, - const CustomDataType stored_type, + const eAttrDomain domain, + const eCustomDataType attribute_type, + const eCustomDataType stored_type, const CreatableEnum creatable, const WritableEnum writable, const DeletableEnum deletable, @@ -288,7 +288,7 @@ class ComponentAttributeProviders { /** * All the domains that are supported by at least one of the providers above. */ - VectorSet<AttributeDomain> supported_domains_; + VectorSet<eAttrDomain> supported_domains_; public: ComponentAttributeProviders(Span<const BuiltinAttributeProvider *> builtin_attribute_providers, @@ -301,7 +301,7 @@ class ComponentAttributeProviders { supported_domains_.add(provider->domain()); } for (const DynamicAttributesProvider *provider : dynamic_attribute_providers) { - provider->foreach_domain([&](AttributeDomain domain) { supported_domains_.add(domain); }); + provider->foreach_domain([&](eAttrDomain domain) { supported_domains_.add(domain); }); } } @@ -315,7 +315,7 @@ class ComponentAttributeProviders { return dynamic_attribute_providers_; } - Span<AttributeDomain> supported_domains() const + Span<eAttrDomain> supported_domains() const { return supported_domains_; } diff --git a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc index 0cd324cfe2c..58380a1a35f 100644 --- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc +++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc @@ -315,8 +315,8 @@ static ResultOffsets calculate_result_offsets(const CurvesInfo &info, const bool return result; } -static AttributeDomain get_attribute_domain_for_mesh(const MeshComponent &mesh, - const AttributeIDRef &attribute_id) +static eAttrDomain get_attribute_domain_for_mesh(const MeshComponent &mesh, + const AttributeIDRef &attribute_id) { /* Only use a different domain if it is builtin and must only exist on one domain. */ if (!mesh.attribute_is_builtin(attribute_id)) { @@ -456,7 +456,7 @@ static void copy_main_point_data_to_mesh_faces(const Span<T> src, static void copy_main_point_domain_attribute_to_mesh(const CurvesInfo &curves_info, const ResultOffsets &offsets, - const AttributeDomain dst_domain, + const eAttrDomain dst_domain, const GSpan src_all, GMutableSpan dst_all) { @@ -538,7 +538,7 @@ static void copy_profile_point_data_to_mesh_faces(const Span<T> src, static void copy_profile_point_domain_attribute_to_mesh(const CurvesInfo &curves_info, const ResultOffsets &offsets, - const AttributeDomain dst_domain, + const eAttrDomain dst_domain, const GSpan src_all, GMutableSpan dst_all) { @@ -597,7 +597,7 @@ static void copy_indices_to_offset_ranges(const VArray<T> &src, static void copy_curve_domain_attribute_to_mesh(const ResultOffsets &mesh_offsets, const Span<int> curve_indices, - const AttributeDomain dst_domain, + const eAttrDomain dst_domain, const GVArray &src, GMutableSpan dst) { @@ -728,11 +728,11 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main, } main_attributes.add_new(id); - const AttributeDomain src_domain = meta_data.domain; - const CustomDataType type = meta_data.data_type; + const eAttrDomain src_domain = meta_data.domain; + const eCustomDataType type = meta_data.data_type; GVArray src = main_component.attribute_try_get_for_read(id, src_domain, type); - const AttributeDomain dst_domain = get_attribute_domain_for_mesh(mesh_component, id); + const eAttrDomain dst_domain = get_attribute_domain_for_mesh(mesh_component, id); OutputAttribute dst = mesh_component.attribute_try_get_for_output_only(id, dst_domain, type); if (!dst) { return true; @@ -763,11 +763,11 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main, if (!should_add_attribute_to_mesh(profile_component, mesh_component, id)) { return true; } - const AttributeDomain src_domain = meta_data.domain; - const CustomDataType type = meta_data.data_type; + const eAttrDomain src_domain = meta_data.domain; + const eCustomDataType type = meta_data.data_type; GVArray src = profile_component.attribute_try_get_for_read(id, src_domain, type); - const AttributeDomain dst_domain = get_attribute_domain_for_mesh(mesh_component, id); + const eAttrDomain dst_domain = get_attribute_domain_for_mesh(mesh_component, id); OutputAttribute dst = mesh_component.attribute_try_get_for_output_only(id, dst_domain, type); if (!dst) { return true; diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index 07e50eea88c..c2e67d853c9 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -160,30 +160,29 @@ CurvesGeometry::~CurvesGeometry() /** \name Accessors * \{ */ -static int domain_num(const CurvesGeometry &curves, const AttributeDomain domain) +static int domain_num(const CurvesGeometry &curves, const eAttrDomain domain) { return domain == ATTR_DOMAIN_POINT ? curves.points_num() : curves.curves_num(); } -static CustomData &domain_custom_data(CurvesGeometry &curves, const AttributeDomain domain) +static CustomData &domain_custom_data(CurvesGeometry &curves, const eAttrDomain domain) { return domain == ATTR_DOMAIN_POINT ? curves.point_data : curves.curve_data; } -static const CustomData &domain_custom_data(const CurvesGeometry &curves, - const AttributeDomain domain) +static const CustomData &domain_custom_data(const CurvesGeometry &curves, const eAttrDomain domain) { return domain == ATTR_DOMAIN_POINT ? curves.point_data : curves.curve_data; } template<typename T> static VArray<T> get_varray_attribute(const CurvesGeometry &curves, - const AttributeDomain domain, + const eAttrDomain domain, const StringRefNull name, const T default_value) { const int num = domain_num(curves, domain); - const CustomDataType type = cpp_type_to_custom_data_type(CPPType::get<T>()); + const eCustomDataType type = cpp_type_to_custom_data_type(CPPType::get<T>()); const CustomData &custom_data = domain_custom_data(curves, domain); const T *data = (const T *)CustomData_get_layer_named(&custom_data, type, name.c_str()); @@ -195,12 +194,12 @@ static VArray<T> get_varray_attribute(const CurvesGeometry &curves, template<typename T> static Span<T> get_span_attribute(const CurvesGeometry &curves, - const AttributeDomain domain, + const eAttrDomain domain, const StringRefNull name) { const int num = domain_num(curves, domain); const CustomData &custom_data = domain_custom_data(curves, domain); - const CustomDataType type = cpp_type_to_custom_data_type(CPPType::get<T>()); + const eCustomDataType type = cpp_type_to_custom_data_type(CPPType::get<T>()); T *data = (T *)CustomData_get_layer_named(&custom_data, type, name.c_str()); if (data == nullptr) { @@ -211,12 +210,12 @@ static Span<T> get_span_attribute(const CurvesGeometry &curves, template<typename T> static MutableSpan<T> get_mutable_attribute(CurvesGeometry &curves, - const AttributeDomain domain, + const eAttrDomain domain, const StringRefNull name, const T default_value = T()) { const int num = domain_num(curves, domain); - const CustomDataType type = cpp_type_to_custom_data_type(CPPType::get<T>()); + const eCustomDataType type = cpp_type_to_custom_data_type(CPPType::get<T>()); CustomData &custom_data = domain_custom_data(curves, domain); T *data = (T *)CustomData_duplicate_referenced_layer_named( @@ -1106,7 +1105,7 @@ void CurvesGeometry::update_customdata_pointers() static void *ensure_customdata_layer(CustomData &custom_data, const StringRefNull name, - const CustomDataType data_type, + const eCustomDataType data_type, const int tot_elements) { for (const int other_layer_i : IndexRange(custom_data.totlayer)) { @@ -1175,7 +1174,7 @@ static CurvesGeometry copy_with_removed_curves(const CurvesGeometry &curves, CustomData &new_point_data = new_curves.point_data; for (const int layer_i : IndexRange(old_point_data.totlayer)) { const CustomDataLayer &old_layer = old_point_data.layers[layer_i]; - const CustomDataType data_type = static_cast<CustomDataType>(old_layer.type); + const eCustomDataType data_type = static_cast<eCustomDataType>(old_layer.type); const CPPType &type = *bke::custom_data_type_to_cpp_type(data_type); const void *src_buffer = old_layer.data; @@ -1202,7 +1201,7 @@ static CurvesGeometry copy_with_removed_curves(const CurvesGeometry &curves, CustomData &new_curve_data = new_curves.curve_data; for (const int layer_i : IndexRange(old_curve_data.totlayer)) { const CustomDataLayer &old_layer = old_curve_data.layers[layer_i]; - const CustomDataType data_type = static_cast<CustomDataType>(old_layer.type); + const eCustomDataType data_type = static_cast<eCustomDataType>(old_layer.type); const CPPType &type = *bke::custom_data_type_to_cpp_type(data_type); const void *src_buffer = old_layer.data; @@ -1268,7 +1267,7 @@ static void reverse_swap_curve_point_data(const CurvesGeometry &curves, static bool layer_matches_name_and_type(const CustomDataLayer &layer, const StringRef name, - const CustomDataType type) + const eCustomDataType type) { if (layer.type != type) { return false; @@ -1311,7 +1310,7 @@ void CurvesGeometry::reverse_curves(const IndexMask curves_to_reverse) continue; } - const CustomDataType data_type = static_cast<CustomDataType>(layer.type); + const eCustomDataType data_type = static_cast<eCustomDataType>(layer.type); attribute_math::convert_to_static_type(data_type, [&](auto dummy) { using T = decltype(dummy); reverse_curve_point_data<T>( @@ -1430,8 +1429,8 @@ static GVArray adapt_curve_domain_curve_to_point(const CurvesGeometry &curves, } GVArray CurvesGeometry::adapt_domain(const GVArray &varray, - const AttributeDomain from, - const AttributeDomain to) const + const eAttrDomain from, + const eAttrDomain to) const { if (!varray) { return {}; diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 058230745e7..a63528835ee 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -2239,7 +2239,7 @@ static bool customdata_typemap_is_valid(const CustomData *data) bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, - CustomDataMask mask, + eCustomDataMask mask, eCDAllocType alloctype, int totelem) { @@ -2341,7 +2341,7 @@ void CustomData_realloc(CustomData *data, int totelem) void CustomData_copy(const struct CustomData *source, struct CustomData *dest, - CustomDataMask mask, + eCustomDataMask mask, eCDAllocType alloctype, int totelem) { @@ -2403,7 +2403,7 @@ void CustomData_free(CustomData *data, int totelem) CustomData_reset(data); } -void CustomData_free_typemask(struct CustomData *data, int totelem, CustomDataMask mask) +void CustomData_free_typemask(struct CustomData *data, int totelem, eCustomDataMask mask) { for (int i = 0; i < data->totlayer; i++) { CustomDataLayer *layer = &data->layers[i]; @@ -2934,7 +2934,7 @@ int CustomData_number_of_layers(const CustomData *data, int type) return number; } -int CustomData_number_of_layers_typemask(const CustomData *data, CustomDataMask mask) +int CustomData_number_of_layers_typemask(const CustomData *data, eCustomDataMask mask) { int number = 0; @@ -3077,7 +3077,7 @@ void CustomData_free_temporary(CustomData *data, int totelem) } } -void CustomData_set_only_copy(const struct CustomData *data, CustomDataMask mask) +void CustomData_set_only_copy(const struct CustomData *data, eCustomDataMask mask) { for (int i = 0; i < data->totlayer; i++) { if (!(mask & CD_TYPE_AS_MASK(data->layers[i].type))) { @@ -3692,7 +3692,7 @@ void CustomData_bmesh_init_pool(CustomData *data, int totelem, const char htype) bool CustomData_bmesh_merge(const CustomData *source, CustomData *dest, - CustomDataMask mask, + eCustomDataMask mask, eCDAllocType alloctype, BMesh *bm, const char htype) @@ -3841,7 +3841,7 @@ static void CustomData_bmesh_alloc_block(CustomData *data, void **block) void CustomData_bmesh_free_block_data_exclude_by_type(CustomData *data, void *block, - const CustomDataMask mask_exclude) + const eCustomDataMask mask_exclude) { if (block == nullptr) { return; @@ -3888,7 +3888,7 @@ void CustomData_bmesh_copy_data_exclude_by_type(const CustomData *source, CustomData *dest, void *src_block, void **dest_block, - const CustomDataMask mask_exclude) + const eCustomDataMask mask_exclude) { /* Note that having a version of this function without a 'mask_exclude' * would cause too much duplicate code, so add a check instead. */ @@ -4600,7 +4600,10 @@ static void customdata_external_filename(char filepath[FILE_MAX], BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(id)); } -void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem) +void CustomData_external_reload(CustomData *data, + ID *UNUSED(id), + eCustomDataMask mask, + int totelem) { for (int i = 0; i < data->totlayer; i++) { CustomDataLayer *layer = &data->layers[i]; @@ -4618,7 +4621,7 @@ void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask } } -void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int totelem) +void CustomData_external_read(CustomData *data, ID *id, eCustomDataMask mask, int totelem) { CustomDataExternal *external = data->external; CustomDataLayer *layer; @@ -4692,7 +4695,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int } void CustomData_external_write( - CustomData *data, ID *id, CustomDataMask mask, int totelem, int free) + CustomData *data, ID *id, eCustomDataMask mask, int totelem, int free) { CustomDataExternal *external = data->external; int update = 0; @@ -5183,7 +5186,7 @@ void CustomData_blend_write(BlendWriter *writer, CustomData *data, Span<CustomDataLayer> layers_to_write, int count, - CustomDataMask cddata_mask, + eCustomDataMask cddata_mask, ID *id) { /* write external customdata (not for undo) */ @@ -5384,7 +5387,7 @@ namespace blender::bke { /** \name Custom Data C++ API * \{ */ -const blender::CPPType *custom_data_type_to_cpp_type(const CustomDataType type) +const blender::CPPType *custom_data_type_to_cpp_type(const eCustomDataType type) { switch (type) { case CD_PROP_FLOAT: @@ -5409,7 +5412,7 @@ const blender::CPPType *custom_data_type_to_cpp_type(const CustomDataType type) return nullptr; } -CustomDataType cpp_type_to_custom_data_type(const blender::CPPType &type) +eCustomDataType cpp_type_to_custom_data_type(const blender::CPPType &type) { if (type.is<float>()) { return CD_PROP_FLOAT; @@ -5435,7 +5438,7 @@ CustomDataType cpp_type_to_custom_data_type(const blender::CPPType &type) if (type.is<ColorGeometry4b>()) { return CD_PROP_BYTE_COLOR; } - return static_cast<CustomDataType>(-1); + return static_cast<eCustomDataType>(-1); } /** \} */ diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc index a28afc8ddca..898869c3c44 100644 --- a/source/blender/blenkernel/intern/geometry_component_curve.cc +++ b/source/blender/blenkernel/intern/geometry_component_curve.cc @@ -114,7 +114,7 @@ void CurveComponentLegacy::ensure_owns_direct_data() /** \name Attribute Access Helper Functions * \{ */ -int CurveComponentLegacy::attribute_domain_num(const AttributeDomain domain) const +int CurveComponentLegacy::attribute_domain_num(const eAttrDomain domain) const { if (curve_ == nullptr) { return 0; @@ -308,10 +308,9 @@ static GVArray adapt_curve_domain_spline_to_point(const CurveEval &curve, GVArra } // namespace blender::bke -GVArray CurveComponentLegacy::attribute_try_adapt_domain_impl( - const GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const +GVArray CurveComponentLegacy::attribute_try_adapt_domain_impl(const GVArray &varray, + const eAttrDomain from_domain, + const eAttrDomain to_domain) const { if (!varray) { return {}; @@ -366,7 +365,7 @@ class BuiltinSplineAttributeProvider final : public BuiltinAttributeProvider { public: BuiltinSplineAttributeProvider(std::string attribute_name, - const CustomDataType attribute_type, + const eCustomDataType attribute_type, const WritableEnum writable, const AsReadAttribute as_read_attribute, const AsWriteAttribute as_write_attribute) @@ -577,7 +576,7 @@ static void point_attribute_materialize_to_uninitialized(Span<Span<T>> data, } static GVArray varray_from_initializer(const AttributeInit &initializer, - const CustomDataType data_type, + const eCustomDataType data_type, const Span<SplinePtr> splines) { switch (initializer.type) { @@ -604,7 +603,7 @@ static GVArray varray_from_initializer(const AttributeInit &initializer, static bool create_point_attribute(GeometryComponent &component, const AttributeIDRef &attribute_id, const AttributeInit &initializer, - const CustomDataType data_type) + const eCustomDataType data_type) { CurveEval *curve = get_curve_from_component_for_write(component); if (curve == nullptr || curve->splines().size() == 0) { @@ -1306,8 +1305,8 @@ class DynamicPointAttributeProvider final : public DynamicAttributesProvider { bool try_create(GeometryComponent &component, const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type, + const eAttrDomain domain, + const eCustomDataType data_type, const AttributeInit &initializer) const final { BLI_assert(this->type_is_supported(data_type)); @@ -1336,12 +1335,12 @@ class DynamicPointAttributeProvider final : public DynamicAttributesProvider { return true; } - void foreach_domain(const FunctionRef<void(AttributeDomain)> callback) const final + void foreach_domain(const FunctionRef<void(eAttrDomain)> callback) const final { callback(ATTR_DOMAIN_POINT); } - bool type_is_supported(CustomDataType data_type) const + bool type_is_supported(eCustomDataType data_type) const { return ((1ULL << data_type) & supported_types_mask) != 0; } diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc index 9b023d12a7d..0003961c033 100644 --- a/source/blender/blenkernel/intern/geometry_component_curves.cc +++ b/source/blender/blenkernel/intern/geometry_component_curves.cc @@ -208,7 +208,7 @@ static Array<float3> curve_normal_point_domain(const bke::CurvesGeometry &curves return results; } -VArray<float3> curve_normals_varray(const CurveComponent &component, const AttributeDomain domain) +VArray<float3> curve_normals_varray(const CurveComponent &component, const eAttrDomain domain) { if (!component.has_curves()) { return {}; @@ -244,7 +244,7 @@ VArray<float3> curve_normals_varray(const CurveComponent &component, const Attri * \{ */ static VArray<float> construct_curve_length_gvarray(const CurveComponent &component, - const AttributeDomain domain) + const eAttrDomain domain) { if (!component.has_curves()) { return {}; @@ -279,7 +279,7 @@ CurveLengthFieldInput::CurveLengthFieldInput() } GVArray CurveLengthFieldInput::get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + const eAttrDomain domain, IndexMask UNUSED(mask)) const { if (component.type() == GEO_COMPONENT_TYPE_CURVE) { @@ -308,7 +308,7 @@ bool CurveLengthFieldInput::is_equal_to(const fn::FieldNode &other) const /** \name Attribute Access Helper Functions * \{ */ -int CurveComponent::attribute_domain_num(const AttributeDomain domain) const +int CurveComponent::attribute_domain_num(const eAttrDomain domain) const { if (curves_ == nullptr) { return 0; @@ -325,8 +325,8 @@ int CurveComponent::attribute_domain_num(const AttributeDomain domain) const } GVArray CurveComponent::attribute_try_adapt_domain_impl(const GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const + const eAttrDomain from_domain, + const eAttrDomain to_domain) const { return blender::bke::CurvesGeometry::wrap(curves_->geometry) .adapt_domain(varray, from_domain, to_domain); diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc b/source/blender/blenkernel/intern/geometry_component_instances.cc index e56a7ca4dd8..653be03b991 100644 --- a/source/blender/blenkernel/intern/geometry_component_instances.cc +++ b/source/blender/blenkernel/intern/geometry_component_instances.cc @@ -366,7 +366,7 @@ blender::Span<int> InstancesComponent::almost_unique_ids() const return almost_unique_ids_; } -int InstancesComponent::attribute_domain_num(const AttributeDomain domain) const +int InstancesComponent::attribute_domain_num(const eAttrDomain domain) const { if (domain != ATTR_DOMAIN_INSTANCE) { return 0; diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index 5ac9a03f43c..8a021e596bd 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -119,7 +119,7 @@ namespace blender::bke { VArray<float3> mesh_normals_varray(const MeshComponent &mesh_component, const Mesh &mesh, const IndexMask mask, - const AttributeDomain domain) + const eAttrDomain domain) { switch (domain) { case ATTR_DOMAIN_FACE: { @@ -169,7 +169,7 @@ VArray<float3> mesh_normals_varray(const MeshComponent &mesh_component, /** \name Attribute Access * \{ */ -int MeshComponent::attribute_domain_num(const AttributeDomain domain) const +int MeshComponent::attribute_domain_num(const eAttrDomain domain) const { if (mesh_ == nullptr) { return 0; @@ -747,10 +747,9 @@ static GVArray adapt_mesh_domain_edge_to_face(const Mesh &mesh, const GVArray &v } // namespace blender::bke -blender::GVArray MeshComponent::attribute_try_adapt_domain_impl( - const blender::GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const +blender::GVArray MeshComponent::attribute_try_adapt_domain_impl(const blender::GVArray &varray, + const eAttrDomain from_domain, + const eAttrDomain to_domain) const { if (!varray) { return {}; @@ -1115,7 +1114,7 @@ class VertexGroupsAttributeProvider final : public DynamicAttributesProvider { return true; } - void foreach_domain(const FunctionRef<void(AttributeDomain)> callback) const final + void foreach_domain(const FunctionRef<void(eAttrDomain)> callback) const final { callback(ATTR_DOMAIN_POINT); } diff --git a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc index 6de123c7cb9..facdbed265d 100644 --- a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc +++ b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc @@ -104,7 +104,7 @@ void PointCloudComponent::ensure_owns_direct_data() /** \name Attribute Access * \{ */ -int PointCloudComponent::attribute_domain_num(const AttributeDomain domain) const +int PointCloudComponent::attribute_domain_num(const eAttrDomain domain) const { if (pointcloud_ == nullptr) { return 0; diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc index 40e36ced199..10226bc6990 100644 --- a/source/blender/blenkernel/intern/geometry_set.cc +++ b/source/blender/blenkernel/intern/geometry_set.cc @@ -470,7 +470,7 @@ void GeometrySet::gather_attributes_for_propagation( return; } - AttributeDomain domain = meta_data.domain; + eAttrDomain domain = meta_data.domain; if (dst_component_type != GEO_COMPONENT_TYPE_INSTANCES && domain == ATTR_DOMAIN_INSTANCE) { domain = ATTR_DOMAIN_POINT; } @@ -567,7 +567,7 @@ void GeometrySet::modify_geometry_sets(ForeachSubGeometryCallback callback) namespace blender::bke { GVArray NormalFieldInput::get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + const eAttrDomain domain, IndexMask mask) const { if (component.type() == GEO_COMPONENT_TYPE_MESH) { diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc index c960a7f35f1..85aed01ce52 100644 --- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc +++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc @@ -375,7 +375,7 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const Mesh *source) while ((layer = BKE_id_attribute_from_index( const_cast<ID *>(&source->id), i++, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL))) { - AttributeDomain domain = BKE_id_attribute_domain(&source->id, layer); + eAttrDomain domain = BKE_id_attribute_domain(&source->id, layer); CustomData *target_cdata = domain == ATTR_DOMAIN_POINT ? &target->vdata : &target->ldata; const CustomData *source_cdata = domain == ATTR_DOMAIN_POINT ? &source->vdata : &source->ldata; diff --git a/source/blender/blenkernel/intern/mesh_sample.cc b/source/blender/blenkernel/intern/mesh_sample.cc index 33b051c792c..7595c08a208 100644 --- a/source/blender/blenkernel/intern/mesh_sample.cc +++ b/source/blender/blenkernel/intern/mesh_sample.cc @@ -204,7 +204,7 @@ Span<float3> MeshAttributeInterpolator::ensure_nearest_weights() } void MeshAttributeInterpolator::sample_data(const GVArray &src, - const AttributeDomain domain, + const eAttrDomain domain, const eAttributeMapMode mode, const GMutableSpan dst) { diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc index d16f7eaf588..9b2697ecc84 100644 --- a/source/blender/blenkernel/intern/mesh_validate.cc +++ b/source/blender/blenkernel/intern/mesh_validate.cc @@ -926,7 +926,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, } static bool mesh_validate_customdata(CustomData *data, - CustomDataMask mask, + eCustomDataMask mask, const uint totitems, const bool do_verbose, const bool do_fixes, @@ -953,7 +953,7 @@ static bool mesh_validate_customdata(CustomData *data, } if (mask != 0) { - CustomDataMask layer_typemask = CD_TYPE_AS_MASK(layer->type); + eCustomDataMask layer_typemask = CD_TYPE_AS_MASK(layer->type); if ((layer_typemask & mask) == 0) { PRINT_ERR("\tCustomDataLayer type %d which isn't in the mask\n", layer->type); ok = false; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index cff7eb20b05..bb499f24c07 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1674,7 +1674,7 @@ static void sculpt_update_object(Depsgraph *depsgraph, ss->vmask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK); CustomDataLayer *layer; - AttributeDomain domain; + eAttrDomain domain; if (BKE_pbvh_get_color_layer(me, &layer, &domain)) { if (layer->type == CD_PROP_COLOR) { diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 1d4fbb92fa0..2b049222073 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1264,7 +1264,7 @@ static int pbvh_get_buffers_update_flags(PBVH *UNUSED(pbvh)) return update_flags; } -bool BKE_pbvh_get_color_layer(const Mesh *me, CustomDataLayer **r_layer, AttributeDomain *r_attr) +bool BKE_pbvh_get_color_layer(const Mesh *me, CustomDataLayer **r_layer, eAttrDomain *r_attr) { CustomDataLayer *layer = BKE_id_attributes_active_color_get((ID *)me); @@ -1274,7 +1274,7 @@ bool BKE_pbvh_get_color_layer(const Mesh *me, CustomDataLayer **r_layer, Attribu return false; } - AttributeDomain domain = BKE_id_attribute_domain((ID *)me, layer); + eAttrDomain domain = BKE_id_attribute_domain((ID *)me, layer); if (!ELEM(domain, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CORNER)) { *r_layer = NULL; @@ -1340,7 +1340,7 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata, break; case PBVH_FACES: { CustomDataLayer *layer = NULL; - AttributeDomain domain; + eAttrDomain domain; BKE_pbvh_get_color_layer(pbvh->mesh, &layer, &domain); diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc index be6e95426c2..dec93826b9b 100644 --- a/source/blender/blenkernel/intern/pbvh.cc +++ b/source/blender/blenkernel/intern/pbvh.cc @@ -44,7 +44,7 @@ using blender::IndexRange; namespace blender::bke { template<typename Func> -inline void to_static_color_type(const CustomDataType type, const Func &func) +inline void to_static_color_type(const eCustomDataType type, const Func &func) { switch (type) { case CD_PROP_COLOR: @@ -146,7 +146,7 @@ static void pbvh_vertex_color_set(PBVH &pbvh, int vertex, const float color[4]) extern "C" { void BKE_pbvh_vertex_color_get(const PBVH *pbvh, int vertex, float r_color[4]) { - blender::bke::to_static_color_type(CustomDataType(pbvh->color_layer->type), [&](auto dummy) { + blender::bke::to_static_color_type(eCustomDataType(pbvh->color_layer->type), [&](auto dummy) { using T = decltype(dummy); blender::bke::pbvh_vertex_color_get<T>(*pbvh, vertex, r_color); }); @@ -154,7 +154,7 @@ void BKE_pbvh_vertex_color_get(const PBVH *pbvh, int vertex, float r_color[4]) void BKE_pbvh_vertex_color_set(PBVH *pbvh, int vertex, const float color[4]) { - blender::bke::to_static_color_type(CustomDataType(pbvh->color_layer->type), [&](auto dummy) { + blender::bke::to_static_color_type(eCustomDataType(pbvh->color_layer->type), [&](auto dummy) { using T = decltype(dummy); blender::bke::pbvh_vertex_color_set<T>(*pbvh, vertex, color); }); @@ -165,7 +165,7 @@ void BKE_pbvh_swap_colors(PBVH *pbvh, const int indices_num, float (*r_colors)[4]) { - blender::bke::to_static_color_type(CustomDataType(pbvh->color_layer->type), [&](auto dummy) { + blender::bke::to_static_color_type(eCustomDataType(pbvh->color_layer->type), [&](auto dummy) { using T = decltype(dummy); T *pbvh_colors = static_cast<T *>(pbvh->color_layer->data); for (const int i : IndexRange(indices_num)) { @@ -181,7 +181,7 @@ void BKE_pbvh_store_colors(PBVH *pbvh, const int indices_num, float (*r_colors)[4]) { - blender::bke::to_static_color_type(CustomDataType(pbvh->color_layer->type), [&](auto dummy) { + blender::bke::to_static_color_type(eCustomDataType(pbvh->color_layer->type), [&](auto dummy) { using T = decltype(dummy); T *pbvh_colors = static_cast<T *>(pbvh->color_layer->data); for (const int i : IndexRange(indices_num)) { @@ -199,7 +199,7 @@ void BKE_pbvh_store_colors_vertex(PBVH *pbvh, BKE_pbvh_store_colors(pbvh, indices, indices_num, r_colors); } else { - blender::bke::to_static_color_type(CustomDataType(pbvh->color_layer->type), [&](auto dummy) { + blender::bke::to_static_color_type(eCustomDataType(pbvh->color_layer->type), [&](auto dummy) { using T = decltype(dummy); for (const int i : IndexRange(indices_num)) { blender::bke::pbvh_vertex_color_get<T>(*pbvh, indices[i], r_colors[i]); diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index a86663a9c74..98b490b28dd 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -198,7 +198,7 @@ struct PBVH { const struct MeshElemMap *pmap; CustomDataLayer *color_layer; - AttributeDomain color_domain; + eAttrDomain color_domain; bool is_drawing; |