Commit: 552b2287db86ed6e77565672fbccff1d553f823f
Author: Campbell Barton
Date:   Fri Feb 1 12:44:19 2019 +1100
Branches: master
https://developer.blender.org/rB552b2287db86ed6e77565672fbccff1d553f823f

Logging: Use CLOG for blenkernel

Part of D4277 by @sobakasu

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

M       source/blender/blenkernel/intern/DerivedMesh.c
M       source/blender/blenkernel/intern/action.c
M       source/blender/blenkernel/intern/addon.c
M       source/blender/blenkernel/intern/anim.c
M       source/blender/blenkernel/intern/anim_sys.c
M       source/blender/blenkernel/intern/appdir.c
M       source/blender/blenkernel/intern/armature.c
M       source/blender/blenkernel/intern/bpath.c
M       source/blender/blenkernel/intern/constraint.c
M       source/blender/blenkernel/intern/context.c
M       source/blender/blenkernel/intern/curve.c
M       source/blender/blenkernel/intern/customdata.c
M       source/blender/blenkernel/intern/data_transfer.c
M       source/blender/blenkernel/intern/dynamicpaint.c
M       source/blender/blenkernel/intern/fcurve.c
M       source/blender/blenkernel/intern/fmodifier.c
M       source/blender/blenkernel/intern/font.c
M       source/blender/blenkernel/intern/gpencil.c
M       source/blender/blenkernel/intern/icons.c
M       source/blender/blenkernel/intern/idprop.c
M       source/blender/blenkernel/intern/image.c
M       source/blender/blenkernel/intern/ipo.c
M       source/blender/blenkernel/intern/library.c
M       source/blender/blenkernel/intern/library_remap.c
M       source/blender/blenkernel/intern/mask.c
M       source/blender/blenkernel/intern/mask_rasterize.c
M       source/blender/blenkernel/intern/material.c
M       source/blender/blenkernel/intern/mesh_convert.c
M       source/blender/blenkernel/intern/mesh_evaluate.c
M       source/blender/blenkernel/intern/mesh_remap.c
M       source/blender/blenkernel/intern/mesh_validate.c
M       source/blender/blenkernel/intern/modifier.c
M       source/blender/blenkernel/intern/nla.c
M       source/blender/blenkernel/intern/node.c
M       source/blender/blenkernel/intern/object.c
M       source/blender/blenkernel/intern/pointcache.c
M       source/blender/blenkernel/intern/rigidbody.c
M       source/blender/blenkernel/intern/softbody.c

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 6b557e1749a..c1d182fd18b 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -77,6 +77,8 @@
 #include "DEG_depsgraph_query.h"
 #include "BKE_shrinkwrap.h"
 
+#include "CLG_log.h"
+
 #ifdef WITH_OPENSUBDIV
 #  include "DNA_userdef_types.h"
 #endif
@@ -92,7 +94,7 @@
 #  define ASSERT_IS_VALID_MESH(mesh)
 #endif
 
-
+static CLG_LogRef LOG = {"bke.derivedmesh"};
 static ThreadRWMutex loops_cache_lock = PTHREAD_RWLOCK_INITIALIZER;
 
 
@@ -549,9 +551,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, 
CustomDataMask mask, bool
                                uid = kb->uid;
                        }
                        else {
-                               printf("%s: error - could not find active 
shapekey %d!\n",
-                                      __func__, ob->shapenr - 1);
-
+                               CLOG_ERROR(&LOG, "could not find active 
shapekey %d!", ob->shapenr - 1);
                                uid = INT_MAX;
                        }
                }
@@ -614,7 +614,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, 
CustomDataMask mask, bool
         * which should be fed through the modifier
         * stack */
        if (tmp.totvert != me->totvert && !did_shapekeys && me->key) {
-               printf("%s: YEEK! this should be recoded! Shape key loss!: ID 
'%s'\n", __func__, tmp.id.name);
+               CLOG_WARN(&LOG, "YEEK! this should be recoded! Shape key loss!: 
ID '%s'", tmp.id.name);
                if (tmp.key && !(tmp.id.tag & LIB_TAG_NO_MAIN)) {
                        id_us_min(&tmp.key->id);
                }
@@ -1107,7 +1107,7 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, 
Mesh *me, int actshape
 
                        kb->totelem = dm->numVertData;
                        kb->data = MEM_calloc_arrayN(kb->totelem, 3 * 
sizeof(float), "kb->data derivedmesh.c");
-                       fprintf(stderr, "%s: lost a shapekey layer: '%s'! 
(bmesh internal error)\n", __func__, kb->name);
+                       CLOG_ERROR(&LOG, "lost a shapekey layer: '%s'! (bmesh 
internal error)", kb->name);
                }
        }
 }
@@ -1123,9 +1123,8 @@ static void add_shapekey_layers(Mesh *me_dst, Mesh 
*me_src, Object *UNUSED(ob))
 
        /* ensure we can use mesh vertex count for derived mesh custom data */
        if (me_src->totvert != me_dst->totvert) {
-               fprintf(stderr,
-                       "%s: vertex size mismatch (mesh/eval) '%s' (%d != 
%d)\n",
-                       __func__, me_src->id.name + 2, me_src->totvert, 
me_dst->totvert);
+               CLOG_WARN(&LOG, "vertex size mismatch (mesh/eval) '%s' (%d != 
%d)",
+                         me_src->id.name + 2, me_src->totvert, 
me_dst->totvert);
                return;
        }
 
