[Bf-blender-cvs] [4dfda4c747a] soc-2020-info-editor: Convert print to clog

Mateusz Grzeliński noreply at git.blender.org
Fri Jul 31 15:52:19 CEST 2020


Commit: 4dfda4c747adcdc1c874720ee02dc15c835abc28
Author: Mateusz Grzeliński
Date:   Fri Jul 31 14:58:06 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rB4dfda4c747adcdc1c874720ee02dc15c835abc28

Convert print to clog

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

M	source/blender/blenkernel/intern/CCGSubSurf_inline.h
M	source/blender/blenkernel/intern/CCGSubSurf_intern.h
M	source/blender/blenkernel/intern/CCGSubSurf_legacy.c
M	source/blender/blenkernel/intern/CCGSubSurf_util.c
M	source/blender/blenkernel/intern/bvhutils.c
M	source/blender/blenkernel/intern/lib_id_delete.c
M	source/blender/blenkernel/intern/subdiv_stats.c

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

diff --git a/source/blender/blenkernel/intern/CCGSubSurf_inline.h b/source/blender/blenkernel/intern/CCGSubSurf_inline.h
index 86012bd2a43..8b2b7d8936b 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_inline.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf_inline.h
@@ -21,6 +21,9 @@
 #ifndef __CCGSUBSURF_INLINE_H__
 #define __CCGSUBSURF_INLINE_H__
 
+/* defined in CCGSubSurf_util.c */
+extern struct CLG_LogRef *BKE_LOG_SUBSURF_DUMP_COORDS;
+
 BLI_INLINE int ccg_gridsize(int level)
 {
   BLI_assert(level > 0);
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_intern.h b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
index 7c35d2ccfce..f6423804c41 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_intern.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf_intern.h
@@ -281,9 +281,7 @@ void ccgSubSurf_converter_free(struct OpenSubdiv_Converter *converter);
 
 /* * CCGSubSurf_util.c * */
 
-#ifdef DUMP_RESULT_GRIDS
 void ccgSubSurf__dumpCoords(CCGSubSurf *ss);
-#endif
 
 #include "CCGSubSurf_inline.h"
 
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
index 8fc9afd58f1..d506a75e872 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
@@ -20,6 +20,7 @@
 
 #include "BLI_sys_types.h"  // for intptr_t support
 #include "MEM_guardedalloc.h"
+#include <CLG_log.h>
 
 #include "BLI_math.h"
 #include "BLI_task.h"
@@ -1303,9 +1304,10 @@ void ccgSubSurf__sync_legacy(CCGSubSurf *ss)
   MEM_freeN(effectedE);
   MEM_freeN(effectedV);
 
-#ifdef DUMP_RESULT_GRIDS
-  ccgSubSurf__dumpCoords(ss);
-#endif
+  if (CLOG_CHECK_VERBOSITY(BKE_LOG_SUBSURF_DUMP_COORDS, 2)) {
+    CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS, 2, "Dump subsufr %p", ss);
+    ccgSubSurf__dumpCoords(ss);
+  }
 }
 
 /* ** Public API exposed to other areas which depends on old CCG code. ** */
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_util.c b/source/blender/blenkernel/intern/CCGSubSurf_util.c
index bc63d8b97f7..08db2c175da 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_util.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_util.c
@@ -18,6 +18,7 @@
  * \ingroup bke
  */
 
+#include <CLG_log.h>
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
@@ -221,7 +222,8 @@ CCGAllocatorIFC *ccg_getStandardAllocatorIFC(void)
  * Catmull-Clark Gridding Subdivision Surface.
  */
 
-#ifdef DUMP_RESULT_GRIDS
+CLG_LOGREF_DECLARE_GLOBAL(BKE_LOG_SUBSURF_DUMP_COORDS, "bke.subsurf.dump.coords");
+
 void ccgSubSurf__dumpCoords(CCGSubSurf *ss)
 {
   int vertDataSize = ss->meshIFC.vertDataSize;
@@ -234,7 +236,13 @@ void ccgSubSurf__dumpCoords(CCGSubSurf *ss)
     CCGVert *v = (CCGVert *)ss->vMap->buckets[i];
     for (; v; v = v->next, index++) {
       float *co = VERT_getCo(v, subdivLevels);
-      printf("vertex index=%d, co=(%f, %f, %f)\n", index, co[0], co[1], co[2]);
+      CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                   3,
+                   "vertex index=%d, co=(%f, %f, %f)",
+                   index,
+                   co[0],
+                   co[1],
+                   co[2]);
     }
   }
 
@@ -243,13 +251,32 @@ void ccgSubSurf__dumpCoords(CCGSubSurf *ss)
     for (; e; e = e->next, index++) {
       int x;
       float *co = VERT_getCo(e->v0, subdivLevels);
-      printf("edge index=%d, start_co=(%f, %f, %f)\n", index, co[0], co[1], co[2]);
+      CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                   1,
+                   "edge index=%d, start_co=(%f, %f, %f)",
+                   index,
+                   co[0],
+                   co[1],
+                   co[2]);
       for (x = 0; x < edgeSize; x++) {
-        float *co = EDGE_getCo(e, subdivLevels, x);
-        printf("edge index=%d, seg=%d, co=(%f, %f, %f)\n", index, x, co[0], co[1], co[2]);
+        float *_co = EDGE_getCo(e, subdivLevels, x);
+        CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                     4,
+                     "edge index=%d, seg=%d, co=(%f, %f, %f)",
+                     index,
+                     x,
+                     _co[0],
+                     _co[1],
+                     _co[2]);
       }
       co = VERT_getCo(e->v1, subdivLevels);
