From 189aa32a3ac0e949275d16ffb19576a1306d1780 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Aug 2019 06:28:35 +1000 Subject: Cleanup: vertex coordinate access, naming & minor changes This also splits vertex access and allocation so it's possible to copy coordinates into an existing array without allocating it. --- source/blender/modifiers/intern/MOD_cloth.c | 2 +- source/blender/modifiers/intern/MOD_collision.c | 2 +- source/blender/modifiers/intern/MOD_correctivesmooth.c | 6 +++--- source/blender/modifiers/intern/MOD_fluidsim_util.c | 2 +- source/blender/modifiers/intern/MOD_meshdeform.c | 2 +- source/blender/modifiers/intern/MOD_particlesystem.c | 2 +- source/blender/modifiers/intern/MOD_surface.c | 2 +- source/blender/modifiers/intern/MOD_util.c | 2 +- source/blender/modifiers/intern/MOD_uvproject.c | 2 +- source/blender/modifiers/intern/MOD_weightvgproximity.c | 4 ++-- 10 files changed, 13 insertions(+), 13 deletions(-) (limited to 'source/blender/modifiers/intern') diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 1a6d172d2f9..cc91e345c8f 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -114,7 +114,7 @@ static void deformVerts(ModifierData *md, } } - BKE_mesh_apply_vert_coords(mesh_src, vertexCos); + BKE_mesh_vert_coords_apply(mesh_src, vertexCos); clothModifier_do(clmd, ctx->depsgraph, scene, ctx->object, mesh_src, vertexCos); diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 1bbc25643a1..3d43c6de88e 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -120,7 +120,7 @@ static void deformVerts(ModifierData *md, float current_time = 0; unsigned int mvert_num = 0; - BKE_mesh_apply_vert_coords(mesh_src, vertexCos); + BKE_mesh_vert_coords_apply(mesh_src, vertexCos); BKE_mesh_calc_normals(mesh_src); current_time = DEG_get_ctime(ctx->depsgraph); diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index be1580f0d70..a234f468e45 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -635,12 +635,12 @@ static void correctivesmooth_modifier_do(ModifierData *md, if (csmd->rest_source == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) { /* caller needs to do sanity check here */ csmd->bind_coords_num = numVerts; - rest_coords = (const float(*)[3])csmd->bind_coords; + rest_coords = csmd->bind_coords; } else { int me_numVerts; - rest_coords = (const float(*)[3])((em) ? BKE_editmesh_vertexCos_get_orco(em, &me_numVerts) : - BKE_mesh_vertexCos_get(ob->data, &me_numVerts)); + rest_coords = em ? BKE_editmesh_vert_coords_alloc_orco(em, &me_numVerts) : + BKE_mesh_vert_coords_alloc(ob->data, &me_numVerts); BLI_assert((unsigned int)me_numVerts == numVerts); is_rest_coords_alloc = true; diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 3083d89d555..587aa108fd1 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -290,7 +290,7 @@ static Mesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example) gzclose(gzf); BKE_mesh_calc_edges(mesh, false, false); - BKE_mesh_apply_vert_normals(mesh, (short(*)[3])normals); + BKE_mesh_vert_normals_apply(mesh, (short(*)[3])normals); MEM_freeN(normals); // CDDM_calc_normals(result); diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index da261b4f835..a582e179983 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -401,7 +401,7 @@ static void meshdeformModifier_do(ModifierData *md, } /* setup deformation data */ - cagecos = BKE_mesh_vertexCos_get(cagemesh, NULL); + cagecos = BKE_mesh_vert_coords_alloc(cagemesh, NULL); bindcagecos = (float(*)[3])mmd->bindcagecos; /* We allocate 1 element extra to make it possible to diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 021e61bd46d..a7c7c207cd6 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -152,7 +152,7 @@ static void deformVerts(ModifierData *md, /* make new mesh */ psmd->mesh_final = BKE_mesh_copy_for_eval(mesh_src, false); - BKE_mesh_apply_vert_coords(psmd->mesh_final, vertexCos); + BKE_mesh_vert_coords_apply(psmd->mesh_final, vertexCos); BKE_mesh_calc_normals(psmd->mesh_final); BKE_mesh_tessface_ensure(psmd->mesh_final); diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index dcc6371e024..840914aa313 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -130,7 +130,7 @@ static void deformVerts(ModifierData *md, float *vec; MVert *x, *v; - BKE_mesh_apply_vert_coords(surmd->mesh, vertexCos); + BKE_mesh_vert_coords_apply(surmd->mesh, vertexCos); BKE_mesh_calc_normals(surmd->mesh); numverts = surmd->mesh->totvert; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 998a2b1cd65..e7acbd3e32e 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -198,7 +198,7 @@ Mesh *MOD_deform_mesh_eval_get(Object *ob, /* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether * we really need vertexCos here. */ if (vertexCos) { - BKE_mesh_apply_vert_coords(mesh, vertexCos); + BKE_mesh_vert_coords_apply(mesh, vertexCos); mesh->runtime.cd_dirty_vert |= CD_MASK_NORMAL; } diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index f9eb92cd132..5f1eae0297a 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -204,7 +204,7 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd, mloop_uv = CustomData_duplicate_referenced_layer_named( &mesh->ldata, CD_MLOOPUV, uvname, numLoops); - coords = BKE_mesh_vertexCos_get(mesh, &numVerts); + coords = BKE_mesh_vert_coords_alloc(mesh, &numVerts); /* convert coords to world space */ for (i = 0, co = coords; i < numVerts; ++i, ++co) { diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 86d1b310d0c..95b15b4a924 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -492,7 +492,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes /* Get our vertex coordinates. */ if (numIdx != numVerts) { - float(*tv_cos)[3] = BKE_mesh_vertexCos_get(mesh, NULL); + float(*tv_cos)[3] = BKE_mesh_vert_coords_alloc(mesh, NULL); v_cos = MEM_malloc_arrayN(numIdx, sizeof(float[3]), "WeightVGProximity Modifier, v_cos"); for (i = 0; i < numIdx; i++) { copy_v3_v3(v_cos[i], tv_cos[indices[i]]); @@ -500,7 +500,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes MEM_freeN(tv_cos); } else { - v_cos = BKE_mesh_vertexCos_get(mesh, NULL); + v_cos = BKE_mesh_vert_coords_alloc(mesh, NULL); } /* Compute wanted distances. */ -- cgit v1.2.3