@@ -1134,9 +1133,8 @@ static void add_shapekey_layers(Mesh *me_dst, Mesh 
*me_src, Object *UNUSED(ob))
                float *array;
 
                if (me_src->totvert != kb->totelem) {
-                       fprintf(stderr,
-                               "%s: vertex size mismatch (Mesh '%s':%d != 
KeyBlock '%s':%d)\n",
-                               __func__, me_src->id.name + 2, me_src->totvert, 
kb->name, kb->totelem);
+                       CLOG_WARN(&LOG, "vertex size mismatch (Mesh '%s':%d != 
KeyBlock '%s':%d)",
+                                 me_src->id.name + 2, me_src->totvert, 
kb->name, kb->totelem);
                        array = MEM_calloc_arrayN((size_t)me_src->totvert, 
sizeof(float[3]), __func__);
                }
                else {
diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 13bcfaf4f32..af7384b8f21 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -67,6 +67,10 @@
 
 #include "RNA_access.h"
 
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.action"};
+
 /* *********************** NOTE ON POSE AND ACTION **********************
  *
  * - Pose is the local (object level) component of armature. The current
@@ -1378,16 +1382,15 @@ bool BKE_pose_copy_result(bPose *to, bPose *from)
        bPoseChannel *pchanto, *pchanfrom;
 
        if (to == NULL || from == NULL) {
-               printf("Pose copy error, pose to:%p from:%p\n", (void *)to, 
(void *)from); /* debug temp */
+               CLOG_ERROR(&LOG, "Pose copy error, pose to:%p from:%p", (void 
*)to, (void *)from); /* debug temp */
                return false;
        }
 
        if (to == from) {
-               printf("BKE_pose_copy_result source and target are the same\n");
+               CLOG_ERROR(&LOG, "source and target are the same");
                return false;
        }
 
-
        for (pchanfrom = from->chanbase.first; pchanfrom; pchanfrom = 
pchanfrom->next) {
                pchanto = BKE_pose_channel_find_name(to, pchanfrom->name);
                if (pchanto != NULL) {
diff --git a/source/blender/blenkernel/intern/addon.c 
b/source/blender/blenkernel/intern/addon.c
index 854bf62c061..fea53cfdbfc 100644
--- a/source/blender/blenkernel/intern/addon.c
+++ b/source/blender/blenkernel/intern/addon.c
@@ -40,9 +40,12 @@
 #include "DNA_listBase.h"
 #include "DNA_userdef_types.h"
 
-
 #include "MEM_guardedalloc.h"
 
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.addon"};
+
 /* -------------------------------------------------------------------- */
 /** \name Add-on New/Free
  * \{ */
@@ -109,12 +112,12 @@ bAddonPrefType *BKE_addon_pref_type_find(const char 
*idname, bool quiet)
                }
 
                if (!quiet) {
-                       printf("search for unknown addon-pref '%s'\n", idname);
+                       CLOG_WARN(&LOG, "search for unknown addon-pref '%s'", 
idname);
                }
        }
        else {
                if (!quiet) {
-                       printf("search for empty addon-pref\n");
+                       CLOG_WARN(&LOG, "search for empty addon-pref");
                }
        }
 
diff --git a/source/blender/blenkernel/intern/anim.c 
b/source/blender/blenkernel/intern/anim.c
index 9c9736d9bc5..377cbb13fe4 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -61,6 +61,10 @@
 
 #include "GPU_batch.h"
 
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.anim"};
+
 // XXX bad level call...
 extern short compare_ak_cfraPtr(void *node, void *data);
 extern void agroup_to_keylist(struct AnimData *adt, struct bActionGroup *agrp, 
struct DLRBT_Tree *keys, int saction_flag);
@@ -493,7 +497,7 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
        }
 
        /* calculate path over requested range */