-      printf("edge index=%d, end_co=(%f, %f, %f)\n", index, co[0], co[1], co[2]);
+      CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                   4,
+                   "edge index=%d, end_co=(%f, %f, %f)",
+                   index,
+                   co[0],
+                   co[1],
+                   co[2]);
     }
   }
 
@@ -259,7 +286,14 @@ void ccgSubSurf__dumpCoords(CCGSubSurf *ss)
       for (S = 0; S < f->numVerts; S++) {
         CCGVert *v = FACE_getVerts(f)[S];
         float *co = VERT_getCo(v, subdivLevels);
-        printf("face index=%d, vertex=%d, coord=(%f, %f, %f)\n", index, S, co[0], co[1], co[2]);
+        CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                     5,
+                     "face index=%d, vertex=%d, coord=(%f, %f, %f)",
+                     index,
+                     S,
+                     co[0],
+                     co[1],
+                     co[2]);
       }
     }
   }
@@ -271,15 +305,17 @@ void ccgSubSurf__dumpCoords(CCGSubSurf *ss)
         CCGEdge *e = FACE_getEdges(f)[S];
         float *co1 = VERT_getCo(e->v0, subdivLevels);
         float *co2 = VERT_getCo(e->v1, subdivLevels);
-        printf("face index=%d, edge=%d, coord1=(%f, %f, %f), coord2=(%f, %f, %f)\n",
-               index,
-               S,
-               co1[0],
-               co1[1],
-               co1[2],
-               co2[0],
-               co2[1],
-               co2[2]);
+        CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                     5,
+                     "face index=%d, edge=%d, coord1=(%f, %f, %f), coord2=(%f, %f, %f)",
+                     index,
+                     S,
+                     co1[0],
+                     co1[1],
+                     co1[2],
+                     co2[0],
+                     co2[1],
+                     co2[2]);
       }
     }
   }
@@ -292,28 +328,31 @@ void ccgSubSurf__dumpCoords(CCGSubSurf *ss)
         for (x = 0; x < gridSize; x++) {
           for (y = 0; y < gridSize; y++) {
             float *co = FACE_getIFCo(f, subdivLevels, S, x, y);
-            printf("face index=%d. corner=%d, x=%d, y=%d, coord=(%f, %f, %f)\n",
-                   index,
-                   S,
-                   x,
-                   y,
-                   co[0],
-                   co[1],
-                   co[2]);
+            CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                         6,
+                         "face index=%d. corner=%d, x=%d, y=%d, coord=(%f, %f, %f)",
+                         index,
+                         S,
+                         x,
+                         y,
+                         co[0],
+                         co[1],
+                         co[2]);
           }
         }
         for (x = 0; x < gridSize; x++) {
           float *co = FACE_getIECo(f, subdivLevels, S, x);
-          printf("face index=%d. corner=%d, ie_index=%d, coord=(%f, %f, %f)\n",
-                 index,
-                 S,
-                 x,
-                 co[0],
-                 co[1],
-                 co[2]);
+          CLOG_VERBOSE(BKE_LOG_SUBSURF_DUMP_COORDS,
+                       6,
+                       "face index=%d. corner=%d, ie_index=%d, coord=(%f, %f, %f)",
+                       index,
+                       S,
+                       x,
+                       co[0],
+                       co[1],
+                       co[2]);
         }
       }
     }
   }
 }
-#endif /* DUMP_RESULT_GRIDS */
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 0bdfa060cc3..bd39d0e8ce0 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -654,7 +654,7 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
           epsilon, tree_type, axis, em, verts_mask, verts_num_active);
 
       /* Save on cache for later use */
-      /* printf("BVHTree built and saved on cache\n"); */
+      CLOG_VERBOSE(&LOG, 1, "BVHTree built and saved on cache");
       bvhcache_insert(*bvh_cache_p, tree, bvh_cache_type);
       data->cached = true;
     }
@@ -717,7 +717,7 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
 
     if (bvh_cache_p) {
       /* Save on cache for later use */
-      /* printf("BVHTree built and saved on cache\n"); */
+      CLOG_VERBOSE(&LOG, 1, "BVHTree built and saved on cache");
       BVHCache *bvh_cache = *bvh_cache_p;
       bvhcache_insert(bvh_cache, tree, bvh_cache_type);
       in_cache = true;
@@ -866,7 +866,7 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
           epsilon, tree_type, axis, em, edges_mask, edges_num_active);
 
       /* Save on cache for later use */
-      /* printf("BVHTree built and saved on cache\n"); */
+      /* CLOG_STR_VERBOSE(&LOG, 1, "BVHTree built and saved on cache"); */
       bvhcache_insert(bvh_cache, tree, bvh_cache_type);
       data->cached = true;
     }
@@ -933,7 +933,7 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
     if (bvh_cache_p) {
       BVHCache *bvh_cache = *bvh_cache_p;
       /* Save on cache for later use */
-      /* printf("BVHTree built and saved on cache\n"); */
+      /* CLOG_STR_VERBOSE(&LOG, 1, "BVHTree built and saved on cache"); */
       bvhcache_insert(bvh_cache, tree, bvh_cache_type);
       in_cache = true;
     }
@@ -977,7 +977,7 @@ static BVHTree *bvhtree_from_mesh_faces_create_tree(float epsilon,
     }
 
     /* Create a bvh-tree of the given target */
-    /* printf("%s: building BVH, total=%d\n", __func__, numFaces); */
+    CLOG_VERBOSE(&LOG, 1, "building BVH, total=%d", faces_num);
     tree = BLI_bvhtree_new(faces_num_active, epsilon, tree_type, axis);
     if (tree) {
       if (vert && face) {
@@ -1064,7 +1064,7 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data,
 
     if (bvh_cache_p) {
       /* Save on cache for later use */
-      /* printf("BVHTree built and

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list