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/object
parent24839fdefa89339e77465c27d89c86cd5ac0cdd9 (diff)
Cleanup: use "num" as a suffix in: source/blender/modifiers
Also rename DNA struct members.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_hook.c102
-rw-r--r--source/blender/editors/object/object_modifier.c56
2 files changed, 82 insertions, 76 deletions
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);
}