Commit: a30c9f710a64d0adca1597c0d0404713a26a401e
Author: Campbell Barton
Date:   Fri Oct 19 09:07:40 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBa30c9f710a64d0adca1597c0d0404713a26a401e

Partial revert '#if 0' cleanup

Partially revert 41216d5ad4c722e2ad9f15c968af454fc7566d5e

Some of this code had comments to be left as is for readability,
or comment the code should be kept.
Other functions were only for debugging.

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

M       source/blender/blenkernel/intern/mask_rasterize.c
M       source/blender/blenkernel/intern/mesh_evaluate.c
M       source/blender/blenkernel/intern/multires.c
M       source/blender/blenkernel/intern/particle_child.c
M       source/blender/blenkernel/intern/pbvh_bmesh.c
M       source/blender/blenkernel/intern/seqmodifier.c
M       source/blender/blenkernel/intern/sequencer.c
M       source/blender/blenkernel/intern/softbody.c
M       source/blender/blenkernel/intern/text.c
M       source/blender/blenlib/intern/BLI_heap.c
M       source/blender/blenlib/intern/math_geom.c
M       source/blender/blenlib/intern/math_interp.c

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

diff --git a/source/blender/blenkernel/intern/mask_rasterize.c 
b/source/blender/blenkernel/intern/mask_rasterize.c
index fc1412c1baa..ecdd30edc36 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -1200,6 +1200,17 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle 
*mr_handle, struct Mask *mas
 /* functions that run inside the sampling thread (keep fast!)            */
 /* --------------------------------------------------------------------- */
 
