Cleanup: Use simpler method to retrieve attribute domain

This commit is contained in:
Hans Goudey 2021-07-02 23:16:39 -05:00
parent 5f5cf21a83
commit 2d146b61d8
Notes: blender-bot 2023-02-14 07:31:32 +01:00
Referenced by issue #88877, 2.93: Crash on system with a non-English locale
2 changed files with 9 additions and 10 deletions

View File

@ -108,15 +108,14 @@ static AttributeDomain get_result_domain(const GeometryComponent &component,
StringRef result_name)
{
/* Use the domain of the result attribute if it already exists. */
ReadAttributeLookup result_attribute = component.attribute_try_get_for_read(result_name);
if (result_attribute) {
return result_attribute.domain;
std::optional<AttributeMetaData> result_info = component.attribute_get_meta_data(result_name);
if (result_info) {
return result_info->domain;
}
/* Otherwise use the input attribute's domain if it exists. */
ReadAttributeLookup input_attribute = component.attribute_try_get_for_read(input_name);
if (input_attribute) {
return input_attribute.domain;
std::optional<AttributeMetaData> input_info = component.attribute_get_meta_data(input_name);
if (input_info) {
return input_info->domain;
}
return ATTR_DOMAIN_POINT;

View File

@ -389,9 +389,9 @@ static AttributeDomain get_result_domain(const GeometryComponent &component,
StringRef result_name)
{
/* Use the domain of the result attribute if it already exists. */
ReadAttributeLookup result_attribute = component.attribute_try_get_for_read(result_name);
if (result_attribute) {
return result_attribute.domain;
std::optional<AttributeMetaData> result_info = component.attribute_get_meta_data(result_name);
if (result_info) {
return result_info->domain;
}
/* Otherwise use the highest priority domain from existing input attributes, or the default. */