Fix T82617: artifacts in Cycles viewport when changing subdivision attributes

The old attributes were not cleared when synchronizing the geometries, this could also lead to crashes in other cases.

Ref T82608.
This commit is contained in:
Kévin Dietrich 2020-11-12 08:55:18 +01:00
parent 08452d9956
commit 88bb29dea6
Notes: blender-bot 2024-01-16 18:05:25 +01:00
Referenced by issue #82958, Change Displacement Scale and have Adaptive Subdivision Crashes
Referenced by issue #82852, Crash When Adding Material To a plane with Addabtive SubD Enabled [Cycles]
Referenced by issue #82617, Subsurface optimal display toggle seems to have permanent effects on vector displacement
2 changed files with 3 additions and 0 deletions

View File

@ -855,6 +855,7 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *ha
hair->set_value(socket, new_hair, socket);
}
hair->attributes.clear();
foreach (Attribute &attr, new_hair.attributes.attributes) {
hair->attributes.attributes.push_back(std::move(attr));
}

View File

@ -1073,10 +1073,12 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *me
mesh->set_value(socket, new_mesh, socket);
}
mesh->attributes.clear();
foreach (Attribute &attr, new_mesh.attributes.attributes) {
mesh->attributes.attributes.push_back(std::move(attr));
}
mesh->subd_attributes.clear();
foreach (Attribute &attr, new_mesh.subd_attributes.attributes) {
mesh->subd_attributes.attributes.push_back(std::move(attr));
}