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:
authorCampbell Barton <campbell@blender.org>2022-03-28 04:29:47 +0300
committerCampbell Barton <campbell@blender.org>2022-03-28 06:41:31 +0300
commit6f305577b346030249bdb762f887136ff02624e3 (patch)
tree207b1cbba07e8a0f864ff854d6d1a74c26c6beaf /source/blender/editors
parent24839fdefa89339e77465c27d89c86cd5ac0cdd9 (diff)
Cleanup: use "num" as a suffix in: source/blender/modifiers
Also rename DNA struct members.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/meshlaplacian.c157
-rw-r--r--source/blender/editors/curve/editcurve.c4
-rw-r--r--source/blender/editors/object/object_hook.c102
-rw-r--r--source/blender/editors/object/object_modifier.c56
4 files changed, 165 insertions, 154 deletions
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 31caa29a02a..7016511111e 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -59,7 +59,7 @@ static void error(const char *str)
struct LaplacianSystem {
LinearSolver *context; /* linear solver */
- int totvert, totface;
+ int verts_num, faces_num;
float **verts; /* vertex coordinates */
float *varea; /* vertex weights for laplacian computation */
@@ -76,8 +76,8 @@ struct LaplacianSystem {
struct HeatWeighting {
const MLoopTri *mlooptri;
const MLoop *mloop; /* needed to find vertices by index */
- int totvert;
- int tottri;
+ int verts_num;
+ int tris_num;
float (*verts)[3]; /* vertex coordinates */
float (*vnors)[3]; /* vertex normals */
@@ -202,28 +202,28 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int
}
}
-static LaplacianSystem *laplacian_system_construct_begin(int totvert, int totface, int lsq)
+static LaplacianSystem *laplacian_system_construct_begin(int verts_num, int faces_num, int lsq)
{
LaplacianSystem *sys;
sys = MEM_callocN(sizeof(LaplacianSystem), "LaplacianSystem");
- sys->verts = MEM_callocN(sizeof(float *) * totvert, "LaplacianSystemVerts");
- sys->vpinned = MEM_callocN(sizeof(char) * totvert, "LaplacianSystemVpinned");
- sys->faces = MEM_callocN(sizeof(int[3]) * totface, "LaplacianSystemFaces");
+ sys->verts = MEM_callocN(sizeof(float *) * verts_num, "LaplacianSystemVerts");
+ sys->vpinned = MEM_callocN(sizeof(char) * verts_num, "LaplacianSystemVpinned");
+ sys->faces = MEM_callocN(sizeof(int[3]) * faces_num, "LaplacianSystemFaces");
- sys->totvert = 0;
- sys->totface = 0;
+ sys->verts_num = 0;
+ sys->faces_num = 0;
sys->areaweights = 1;
sys->storeweights = 0;
/* create linear solver */
if (lsq) {
- sys->context = EIG_linear_least_squares_solver_new(0, totvert, 1);
+ sys->context = EIG_linear_least_squares_solver_new(0, verts_num, 1);
}
else {
- sys->context = EIG_linear_solver_new(0, totvert, 1);
+ sys->context = EIG_linear_solver_new(0, verts_num, 1);
}
return sys;
@@ -231,42 +231,43 @@ static LaplacianSystem *laplacian_system_construct_begin(int totvert, int totfac
void laplacian_add_vertex(LaplacianSystem *sys, float *co, int pinned)
{
- sys->verts[sys->totvert] = co;
- sys->vpinned[sys->totvert] = pinned;
- sys->totvert++;
+ sys->verts[sys->verts_num] = co;
+ sys->vpinned[sys->verts_num] = pinned;
+ sys->verts_num++;
}
void laplacian_add_triangle(LaplacianSystem *sys, int v1, int v2, int v3)
{
- sys->faces[sys->totface][0] = v1;
- sys->faces[sys->totface][1] = v2;
- sys->faces[sys->totface][2] = v3;
- sys->totface++;
+ sys->faces[sys->faces_num][0] = v1;
+ sys->faces[sys->faces_num][1] = v2;
+ sys->faces[sys->faces_num][2] = v3;
+ sys->faces_num++;
}
static void laplacian_system_construct_end(LaplacianSystem *sys)
{
int(*face)[3];
- int a, totvert = sys->totvert, totface = sys->totface;
+ int a, verts_num = sys->verts_num, faces_num = sys->faces_num;
laplacian_begin_solve(sys, 0);
- sys->varea = MEM_callocN(sizeof(float) * totvert, "LaplacianSystemVarea");
+ sys->varea = MEM_callocN(sizeof(float) * verts_num, "LaplacianSystemVarea");
- sys->edgehash = BLI_edgehash_new_ex(__func__, BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(sys->totface));
- for (a = 0, face = sys->faces; a < sys->totface; a++, face++) {
+ sys->edgehash = BLI_edgehash_new_ex(__func__,
+ BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(sys->faces_num));
+ for (a = 0, face = sys->faces; a < sys->faces_num; a++, face++) {
laplacian_increase_edge_count(sys->edgehash, (*face)[0], (*face)[1]);
laplacian_increase_edge_count(sys->edgehash, (*face)[1], (*face)[2]);
laplacian_increase_edge_count(sys->edgehash, (*face)[2], (*face)[0]);
}
if (sys->areaweights) {
- for (a = 0, face = sys->faces; a < sys->totface; a++, face++) {
+ for (a = 0, face = sys->faces; a < sys->faces_num; a++, face++) {
laplacian_triangle_area(sys, (*face)[0], (*face)[1], (*face)[2]);
}
}
- for (a = 0; a < totvert; a++) {
+ for (a = 0; a < verts_num; a++) {
if (sys->areaweights) {
if (sys->varea[a] != 0.0f) {
sys->varea[a] = 0.5f / sys->varea[a];
@@ -283,10 +284,10 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
}
if (sys->storeweights) {
- sys->fweights = MEM_callocN(sizeof(float[3]) * totface, "LaplacianFWeight");
+ sys->fweights = MEM_callocN(sizeof(float[3]) * faces_num, "LaplacianFWeight");
}
- for (a = 0, face = sys->faces; a < totface; a++, face++) {
+ for (a = 0, face = sys->faces; a < faces_num; a++, face++) {
laplacian_triangle_weights(sys, a, (*face)[0], (*face)[1], (*face)[2]);
}
@@ -327,7 +328,7 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index)
if (!sys->variablesdone) {
if (index >= 0) {
- for (a = 0; a < sys->totvert; a++) {
+ for (a = 0; a < sys->verts_num; a++) {
if (sys->vpinned[a]) {
EIG_linear_solver_variable_set(sys->context, 0, a, sys->verts[a][index]);
EIG_linear_solver_variable_lock(sys->context, a);
@@ -411,14 +412,14 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
const MLoopTri *looptri = sys->heat.mlooptri;
const MLoop *mloop = sys->heat.mloop;
float(*verts)[3] = sys->heat.verts;
- int tottri = sys->heat.tottri;
- int totvert = sys->heat.totvert;
+ int tris_num = sys->heat.tris_num;
+ int verts_num = sys->heat.verts_num;
int a;
- sys->heat.bvhtree = BLI_bvhtree_new(tottri, 0.0f, 4, 6);
- sys->heat.vltree = MEM_callocN(sizeof(MLoopTri *) * totvert, "HeatVFaces");
+ sys->heat.bvhtree = BLI_bvhtree_new(tris_num, 0.0f, 4, 6);
+ sys->heat.vltree = MEM_callocN(sizeof(MLoopTri *) * verts_num, "HeatVFaces");
- for (a = 0; a < tottri; a++) {
+ for (a = 0; a < tris_num; a++) {
const MLoopTri *lt = &looptri[a];
float bb[6];
int vtri[3];
@@ -552,9 +553,9 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
float fnor[3];
int a, v1, v2, v3, (*face)[3];
- sys->heat.vnors = MEM_callocN(sizeof(float[3]) * sys->totvert, "HeatVNors");
+ sys->heat.vnors = MEM_callocN(sizeof(float[3]) * sys->verts_num, "HeatVNors");
- for (a = 0, face = sys->faces; a < sys->totface; a++, face++) {
+ for (a = 0, face = sys->faces; a < sys->faces_num; a++, face++) {
v1 = (*face)[0];
v2 = (*face)[1];
v3 = (*face)[2];
@@ -566,7 +567,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
add_v3_v3(sys->heat.vnors[v3], fnor);
}
- for (a = 0; a < sys->totvert; a++) {
+ for (a = 0; a < sys->verts_num; a++) {
normalize_v3(sys->heat.vnors[a]);
}
}
@@ -575,21 +576,21 @@ static void heat_laplacian_create(LaplacianSystem *sys)
{
const MLoopTri *mlooptri = sys->heat.mlooptri, *lt;
const MLoop *mloop = sys->heat.mloop;
- int tottri = sys->heat.tottri;
- int totvert = sys->heat.totvert;
+ int tris_num = sys->heat.tris_num;
+ int verts_num = sys->heat.verts_num;
int a;
/* heat specific definitions */
- sys->heat.mindist = MEM_callocN(sizeof(float) * totvert, "HeatMinDist");
- sys->heat.H = MEM_callocN(sizeof(float) * totvert, "HeatH");
- sys->heat.p = MEM_callocN(sizeof(float) * totvert, "HeatP");
+ sys->heat.mindist = MEM_callocN(sizeof(float) * verts_num, "HeatMinDist");
+ sys->heat.H = MEM_callocN(sizeof(float) * verts_num, "HeatH");
+ sys->heat.p = MEM_callocN(sizeof(float) * verts_num, "HeatP");
/* add verts and faces to laplacian */
- for (a = 0; a < totvert; a++) {
+ for (a = 0; a < verts_num; a++) {
laplacian_add_vertex(sys, sys->heat.verts[a], 0);
}
- for (a = 0, lt = mlooptri; a < tottri; a++, lt++) {
+ for (a = 0, lt = mlooptri; a < tris_num; a++, lt++) {
int vtri[3];
vtri[0] = mloop[lt->tri[0]].v;
vtri[1] = mloop[lt->tri[1]].v;
@@ -600,7 +601,7 @@ static void heat_laplacian_create(LaplacianSystem *sys)
/* for distance computation in set_H */
heat_calc_vnormals(sys);
- for (a = 0; a < totvert; a++) {
+ for (a = 0; a < verts_num; a++) {
heat_set_H(sys, a);
}
}
@@ -648,7 +649,7 @@ void heat_bone_weighting(Object *ob,
MLoop *ml;
float solution, weight;
int *vertsflipped = NULL, *mask = NULL;
- int a, tottri, j, bbone, firstsegment, lastsegment;
+ int a, tris_num, j, bbone, firstsegment, lastsegment;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
MVert *mvert = me->mvert;
@@ -658,7 +659,7 @@ void heat_bone_weighting(Object *ob,
*error_str = NULL;
/* bone heat needs triangulated faces */
- tottri = poly_to_tri_count(me->totpoly, me->totloop);
+ tris_num = poly_to_tri_count(me->totpoly, me->totloop);
/* count triangles and create mask */
if (ob->mode & OB_MODE_WEIGHT_PAINT && (use_face_sel || use_vert_sel)) {
@@ -684,16 +685,16 @@ void heat_bone_weighting(Object *ob,
}
/* create laplacian */
- sys = laplacian_system_construct_begin(me->totvert, tottri, 1);
+ sys = laplacian_system_construct_begin(me->totvert, tris_num, 1);
- sys->heat.tottri = poly_to_tri_count(me->totpoly, me->totloop);
- mlooptri = MEM_mallocN(sizeof(*sys->heat.mlooptri) * sys->heat.tottri, __func__);
+ sys->heat.tris_num = poly_to_tri_count(me->totpoly, me->totloop);
+ mlooptri = MEM_mallocN(sizeof(*sys->heat.mlooptri) * sys->heat.tris_num, __func__);
BKE_mesh_recalc_looptri(me->mloop, me->mpoly, me->mvert, me->totloop, me->totpoly, mlooptri);
sys->heat.mlooptri = mlooptri;
sys->heat.mloop = me->mloop;
- sys->heat.totvert = me->totvert;
+ sys->heat.verts_num = me->totvert;
sys->heat.verts = verts;
sys->heat.root = root;
sys->heat.tip = tip;
@@ -886,7 +887,7 @@ typedef struct MeshDeformBind {
Mesh *cagemesh;
float (*cagecos)[3];
float (*vertexcos)[3];
- int totvert, totcagevert;
+ int verts_num, cage_verts_num;
/* grids */
MemArena *memarena;
@@ -1467,7 +1468,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
}
/* solve for each cage vert */
- for (a = 0; a < mdb->totcagevert; a++) {
+ for (a = 0; a < mdb->cage_verts_num; a++) {
/* fill in right hand side and solve */
for (z = 0; z < mdb->size; z++) {
for (y = 0; y < mdb->size; y++) {
@@ -1503,14 +1504,14 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
if (mdb->weights) {
/* static bind : compute weights for each vertex */
- for (b = 0; b < mdb->totvert; b++) {
+ for (b = 0; b < mdb->verts_num; b++) {
if (mdb->inside[b]) {
copy_v3_v3(vec, mdb->vertexcos[b]);
gridvec[0] = (vec[0] - mdb->min[0] - mdb->halfwidth[0]) / mdb->width[0];
gridvec[1] = (vec[1] - mdb->min[1] - mdb->halfwidth[1]) / mdb->width[1];
gridvec[2] = (vec[2] - mdb->min[2] - mdb->halfwidth[2]) / mdb->width[2];
- mdb->weights[b * mdb->totcagevert + a] = meshdeform_interp_w(mdb, gridvec, vec, a);
+ mdb->weights[b * mdb->cage_verts_num + a] = meshdeform_interp_w(mdb, gridvec, vec, a);
}
}
}
@@ -1536,9 +1537,12 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
break;
}
- BLI_snprintf(
- message, sizeof(message), "Mesh deform solve %d / %d |||", a + 1, mdb->totcagevert);
- progress_bar((float)(a + 1) / (float)(mdb->totcagevert), message);
+ BLI_snprintf(message,
+ sizeof(message),
+ "Mesh deform solve %d / %d |||",
+ a + 1,
+ mdb->cage_verts_num);
+ progress_bar((float)(a + 1) / (float)(mdb->cage_verts_num), message);
}
#if 0
@@ -1573,7 +1577,7 @@ static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBin
/* compute bounding box of the cage mesh */
INIT_MINMAX(mdb->min, mdb->max);
- for (a = 0; a < mdb->totcagevert; a++) {
+ for (a = 0; a < mdb->cage_verts_num; a++) {
minmax_v3v3_v3(mdb->min, mdb->max, mdb->cagecos[a]);
}
@@ -1586,13 +1590,14 @@ static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBin
mdb->boundisect = MEM_callocN(sizeof(*mdb->boundisect) * mdb->size3, "MDefBoundIsect");
mdb->semibound = MEM_callocN(sizeof(int) * mdb->size3, "MDefSemiBound");
mdb->bvhtree = BKE_bvhtree_from_mesh_get(&mdb->bvhdata, mdb->cagemesh, BVHTREE_FROM_LOOPTRI, 4);
- mdb->inside = MEM_callocN(sizeof(int) * mdb->totvert, "MDefInside");
+ mdb->inside = MEM_callocN(sizeof(int) * mdb->verts_num, "MDefInside");
if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
mdb->dyngrid = MEM_callocN(sizeof(MDefBindInfluence *) * mdb->size3, "MDefDynGrid");
}
else {
- mdb->weights = MEM_callocN(sizeof(float) * mdb->totvert * mdb->totcagevert, "MDefWeights");
+ mdb->weights = MEM_callocN(sizeof(float) * mdb->verts_num * mdb->cage_verts_num,
+ "MDefWeights");
}
mdb->memarena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena");
@@ -1632,7 +1637,7 @@ static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBin
progress_bar(0, "Setting up mesh deform system");
totinside = 0;
- for (a = 0; a < mdb->totvert; a++) {
+ for (a = 0; a < mdb->verts_num; a++) {
copy_v3_v3(vec, mdb->vertexcos[a]);
mdb->inside[a] = meshdeform_inside_cage(mdb, vec);
if (mdb->inside[a]) {
@@ -1674,16 +1679,16 @@ static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBin
/* assign results */
if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
- mmd->totinfluence = 0;
+ mmd->influences_num = 0;
for (a = 0; a < mdb->size3; a++) {
for (inf = mdb->dyngrid[a]; inf; inf = inf->next) {
- mmd->totinfluence++;
+ mmd->influences_num++;
}
}
/* convert MDefBindInfluences to smaller MDefInfluences */
mmd->dyngrid = MEM_callocN(sizeof(MDefCell) * mdb->size3, "MDefDynGrid");
- mmd->dyninfluences = MEM_callocN(sizeof(MDefInfluence) * mmd->totinfluence, "MDefInfluence");
+ mmd->dyninfluences = MEM_callocN(sizeof(MDefInfluence) * mmd->influences_num, "MDefInfluence");
offset = 0;
for (a = 0; a < mdb->size3; a++) {
cell = &mmd->dyngrid[a];
@@ -1695,17 +1700,17 @@ static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBin
mdinf->weight = inf->weight;
mdinf->vertex = inf->vertex;
totweight += mdinf->weight;
- cell->totinfluence++;
+ cell->influences_num++;
}
if (totweight > 0.0f) {
mdinf = mmd->dyninfluences + cell->offset;
- for (b = 0; b < cell->totinfluence; b++, mdinf++) {
+ for (b = 0; b < cell->influences_num; b++, mdinf++) {
mdinf->weight /= totweight;
}
}
- offset += cell->totinfluence;
+ offset += cell->influences_num;
}
mmd->dynverts = mdb->inside;
@@ -1732,7 +1737,7 @@ void ED_mesh_deform_bind_callback(Object *object,
MeshDeformModifierData *mmd,
Mesh *cagemesh,
float *vertexcos,
- int totvert,
+ int verts_num,
float cagemat[4][4])
{
MeshDeformModifierData *mmd_orig = (MeshDeformModifierData *)BKE_modifier_get_original(
@@ -1750,19 +1755,19 @@ void ED_mesh_deform_bind_callback(Object *object,
BKE_mesh_wrapper_ensure_mdata(cagemesh);
/* get mesh and cage mesh */
- mdb.vertexcos = MEM_callocN(sizeof(float[3]) * totvert, "MeshDeformCos");
- mdb.totvert = totvert;
+ mdb.vertexcos = MEM_callocN(sizeof(float[3]) * verts_num, "MeshDeformCos");
+ mdb.verts_num = verts_num;
mdb.cagemesh = cagemesh;
- mdb.totcagevert = mdb.cagemesh->totvert;
- mdb.cagecos = MEM_callocN(sizeof(*mdb.cagecos) * mdb.totcagevert, "MeshDeformBindCos");
+ mdb.cage_verts_num = mdb.cagemesh->totvert;
+ mdb.cagecos = MEM_callocN(sizeof(*mdb.cagecos) * mdb.cage_verts_num, "MeshDeformBindCos");
copy_m4_m4(mdb.cagemat, cagemat);
mvert = mdb.cagemesh->mvert;
- for (a = 0; a < mdb.totcagevert; a++) {
+ for (a = 0; a < mdb.cage_verts_num; a++) {
copy_v3_v3(mdb.cagecos[a], mvert[a].co);
}
- for (a = 0; a < mdb.totvert; a++) {
+ for (a = 0; a < mdb.verts_num; a++) {
mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a * 3);
}
@@ -1771,12 +1776,12 @@ void ED_mesh_deform_bind_callback(Object *object,
/* assign bind variables */
mmd_orig->bindcagecos = (float *)mdb.cagecos;
- mmd_orig->totvert = mdb.totvert;
- mmd_orig->totcagevert = mdb.totcagevert;
+ mmd_orig->verts_num = mdb.verts_num;
+ mmd_orig->cage_verts_num = mdb.cage_verts_num;
copy_m4_m4(mmd_orig->bindmat, mmd_orig->object->obmat);
/* transform bindcagecos to world space */
- for (a = 0; a < mdb.totcagevert; a++) {
+ for (a = 0; a < mdb.cage_verts_num; a++) {
mul_m4_v3(mmd_orig->object->obmat, mmd_orig->bindcagecos + a * 3);
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 5ff63e767f6..38c14391273 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1209,7 +1209,7 @@ static void remap_hooks_and_vertex_parents(Main *bmain, Object *obedit)
old_to_new_map = init_index_map(obedit, &old_totvert);
}
- for (i = j = 0; i < hmd->totindex; i++) {
+ for (i = j = 0; i < hmd->indexar_num; i++) {
if (hmd->indexar[i] < old_totvert) {
index = old_to_new_map[hmd->indexar[i]];
if (index != -1) {
@@ -1221,7 +1221,7 @@ static void remap_hooks_and_vertex_parents(Main *bmain, Object *obedit)
}
}
- hmd->totindex = j;
+ hmd->indexar_num = j;
}
}
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index e8637b57724..b3f62f3fc0f 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -54,23 +54,26 @@
#include "object_intern.h"
-static int return_editmesh_indexar(BMEditMesh *em, int *r_tot, int **r_indexar, float r_cent[3])
+static int return_editmesh_indexar(BMEditMesh *em,
+ int *r_indexar_num,
+ int **r_indexar,
+ float r_cent[3])
{
BMVert *eve;
BMIter iter;
- int *index, nr, totvert = 0;
+ int *index, nr, indexar_num = 0;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- totvert++;
+ indexar_num++;
}
}
- if (totvert == 0) {
+ if (indexar_num == 0) {
return 0;
}
- *r_indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
- *r_tot = totvert;
+ *r_indexar = index = MEM_mallocN(4 * indexar_num, "hook indexar");
+ *r_indexar_num = indexar_num;
nr = 0;
zero_v3(r_cent);
@@ -83,9 +86,9 @@ static int return_editmesh_indexar(BMEditMesh *em, int *r_tot, int **r_indexar,
nr++;
}
- mul_v3_fl(r_cent, 1.0f / (float)totvert);
+ mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
- return totvert;
+ return indexar_num;
}
static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name, float r_cent[3])
@@ -97,7 +100,7 @@ static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name,
if (cd_dvert_offset != -1) {
const int defgrp_index = active_index - 1;
- int totvert = 0;
+ int indexar_num = 0;
MDeformVert *dvert;
BMVert *eve;
@@ -109,14 +112,14 @@ static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name,
if (BKE_defvert_find_weight(dvert, defgrp_index) > 0.0f) {
add_v3_v3(r_cent, eve->co);
- totvert++;
+ indexar_num++;
}
}
- if (totvert) {
+ if (indexar_num) {
const ListBase *defbase = BKE_object_defgroup_list(obedit);
bDeformGroup *dg = BLI_findlink(defbase, defgrp_index);
BLI_strncpy(r_name, dg->name, sizeof(dg->name));
- mul_v3_fl(r_cent, 1.0f / (float)totvert);
+ mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
return true;
}
}
@@ -139,7 +142,7 @@ static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (nr == hmd->indexar[index]) {
BM_vert_select_set(em->bm, eve, true);
- if (index < hmd->totindex - 1) {
+ if (index < hmd->indexar_num - 1) {
index++;
}
}
@@ -151,12 +154,12 @@ static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
}
static int return_editlattice_indexar(Lattice *editlatt,
- int *r_tot,
int **r_indexar,
+ int *r_indexar_num,
float r_cent[3])
{
BPoint *bp;
- int *index, nr, totvert = 0, a;
+ int *index, nr, indexar_num = 0, a;
/* count */
a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw;
@@ -164,18 +167,18 @@ static int return_editlattice_indexar(Lattice *editlatt,
while (a--) {
if (bp->f1 & SELECT) {
if (bp->hide == 0) {
- totvert++;
+ indexar_num++;
}
}
bp++;
}
- if (totvert == 0) {
+ if (indexar_num == 0) {
return 0;
}
- *r_indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
- *r_tot = totvert;
+ *r_indexar = index = MEM_mallocN(4 * indexar_num, "hook indexar");
+ *r_indexar_num = indexar_num;
nr = 0;
zero_v3(r_cent);
@@ -193,9 +196,9 @@ static int return_editlattice_indexar(Lattice *editlatt,
nr++;
}
- mul_v3_fl(r_cent, 1.0f / (float)totvert);
+ mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
- return totvert;
+ return indexar_num;
}
static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
@@ -211,7 +214,7 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
while (a--) {
if (hmd->indexar[index] == nr) {
bp->f1 |= SELECT;
- if (index < hmd->totindex - 1) {
+ if (index < hmd->indexar_num - 1) {
index++;
}
}
@@ -220,12 +223,15 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
}
}
-static int return_editcurve_indexar(Object *obedit, int *r_tot, int **r_indexar, float r_cent[3])
+static int return_editcurve_indexar(Object *obedit,
+ int **r_indexar,
+ int *r_indexar_num,
+ float r_cent[3])
{
ListBase *editnurb = object_editcurve_get(obedit);
BPoint *bp;
BezTriple *bezt;
- int *index, a, nr, totvert = 0;
+ int *index, a, nr, indexar_num = 0;
LISTBASE_FOREACH (Nurb *, nu, editnurb) {
if (nu->type == CU_BEZIER) {
@@ -233,13 +239,13 @@ static int return_editcurve_indexar(Object *obedit, int *r_tot, int **r_indexar,
a = nu->pntsu;
while (a--) {
if (bezt->f1 & SELECT) {
- totvert++;
+ indexar_num++;
}
if (bezt->f2 & SELECT) {
- totvert++;
+ indexar_num++;
}
if (bezt->f3 & SELECT) {
- totvert++;
+ indexar_num++;
}
bezt++;
}
@@ -249,18 +255,18 @@ static int return_editcurve_indexar(Object *obedit, int *r_tot, int **r_indexar,
a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) {
- totvert++;
+ indexar_num++;
}
bp++;
}
}
}
- if (totvert == 0) {
+ if (indexar_num == 0) {
return 0;
}
- *r_indexar = index = MEM_mallocN(sizeof(*index) * totvert, "hook indexar");
- *r_tot = totvert;
+ *r_indexar = index = MEM_mallocN(sizeof(*index) * indexar_num, "hook indexar");
+ *r_indexar_num = indexar_num;
nr = 0;
zero_v3(r_cent);
@@ -305,21 +311,21 @@ static int return_editcurve_indexar(Object *obedit, int *r_tot, int **r_indexar,
}
}
- mul_v3_fl(r_cent, 1.0f / (float)totvert);
+ mul_v3_fl(r_cent, 1.0f / (float)indexar_num);
- return totvert;
+ return indexar_num;
}
static bool object_hook_index_array(Main *bmain,
Scene *scene,
Object *obedit,
- int *r_tot,
int **r_indexar,
+ int *r_indexar_num,
char *r_name,
float r_cent[3])
{
*r_indexar = NULL;
- *r_tot = 0;
+ *r_indexar_num = 0;
r_name[0] = 0;
switch (obedit->type) {
@@ -338,7 +344,7 @@ static bool object_hook_index_array(Main *bmain,
BKE_editmesh_looptri_and_normals_calc(em);
/* check selected vertices first */
- if (return_editmesh_indexar(em, r_tot, r_indexar, r_cent) == 0) {
+ if (return_editmesh_indexar(em, r_indexar_num, r_indexar, r_cent) == 0) {
return return_editmesh_vgroup(obedit, em, r_name, r_cent);
}
return true;
@@ -347,10 +353,10 @@ static bool object_hook_index_array(Main *bmain,
case OB_SURF:
ED_curve_editnurb_load(bmain, obedit);
ED_curve_editnurb_make(obedit);
- return return_editcurve_indexar(obedit, r_tot, r_indexar, r_cent);
+ return return_editcurve_indexar(obedit, r_indexar, r_indexar_num, r_cent);
case OB_LATTICE: {
Lattice *lt = obedit->data;
- return return_editlattice_indexar(lt->editlatt->latt, r_tot, r_indexar, r_cent);
+ return return_editlattice_indexar(lt->editlatt->latt, r_indexar, r_indexar_num, r_cent);
}
default:
return false;
@@ -371,21 +377,21 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
while (a--) {
if (nr == hmd->indexar[index]) {
bezt->f1 |= SELECT;
- if (index < hmd->totindex - 1) {
+ if (index < hmd->indexar_num - 1) {
index++;
}
}
nr++;
if (nr == hmd->indexar[index]) {
bezt->f2 |= SELECT;
- if (index < hmd->totindex - 1) {
+ if (index < hmd->indexar_num - 1) {
index++;
}
}
nr++;
if (nr == hmd->indexar[index]) {
bezt->f3 |= SELECT;
- if (index < hmd->totindex - 1) {
+ if (index < hmd->indexar_num - 1) {
index++;
}
}
@@ -400,7 +406,7 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
while (a--) {
if (nr == hmd->indexar[index]) {
bp->f1 |= SELECT;
- if (index < hmd->totindex - 1) {
+ if (index < hmd->indexar_num - 1) {
index++;
}
}
@@ -514,10 +520,10 @@ static int add_hook_object(const bContext *C,
HookModifierData *hmd = NULL;
float cent[3];
float pose_mat[4][4];
- int tot, ok, *indexar;
+ int indexar_num, ok, *indexar;
char name[MAX_NAME];
- ok = object_hook_index_array(bmain, scene, obedit, &tot, &indexar, name, cent);
+ ok = object_hook_index_array(bmain, scene, obedit, &indexar, &indexar_num, name, cent);
if (!ok) {
BKE_report(reports, RPT_ERROR, "Requires selected vertices or active vertex group");
@@ -545,7 +551,7 @@ static int add_hook_object(const bContext *C,
hmd->object = ob;
hmd->indexar = indexar;
copy_v3_v3(hmd->cent, cent);
- hmd->totindex = tot;
+ hmd->indexar_num = indexar_num;
BLI_strncpy(hmd->name, name, sizeof(hmd->name));
unit_m4(pose_mat);
@@ -873,7 +879,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
HookModifierData *hmd = NULL;
float cent[3];
char name[MAX_NAME];
- int *indexar, tot;
+ int *indexar, indexar_num;
object_hook_from_context(C, &ptr, num, &ob, &hmd);
if (hmd == NULL) {
@@ -883,7 +889,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
/* assign functionality */
- if (!object_hook_index_array(bmain, scene, ob, &tot, &indexar, name, cent)) {
+ if (!object_hook_index_array(bmain, scene, ob, &indexar, &indexar_num, name, cent)) {
BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
return OPERATOR_CANCELLED;
}
@@ -893,7 +899,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
copy_v3_v3(hmd->cent, cent);
hmd->indexar = indexar;
- hmd->totindex = tot;
+ hmd->indexar_num = indexar_num;
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 7fedc2c6265..7c3571d3b75 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -541,36 +541,36 @@ bool ED_object_modifier_convert(ReportList *UNUSED(reports),
return false;
}
- int totpart = psys_eval->totcached;
- int totchild = psys_eval->totchildcache;
+ int part_num = psys_eval->totcached;
+ int child_num = psys_eval->totchildcache;
- if (totchild && (part->draw & PART_DRAW_PARENT) == 0) {
- totpart = 0;
+ if (child_num && (part->draw & PART_DRAW_PARENT) == 0) {
+ part_num = 0;
}
/* count */
- int totvert = 0, totedge = 0;
+ int verts_num = 0, edges_num = 0;
ParticleCacheKey **cache = psys_eval->pathcache;
- for (int a = 0; a < totpart; a++) {
+ for (int a = 0; a < part_num; a++) {
ParticleCacheKey *key = cache[a];
if (key->segments > 0) {
- totvert += key->segments + 1;
- totedge += key->segments;
+ verts_num += key->segments + 1;
+ edges_num += key->segments;
}
}
cache = psys_eval->childcache;
- for (int a = 0; a < totchild; a++) {
+ for (int a = 0; a < child_num; a++) {
ParticleCacheKey *key = cache[a];
if (key->segments > 0) {
- totvert += key->segments + 1;
- totedge += key->segments;
+ verts_num += key->segments + 1;
+ edges_num += key->segments;
}
}
- if (totvert == 0) {
+ if (verts_num == 0) {
return false;
}
@@ -578,11 +578,11 @@ bool ED_object_modifier_convert(ReportList *UNUSED(reports),
Object *obn = BKE_object_add(bmain, view_layer, OB_MESH, NULL);
Mesh *me = obn->data;
- me->totvert = totvert;
- me->totedge = totedge;
+ me->totvert = verts_num;
+ me->totedge = edges_num;
- me->mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
- me->medge = CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
+ me->mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, verts_num);
+ me->medge = CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, edges_num);
me->mface = CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, 0);
MVert *mvert = me->mvert;
@@ -590,7 +590,7 @@ bool ED_object_modifier_convert(ReportList *UNUSED(reports),
/* copy coordinates */
cache = psys_eval->pathcache;
- for (int a = 0; a < totpart; a++) {
+ for (int a = 0; a < part_num; a++) {
ParticleCacheKey *key = cache[a];
int kmax = key->segments;
for (int k = 0; k <= kmax; k++, key++, cvert++, mvert++) {
@@ -609,7 +609,7 @@ bool ED_object_modifier_convert(ReportList *UNUSED(reports),
}
cache = psys_eval->childcache;
- for (int a = 0; a < totchild; a++) {
+ for (int a = 0; a < child_num; a++) {
ParticleCacheKey *key = cache[a];
int kmax = key->segments;
for (int k = 0; k <= kmax; k++, key++, cvert++, mvert++) {
@@ -774,9 +774,9 @@ static bool modifier_apply_obdata(
RPT_INFO,
"Applied modifier only changed CV points, not tessellated/bevel vertices");
- int numVerts;
- float(*vertexCos)[3] = BKE_curve_nurbs_vert_coords_alloc(&curve_eval->nurb, &numVerts);
- mti->deformVerts(md_eval, &mectx, NULL, vertexCos, numVerts);
+ int verts_num;
+ float(*vertexCos)[3] = BKE_curve_nurbs_vert_coords_alloc(&curve_eval->nurb, &verts_num);
+ mti->deformVerts(md_eval, &mectx, NULL, vertexCos, verts_num);
BKE_curve_nurbs_vert_coords_apply(&curve->nurb, vertexCos, false);
MEM_freeN(vertexCos);
@@ -793,9 +793,9 @@ static bool modifier_apply_obdata(
return false;
}
- int numVerts;
- float(*vertexCos)[3] = BKE_lattice_vert_coords_alloc(lattice, &numVerts);
- mti->deformVerts(md_eval, &mectx, NULL, vertexCos, numVerts);
+ int verts_num;
+ float(*vertexCos)[3] = BKE_lattice_vert_coords_alloc(lattice, &verts_num);
+ mti->deformVerts(md_eval, &mectx, NULL, vertexCos, verts_num);
BKE_lattice_vert_coords_apply(lattice, vertexCos);
MEM_freeN(vertexCos);
@@ -2781,9 +2781,9 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
MEM_SAFE_FREE(mmd->dynverts);
MEM_SAFE_FREE(mmd->bindweights); /* Deprecated */
MEM_SAFE_FREE(mmd->bindcos); /* Deprecated */
- mmd->totvert = 0;
- mmd->totcagevert = 0;
- mmd->totinfluence = 0;
+ mmd->verts_num = 0;
+ mmd->cage_verts_num = 0;
+ mmd->influences_num = 0;
}
else {
/* Force modifier to run, it will call binding routine
@@ -3119,7 +3119,7 @@ static int laplaciandeform_bind_exec(bContext *C, wmOperator *op)
/* This is hard to know from the modifier itself whether the evaluation is
* happening for binding or not. So we copy all the required data here. */
- lmd->total_verts = lmd_eval->total_verts;
+ lmd->verts_num = lmd_eval->verts_num;
if (lmd_eval->vertexco == NULL) {
MEM_SAFE_FREE(lmd->vertexco);
}