+/* 2D ray test */
+#if 0
+static float maskrasterize_layer_z_depth_tri(const float pt[2],
+                                             const float v1[3], const float 
v2[3], const float v3[3])
+{
+       float w[3];
+       barycentric_weights_v2(v1, v2, v3, pt, w);
+       return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
+}
+#endif
+
 static float maskrasterize_layer_z_depth_quad(const float pt[2],
                                               const float v1[3], const float 
v2[3], const float v3[3], const float v4[3])
 {
@@ -1214,10 +1225,24 @@ static float maskrasterize_layer_isect(unsigned int 
*face, float (*cos)[3], cons
        /* we always cast from same place only need xy */
        if (face[3] == TRI_VERT) {
                /* --- tri --- */
+
+#if 0
+               /* not essential but avoids unneeded extra lookups */
+               if ((cos[0][2] < dist_orig) ||
+                   (cos[1][2] < dist_orig) ||
+                   (cos[2][2] < dist_orig))
+               {
+                       if (isect_point_tri_v2_cw(xy, cos[face[0]], 
cos[face[1]], cos[face[2]])) {
+                               /* we know all tris are close for now */
+                               return maskrasterize_layer_z_depth_tri(xy, 
cos[face[0]], cos[face[1]], cos[face[2]]);
+                       }
+               }
+#else
                /* we know all tris are close for now */
                if (isect_point_tri_v2_cw(xy, cos[face[0]], cos[face[1]], 
cos[face[2]])) {
                        return 0.0f;
                }
+#endif
        }
        else {
                /* --- quad --- */
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c 
b/source/blender/blenkernel/intern/mesh_evaluate.c
index e40336cd4bd..fd117734aaf 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -982,6 +982,10 @@ static void 
split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
        const MLoop *ml_curr = data->ml_curr;
        const MLoop *ml_prev = data->ml_prev;
        const int ml_curr_index = data->ml_curr_index;
+#if 0  /* Not needed for 'single' loop. */
+       const int ml_prev_index = data->ml_prev_index;
+       const int *e2l_prev = data->e2l_prev;
+#endif
        const int mp_index = data->mp_index;
 
        /* Simple case (both edges around that vertex are sharp in current 
polygon),
@@ -1032,6 +1036,9 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon 
*common_data, LoopSpli
        const float (*polynors)[3] = common_data->polynors;
 
        MLoopNorSpace *lnor_space = data->lnor_space;
+#if 0  /* Not needed for 'fan' loops. */
+       float (*lnor)[3] = data->lnor;
+#endif
        const MLoop *ml_curr = data->ml_curr;
        const MLoop *ml_prev = data->ml_prev;
        const int ml_curr_index = data->ml_curr_index;
@@ -1416,6 +1423,10 @@ static void loop_split_generator(TaskPool *pool, 
LoopSplitTaskDataCommon *common
                                        data->ml_curr = ml_curr;
                                        data->ml_prev = ml_prev;
                                        data->ml_curr_index = ml_curr_index;
+#if 0  /* Not needed for 'single' loop. */
+                                       data->ml_prev_index = ml_prev_index;
+                                       data->e2l_prev = NULL;  /* Tag as 
'single' task. */
+#endif
                                        data->mp_index = mp_index;
                                        if (lnors_spacearr) {
                                                data->lnor_space = 
BKE_lnor_space_create(lnors_spacearr);
@@ -1430,6 +1441,9 @@ static void loop_split_generator(TaskPool *pool, 
LoopSplitTaskDataCommon *common
                                 * All this due/thanks to link between normals 
and loop ordering (i.e. winding).
                                 */
                                else {
+#if 0  /* Not needed for 'fan' loops. */
+                                       data->lnor = lnors;
+#endif
                                        data->ml_curr = ml_curr;
                                        data->ml_prev = ml_prev;
                                        data->ml_curr_index = ml_curr_index;
diff --git a/source/blender/blenkernel/intern/multires.c 
b/source/blender/blenkernel/intern/multires.c
index 8f5354a501c..2aa3b3f79a3 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -2373,6 +2373,19 @@ int mdisp_rot_face_to_crn(struct MVert *UNUSED(mvert), 
struct MPoly *mpoly, stru
                 * the barycentric coordinates and finally find the closest 
vertex
                 * should work reliably for convex cases only but better than 
nothing */
 
+#if 0
+               int minS, i;
+               float mindist = FLT_MAX;
+
+               for (i = 0; i < mpoly->totloop; i++) {
+                       float len = len_v3v3(NULL, mvert[mloop[mpoly->loopstart 
+ i].v].co);
+                       if (len < mindist) {
+                               mindist = len;
+                               minS = i;
+                       }
+               }
+               S = minS;
+#endif
                /* temp not implemented yet and also not working properly in 
current master.
                 * (was worked around by subdividing once) */
                S = 0;
diff --git a/source/blender/blenkernel/intern/particle_child.c 
b/source/blender/blenkernel/intern/particle_child.c
index 339c8533e51..0cba5f5a2fc 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -299,6 +299,8 @@ void psys_apply_child_modifiers(ParticleThreadContext *ctx, 
struct ListBase *mod
        int totkeys, k;
        float max_length;
 
+       /* TODO for the future: use true particle modifiers that work on the 
whole curve */
+
        (void)modifiers;
        (void)mod;
 
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c 
b/source/blender/blenkernel/intern/pbvh_bmesh.c
index b58a35e9841..e32a5d0681e 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -413,6 +413,45 @@ static bool pbvh_bmesh_node_limit_ensure(PBVH *bvh, int 
node_index)
 
 /**********************************************************************/
 
+#if 0
+static int pbvh_bmesh_node_offset_from_elem(PBVH *bvh, BMElem *ele)
+{
+       switch (ele->head.htype) {
+               case BM_VERT:
+                       return bvh->cd_vert_node_offset;
+               default:
+                       BLI_assert(ele->head.htype == BM_FACE);
+                       return bvh->cd_face_node_offset;
+       }
+
+}
+
+static int pbvh_bmesh_node_index_from_elem(PBVH *bvh, void *key)
+{
+       const int cd_node_offset = pbvh_bmesh_node_offset_from_elem(bvh, key);
+       const int node_index = BM_ELEM_CD_GET_INT((BMElem *)key, 
cd_node_offset);
+
+       BLI_assert(node_index != DYNTOPO_NODE_NONE);
+       BLI_assert(node_index < bvh->totnode);
+       (void)bvh;
+
+       return node_index;
+}
+
+static PBVHNode *pbvh_bmesh_node_from_elem(PBVH *bvh, void *key)
+{
+       return &bvh->nodes[pbvh_bmesh_node_index_from_elem(bvh, key)];
+}
+
+/* typecheck */
+#define pbvh_bmesh_node_index_from_elem(bvh, key) ( \
+       CHECK_TYPE_ANY(key, BMFace *, BMVert *), \
+       pbvh_bmesh_node_index_from_elem(bvh, key))
+#define pbvh_bmesh_node_from_elem(bvh, key) ( \
+       CHECK_TYPE_ANY(key, BMFace *, BMVert *), \
+       pbvh_bmesh_node_from_elem(bvh, key))
+#endif
+
 BLI_INLINE int pbvh_bmesh_node_index_from_vert(PBVH *bvh, const BMVert *key)
 {
        const int node_index = BM_ELEM_CD_GET_INT((const BMElem *)key, 
bvh->cd_vert_node_offset);
@@ -496,6 +535,25 @@ static BMFace *pbvh_bmesh_face_create(
        return f;
 }
 
+/* Return the number of faces in 'node' that use vertex 'v' */
+#if 0
+static int pbvh_bmesh_node_vert_use_count(PBVH *bvh, PBVHNode *node, BMVert *v)
+{
+       BMFace *f;
+       int count = 0;
+
+       BM_FACES_OF_VERT_ITER_BEGIN(f, v) {
+               PBVHNode *f_node = pbvh_bmesh_node_from_face(bvh, f);
+               if (f_node == node) {
+                       count++;
+               }
+       }
+       BM_FACES_OF_VERT_ITER_END;
+
+       return count;
+}
+#endif
+
 #define pbvh_bmesh_node_vert_use_count_is_equal(bvh, node, v, n) \
        (pbvh_bmesh_node_vert_use_count_at_most(bvh, node, v, (n) + 1) == n)
 
@@ -1197,7 +1255,12 @@ static bool pbvh_bmesh_subdivide_long_edges(
 
                /* At the moment edges never get shorter (subdiv will make new 
edges)
                 * unlike collapse where edges can become longer. */
+#if 0
+               if (len_squared_v3v3(v1->co, v2->co) <= 
eq_ctx->q->limit_len_squared)
+                       continue;
+#else
                BLI_assert(len_squared_v3v3(v1->co, v2->co) > 
eq_ctx->q->limit_len_squared);
+#endif
 
                /* Check that the edge's vertices are still in the PBVH. It's
                 * possible that an edge collapse has deleted adjacent faces
@@ -1273,12 +1336,25 @@ static void pbvh_bmesh_collapse_edge(
                /* Get vertices, replace use of v_del with v_conn */
                // BM_iter_as_array(NULL, BM_VERTS_OF_FACE, f, (void **)v_tri, 
3);
                BMFace *f = l->f;
+#if 0
+               BMVert *v_tri[3];
+               BM_face_as_array_vert_tri(f, v_tri);
+               for (int i = 0; i < 3; i++) {
+                       if (v_tri[i] == v_del) {
+                               v_tri[i] = v_conn;
+                       }
+               }
+#endif
 
                /* Check if a face using these vertices already exists. If so,
                 * skip adding this face and mark the existing one for
                 * deletion as well. Prevents extraneous "flaps" from being
                 * created. */
+#if 0
+               if (UNLIKELY(existing_face = BM_face_exists(v_tri, 3)))
+#else
                if (UNLIKELY(existing_face = 
bm_face_exists_tri_from_loop_vert(l->next, v_conn)))
+#endif
                {
                        BLI_buffer_append(deleted_faces, BMFace *, 
existing_face);
                }
@@ -1967,7 +2043,17 @@ void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node)
                if (BM_elem_flag_test(f, BM_ELEM_HIDDEN))
                        continue;
 
+#if 0
+               BMIter bm_iter;
+               BMVert *v;
+               int j = 0;
+               BM_ITER_ELEM (v, &bm_iter, f, BM_VERTS_OF_FACE) {
+                       node->bm_ortri[i][j] = BM_elem_index_get(v);
+                       j++;
+               }
+#else
                bm_face_as_array_index_tri(f, node->bm_ortri[i]);
+#endif
                i++;
        }
        node->bm_tot_ortri = i;
@@ -2190,6 +2276,24 @@ static void pbvh_bmesh_verify(PBVH *bvh)
                }
        }
 
+#if 0
+       /* check that every vert belongs somewhere */
+       /* Slow */
+       BM_ITER_MESH (vi, &iter, bvh->bm, BM_VERTS_OF_MESH) {
+               bool has_unique = false;
+               for (int i = 0; i < bvh->totnode; i++) {
+                       PBVHNode *n = &bvh->nodes[i];
+                       if ((n->bm_unique_verts != NULL) && 
BLI_gset_haskey(n->bm_unique_verts, vi))
+                               has_unique = true;
+               }
+               BLI_assert(has_unique);
+               vert_count++;
+       }
+
+       /* if totvert differs from number of verts inside the hash. 
hash-totvert is checked above  */
+       BLI_assert(vert_count == bvh->bm->totvert);
+#endif
+
        /* Check that node elements are recorded in the top level */
        for (int i = 0; i < bvh->totnode; i++) {
                PBVHNode *n = &bvh->nodes[i];
diff --git a/source/blender/blenkernel/intern/seqmodifier.c 
b/source/blender/blenkernel/intern/seqmodifier.c
index 70d24718e5a..4a483d439e4 100644
--- a/sou

@@ 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