[Bf-blender-cvs] [ed2362afa04] soc-2020-info-editor: Remove debug guards from clog, add clog
Mateusz GrzeliÅski
noreply at git.blender.org
Sat Jul 11 10:43:40 CEST 2020
Commit: ed2362afa044e6afc4631fa26ce9d8c456a8f2cd
Author: Mateusz Grzeliński
Date: Thu Jul 9 20:54:59 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBed2362afa044e6afc4631fa26ce9d8c456a8f2cd
Remove debug guards from clog, add clog
===================================================================
M source/blender/blenkernel/intern/mesh.c
M source/blender/blenkernel/intern/pointcache.c
M source/blender/bmesh/CMakeLists.txt
M source/blender/bmesh/intern/bmesh_mesh.c
M source/blender/bmesh/intern/bmesh_private.h
===================================================================
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 8b218dfcdef..932001db52b 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -462,20 +462,17 @@ static void mesh_ensure_tessellation_customdata(Mesh *me)
CustomData_from_bmeshpoly(&me->fdata, &me->ldata, me->totface);
- /* TODO - add some --debug-mesh option */
- if (G.debug & G_DEBUG) {
- /* note: this warning may be un-called for if we are initializing the mesh for the
- * first time from bmesh, rather then giving a warning about this we could be smarter
- * and check if there was any data to begin with, for now just print the warning with
- * some info to help troubleshoot what's going on - campbell */
- CLOG_WARN(BKE_LOG_MESH,
- "Tessellation uvs or vcol data got out of sync, had to reset!\n"
- "CD_MTFACE: %d != CD_MLOOPUV: %d || CD_MCOL: %d != CD_MLOOPCOL: %d",
- tottex_tessface,
- tottex_original,
- totcol_tessface,
- totcol_original);
- }
+ /* note: this warning may be un-called for if we are initializing the mesh for the
+ * first time from bmesh, rather then giving a warning about this we could be smarter
+ * and check if there was any data to begin with, for now just print the warning with
+ * some info to help troubleshoot what's going on - campbell */
+ CLOG_WARN(BKE_LOG_MESH,
+ "Tessellation uvs or vcol data got out of sync, had to reset!\n"
+ "CD_MTFACE: %d != CD_MLOOPUV: %d || CD_MCOL: %d != CD_MLOOPCOL: %d",
+ tottex_tessface,
+ tottex_original,
+ totcol_tessface,
+ totcol_original);
}
}
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index ce5402551b6..aef60bd7861 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2844,8 +2844,8 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
ptcache_file_close(pf);
- if (error && G.debug & G_DEBUG) {
- printf("Error reading from disk cache\n");
+ if (error) {
+ CLOG_ERROR(&LOG, "Error reading from disk cache");
}
return pm;
@@ -2860,9 +2860,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame);
if (pf == NULL) {
- if (G.debug & G_DEBUG) {
- printf("Error opening disk cache file for writing\n");
- }
+ CLOG_ERROR(&LOG, "Error opening disk cache file for writing");
return 0;
}
@@ -2938,8 +2936,8 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
ptcache_file_close(pf);
- if (error && G.debug & G_DEBUG) {
- printf("Error writing to disk cache\n");
+ if (error) {
+ CLOG_ERROR(&LOG, "Error writing to disk cache");
}
return error == 0;
@@ -2955,9 +2953,7 @@ static int ptcache_read_stream(PTCacheID *pid, int cfra)
}
if (pf == NULL) {
- if (G.debug & G_DEBUG) {
- printf("Error opening disk cache file for reading\n");
- }
+ CLOG_ERROR(&LOG, "Error opening disk cache file for reading");
return 0;
}
@@ -3252,9 +3248,7 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra);
if (pf == NULL) {
- if (G.debug & G_DEBUG) {
- printf("Error opening disk cache file for writing\n");
- }
+ CLOG_ERROR(&LOG, "Error opening disk cache file for writing");
return 0;
}
@@ -3273,8 +3267,8 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
ptcache_file_close(pf);
- if (error && G.debug & G_DEBUG) {
- printf("Error writing to disk cache\n");
+ if (error) {
+ CLOG_ERROR(&LOG, "Error writing to disk cache");
}
return error == 0;
@@ -4231,10 +4225,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
baker->update_progress(baker->bake_job, progress, &cancel);
}
- if (G.background) {
- printf("bake: frame %d :: %d\n", CFRA, endframe);
- }
- else {
+ if (CLOG_CHECK_VERBOSITY(&LOG, 2)) {
ctime = PIL_check_seconds_timer();
fetd = (ctime - ptime) * (endframe - CFRA) / baker->quick_step;
@@ -4246,12 +4237,15 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
ptcache_dt_to_str(run, ctime - stime);
ptcache_dt_to_str(etd, fetd);
- printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s\r",
- run,
- CFRA - startframe + 1,
- endframe - startframe + 1,
- ctime - ptime,
- etd);
+ CLOG_VERBOSE_EVERY_N(&LOG,
+ 2,
+ 10,
+ "Baked for %s, current frame: %i/%i (%.3fs), ETC: %s",
+ run,
+ CFRA - startframe + 1,
+ endframe - startframe + 1,
+ ctime - ptime,
+ etd);
}
ptime = ctime;
@@ -4266,12 +4260,12 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
}
if (use_timer) {
- /* start with newline because of \r above */
ptcache_dt_to_str(run, PIL_check_seconds_timer() - stime);
- printf("\nBake %s %s (%i frames simulated).\n",
- (cancel ? "canceled after" : "finished in"),
- run,
- CFRA - startframe);
+ CLOG_INFO(&LOG,
+ "Bake %s %s (%i frames simulated)",
+ (cancel ? "canceled after" : "finished in"),
+ run,
+ CFRA - startframe);
}
/* clear baking flag */
@@ -4387,9 +4381,7 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
if (!G.relbase_valid) {
cache->flag &= ~PTCACHE_DISK_CACHE;
- if (G.debug & G_DEBUG) {
- printf("File must be saved before using disk cache!\n");
- }
+ CLOG_WARN(&LOG, "File must be saved before using disk cache!");
return;
}
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index 43d12e8eeed..f55b2d99def 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -27,6 +27,7 @@ set(INC
../../../intern/atomic
../../../intern/eigen
../../../intern/guardedalloc
+ ../../../intern/clog
../../../extern/rangetree
)
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 834371fefdf..d92dc1a2d05 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -20,6 +20,7 @@
* BM mesh level functions.
*/
+#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_listBase.h"
@@ -42,6 +43,8 @@
#include "intern/bmesh_private.h"
+CLG_LOGREF_DECLARE_GLOBAL(BMESH_LOG, "bmesh.mesh");
+
/* used as an extern, defined in bmesh.h */
const BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512};
const BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512};
@@ -1027,9 +1030,7 @@ static bool bm_mesh_loops_split_lnor_fans(BMesh *bm,
* Maybe we should set those loops' edges as sharp?
*/
BLI_BITMAP_ENABLE(done_loops, i);
- if (G.debug & G_DEBUG) {
- printf("WARNING! Getting invalid NULL loop space for loop %d!\n", i);
- }
+ CLOG_WARN(BMESH_LOG, "Getting invalid NULL loop space for loop %d!", i);
continue;
}
diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h
index 8b4a59d5b9b..850d6af9142 100644
--- a/source/blender/bmesh/intern/bmesh_private.h
+++ b/source/blender/bmesh/intern/bmesh_private.h
@@ -28,6 +28,8 @@
* parts of the bmesh internals.
*/
+extern struct CLG_LogRef *BMESH_LOG;
+
/* returns positive nonzero on error */
#ifdef NDEBUG
More information about the Bf-blender-cvs
mailing list