Commit: 7c8d616cbce43831eb2b54ac581d09a4435857dd
Author: Bastien Montagne
Date:   Wed Nov 8 13:24:32 2017 +0100
Branches: soc-2017-normal-tools
https://developer.blender.org/rB7c8d616cbce43831eb2b54ac581d09a4435857dd

More style cleanup, renaming some now-public functions.

===================================================================

M       source/blender/blenkernel/BKE_mesh.h
M       source/blender/blenkernel/intern/mesh_evaluate.c
M       source/blender/bmesh/intern/bmesh_mesh.c
M       source/blender/bmesh/intern/bmesh_mesh.h
M       source/blender/editors/mesh/editmesh_tools.c
M       source/blender/modifiers/intern/MOD_weighted_normal.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index e3544543adc..be43eb8bfb9 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -195,10 +195,10 @@ void BKE_mesh_loop_tangents_ex(
         struct ReportList *reports);
 void BKE_mesh_loop_tangents(
         struct Mesh *mesh, const char *uvmap, float (*r_looptangents)[4], 
struct ReportList *reports);
-void loop_manifold_fan_around_vert_next(
-               const struct MLoop *mloops, const struct MPoly *mpolys,
-               const int *loop_to_poly, const int *e2lfan_curr, const uint 
mv_pivot_index,
-               const struct MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int 
*r_mlfan_vert_index, int *r_mpfan_curr_index);
+void BKE_mesh_loop_manifold_fan_around_vert_next(
+        const struct MLoop *mloops, const struct MPoly *mpolys,
+        const int *loop_to_poly, const int *e2lfan_curr, const uint 
mv_pivot_index,
+        const struct MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int 
*r_mlfan_vert_index, int *r_mpfan_curr_index);
 
 /**
  * References a contiguous loop-fan with normal offset vars.
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c 
b/source/blender/blenkernel/intern/mesh_evaluate.c
index 9d71667aaa4..88d202d6f4a 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -652,7 +652,7 @@ typedef struct LoopSplitTaskDataCommon {
 /* See comment about edge_to_loops below. */
 #define IS_EDGE_SHARP(_e2l) (ELEM((_e2l)[1], INDEX_UNSET, INDEX_INVALID))
 
