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 <ideasman42@gmail.com>2018-06-17 18:04:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-17 18:04:27 +0300
commit1eed46c788f1c9e0d92985857bdbf5a7045f6791 (patch)
tree41af1e5f961d9fc62214b0498bb4cc0d2b07656f /source/blender/modifiers/intern/MOD_mask.c
parent78fbd146f3cd9a5c97307ff6f2d14422e7ae54b9 (diff)
Cleanup: trailing space for modifiers
Diffstat (limited to 'source/blender/modifiers/intern/MOD_mask.c')
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index 326ff707225..25db2d5ff0b 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -77,7 +77,7 @@ static void updateDepgraph(ModifierData *md, const ModifierUpdateDepsgraphContex
if (mmd->ob_arm) {
bArmature *arm = (bArmature *)mmd->ob_arm->data;
DagNode *armNode = dag_get_node(ctx->forest, mmd->ob_arm);
-
+
/* tag relationship in depsgraph, but also on the armature */
dag_add_relation(ctx->forest, armNode, ctx->obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Mask Modifier");
arm->flag |= ARM_HAS_VIZ_DEPS;
@@ -129,17 +129,17 @@ static DerivedMesh *applyModifier(
}
/* Overview of Method:
- * 1. Get the vertices that are in the vertexgroup of interest
+ * 1. Get the vertices that are in the vertexgroup of interest
* 2. Filter out unwanted geometry (i.e. not in vertexgroup), by populating mappings with new vs old indices
* 3. Make a new mesh containing only the mapping data
*/
-
+
/* get original number of verts, edges, and faces */
maxVerts = dm->getNumVerts(dm);
maxEdges = dm->getNumEdges(dm);
maxPolys = dm->getNumPolys(dm);
-
- /* check if we can just return the original mesh
+
+ /* check if we can just return the original mesh
* - must have verts and therefore verts assigned to vgroups to do anything useful
*/
if (!(ELEM(mmd->mode, MOD_MASK_MODE_ARM, MOD_MASK_MODE_VGROUP)) ||
@@ -147,7 +147,7 @@ static DerivedMesh *applyModifier(
{
return dm;
}
-
+
/* if mode is to use selected armature bones, aggregate the bone groups */
if (mmd->mode == MOD_MASK_MODE_ARM) { /* --- using selected bones --- */
Object *oba = mmd->ob_arm;
@@ -156,17 +156,17 @@ static DerivedMesh *applyModifier(
bool *bone_select_array;
int bone_select_tot = 0;
const int defbase_tot = BLI_listbase_count(&ob->defbase);
-
+
/* check that there is armature object with bones to use, otherwise return original mesh */
if (ELEM(NULL, oba, oba->pose, ob->defbase.first))
return dm;
-
- /* determine whether each vertexgroup is associated with a selected bone or not
+
+ /* determine whether each vertexgroup is associated with a selected bone or not
* - each cell is a boolean saying whether bone corresponding to the ith group is selected
* - groups that don't match a bone are treated as not existing (along with the corresponding ungrouped verts)
*/
bone_select_array = MEM_malloc_arrayN((size_t)defbase_tot, sizeof(char), "mask array");
-
+
for (i = 0, def = ob->defbase.first; def; def = def->next, i++) {
pchan = BKE_pose_channel_find_name(oba->pose, def->name);
if (pchan && pchan->bone && (pchan->bone->flag & BONE_SELECTED)) {
@@ -182,8 +182,8 @@ static DerivedMesh *applyModifier(
* key = oldindex, value = newindex
*/
vertHash = BLI_ghash_int_new_ex("mask vert gh", (unsigned int)maxVerts);
-
- /* add vertices which exist in vertexgroups into vertHash for filtering
+
+ /* add vertices which exist in vertexgroups into vertHash for filtering
* - dv = for each vertex, what vertexgroups does it belong to
* - dw = weight that vertex was assigned to a vertexgroup it belongs to
*/
@@ -191,7 +191,7 @@ static DerivedMesh *applyModifier(
MDeformWeight *dw = dv->dw;
bool found = false;
int j;
-
+
/* check the groups that vertex is assigned to, and see if it was any use */
for (j = 0; j < dv->totweight; j++, dw++) {
if (dw->def_nr < defbase_tot) {
@@ -203,16 +203,16 @@ static DerivedMesh *applyModifier(
}
}
}
-
+
if (found_test != found) {
continue;
}
-
+
/* add to ghash for verts (numVerts acts as counter for mapping) */
BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numVerts));
numVerts++;
}
-
+
/* free temp hashes */
MEM_freeN(bone_select_array);
}
@@ -222,10 +222,10 @@ static DerivedMesh *applyModifier(
/* if no vgroup (i.e. dverts) found, return the initial mesh */
if (defgrp_index == -1)
return dm;
-
+
/* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */
vertHash = BLI_ghash_int_new_ex("mask vert2 bh", (unsigned int)maxVerts);
-
+
/* add vertices which exist in vertexgroup into ghash for filtering */
for (i = 0, dv = dvert; i < maxVerts; i++, dv++) {
const bool found = defvert_find_weight(dv, defgrp_index) != 0.0f;
@@ -251,12 +251,12 @@ static DerivedMesh *applyModifier(
/* overalloc, assume all polys are seen */
loop_mapping = MEM_malloc_arrayN((size_t)maxPolys, sizeof(int), "mask loopmap");
- /* loop over edges and faces, and do the same thing to
- * ensure that they only reference existing verts
+ /* loop over edges and faces, and do the same thing to
+ * ensure that they only reference existing verts
*/
for (i = 0; i < maxEdges; i++) {
const MEdge *me = &medge_src[i];
-
+
/* only add if both verts will be in new mesh */
if (BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1)) &&
BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2)))
@@ -270,14 +270,14 @@ static DerivedMesh *applyModifier(
const MLoop *ml_src = &mloop_src[mp_src->loopstart];
bool ok = true;
int j;
-
+
for (j = 0; j < mp_src->totloop; j++, ml_src++) {
if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(ml_src->v))) {
ok = false;
break;
}
}
-
+
/* all verts must be available */
if (ok) {
BLI_ghash_insert(polyHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numPolys));
@@ -286,13 +286,13 @@ static DerivedMesh *applyModifier(
numLoops += mp_src->totloop;
}
}
-
-
- /* now we know the number of verts, edges and faces,
+
+
+ /* now we know the number of verts, edges and faces,
* we can create the new (reduced) mesh
*/
result = CDDM_from_template(dm, numVerts, numEdges, 0, numLoops, numPolys);
-
+
mpoly_dst = CDDM_get_polys(result);
mloop_dst = CDDM_get_loops(result);
medge_dst = CDDM_get_edges(result);
@@ -305,21 +305,21 @@ static DerivedMesh *applyModifier(
MVert *v_dst;
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
-
+
v_src = &mvert_src[i_src];
v_dst = &mvert_dst[i_dst];
*v_dst = *v_src;
DM_copy_vert_data(dm, result, i_src, i_dst, 1);
}
-
+
/* edges */
GHASH_ITER (gh_iter, edgeHash) {
const MEdge *e_src;
MEdge *e_dst;
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
-
+
e_src = &medge_src[i_src];
e_dst = &medge_dst[i_dst];
@@ -328,7 +328,7 @@ static DerivedMesh *applyModifier(
e_dst->v1 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v1)));
e_dst->v2 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v2)));
}
-
+
/* faces */
GHASH_ITER (gh_iter, polyHash) {
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
@@ -339,7 +339,7 @@ static DerivedMesh *applyModifier(
const int i_ml_dst = loop_mapping[i_dst];
const MLoop *ml_src = &mloop_src[i_ml_src];
MLoop *ml_dst = &mloop_dst[i_ml_dst];
-
+
DM_copy_poly_data(dm, result, i_src, i_dst, 1);
DM_copy_loop_data(dm, result, i_ml_src, i_ml_dst, mp_src->totloop);
@@ -356,7 +356,7 @@ static DerivedMesh *applyModifier(
/* why is this needed? - campbell */
/* recalculate normals */
result->dirty |= DM_DIRTY_NORMALS;
-
+
/* free hashes */
BLI_ghash_free(vertHash, NULL, NULL);
BLI_ghash_free(edgeHash, NULL, NULL);