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:
Diffstat (limited to 'source/blender/editors/object/object_vgroup.cc')
-rw-r--r--source/blender/editors/object/object_vgroup.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/editors/object/object_vgroup.cc b/source/blender/editors/object/object_vgroup.cc
index d3bdf8ca4d3..72b9b1b839c 100644
--- a/source/blender/editors/object/object_vgroup.cc
+++ b/source/blender/editors/object/object_vgroup.cc
@@ -68,6 +68,7 @@
#include "object_intern.h"
+using blender::float3;
using blender::MutableSpan;
using blender::Span;
@@ -1286,12 +1287,12 @@ static blender::Vector<int> getSurroundingVerts(Mesh *me, int vert)
* coord is the place the average is stored,
* points is the point cloud, count is the number of points in the cloud.
*/
-static void getSingleCoordinate(MVert *points, int count, float coord[3])
+static void getSingleCoordinate(float3 *points, int count, float coord[3])
{
int i;
zero_v3(coord);
for (i = 0; i < count; i++) {
- add_v3_v3(coord, points[i].co);
+ add_v3_v3(coord, points[i]);
}
mul_v3_fl(coord, 1.0f / count);
}
@@ -1357,7 +1358,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
Mesh *me_deform;
MDeformWeight *dw, *dw_eval;
- MVert m;
+ float3 m;
MDeformVert *dvert = me->deform_verts_for_write().data() + index;
MDeformVert *dvert_eval = mesh_eval->deform_verts_for_write().data() + index;
int totweight = dvert->totweight;
@@ -1382,9 +1383,9 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
do {
wasChange = false;
me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
- const Span<MVert> verts = me_deform->verts();
- m = verts[index];
- copy_v3_v3(oldPos, m.co);
+ const Span<float3> positions = me_deform->positions();
+ m = positions[index];
+ copy_v3_v3(oldPos, m);
distToStart = dot_v3v3(norm, oldPos) + d;
if (distToBe == originalDistToBe) {
@@ -1425,9 +1426,8 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
}
dw_eval->weight = dw->weight;
me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
- m = verts[index];
- getVerticalAndHorizontalChange(
- norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
+ m = positions[index];
+ getVerticalAndHorizontalChange(norm, d, coord, oldPos, distToStart, m, changes, dists, i);
dw->weight = oldw;
dw_eval->weight = oldw;
if (!k) {
@@ -1531,28 +1531,27 @@ static void vgroup_fix(
int i;
Mesh *me = static_cast<Mesh *>(ob->data);
- MVert *mvert = me->verts_for_write().data();
if (!(me->editflag & ME_EDIT_PAINT_VERT_SEL)) {
return;
}
const bke::AttributeAccessor attributes = me->attributes();
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
".select_vert", ATTR_DOMAIN_POINT, false);
- for (i = 0; i < me->totvert && mvert; i++, mvert++) {
+ for (i = 0; i < me->totvert; i++) {
if (select_vert[i]) {
blender::Vector<int> verts = getSurroundingVerts(me, i);
const int count = verts.size();
if (!verts.is_empty()) {
- MVert m;
- MVert *p = static_cast<MVert *>(MEM_callocN(sizeof(MVert) * (count), "deformedPoints"));
+ float3 m;
+ float3 *p = static_cast<float3 *>(MEM_callocN(sizeof(float3) * (count), "deformedPoints"));
int k;
Mesh *me_deform = mesh_get_eval_deform(
depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
- const Span<MVert> verts_deform = me_deform->verts();
+ const Span<float3> positions_deform = me_deform->positions();
k = count;
while (k--) {
- p[k] = verts_deform[verts[k]];
+ p[k] = positions_deform[verts[k]];
}
if (count >= 3) {
@@ -1560,8 +1559,8 @@ static void vgroup_fix(
float coord[3];
float norm[3];
getSingleCoordinate(p, count, coord);
- m = verts_deform[i];
- sub_v3_v3v3(norm, m.co, coord);
+ m = positions_deform[i];
+ sub_v3_v3v3(norm, m, coord);
mag = normalize_v3(norm);
if (mag) { /* zeros fix */
d = -dot_v3v3(norm, coord);