Merge branch 'blender-v3.1-release'

This commit is contained in:
Jacques Lucke 2022-02-09 15:54:41 +01:00
commit e098a29606
1 changed files with 9 additions and 1 deletions

View File

@ -1031,7 +1031,11 @@ static void store_computed_output_attributes(
{
for (const OutputAttributeToStore &store : attributes_to_store) {
GeometryComponent &component = geometry.get_component_for_write(store.component_type);
if (component.attribute_exists(store.name)) {
const CustomDataType data_type = blender::bke::cpp_type_to_custom_data_type(store.data.type());
const std::optional<AttributeMetaData> meta_data = component.attribute_get_meta_data(
store.name);
if (meta_data.has_value() && meta_data->domain == store.domain &&
meta_data->data_type == data_type) {
/* Copy the data into an existing attribute. */
blender::bke::WriteAttributeLookup write_attribute = component.attribute_try_get_for_write(
store.name);
@ -1045,6 +1049,10 @@ static void store_computed_output_attributes(
MEM_freeN(store.data.data());
}
else {
/* Replace the existing attribute with the new data. */
if (meta_data.has_value()) {
component.attribute_try_delete(store.name);
}
component.attribute_try_create(store.name,
store.domain,
blender::bke::cpp_type_to_custom_data_type(store.data.type()),