[Bf-blender-cvs] [46aee64dd38] soc-2020-info-editor: Convert local logger to global
Mateusz GrzeliÅski
noreply at git.blender.org
Thu Jul 2 11:19:15 CEST 2020
Commit: 46aee64dd38f84fda6c7f98dbe6f072e146e3dfb
Author: Mateusz Grzeliński
Date: Thu Jul 2 11:17:59 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rB46aee64dd38f84fda6c7f98dbe6f072e146e3dfb
Convert local logger to global
- convert prints to CLOGs
===================================================================
M source/blender/blenkernel/BKE_mesh.h
M source/blender/blenkernel/BKE_mesh_runtime.h
M source/blender/blenkernel/intern/mesh.c
M source/blender/blenkernel/intern/mesh_evaluate.c
M source/blender/blenkernel/intern/mesh_mapping.c
M source/blender/blenkernel/intern/mesh_remap.c
M source/blender/blenkernel/intern/mesh_runtime.c
M source/blender/blenkernel/intern/mesh_validate.c
M source/blender/makesrna/intern/rna_object_api.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 7d989bfcf69..8f584a0cc35 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -26,6 +26,8 @@
/* defines BLI_INLINE */
#include "BLI_compiler_compat.h"
+extern struct CLG_LogRef *BKE_LOG_MESH;
+
struct BLI_Stack;
struct BMEditMesh;
struct BMesh;
diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h b/source/blender/blenkernel/BKE_mesh_runtime.h
index 468ec6a44cd..75854f592ec 100644
--- a/source/blender/blenkernel/BKE_mesh_runtime.h
+++ b/source/blender/blenkernel/BKE_mesh_runtime.h
@@ -102,9 +102,9 @@ void BKE_mesh_runtime_eval_to_meshkey(struct Mesh *me_deformed,
struct KeyBlock *kb);
#ifndef NDEBUG
-char *BKE_mesh_runtime_debug_info(struct Mesh *me_eval);
+char *BKE_mesh_runtime_debug_sprinfN(struct Mesh *me_eval);
void BKE_mesh_runtime_debug_print(struct Mesh *me_eval);
-void BKE_mesh_runtime_debug_print_cdlayers(struct CustomData *data);
+char *BKE_mesh_runtime_debug_sprintfN_cdlayers(struct CustomData *data);
bool BKE_mesh_runtime_is_valid(struct Mesh *me_eval);
#endif /* NDEBUG */
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 48baedadd73..8b218dfcdef 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -22,6 +22,7 @@
*/
#include "MEM_guardedalloc.h"
+#include <CLG_log.h>
#include "DNA_defaults.h"
#include "DNA_key_types.h"
@@ -467,15 +468,13 @@ static void mesh_ensure_tessellation_customdata(Mesh *me)
* 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 */
- printf(
- "%s: warning! 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\n",
- __func__,
- tottex_tessface,
- tottex_original,
- totcol_tessface,
- totcol_original);
+ 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/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index b298a6a2787..e52f2b72031 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -1050,13 +1050,13 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
*/
copy_v3_v3(*lnor, polynors[mp_index]);
-#if 0
- printf("BASIC: handling loop %d / edge %d / vert %d / poly %d\n",
- ml_curr_index,
- ml_curr->e,
- ml_curr->v,
- mp_index);
-#endif
+ CLOG_INFO(BKE_LOG_MESH,
+ 5,
+ "BASIC: handling loop %d / edge %ud / vert %ud / poly %d",
+ ml_curr_index,
+ ml_curr->e,
+ ml_curr->v,
+ mp_index);
/* If needed, generate this (simple!) lnor space. */
if (lnors_spacearr) {
@@ -1269,9 +1269,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
clnors_avg[0] /= clnors_nbr;
clnors_avg[1] /= clnors_nbr;
/* Fix/update all clnors of this fan with computed average value. */
- if (G.debug & G_DEBUG) {
- printf("Invalid clnors in this fan!\n");
- }
+ CLOG_INFO(BKE_LOG_MESH, 0, "Invalid clnors in this fan!");
while ((clnor = BLI_SMALLSTACK_POP(clnors))) {
// print_v2("org clnor", clnor);
clnor[0] = (short)clnors_avg[0];
@@ -1480,14 +1478,14 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
const int *e2l_curr = edge_to_loops[ml_curr->e];
const int *e2l_prev = edge_to_loops[ml_prev->e];
-#if 0
- printf("Checking loop %d / edge %u / vert %u (sharp edge: %d, skiploop: %d)...",
- ml_curr_index,
- ml_curr->e,
- ml_curr->v,
- IS_EDGE_SHARP(e2l_curr),
- BLI_BITMAP_TEST_BOOL(skip_loops, ml_curr_index));
-#endif
+ CLOG_INFO(BKE_LOG_MESH,
+ 4,
+ "Checking loop %d / edge %u / vert %u (sharp edge: %d, skiploop: %d)...",
+ ml_curr_index,
+ ml_curr->e,
+ ml_curr->v,
+ IS_EDGE_SHARP(e2l_curr),
+ BLI_BITMAP_TEST_BOOL(skip_loops, ml_curr_index));
/* A smooth edge, we have to check for cyclic smooth fan case.
* If we find a new, never-processed cyclic smooth fan, we can do it now using that loop/edge
@@ -1841,7 +1839,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
*/
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(BKE_LOG_MESH, "Getting invalid NULL loop space for loop %d!", i);
}
continue;
}
@@ -1942,7 +1940,8 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
if (!lnors_spacearr.lspacearr[i]) {
BLI_BITMAP_DISABLE(done_loops, i);
if (G.debug & G_DEBUG) {
- printf("WARNING! Still getting invalid NULL loop space in second loop for loop %d!\n", i);
+ CLOG_WARN(
+ BKE_LOG_MESH, "Still getting invalid NULL loop space in second loop for loop %d!", i);
}
continue;
}
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index 4ed9b31dbb5..396322b0494 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -22,6 +22,7 @@
*/
#include "MEM_guardedalloc.h"
+#include <CLG_log.h>
#include "DNA_meshdata_types.h"
#include "DNA_vec_types.h"
@@ -37,6 +38,9 @@
#include "BLI_strict_flags.h"
+/* for the logger */
+#include <BKE_mesh.h>
+
/* -------------------------------------------------------------------- */
/** \name Mesh Connectivity Mapping
* \{ */
@@ -780,10 +784,10 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
* I don't think we can reach this goal with such a simple algo,
* but I don't think either we'll never need all 32 groups!
*/
- printf(
+ CLOG_WARN(
+ BKE_LOG_MESH,
"Warning, could not find an available id for current smooth group, faces will me "
- "marked "
- "as out of any smooth group...\n");
+ "marked as out of any smooth group...");
/* Can't use 0, will have to set them to this value later. */
poly_group_id = poly_group_id_overflowed;
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index 404d6a581ae..0cea41b6738 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -47,7 +47,7 @@
#include "BLI_strict_flags.h"
-static CLG_LogRef LOG = {"bke.mesh"};
+CLG_LOGREF_DECLARE_GLOBAL(BKE_LOG_MESH, "bke.mesh");
/* -------------------------------------------------------------------- */
/** \name Some generic helpers.
@@ -166,9 +166,8 @@ float BKE_mesh_remap_calc_difference_from_mesh(const SpaceTransform *space_trans
result = ((float)numverts_dst / result) - 1.0f;
-#if 0
- printf("%s: Computed difference between meshes (the lower the better): %f\n", __func__, result);
-#endif
+ CLOG_INFO(
+ BKE_LOG_MESH, 3, "Computed difference between meshes (the lower the better): %f", result);
return result;
}
@@ -707,7 +706,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(const int mode,
MEM_freeN(weights);
}
else {
- CLOG_WARN(&LOG, "Unsupported mesh-to-mesh vertex mapping mode (%d)!", mode);
+ CLOG_WARN(BKE_LOG_MESH, "Unsupported mesh-to-mesh vertex mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numverts_dst);
}
@@ -1049,7 +1048,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
MEM_freeN(weights);
}
else {
- CLOG_WARN(&LOG, "Unsupported mesh-to-mesh edge mapping mode (%d)!", mode);
+ CLOG_WARN(BKE_LOG_MESH, "Unsupported mesh-to-mesh edge mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numedges_dst);
}
@@ -2484,7 +2483,7 @@ void BKE_mesh_remap_calc_polys_from_mesh(const int mode,
BLI_rng_free(rng);
}
else {
- CLOG_WARN(&LOG, "Unsupported mesh-to-mesh poly mapping mode (%d)!", mode);
+ CLOG_WARN(BKE_LOG_MESH, "Unsupported mesh-to-mesh poly mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numpolys_dst);
}
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c
index 932423bc445..85e7c95417a 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.c
+++ b/source/blender/blenkernel/intern/mesh_runtime.c
@@ -22,6 +22,7 @@
*/
#include "atomic_ops.h"
+#include <CLG_log.h>
#include "MEM_guardedalloc.h"
@@ -306,7 +307,7 @@ static void mesh_runtime_debug_info_layers(DynStr *dynstr, CustomData *cd)
}
}
-char *BKE_mesh_runtime_debug_info(Mesh *me_eval)
+char *BKE_mesh_runtime_debug_sprinfN(Mesh *me_eval)
{
DynStr *dynstr = BLI_dynstr_new();
char *ret;
@@ -363,19 +364,20 @@ char *BKE_mesh_runtime_debug_info(Mesh *me_eval)
void BKE_mesh_runtime_debug_print(Mesh *me_eval)
{
- char *str = BKE_mesh_runtime_debug_info(me_eval);
+ char *str = BKE_mesh_runtime_debug_sprinfN(me_eval);
puts(str);
fflush(stdout);
MEM_freeN(str);
}
/* XXX Should go
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list