-       printf("Calculating MotionPaths between frames %d - %d (%d frames)\n", 
sfra, efra, efra - sfra + 1);
+       CLOG_INFO(&LOG, 1, "Calculating MotionPaths between frames %d - %d (%d 
frames)", sfra, efra, efra - sfra + 1);
        for (CFRA = sfra; CFRA <= efra; CFRA++) {
                if (current_frame_only) {
                        /* For current frame, only update tagged. */
@@ -704,7 +708,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], 
float dir[3], float qua
        if (ob == NULL || ob->type != OB_CURVE) return 0;
        cu = ob->data;
        if (ob->runtime.curve_cache == NULL || ob->runtime.curve_cache->path == 
NULL || ob->runtime.curve_cache->path->data == NULL) {
-               printf("no path!\n");
+               CLOG_WARN(&LOG, "no path!");
                return 0;
        }
        path = ob->runtime.curve_cache->path;
diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index 5be89212004..f3098f3273b 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -80,6 +80,10 @@
 
 #include "atomic_ops.h"
 
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"bke.anim_sys"};
+
 /* ***************************************** */
 /* AnimData API */
 
@@ -363,7 +367,7 @@ void BKE_animdata_merge_copy(
 
        // TODO: we must unset all "tweakmode" flags
        if ((src->flag & ADT_NLA_EDIT_ON) || (dst->flag & ADT_NLA_EDIT_ON)) {
-               printf("ERROR: Merging AnimData blocks while editing NLA is 
dangerous as it may cause data corruption\n");
+               CLOG_ERROR(&LOG, "Merging AnimData blocks while editing NLA is 
dangerous as it may cause data corruption");
                return;
        }
 
@@ -450,8 +454,8 @@ void action_move_fcurves_by_basepath(bAction *srcAct, 
bAction *dstAct, const cha
        /* sanity checks */
        if (ELEM(NULL, srcAct, dstAct, basepath)) {
                if (G.debug & G_DEBUG) {
-                       printf("ERROR: action_partition_fcurves_by_basepath(%p, 
%p, %p) has insufficient info to work with\n",
-                              (void *)srcAct, (void *)dstAct, (void 
*)basepath);
+                       CLOG_ERROR(&LOG, "srcAct: %p, dstAct: %p, basepath: %p 
has insufficient info to work with",
+                                          (void *)srcAct, (void *)dstAct, 
(void *)basepath);
                }
                return;
        }
@@ -532,7 +536,7 @@ void BKE_animdata_separate_by_basepath(
        /* sanity checks */
        if (ELEM(NULL, srcID, dstID)) {
                if (G.debug & G_DEBUG)
-                       printf("ERROR: no source or destination ID to separate 
AnimData with\n");
+                       CLOG_ERROR(&LOG, "no source or destination ID to 
separate AnimData with");
                return;
        }
 
@@ -542,7 +546,7 @@ void BKE_animdata_separate_by_basepath(
 
        if (ELEM(NULL, srcAdt, dstAdt)) {
                if (G.debug & G_DEBUG)
-                       printf("ERROR: no AnimData for this pair of ID's\n");
+                       CLOG_ERROR(&LOG, "no AnimData for this pair of ID's");
                return;
        }
 
@@ -553,8 +557,9 @@ void BKE_animdata_separate_by_basepath(
                        dstAdt->action = BKE_action_add(bmain, 
srcAdt->action->id.name + 2);
                }
                else if (dstAdt->action == srcAdt->action) {
-                       printf("Argh! Source and Destination share animation! 
('%s' and '%s' both use '%s') Making new empty action\n",
-                              srcID->name, dstID->name, 
srcAdt->action->id.name);
+                       CLOG_WARN(&LOG, "Argh! Source and Destination share 
animation! "
+                                     "('%s' and '%s' both use '%s') Making new 
empty action",
+                                 srcID->name, dstID->name, 
srcAdt->action->id.name);
 
                        /* TODO: review this... */
                        id_us_min(&dstAdt->action->id);
@@ -820,7 +825,7 @@ char *BKE_animsys_fix_rna_path_rename(ID *owner_id, char 
*old_path, const char *
 
        /* if no action, no need to proceed */
        if (ELEM(NULL, owner_id, old_path)) {
-               if (G.debug & G_DEBUG) printf("%s: early abort\n", __func__);
+               if (G.debug & G_DEBUG) CLOG_WARN(&LOG, "early abort");
                return old_path;
        }
 
@@ -1377,20 +1382,20 @@ KS_Path *BKE_keyingset_add_path(KeyingSet *ks, ID *id, 
const char group_name[],
 
        /* sanity checks */
        if (ELEM(NULL, ks, rna_path)) {
-               printf("ERROR: no Keying Set and/or RNA Path to add path 
with\n");
+               CLOG_ERROR(&LOG, "no Keying Set and/or RNA Path to add path 
with");
                return NULL;
        }
 
        /* ID is required for all types of KeyingSets */
        if (id == NULL) {
-               printf("ERROR: No ID provided for Keying Set Path\n");
+               CLOG_ERROR(&LOG, "No ID provided for Keying Set Path");
                return NULL;
        }
 
        /* don't add if there is already a matching KS_Path in the KeyingSet */
        if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, 
groupmode)) {
                if (G.debug & G_DEBUG)
-                       printf("E

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