Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-08-30 23:39:30 +0300
committerHans Goudey <h.goudey@me.com>2022-08-30 23:39:30 +0300
commit47d105f6ad49e395a10ff49a84ff06ad1015ee9d (patch)
tree29967bdc565b474eea0c3b4eac6bbe4561cf3613 /source/blender/blenkernel/intern/DerivedMesh.cc
parentbcd671e565cd337292562d7b2542410f17ab0ff6 (diff)
parentd9c48d94e41ba9f8d6b91043142af17a76b7345c (diff)
Merge branch 'blender-v3.3-release'
Diffstat (limited to 'source/blender/blenkernel/intern/DerivedMesh.cc')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 3afdbccb1f4..adc986a3813 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -741,6 +741,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
Mesh **r_final,
GeometrySet **r_geometry_set)
{
+ using namespace blender::bke;
/* Input and final mesh. Final mesh is only created the moment the first
* constructive modifier is executed, or a deform modifier needs normals
* or certain data layers. */
@@ -824,18 +825,13 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
ASSERT_IS_VALID_MESH(mesh_final);
}
- float3 *rest_positions = static_cast<float3 *>(CustomData_add_layer_named(&mesh_final->vdata,
- CD_PROP_FLOAT3,
- CD_SET_DEFAULT,
- nullptr,
- mesh_final->totvert,
- "rest_position"));
- blender::threading::parallel_for(
- IndexRange(mesh_final->totvert), 1024, [&](const IndexRange range) {
- for (const int i : range) {
- rest_positions[i] = mesh_final->mvert[i].co;
- }
- });
+ MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh_final);
+ SpanAttributeWriter<float3> rest_positions =
+ attributes.lookup_or_add_for_write_only_span<float3>("rest_position", ATTR_DOMAIN_POINT);
+ if (rest_positions) {
+ attributes.lookup<float3>("position").materialize(rest_positions.span);
+ rest_positions.finish();
+ }
}
/* Apply all leading deform modifiers. */