[Bf-blender-cvs] [e7502ee0aa8] master: Cleanup: bmesh conversion comments
Campbell Barton
noreply at git.blender.org
Wed Nov 27 20:45:20 CET 2019
Commit: e7502ee0aa8e27247689ef8debccaaa3b8b056bf
Author: Campbell Barton
Date: Thu Nov 28 06:12:00 2019 +1100
Branches: master
https://developer.blender.org/rBe7502ee0aa8e27247689ef8debccaaa3b8b056bf
Cleanup: bmesh conversion comments
===================================================================
M source/blender/bmesh/intern/bmesh_mesh_conv.c
===================================================================
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 5f0c673b379..9bcc9b9e84b 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -91,7 +91,7 @@
#include "BKE_key.h"
#include "bmesh.h"
-#include "intern/bmesh_private.h" /* for element checking */
+#include "intern/bmesh_private.h" /* For element checking. */
void BM_mesh_cd_flag_ensure(BMesh *bm, Mesh *mesh, const char cd_flag)
{
@@ -202,7 +202,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
CustomData_MeshMasks_update(&mask, ¶ms->cd_mask_extra);
if (!me || !me->totvert) {
- if (me && is_new) { /*no verts? still copy customdata layout*/
+ if (me && is_new) { /* No verts? still copy custom-data layout. */
CustomData_copy(&me->vdata, &bm->vdata, mask.vmask, CD_ASSIGN, 0);
CustomData_copy(&me->edata, &bm->edata, mask.emask, CD_ASSIGN, 0);
CustomData_copy(&me->ldata, &bm->ldata, mask.lmask, CD_ASSIGN, 0);
@@ -213,7 +213,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
CustomData_bmesh_init_pool(&bm->ldata, me->totloop, BM_LOOP);
CustomData_bmesh_init_pool(&bm->pdata, me->totpoly, BM_FACE);
}
- return; /* sanity check */
+ return; /* Sanity check. */
}
if (is_new) {
@@ -254,9 +254,8 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
if (tot_shape_keys) {
if (is_new) {
- /* check if we need to generate unique ids for the shapekeys.
- * this also exists in the file reading code, but is here for
- * a sanity check */
+ /* Check if we need to generate unique ids for the shape-keys.
+ * This also exists in the file reading code, but is here for a sanity check. */
if (!me->key->uidgen) {
fprintf(stderr,
"%s had to generate shape key uid's in a situation we shouldn't need to! "
@@ -310,10 +309,10 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
v = vtable[i] = BM_vert_create(bm, keyco ? keyco[i] : mvert->co, NULL, BM_CREATE_SKIP_CD);
BM_elem_index_set(v, i); /* set_ok */
- /* transfer flag */
+ /* Transfer flag. */
v->head.hflag = BM_vert_flag_from_mflag(mvert->flag & ~SELECT);
- /* this is necessary for selection counts to work properly */
+ /* This is necessary for selection counts to work properly. */
if (mvert->flag & SELECT) {
BM_vert_select_set(bm, v, true);
}
@@ -327,12 +326,12 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
BM_ELEM_CD_SET_FLOAT(v, cd_vert_bweight_offset, (float)mvert->bweight / 255.0f);
}
- /* set shape key original index */
+ /* Set shape key original index. */
if (cd_shape_keyindex_offset != -1) {
BM_ELEM_CD_SET_INT(v, cd_shape_keyindex_offset, i);
}
- /* set shapekey data */
+ /* Set shape-key data. */
if (tot_shape_keys) {
float(*co_dst)[3] = BM_ELEM_CD_GET_VOID_P(v, cd_shape_key_offset);
for (int j = 0; j < tot_shape_keys; j++, co_dst++) {
@@ -341,7 +340,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
}
}
if (is_new) {
- bm->elem_index_dirty &= ~BM_VERT; /* added in order, clear dirty flag */
+ bm->elem_index_dirty &= ~BM_VERT; /* Added in order, clear dirty flag. */
}
etable = MEM_mallocN(sizeof(BMEdge **) * me->totedge, __func__);
@@ -352,10 +351,10 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
bm, vtable[medge->v1], vtable[medge->v2], NULL, BM_CREATE_SKIP_CD);
BM_elem_index_set(e, i); /* set_ok */
- /* transfer flags */
+ /* Transfer flags. */
e->head.hflag = BM_edge_flag_from_mflag(medge->flag & ~SELECT);
- /* this is necessary for selection counts to work properly */
+ /* This is necessary for selection counts to work properly. */
if (medge->flag & SELECT) {
BM_edge_select_set(bm, e, true);
}
@@ -371,10 +370,10 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
}
}
if (is_new) {
- bm->elem_index_dirty &= ~BM_EDGE; /* added in order, clear dirty flag */
+ bm->elem_index_dirty &= ~BM_EDGE; /* Added in order, clear dirty flag. */
}
- /* only needed for selection. */
+ /* Only needed for selection. */
if (me->mselect && me->totselect != 0) {
ftable = MEM_mallocN(sizeof(BMFace **) * me->totpoly, __func__);
}
@@ -400,13 +399,13 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
continue;
}
- /* don't use 'i' since we may have skipped the face */
+ /* Don't use 'i' since we may have skipped the face. */
BM_elem_index_set(f, bm->totface - 1); /* set_ok */
- /* transfer flag */
+ /* Transfer flag. */
f->head.hflag = BM_face_flag_from_mflag(mp->flag & ~ME_FACE_SEL);
- /* this is necessary for selection counts to work properly */
+ /* This is necessary for selection counts to work properly. */
if (mp->flag & ME_FACE_SEL) {
BM_face_select_set(bm, f, true);
}
@@ -419,7 +418,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
int j = mp->loopstart;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
- /* don't use 'j' since we may have skipped some faces, hence some loops. */
+ /* Don't use 'j' since we may have skipped some faces, hence some loops. */
BM_elem_index_set(l_iter, totloops++); /* set_ok */
/* Save index of corresponding #MLoop. */
@@ -434,7 +433,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
}
}
if (is_new) {
- bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP); /* added in order, clear dirty flag */
+ bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP); /* Added in order, clear dirty flag. */
}
/* -------------------------------------------------------------------- */
@@ -489,7 +488,7 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
int i = 0;
BMIter iter;
- /* caller needs to ensure this */
+ /* Caller needs to ensure this. */
BLI_assert(ototvert > 0);
vertMap = MEM_callocN(sizeof(*vertMap) * ototvert, "vertMap");
@@ -497,7 +496,7 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
const int keyi = BM_ELEM_CD_GET_INT(eve, cd_shape_keyindex_offset);
if ((keyi != ORIGINDEX_NONE) && (keyi < ototvert) &&
- /* not fool-proof, but chances are if we have many verts with the same index,
+ /* Not fool-proof, but chances are if we have many verts with the same index,
* we will want to use the first one,
* since the second is more likely to be a duplicate. */
(vertMap[keyi] == NULL)) {
@@ -520,8 +519,9 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
}
/**
- * returns customdata shapekey index from a keyblock or -1
- * \note could split this out into a more generic function */
+ * Returns custom-data shapekey index from a keyblock or -1
+ * \note could split this out into a more generic function.
+ */
static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
{
int i;
@@ -540,12 +540,12 @@ static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
{
- /* this is a cheap way to set the edge draw, its not precise and will
+ /* This is a cheap way to set the edge draw, its not precise and will
* pick the first 2 faces an edge uses.
* The dot comparison is a little arbitrary, but set so that a 5 subd
- * IcoSphere won't vanish but subd 6 will (as with pre-bmesh blender) */
+ * IcoSphere won't vanish but subd 6 will (as with pre-bmesh Blender). */
- if (/* (med->flag & ME_EDGEDRAW) && */ /* assume to be true */
+ if (/* (med->flag & ME_EDGEDRAW) && */ /* Assume to be true. */
(e->l && (e->l != e->l->radial_next)) &&
(dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.9995f)) {
med->flag &= ~ME_EDGEDRAW;
@@ -577,7 +577,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
ototvert = me->totvert;
- /* new vertex block */
+ /* New vertex block. */
if (bm->totvert == 0) {
mvert = NULL;
}
@@ -585,7 +585,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
mvert = MEM_callocN(bm->totvert * sizeof(MVert), "loadeditbMesh vert");
}
- /* new edge block */
+ /* New edge block. */
if (bm->totedge == 0) {
medge = NULL;
}
@@ -593,7 +593,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
medge = MEM_callocN(bm->totedge * sizeof(MEdge), "loadeditbMesh edge");
}
- /* new ngon face block */
+ /* New ngon face block. */
if (bm->totface == 0) {
mpoly = NULL;
}
@@ -601,7 +601,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
mpoly = MEM_callocN(bm->totface * sizeof(MPoly), "loadeditbMesh poly");
}
- /* new loop block */
+ /* New loop block. */
if (bm->totloop == 0) {
mloop = NULL;
}
@@ -609,25 +609,24 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
mloop = MEM_callocN(bm->totloop * sizeof(MLoop), "loadeditbMesh loop");
}
- /* lets save the old verts just in case we are actually working on
- * a key ... we now do processing of the keys at the end */
+ /* Lets save the old verts just in case we are actually working on
+ * a key ... we now do processing of the keys at the end. */
oldverts = MEM_dupallocN(me->mvert);
- /* free custom data */
+ /* Free custom data. */
CustomData_free(&me->vdata, me->totvert);
CustomData_free(&me->edata, me->totedge);
CustomData_free(&me->fdata, me->totface);
CustomData_free(&me->ldata, me->totloop);
CustomData_free(&me->pdata, me->totpoly);
- /* add new c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list