Fix #136835: Sculpting with certain modifiers uses original positions
Mistake in 4d7274b7f4.
The Previous code:
```
float(*deformedVerts)[3] = *deformcos;
float(*origVerts)[3] = static_cast<float(*)[3]>(MEM_dupallocN(deformedVerts));
```
Didn't create a copy of the positions for the `deformedVerts` variable.
It's meant to modify the input position array. It was probably done that way
since dealing with pointers to pointers in C was annoying. With `Array`,
it's not annoying anymore, we can just use that directly.
This commit is contained in:
@@ -419,8 +419,7 @@ void BKE_crazyspace_build_sculpt(Depsgraph *depsgraph,
|
||||
deformmats.fill(blender::float3x3::identity());
|
||||
}
|
||||
|
||||
blender::Array<blender::float3, 0> deformedVerts = deformcos;
|
||||
blender::Array<blender::float3, 0> origVerts = deformedVerts;
|
||||
blender::Array<blender::float3, 0> origVerts = deformcos;
|
||||
float(*quats)[4];
|
||||
int i, deformed = 0;
|
||||
VirtualModifierData virtual_modifier_data;
|
||||
@@ -449,14 +448,14 @@ void BKE_crazyspace_build_sculpt(Depsgraph *depsgraph,
|
||||
mesh_eval = BKE_mesh_copy_for_eval(*mesh);
|
||||
}
|
||||
|
||||
mti->deform_verts(md, &mectx, mesh_eval, deformedVerts);
|
||||
mti->deform_verts(md, &mectx, mesh_eval, deformcos);
|
||||
deformed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
quats = MEM_malloc_arrayN<float[4]>(size_t(mesh->verts_num), "crazy quats");
|
||||
|
||||
BKE_crazyspace_set_quats_mesh(mesh, origVerts, deformedVerts, quats);
|
||||
BKE_crazyspace_set_quats_mesh(mesh, origVerts, deformcos, quats);
|
||||
|
||||
for (i = 0; i < mesh->verts_num; i++) {
|
||||
float qmat[3][3], tmat[3][3];
|
||||
|
||||
Reference in New Issue
Block a user