-void loop_manifold_fan_around_vert_next(
+void BKE_mesh_loop_manifold_fan_around_vert_next(
         const MLoop *mloops, const MPoly *mpolys,
         const int *loop_to_poly, const int *e2lfan_curr, const uint 
mv_pivot_index,
         const MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int 
*r_mlfan_vert_index, int *r_mpfan_curr_index)
@@ -892,7 +892,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon 
*common_data, LoopSpli
                copy_v3_v3(vec_prev, vec_curr);
 
                /* Find next loop of the smooth fan. */
-               loop_manifold_fan_around_vert_next(
+               BKE_mesh_loop_manifold_fan_around_vert_next(
                            mloops, mpolys, loop_to_poly, e2lfan_curr, 
mv_pivot_index,
                            &mlfan_curr, &mlfan_curr_index, &mlfan_vert_index, 
&mpfan_curr_index);
 
@@ -1029,7 +1029,7 @@ static bool loop_split_generator_check_cyclic_smooth_fan(
 
        while (true) {
                /* Find next loop of the smooth fan. */
-               loop_manifold_fan_around_vert_next(
+               BKE_mesh_loop_manifold_fan_around_vert_next(
                            mloops, mpolys, loop_to_poly, e2lfan_curr, 
mv_pivot_index,
                            &mlfan_curr, &mlfan_curr_index, &mlfan_vert_index, 
&mpfan_curr_index);
 
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c 
b/source/blender/bmesh/intern/bmesh_mesh.c
index 9e74e9b6b9e..275c61ab706 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -558,7 +558,7 @@ static void bm_mesh_edges_sharp_tag(
 
 /* Check whether gievn loop is part of an unknown-so-far cyclic smooth fan, or 
not.
  * Needed because cyclic smooth fans have no obvious 'entry point', and yet we 
need to walk them once, and only once. */
-bool bm_mesh_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
+bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
 {
        BMLoop *lfan_pivot_next = l_curr;
        BMEdge *e_next = l_curr->e;
@@ -661,7 +661,7 @@ static void bm_mesh_loops_calc_normals(
                         * However, this would complicate the code, add more 
memory usage, and BM_vert_step_fan_loop()
                         * is quite cheap in term of CPU cycles, so really 
think it's not worth it. */
                        if (BM_elem_flag_test(l_curr->e, BM_ELEM_TAG) &&
-                           (BM_elem_flag_test(l_curr, BM_ELEM_TAG) || 
!bm_mesh_loop_check_cyclic_smooth_fan(l_curr)))
+                           (BM_elem_flag_test(l_curr, BM_ELEM_TAG) || 
!BM_loop_check_cyclic_smooth_fan(l_curr)))
                        {
                        }
                        else if (!BM_elem_flag_test(l_curr->e, BM_ELEM_TAG) &&
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h 
b/source/blender/bmesh/intern/bmesh_mesh.h
index ea2825c0a2f..64747d7287e 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -51,8 +51,8 @@ void BM_loops_calc_normal_vcos(
         BMesh *bm, const float (*vcos)[3], const float (*vnos)[3], const float 
(*pnos)[3],
         const bool use_split_normals, const float split_angle, float 
(*r_lnos)[3],
         struct MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], 
const int cd_loop_clnors_offset,
-               bool rebuild);
-bool bm_mesh_loop_check_cyclic_smooth_fan(BMLoop *l_curr);
+        const bool rebuild);
+bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr);
 void BM_lnorspacearr_store(BMesh *bm, float (*r_lnors)[3]);
 void BM_lnorspace_invalidate(BMesh *bm, bool inval_all);
 void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor);
diff --git a/source/blender/editors/mesh/editmesh_tools.c 
b/source/blender/editors/mesh/editmesh_tools.c
index 26c49b4d5b2..662ca12e218 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -6489,7 +6489,7 @@ static bool split_loop(bContext *C, wmOperator 
*UNUSED(op), LoopNormalData *UNUS
                l_curr = l_first = BM_FACE_FIRST_LOOP(f);
                do {
                        if (BM_elem_flag_test(l_curr->v, BM_ELEM_SELECT) && 
(!BM_elem_flag_test(l_curr->e, BM_ELEM_TAG) ||
-                               (!BM_elem_flag_test(l_curr, BM_ELEM_TAG) && 
bm_mesh_loop_check_cyclic_smooth_fan(l_curr))))
+                               (!BM_elem_flag_test(l_curr, BM_ELEM_TAG) && 
BM_loop_check_cyclic_smooth_fan(l_curr))))
                        {
                                if (!BM_elem_flag_test(l_curr->e, BM_ELEM_TAG) 
&& !BM_elem_flag_test(l_curr->prev->e, BM_ELEM_TAG)) {
                                        int loop_index = 
BM_elem_index_get(l_curr);
@@ -6670,7 +6670,7 @@ static int edbm_average_loop_normals_exec(bContext *C, 
wmOperator *op)
                l_curr = l_first = BM_FACE_FIRST_LOOP(f);
                do {
                        if (BM_elem_flag_test(l_curr->v, BM_ELEM_SELECT) && 
(!BM_elem_flag_test(l_curr->e, BM_ELEM_TAG) ||
-                               (!BM_elem_flag_test(l_curr, BM_ELEM_TAG) && 
bm_mesh_loop_check_cyclic_smooth_fan(l_curr))))
+                               (!BM_elem_flag_test(l_curr, BM_ELEM_TAG) && 
BM_loop_check_cyclic_smooth_fan(l_curr))))
                        {
                                if (!BM_elem_flag_test(l_curr->e, BM_ELEM_TAG) 
&& !BM_elem_flag_test(l_curr->prev->e, BM_ELEM_TAG)) {
                                        int loop_index = 
BM_elem_index_get(l_curr);
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c 
b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 2a073a0885c..2bed6eb6d8a 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -156,9 +156,11 @@ static void 
apply_weights_sharp_loops(WeightedNormalModifierData *wnmd, int *loo
 
 /* Modified version of loop_split_worker_do which sets custom_normals without 
considering smoothness of faces or loop normal space array
  * Used only to work on sharp edges */
-static void loop_split_worker(WeightedNormalModifierData *wnmd, pair 
*mode_pair, MLoop *ml_curr, MLoop *ml_prev, int ml_curr_index,
-               int ml_prev_index, int *e2l_prev, int mp_index, float 
(*loop_normal)[3], int *loops_to_poly, float (*polynors)[3], MEdge *medge,
-               MLoop *mloop, MPoly *mpoly, int (*edge_to_loops)[2], int 
weight, int *strength)
+static void loop_split_worker(
+        WeightedNormalModifierData *wnmd, pair *mode_pair, MLoop *ml_curr, 
MLoop *ml_prev,
+        int ml_curr_index, int ml_prev_index, int *e2l_prev, int mp_index,
+        float (*loop_normal)[3], int *loops_to_poly, float (*polynors)[3],
+        MEdge *medge, MLoop *mloop, MPoly *mpoly, int (*edge_to_loops)[2], int 
weight, int *strength)
 {
        if (e2l_prev) {
                int *e2lfan_curr = e2l_prev;
@@ -180,9 +182,9 @@ static void loop_split_worker(WeightedNormalModifierData 
*wnmd, pair *mode_pair,
                                break;
                        }
 
-                       loop_manifold_fan_around_vert_next(
-                               mloop, mpoly, loops_to_poly, e2lfan_curr, 
mv_pivot_index,
-                               &mlfan_curr, &mlfan_curr_index, 
&mlfan_vert_index, &mpfan_curr_index);
+                       BKE_mesh_loop_manifold_fan_around_vert_next(
+                                   mloop, mpoly, loops_to_poly, e2lfan_curr, 
mv_pivot_index,
+                                   &mlfan_curr, &mlfan_curr_index, 
&mlfan_vert_index, &mpfan_curr_index);
 
                        e2lfan_curr = edge_to_loops[mlfan_curr->e];
                }
@@ -202,11 +204,11 @@ static void loop_split_worker(WeightedNormalModifierData 
*wnmd, pair *mode_pair,
        }
 }
 
-static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, 
Object *UNUSED(ob), DerivedMesh *UNUSED(dm),
-       short(*clnors)[2], MVert *mvert, const int numVerts, MEdge *medge,
-       const int numEdges, MLoop *mloop, const int numLoops, MPoly *mpoly,
-       const int numPoly, float(*polynors)[3], MDeformVert *dvert, int 
defgrp_index,
-       const bool use_invert_vgroup, const float weight, short mode, pair 
*mode_pair, int *strength)
+static void apply_weights_vertex_normal(
+        WeightedNormalModifierData *wnmd, Object *UNUSED(ob), DerivedMesh 
*UNUSED(dm), short(*clnors)[2],
+        MVert *mvert, const int numVerts, MEdge *medge, const int numEdges, 
MLoop *mloop, const int numLoops,
+        MPoly *mpoly, const int numPoly, float(*polynors)[3], MDeformVert 
*dvert, int defgrp_index,
+        const bool use_invert_vgroup, const float weight, short mode, pair 
*mode_pair, int *strength)
 {
        float(*custom_normal)[3] = MEM_callocN(sizeof(*custom_normal) * 
numVerts, __func__);
        int *vertcount = MEM_callocN(sizeof(*vertcount) * numVerts, __func__);  
/* Count number of loops using this vertex so far. */
@@ -226,8 +228,9 @@ static void 
apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, Object
                cur_strength[i] = FACE_STRENGTH_WEAK;
        }
 
-       const bool keep_sharp = (wnmd->flag & MOD_WEIGHTEDNORMAL_KEEP_SHARP) != 
0,
-                 face_influence = (wnmd->flag & 
MOD_WEIGHTEDNORMAL_FACE_INFLUENCE) != 0, has_vgroup = dvert != NULL;
+       const bool keep_sharp = (wnmd->flag & MOD_WEIGHTEDNORMAL_KEEP_SHARP) != 
0;
+       const bool face_influence = (wnmd->flag & 
MOD_WEIGHTEDNORMAL_FACE_INFLUENCE) != 0;
+       const bool has_vgroup = dvert != NULL;
 
        if (mode == MOD_WEIGHTEDNORMAL_MODE_FACE) {
                for (int i = 0; i < numPoly; i++) {  /* Iterate through each 
pair in descending order. */
@@ -244,7 +247,7 @@ static void 
apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, Obj

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to