diff options
author | Jacques Lucke <jacques@blender.org> | 2021-04-20 12:19:43 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-04-20 12:19:43 +0300 |
commit | 7834fcc67d28b9104faaf8b2379b9f094076a572 (patch) | |
tree | b3b16d3765ab79619b8d57a7e5324a573bb1b0cf /source/blender | |
parent | b2c6eb86405eab2ec93ceb5dfd0363dddc828b0e (diff) | |
parent | 2125ee4305c0f22c2c30795669b0f38404e4eb72 (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc index ff20b5f35a4..bb46c5c84cd 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc @@ -66,6 +66,28 @@ static AttributeDomain get_result_domain(const GeometryComponent &component, return ATTR_DOMAIN_POINT; } +static bool conversion_can_be_skipped(const GeometryComponent &component, + const StringRef source_name, + const StringRef result_name, + const AttributeDomain result_domain, + const CustomDataType result_type) +{ + if (source_name != result_name) { + return false; + } + ReadAttributeLookup read_attribute = component.attribute_try_get_for_read(source_name); + if (!read_attribute) { + return false; + } + if (read_attribute.domain != result_domain) { + return false; + } + if (read_attribute.varray->type() != *bke::custom_data_type_to_cpp_type(result_type)) { + return false; + } + return true; +} + static void attribute_convert_calc(GeometryComponent &component, const GeoNodeExecParams ¶ms, const StringRef source_name, @@ -78,6 +100,10 @@ static void attribute_convert_calc(GeometryComponent &component, component, source_name, result_name) : domain; + if (conversion_can_be_skipped(component, source_name, result_name, result_domain, result_type)) { + return; + } + GVArrayPtr source_attribute = component.attribute_try_get_for_read( source_name, result_domain, result_type); if (!source_attribute) { |