Logging: Use CLOG for blenkernel

Part of D4277 by @sobakasu
This commit is contained in:
Campbell Barton 2019-02-01 12:44:19 +11:00
parent 8a51af7d1c
commit 552b2287db
Notes: blender-bot 2023-02-14 05:22:16 +01:00
Referenced by issue #69017, Edge split modifier generating an error in background in Sculpt Mode
Referenced by issue #61765, Thread-unsafe logging used
Referenced by issue #61682, Selecting Collections on Outliner doesn't automatically select all the objects
Referenced by issue #61111, Mapping node values get stuck after setting a keyframe
Referenced by issue #61114, Pen Input Lag in 2.8 Beta on Windows Ink in first 2 seconds of touchdown.
Referenced by issue #61104, Compositing two scenes with different output scales crashes blender
Referenced by issue #61089, Not really a bug but a difference between 2.8 and 2.79 (and previous)
Referenced by issue #61096, fbx import crashes on file from mixamo
Referenced by issue #56635, Driver/Keyframes on object visibility do not update viewport
38 changed files with 364 additions and 231 deletions

View File

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

View File

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

View File

@ -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");
}
}

View File

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

View File

@ -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("ERROR: destination already exists in Keying Set\n");
CLOG_ERROR(&LOG, "destination already exists in Keying Set");
return NULL;
}
@ -1513,9 +1518,9 @@ static bool animsys_store_rna_setting(
if (array_len && array_index >= array_len) {
if (G.debug & G_DEBUG) {
printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d\n",
(ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
path, array_index, array_len - 1);
CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d",
(ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
path, array_index, array_len - 1);
}
}
else {
@ -1529,9 +1534,9 @@ static bool animsys_store_rna_setting(
/* XXX don't tag as failed yet though, as there are some legit situations (Action Constraint)
* where some channels will not exist, but shouldn't lock up Action */
if (G.debug & G_DEBUG) {
printf("Animato: Invalid path. ID = '%s', '%s[%d]'\n",
(ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
path, array_index);
CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s[%d]'",
(ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
path, array_index);
}
}
}
@ -2427,8 +2432,8 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, NlaEvalData *nlaeval,
if (!RNA_path_resolve_property(ptr, path, &key.ptr, &key.prop)) {
/* Report failure to resolve the path. */
if (G.debug & G_DEBUG) {
printf("Animato: Invalid path. ID = '%s', '%s'\n",
(ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", path);
CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s'",
(ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", path);
}
/* Cache NULL result. */
@ -2649,8 +2654,8 @@ static bool nlaeval_blend_value(NlaBlendData *blend, NlaEvalChannel *nec, int ar
if (index < 0) {
if (G.debug & G_DEBUG) {
ID *id = nec->key.ptr.id.data;
printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d\n",
id ? (id->name + 2) : "<No ID>", nec->rna_path, array_index, nec->base_snapshot.length);
CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d",
id ? (id->name + 2) : "<No ID>", nec->rna_path, array_index, nec->base_snapshot.length);
}
return false;
@ -2824,7 +2829,7 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, NlaEvalData *channels,
return;
if (strip->act == NULL) {
printf("NLA-Strip Eval Error: Strip '%s' has no Action\n", strip->name);
CLOG_ERROR(&LOG, "NLA-Strip Eval Error: Strip '%s' has no Action", strip->name);
return;
}
@ -3283,7 +3288,7 @@ static void animsys_calculate_nla(Depsgraph *depsgraph, PointerRNA *ptr, AnimDat
else {
/* special case - evaluate as if there isn't any NLA data */
/* TODO: this is really just a stop-gap measure... */
if (G.debug & G_DEBUG) printf("NLA Eval: Stopgap for active action on NLA Stack - no strips case\n");
if (G.debug & G_DEBUG) CLOG_WARN(&LOG, "NLA Eval: Stopgap for active action on NLA Stack - no strips case");
animsys_evaluate_action(depsgraph, ptr, adt->action, ctime);
}
@ -3786,7 +3791,7 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph,
/* set error-flag if evaluation failed */
if (ok == 0) {
printf("invalid driver - %s[%d]\n", fcu->rna_path, fcu->array_index);
CLOG_ERROR(&LOG, "invalid driver - %s[%d]", fcu->rna_path, fcu->array_index);
driver_orig->flag |= DRIVER_FLAG_INVALID;
}
}

View File

@ -41,6 +41,8 @@
#include "MEM_guardedalloc.h"
#include "CLG_log.h"
#ifdef WIN32
# include "utf_winfunc.h"
# include "utfconv.h"
@ -60,6 +62,7 @@
#endif /* WIN32 */
/* local */
static CLG_LogRef LOG = {"bke.appdir"};
static char bprogname[FILE_MAX]; /* full path to program executable */
static char bprogdir[FILE_MAX]; /* full path to directory in which executable is located */
static char btempdir_base[FILE_MAX]; /* persistent temporary directory */
@ -569,7 +572,7 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
if (GetModuleFileNameW(0, fullname_16, maxlen)) {
conv_utf_16_to_8(fullname_16, fullname, maxlen);
if (!BLI_exists(fullname)) {
printf("path can't be found: \"%.*s\"\n", (int)maxlen, fullname);
CLOG_ERROR(&LOG, "path can't be found: \"%.*s\"", (int)maxlen, fullname);
MessageBox(NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK);
}
MEM_freeN(fullname_16);
@ -605,7 +608,7 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
#if defined(DEBUG)
if (!STREQ(name, fullname)) {
printf("guessing '%s' == '%s'\n", name, fullname);
CLOG_INFO(&LOG, 2, "guessing '%s' == '%s'", name, fullname);
}
#endif
}
@ -852,7 +855,7 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c
BLI_add_slash(fullname);
}
else {
printf("Warning! Could not generate a temp file name for '%s', falling back to '%s'\n", tmp_name, fullname);
CLOG_WARN(&LOG, "Could not generate a temp file name for '%s', falling back to '%s'", tmp_name, fullname);
}
MEM_freeN(tmp_name);

View File

@ -75,6 +75,10 @@
#include "atomic_ops.h"
#include "CLG_log.h"
static CLG_LogRef LOG = {"bke.armature"};
/* **************** Generic Functions, data level *************** */
bArmature *BKE_armature_add(Main *bmain, const char *name)
@ -1153,7 +1157,7 @@ void armature_deform_verts(
}
if ((armOb->pose->flag & POSE_RECALC) != 0) {
printf("ERROR! Trying to evaluate influence of armature '%s' which needs Pose recalc!\n", armOb->id.name);
CLOG_ERROR(&LOG, "Trying to evaluate influence of armature '%s' which needs Pose recalc!", armOb->id.name);
BLI_assert(0);
}
@ -1169,7 +1173,7 @@ void armature_deform_verts(
ObjectBBoneDeform *bbone_deform =
BKE_armature_cached_bbone_deformation_get(armOb);
if (bbone_deform == NULL || bbone_deform->pdef_info_array == NULL) {
fprintf(stderr,
CLOG_ERROR(&LOG,
"Armature does not have bbone cache %s, "
"usually happens due to a dependency cycle.\n",
armOb->id.name + 2);
@ -1997,7 +2001,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->layer & layer_protected) {
if (BKE_pose_channel_find_name(frompose, pchan->name) == NULL) {
printf("failed to sync proxy armature because '%s' is missing pose channel '%s'\n",
CLOG_ERROR(&LOG, "failed to sync proxy armature because '%s' is missing pose channel '%s'",
from->id.name, pchan->name);
error = 1;
}

View File

@ -81,10 +81,14 @@
#include "BKE_bpath.h" /* own include */
#include "CLG_log.h"
#ifndef _MSC_VER
# include "BLI_strict_flags.h"
#endif
static CLG_LogRef LOG = {"bke.bpath"};
static bool checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
{
ReportList *reports = (ReportList *)userdata;
@ -141,7 +145,7 @@ void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *re
const int flag = BKE_BPATH_TRAVERSE_SKIP_LIBRARY;
if (basedir[0] == '\0') {
printf("%s: basedir='', this is a bug\n", __func__);
CLOG_ERROR(&LOG, "basedir='', this is a bug");
return;
}
@ -185,7 +189,7 @@ void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *re
const int flag = BKE_BPATH_TRAVERSE_SKIP_LIBRARY;
if (basedir[0] == '\0') {
printf("%s: basedir='', this is a bug\n", __func__);
CLOG_ERROR(&LOG, "basedir='', this is a bug");
return;
}
@ -684,8 +688,7 @@ bool BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pa
const char *base_old = ((char **)pathbase_v)[1];
if (BLI_path_is_rel(base_old)) {
printf("%s: error, old base path '%s' is not absolute.\n",
__func__, base_old);
CLOG_ERROR(&LOG, "old base path '%s' is not absolute.", base_old);
return false;
}

View File

@ -87,6 +87,8 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "CLG_log.h"
#ifdef WITH_PYTHON
# include "BPY_extern.h"
#endif
@ -101,6 +103,8 @@
/* Constraint Target Macros */
#define VALID_CONS_TARGET(ct) ((ct) && (ct->tar))
static CLG_LogRef LOG = {"bke.constraint"};
/* ************************ Constraints - General Utilities *************************** */
/* These functions here don't act on any specific constraints, and are therefore should/will
* not require any of the special function-pointers afforded by the relevant constraint
@ -4706,7 +4710,7 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
return constraintsTypeInfo[type];
}
else {
printf("No valid constraint type-info data available. Type = %i\n", type);
CLOG_WARN(&LOG, "No valid constraint type-info data available. Type = %i", type);
}
return NULL;

View File

@ -62,10 +62,14 @@
#include "RNA_access.h"
#include "CLG_log.h"
#ifdef WITH_PYTHON
# include "BPY_extern.h"
#endif
static CLG_LogRef LOG = {"bke.context"};
/* struct */
struct bContext {
@ -255,10 +259,10 @@ static void *ctx_wm_python_context_get(
return result.ptr.data;
}
else {
printf("PyContext '%s' is a '%s', expected a '%s'\n",
member,
RNA_struct_identifier(result.ptr.type),
RNA_struct_identifier(member_type));
CLOG_WARN(&LOG, "PyContext '%s' is a '%s', expected a '%s'",
member,
RNA_struct_identifier(result.ptr.type),
RNA_struct_identifier(member_type));
}
}
}
@ -413,8 +417,8 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
return ptr;
}
else {
printf("%s: warning, member '%s' is '%s', not '%s'\n",
__func__, member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type));
CLOG_WARN(&LOG, "member '%s' is '%s', not '%s'",
member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type));
}
}

View File

@ -63,9 +63,13 @@
#include "DEG_depsgraph.h"
#include "CLG_log.h"
/* globals */
/* local */
static CLG_LogRef LOG = {"bke.curve"};
static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], const float v4[3],
short cox, short coy,
float *lambda, float *mu, float vec[3]);
@ -1032,7 +1036,7 @@ static void calcknots(float *knots, const int pnts, const short order, const sho
}
}
else {
printf("bez nurb curve order is not 3 or 4, should never happen\n");
CLOG_ERROR(&LOG, "bez nurb curve order is not 3 or 4, should never happen");
}
break;
default:

View File

@ -59,6 +59,8 @@
#include "bmesh.h"
#include "CLG_log.h"
/* only for customdata_data_transfer_interp_normal_normals */
#include "data_transfer_intern.h"
@ -68,6 +70,7 @@
/* ensure typemap size is ok */
BLI_STATIC_ASSERT(ARRAY_SIZE(((CustomData *)NULL)->typemap) == CD_NUMTYPES, "size mismatch");
static CLG_LogRef LOG = {"bke.customdata"};
/********************* Layer type information **********************/
typedef struct LayerTypeInfo {
@ -620,7 +623,7 @@ static int layerRead_mdisps(CDataFile *cdf, void *data, int count)
d[i].disps = MEM_calloc_arrayN(d[i].totdisp, 3 * sizeof(float), "mdisps read");
if (!cdf_read_data(cdf, d[i].totdisp * 3 * sizeof(float), d[i].disps)) {
printf("failed to read multires displacement %d/%d %d\n", i, count, d[i].totdisp);
CLOG_ERROR(&LOG, "failed to read multires displacement %d/%d %d", i, count, d[i].totdisp);
return 0;
}
}
@ -635,7 +638,7 @@ static int layerWrite_mdisps(CDataFile *cdf, const void *data, int count)
for (i = 0; i < count; ++i) {
if (!cdf_write_data(cdf, d[i].totdisp * 3 * sizeof(float), d[i].disps)) {
printf("failed to write multires displacement %d/%d %d\n", i, count, d[i].totdisp);
CLOG_ERROR(&LOG, "failed to write multires displacement %d/%d %d", i, count, d[i].totdisp);
return 0;
}
}
@ -2241,9 +2244,9 @@ static void CustomData_copy_data_layer(
if (!count || !src_data || !dst_data) {
if (count && !(src_data == NULL && dst_data == NULL)) {
printf("%s: warning null data for %s type (%p --> %p), skipping\n",
__func__, layerType_getName(source->layers[src_i].type),
(void *)src_data, (void *)dst_data);
CLOG_WARN(&LOG, "null data for %s type (%p --> %p), skipping",
layerType_getName(source->layers[src_i].type),
(void *)src_data, (void *)dst_data);
}
return;
}
@ -3403,7 +3406,7 @@ void CustomData_file_write_prepare(
CustomDataLayer *layer = &data->layers[i];
if (layer->flag & CD_FLAG_NOCOPY) { /* Layers with this flag set are not written to file. */
data->totlayer--;
/* printf("%s: skipping layer %p (%s)\n", __func__, layer, layer->name); */
/* CLOG_WARN(&LOG, "skipping layer %p (%s)", layer, layer->name); */
}
else {
if (UNLIKELY((size_t)j >= write_layers_size)) {
@ -3656,7 +3659,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
cdf = cdf_create(CDF_TYPE_MESH);
if (!cdf_read_open(cdf, filename)) {
cdf_free(cdf);
fprintf(stderr, "Failed to read %s layer from %s.\n", layerType_getName(layer->type), filename);
CLOG_ERROR(&LOG, "Failed to read %s layer from %s.", layerType_getName(layer->type), filename);
return;
}
@ -3745,7 +3748,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
}
if (!cdf_write_open(cdf, filename)) {
fprintf(stderr, "Failed to open %s for writing.\n", filename);
CLOG_ERROR(&LOG, "Failed to open %s for writing.", filename);
cdf_free(cdf);
return;
}
@ -3772,7 +3775,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
}
if (i != data->totlayer) {
fprintf(stderr, "Failed to write data to %s.\n", filename);
CLOG_ERROR(&LOG, "Failed to write data to %s.", filename);
cdf_write_close(cdf);
cdf_free(cdf);
return;
@ -3877,7 +3880,7 @@ static void copy_bit_flag(void *dst, const void *src, const size_t data_size, co
COPY_BIT_FLAG(uint64_t, dst, src, flag);
break;
default:
//printf("ERROR %s: Unknown flags-container size (%zu)\n", __func__, datasize);
//CLOG_ERROR(&LOG, "Unknown flags-container size (%zu)", datasize);
break;
}
@ -3896,7 +3899,7 @@ static bool check_bit_flag(const void *data, const size_t data_size, const uint6
case 8:
return ((*((uint64_t *)data) & ((uint64_t)flag)) != 0);
default:
//printf("ERROR %s: Unknown flags-container size (%zu)\n", __func__, datasize);
//CLOG_ERROR(&LOG, "Unknown flags-container size (%zu)", datasize);
return false;
}
}

View File

@ -29,6 +29,8 @@
* \ingroup bke
*/
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_customdata_types.h"
@ -54,6 +56,7 @@
#include "data_transfer_intern.h"
static CLG_LogRef LOG = {"bke.data_transfer"};
CustomDataMask BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types)
{
@ -1117,7 +1120,7 @@ bool BKE_object_data_transfer_ex(
me_src = ob_src->runtime.mesh_eval;
if (me_src == NULL || (me_src_mask & ~ob_src->runtime.last_data_mask) != 0) {
printf("Data Transfer: source mesh data is not ready - dependency cycle?\n");
CLOG_WARN(&LOG, "Data Transfer: source mesh data is not ready - dependency cycle?");
return changed;
}
}

View File

@ -89,11 +89,15 @@
#include "atomic_ops.h"
#include "CLG_log.h"
/* could enable at some point but for now there are far too many conversions */
#ifdef __GNUC__
//# pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif
static CLG_LogRef LOG = {"bke.dynamicpaint"};
/* precalculated gaussian factors for 5x super sampling */
static const float gaussianFactors[5] = {
0.996849f,
@ -240,6 +244,7 @@ static int setError(DynamicPaintCanvasSettings *canvas, const char *string)
{
/* Add error to canvas ui info label */
BLI_strncpy(canvas->error, string, sizeof(canvas->error));
CLOG_STR_ERROR(&LOG, string);
return 0;
}
@ -2810,7 +2815,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
/*
* Start generating the surface
*/
printf("DynamicPaint: Preparing UV surface of %ix%i pixels and %i tris.\n", w, h, tottri);
CLOG_INFO(&LOG, 1, "Preparing UV surface of %ix%i pixels and %i tris.", w, h, tottri);
/* Init data struct */
if (surface->data)
@ -4448,7 +4453,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
particlesAdded++;
}
if (invalidParticles)
printf("Warning: Invalid particle(s) found!\n");
CLOG_WARN(&LOG, "Invalid particle(s) found!");
/* If no suitable particles were found, exit */
if (particlesAdded < 1) {

View File

@ -67,6 +67,8 @@
#include "atomic_ops.h"
#include "CLG_log.h"
#ifdef WITH_PYTHON
#include "BPY_extern.h"
#endif
@ -78,6 +80,8 @@
static ThreadMutex python_driver_lock = BLI_MUTEX_INITIALIZER;
#endif
static CLG_LogRef LOG = {"bke.fcurve"};
/* ************************** Data-Level Functions ************************* */
/* ---------------------- Freeing --------------------------- */
@ -434,7 +438,7 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
* - keyframe to be added would replace one of the existing ones on bounds
*/
if ((arraylen <= 0) || (array == NULL)) {
printf("Warning: binarysearch_bezt_index() encountered invalid array\n");
CLOG_WARN(&LOG, "encountered invalid array");
return 0;
}
else {
@ -484,10 +488,10 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl
/* print error if loop-limit exceeded */
if (loopbreaker == (maxloop - 1)) {
printf("Error: binarysearch_bezt_index() was taking too long\n");
CLOG_ERROR(&LOG, "search taking too long");
/* include debug info */
printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
CLOG_ERROR(&LOG, "\tround = %d: start = %d, end = %d, arraylen = %d", loopbreaker, start, end, arraylen);
}
/* not found, so return where to place it */
@ -849,13 +853,13 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample
int cfra;
/* sanity checks */
/* TODO: make these tests report errors using reports not printf's */
/* TODO: make these tests report errors using reports not CLOG's */
if (ELEM(NULL, fcu, sample_cb)) {
printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
CLOG_ERROR(&LOG, "No F-Curve with F-Curve Modifiers to Bake");
return;
}
if (start > end) {
printf("Error: Frame range for Sampled F-Curve creation is inappropriate\n");
CLOG_ERROR(&LOG, "Error: Frame range for Sampled F-Curve creation is inappropriate");
return;
}
@ -1166,7 +1170,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
/* error check for missing pointer... */
if (id == NULL) {
if (G.debug & G_DEBUG) {
printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path);
CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
}
driver->flag |= DRIVER_FLAG_INVALID;
@ -1199,8 +1203,8 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
else {
/* out of bounds */
if (G.debug & G_DEBUG) {
printf("Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
id->name, dtar->rna_path, index);
CLOG_ERROR(&LOG, "Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)",
id->name, dtar->rna_path, index);
}
driver->flag |= DRIVER_FLAG_INVALID;
@ -1231,7 +1235,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar)
else {
/* path couldn't be resolved */
if (G.debug & G_DEBUG) {
printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path);
CLOG_ERROR(&LOG, "Driver Evaluation Error: cannot resolve target for %s -> %s", id->name, dtar->rna_path);
}
driver->flag |= DRIVER_FLAG_INVALID;
@ -1266,7 +1270,7 @@ bool driver_get_variable_property(
/* error check for missing pointer... */
if (id == NULL) {
if (G.debug & G_DEBUG) {
printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path);
CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path);
}
driver->flag |= DRIVER_FLAG_INVALID;
@ -1288,7 +1292,7 @@ bool driver_get_variable_property(
else {
/* path couldn't be resolved */
if (G.debug & G_DEBUG) {
printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path);
CLOG_ERROR(&LOG, "Driver Evaluation Error: cannot resolve target for %s -> %s", id->name, dtar->rna_path);
}
ptr = PointerRNA_NULL;
@ -1351,8 +1355,8 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar)
/* make sure we have enough valid targets to use - all or nothing for now... */
if (driver_check_valid_targets(driver, dvar) != 2) {
if (G.debug & G_DEBUG) {
printf("RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)\n",
valid_targets, dvar->targets[0].id, dvar->targets[1].id);
CLOG_WARN(&LOG, "RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
valid_targets, dvar->targets[0].id, dvar->targets[1].id);
}
return 0.0f;
}
@ -1408,8 +1412,8 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
/* make sure we have enough valid targets to use - all or nothing for now... */
if (valid_targets < dvar->num_targets) {
if (G.debug & G_DEBUG) {
printf("LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)\n",
valid_targets, dvar->targets[0].id, dvar->targets[1].id);
CLOG_WARN(&LOG, "LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)",
valid_targets, dvar->targets[0].id, dvar->targets[1].id);
}
return 0.0f;
}
@ -1933,14 +1937,14 @@ static bool driver_evaluate_simple_expr(ChannelDriver *driver, ExprPyLike_Parsed
case EXPR_PYLIKE_DIV_BY_ZERO:
case EXPR_PYLIKE_MATH_ERROR:
message = (status == EXPR_PYLIKE_DIV_BY_ZERO) ? "Division by Zero" : "Math Domain Error";
fprintf(stderr, "\n%s in Driver: '%s'\n", message, driver->expression);
CLOG_ERROR(&LOG, "%s in Driver: '%s'", message, driver->expression);
driver->flag |= DRIVER_FLAG_INVALID;
return true;
default:
/* arriving here means a bug, not user error */
printf("Error: simple driver expression evaluation failed: '%s'\n", driver->expression);
CLOG_ERROR(&LOG, "simple driver expression evaluation failed: '%s'", driver->expression);
return false;
}
}

View File

@ -35,6 +35,8 @@
#include "MEM_guardedalloc.h"
#include "CLG_log.h"
#include "DNA_anim_types.h"
#include "BLT_translation.h"
@ -48,6 +50,8 @@
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
static CLG_LogRef LOG = {"bke.fmodifier"};
/* ******************************** F-Modifiers ********************************* */
/* Forward declarations. */
@ -342,7 +346,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float
break;
}
default:
printf("Invalid Function-Generator for F-Modifier - %d\n", data->type);
CLOG_ERROR(&LOG, "Invalid Function-Generator for F-Modifier - %d", data->type);
break;
}
@ -504,7 +508,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
* - keyframe to be added would replace one of the existing ones on bounds
*/
if ((arraylen <= 0) || (array == NULL)) {
printf("Warning: binarysearch_fcm_envelopedata_index() encountered invalid array\n");
CLOG_WARN(&LOG, "encountered invalid array");
return 0;
}
else {
@ -558,10 +562,10 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array
/* print error if loop-limit exceeded */
if (loopbreaker == (maxloop - 1)) {
printf("Error: binarysearch_fcm_envelopedata_index() was taking too long\n");
CLOG_ERROR(&LOG, "binary search was taking too long");
// include debug info
printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
CLOG_ERROR(&LOG, "\tround = %d: start = %d, end = %d, arraylen = %d", loopbreaker, start, end, arraylen);
}
/* not found, so return where to place it */
@ -1035,7 +1039,7 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type)
return fmodifiersTypeInfo[type];
}
else {
printf("No valid F-Curve Modifier type-info data available. Type = %i\n", type);
CLOG_ERROR(&LOG, "No valid F-Curve Modifier type-info data available. Type = %i", type);
}
return NULL;
@ -1069,7 +1073,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
if ((modifiers->first) && (type == FMODIFIER_TYPE_CYCLES)) {
/* cycles modifier must be first in stack, so for now, don't add if it can't be */
/* TODO: perhaps there is some better way, but for now, */
printf("Error: Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.\n");
CLOG_STR_ERROR(&LOG, "Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.");
return NULL;
}
@ -1183,7 +1187,7 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm)
}
else {
/* XXX this case can probably be removed some day, as it shouldn't happen... */
printf("remove_fmodifier() - no modifier stack given\n");
CLOG_STR_ERROR(&LOG, "no modifier stack given");
MEM_freeN(fcm);
return false;
}
@ -1498,9 +1502,9 @@ void fcurve_bake_modifiers(FCurve *fcu, int start, int end)
ChannelDriver *driver;
/* sanity checks */
/* TODO: make these tests report errors using reports not printf's */
/* TODO: make these tests report errors using reports not CLOG's */
if (ELEM(NULL, fcu, fcu->modifiers.first)) {
printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
CLOG_ERROR(&LOG, "No F-Curve with F-Curve Modifiers to Bake");
return;
}

View File

@ -37,6 +37,8 @@
#include <wchar.h>
#include <wctype.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
@ -62,6 +64,7 @@
#include "BKE_anim.h"
#include "BKE_curve.h"
static CLG_LogRef LOG = {"bke.data_transfer"};
static ThreadRWMutex vfont_rwlock = BLI_RWLOCK_INITIALIZER;
/* The vfont code */
@ -140,7 +143,7 @@ void BKE_vfont_builtin_register(void *mem, int size)
static PackedFile *get_builtin_packedfile(void)
{
if (!builtin_font_data) {
printf("Internal error, builtin font not loaded\n");
CLOG_ERROR(&LOG, "Internal error, builtin font not loaded");
return NULL;
}
@ -195,7 +198,7 @@ static VFontData *vfont_get_data(VFont *vfont)
}
}
if (!pf) {
printf("Font file doesn't exist: %s\n", vfont->name);
CLOG_WARN(&LOG, "Font file doesn't exist: %s", vfont->name);
/* DON'T DO THIS
* missing file shouldn't modify path! - campbell */
@ -862,7 +865,7 @@ makebreak:
(ct->dobreak == 0) &&
(((xof - tb_scale.x) + twidth) > xof_scale + tb_scale.w))
{
// fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
// CLOG_WARN(&LOG, "linewidth exceeded: %c%c%c...", mem[i], mem[i+1], mem[i+2]);
for (j = i; j && (mem[j] != '\n') && (chartransdata[j].dobreak == 0); j--) {
bool dobreak = false;
if (mem[j] == ' ' || mem[j] == '-') {
@ -877,7 +880,7 @@ makebreak:
dobreak = true;
}
else if (chartransdata[j].dobreak) {
// fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]);
// CLOG_WARN(&LOG, "word too long: %c%c%c...", mem[j], mem[j+1], mem[j+2]);
ct->dobreak = 1;
custrinfo[i + 1].flag |= CU_CHINFO_WRAP;
ct -= 1;
@ -1368,7 +1371,7 @@ makebreak:
}
if (ob == NULL || info->mat_nr > (ob->totcol)) {
/* printf("Error: Illegal material index (%d) in text object, setting to 0\n", info->mat_nr); */
/* CLOG_ERROR(&LOG, "Illegal material index (%d) in text object, setting to 0", info->mat_nr); */
info->mat_nr = 0;
}
/* We do not want to see any character for \n or \r */

View File

@ -34,6 +34,8 @@
#include <stddef.h>
#include <math.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
@ -64,6 +66,8 @@
#include "DEG_depsgraph.h"
static CLG_LogRef LOG = {"bke.gpencil"};
/* ************************************************** */
/* Draw Engine */
@ -262,7 +266,7 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
/* check whether frame was added successfully */
if (state == -1) {
printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe);
CLOG_ERROR(&LOG, "Frame (%d) existed already for this layer. Using existing frame", cframe);
/* free the newly created one, and use the old one instead */
MEM_freeN(gpf);
@ -887,7 +891,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M
gpl->actframe = gpf;
else {
/* unresolved errogenous situation! */
printf("Error: cannot find appropriate gp-frame\n");
CLOG_STR_ERROR(&LOG, "cannot find appropriate gp-frame");
/* gpl->actframe should still be NULL */
}
}

View File

@ -35,6 +35,8 @@
#include <stdlib.h>
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_brush_types.h"
@ -77,6 +79,8 @@ enum {
/* GLOBALS */
static CLG_LogRef LOG = {"bke.icons"};
static GHash *gIcons = NULL;
static int gNextIconId = 1;
@ -588,7 +592,7 @@ int BKE_icon_id_ensure(struct ID *id)
id->icon_id = get_next_free_id();
if (!id->icon_id) {
printf("%s: Internal error - not enough IDs\n", __func__);
CLOG_ERROR(&LOG, "not enough IDs");
return 0;
}
@ -633,7 +637,7 @@ int BKE_icon_gplayer_color_ensure(bGPDlayer *gpl)
gpl->runtime.icon_id = get_next_free_id();
if (!gpl->runtime.icon_id) {
printf("%s: Internal error - not enough IDs\n", __func__);
CLOG_ERROR(&LOG, "not enough IDs");
return 0;
}
@ -665,7 +669,7 @@ int BKE_icon_preview_ensure(ID *id, PreviewImage *preview)
preview->icon_id = get_next_free_id();
if (!preview->icon_id) {
printf("%s: Internal error - not enough IDs\n", __func__);
CLOG_ERROR(&LOG, "not enough IDs");
return 0;
}
@ -690,7 +694,7 @@ Icon *BKE_icon_get(const int icon_id)
icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id));
if (!icon) {
printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
CLOG_ERROR(&LOG, "no icon for icon ID: %d", icon_id);
return NULL;
}
@ -704,7 +708,7 @@ void BKE_icon_set(const int icon_id, struct Icon *icon)
void **val_p;
if (BLI_ghash_ensure_p(gIcons, POINTER_FROM_INT(icon_id), &val_p)) {
printf("%s: Internal error, icon already set: %d\n", __func__, icon_id);
CLOG_ERROR(&LOG, "icon already set: %d", icon_id);
return;
}

View File

@ -40,6 +40,8 @@
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_strict_flags.h"
@ -52,6 +54,8 @@
*/
#define IDP_ARRAY_REALLOC_LIMIT 200
static CLG_LogRef LOG = {"bke.idprop"};
/*local size table.*/
static size_t idp_size_table[] = {
1, /*strings*/
@ -986,7 +990,7 @@ IDProperty *IDP_New(const char type, const IDPropertyTemplate *val, const char *
prop->len = prop->totallen = val->array.len;
break;
}
printf("%s: bad array type.\n", __func__);
CLOG_ERROR(&LOG, "bad array type.");
return NULL;
}
case IDP_STRING:

View File

@ -40,6 +40,8 @@
#include <time.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "IMB_colormanagement.h"
@ -98,6 +100,7 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
static CLG_LogRef LOG = {"bke.image"};
static SpinLock image_spin;
/* prototypes */
@ -730,7 +733,7 @@ static void image_memorypack_multiview(Image *ima)
IMB_saveiff(ibuf, iv->filepath, IB_rect | IB_mem);
if (ibuf->encodedbuffer == NULL) {
printf("memory save for pack error\n");
CLOG_STR_ERROR(&LOG, "memory save for pack error");
IMB_freeImBuf(ibuf);
image_free_packedfiles(ima);
return;
@ -783,7 +786,7 @@ void BKE_image_memorypack(Image *ima)
IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
if (ibuf->encodedbuffer == NULL) {
printf("memory save for pack error\n");
CLOG_STR_ERROR(&LOG, "memory save for pack error");
}
else {
ImagePackedFile *imapf;

View File

@ -77,12 +77,16 @@
#include "BKE_nla.h"
#include "BKE_sequencer.h"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#ifdef WIN32
# include "BLI_math_base.h" /* M_PI */
#endif
static CLG_LogRef LOG = {"bke.ipo"};
/* *************************************************** */
/* Old-Data Freeing Tools */
@ -292,7 +296,7 @@ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index)
}
/* for debugging only */
printf("ERROR: unmatched PoseChannel setting (code %d)\n", adrcode);
CLOG_ERROR(&LOG, "unmatched PoseChannel setting (code %d)", adrcode);
return NULL;
}
@ -893,7 +897,7 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[],
/* TODO... add other blocktypes... */
default:
printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet\n", blocktype, adrcode);
CLOG_WARN(&LOG, "No path for blocktype %d, adrcode %d yet", blocktype, adrcode);
break;
}
@ -1519,7 +1523,7 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char
if (ELEM(NULL, id, ipo))
return;
if (adt == NULL) {
printf("ERROR ipo_to_animdata(): adt invalid\n");
CLOG_ERROR(&LOG, "adt invalid");
return;
}
@ -1686,13 +1690,13 @@ void do_versions_ipos_to_animato(Main *bmain)
ID *id;
if (bmain == NULL) {
printf("Argh! Main is NULL in do_versions_ipos_to_animato()\n");
CLOG_ERROR(&LOG, "Argh! Main is NULL");
return;
}
/* only convert if version is right */
if (bmain->versionfile >= 250) {
printf("WARNING: Animation data too new to convert (Version %d)\n", bmain->versionfile);
CLOG_WARN(&LOG, "Animation data too new to convert (Version %d)", bmain->versionfile);
return;
}
else if (G.debug & G_DEBUG)

View File

@ -39,6 +39,8 @@
#include <stddef.h>
#include <assert.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
/* all types are needed here, in order to do memory operations */
@ -140,6 +142,8 @@
# include "PIL_time_utildefines.h"
#endif
static CLG_LogRef LOG = {"bke.library"};
/* GS reads the memory pointed at in a specific ordering.
* only use this definition, makes little and big endian systems
* work fine, in conjunction with MAKE_ID */
@ -185,7 +189,7 @@ void id_us_ensure_real(ID *id)
id->tag |= LIB_TAG_EXTRAUSER;
if (id->us <= limit) {
if (id->us < limit || ((id->us == limit) && (id->tag & LIB_TAG_EXTRAUSER_SET))) {
printf("ID user count error: %s (from '%s')\n", id->name, id->lib ? id->lib->filepath : "[Main]");
CLOG_ERROR(&LOG, "ID user count error: %s (from '%s')", id->name, id->lib ? id->lib->filepath : "[Main]");
BLI_assert(0);
}
id->us = limit + 1;
@ -241,8 +245,8 @@ void id_us_min(ID *id)
const int limit = ID_FAKE_USERS(id);
if (id->us <= limit) {
printf("ID user decrement error: %s (from '%s'): %d <= %d\n",
id->name, id->lib ? id->lib->filepath : "[Main]", id->us, limit);
CLOG_ERROR(&LOG, "ID user decrement error: %s (from '%s'): %d <= %d",
id->name, id->lib ? id->lib->filepath : "[Main]", id->us, limit);
BLI_assert(0);
id->us = limit;
}
@ -1977,8 +1981,8 @@ void BKE_library_make_local(
/* Proxies only work when the proxified object is linked-in from a library. */
if (ob->proxy->id.lib == NULL) {
printf("Warning, proxy object %s will loose its link to %s, because the "
"proxified object is local.\n", id->newid->name, ob->proxy->id.name);
CLOG_WARN(&LOG, "proxy object %s will loose its link to %s, because the "
"proxified object is local.", id->newid->name, ob->proxy->id.name);
continue;
}
@ -1988,8 +1992,8 @@ void BKE_library_make_local(
* referred to from a library. Not checking for local use; if new local proxy
* was not used locally would be a nasty bug! */
if (is_local || is_lib) {
printf("Warning, made-local proxy object %s will loose its link to %s, "
"because the linked-in proxy is referenced (is_local=%i, is_lib=%i).\n",
CLOG_WARN(&LOG, "made-local proxy object %s will loose its link to %s, "
"because the linked-in proxy is referenced (is_local=%i, is_lib=%i).",
id->newid->name, ob->proxy->id.name, is_local, is_lib);
}
else {

View File

@ -31,6 +31,8 @@
#include <stddef.h>
#include <assert.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
/* all types are needed here, in order to do memory operations */
@ -119,6 +121,8 @@
#include "BPY_extern.h"
#endif
static CLG_LogRef LOG = {"bke.library_remap"};
static BKE_library_free_window_manager_cb free_windowmanager_cb = NULL;
void BKE_library_callback_free_window_manager_set(BKE_library_free_window_manager_cb func)
@ -496,9 +500,9 @@ void BKE_libblock_remap_locked(
}
if (old_id->us - skipped_refcounted < 0) {
printf("Error in remapping process from '%s' (%p) to '%s' (%p): "
"wrong user count in old ID after process (summing up to %d)\n",
old_id->name, old_id, new_id ? new_id->name : "<NULL>", new_id, old_id->us - skipped_refcounted);
CLOG_ERROR(&LOG, "Error in remapping process from '%s' (%p) to '%s' (%p): "
"wrong user count in old ID after process (summing up to %d)",
old_id->name, old_id, new_id ? new_id->name : "<NULL>", new_id, old_id->us - skipped_refcounted);
BLI_assert(0);
}

View File

@ -32,6 +32,8 @@
#include <stddef.h>
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
@ -63,6 +65,8 @@
#include "DEG_depsgraph_build.h"
static CLG_LogRef LOG = {"bke.mask"};
static struct {
ListBase splines;
struct GHash *id_hash;
@ -1489,8 +1493,8 @@ void BKE_mask_layer_shape_from_mask(MaskLayer *masklay, MaskLayerShape *masklay_
}
}
else {
printf("%s: vert mismatch %d != %d (frame %d)\n",
__func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
masklay_shape->tot_vert, tot, masklay_shape->frame);
}
}
@ -1511,8 +1515,8 @@ void BKE_mask_layer_shape_to_mask(MaskLayer *masklay, MaskLayerShape *masklay_sh
}
}
else {
printf("%s: vert mismatch %d != %d (frame %d)\n",
__func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
masklay_shape->tot_vert, tot, masklay_shape->frame);
}
}
@ -1550,9 +1554,9 @@ void BKE_mask_layer_shape_to_mask_interp(MaskLayer *masklay,
}
}
else {
printf("%s: vert mismatch %d != %d != %d (frame %d - %d)\n",
__func__, masklay_shape_a->tot_vert, masklay_shape_b->tot_vert, tot,
masklay_shape_a->frame, masklay_shape_b->frame);
CLOG_ERROR(&LOG, "vert mismatch %d != %d != %d (frame %d - %d)",
masklay_shape_a->tot_vert, masklay_shape_b->tot_vert, tot,
masklay_shape_a->frame, masklay_shape_b->frame);
}
}
@ -1806,8 +1810,8 @@ void BKE_mask_layer_shape_changed_add(MaskLayer *masklay, int index,
masklay_shape->data = data_resized;
}
else {
printf("%s: vert mismatch %d != %d (frame %d)\n",
__func__, masklay_shape->tot_vert, tot, masklay_shape->frame);
CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
masklay_shape->tot_vert, tot, masklay_shape->frame);
}
}
}
@ -1847,8 +1851,8 @@ void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int coun
masklay_shape->data = data_resized;
}
else {
printf("%s: vert mismatch %d != %d (frame %d)\n",
__func__, masklay_shape->tot_vert - count, tot, masklay_shape->frame);
CLOG_ERROR(&LOG, "vert mismatch %d != %d (frame %d)",
masklay_shape->tot_vert - count, tot, masklay_shape->frame);
}
}
}

View File

@ -68,6 +68,8 @@
* - Campbell
*/
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_vec_types.h"
@ -121,6 +123,8 @@
# define FACE_ASSERT(face, vert_max)
#endif
static CLG_LogRef LOG = {"bke.mask_rasterize"};
static void rotate_point_v2(float r_p[2], const float p[2], const float cent[2], const float angle, const float asp[2])
{
const float s = sinf(angle);
@ -1401,6 +1405,7 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
value = fabsf(value - value_layer);
break;
default: /* same as add */
CLOG_ERROR(&LOG, "unhandled blend type: %d", layer->blend);
BLI_assert(0);
value += value_layer;
break;

View File

@ -34,6 +34,8 @@
#include <math.h>
#include <stddef.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
@ -79,6 +81,8 @@
/* used in UI and render */
Material defmaterial;
static CLG_LogRef LOG = {"bke.material"};
/* called on startup, creator.c */
void init_def_material(void)
{
@ -524,7 +528,7 @@ Material **give_current_material_p(Object *ob, short act)
return NULL;
else if (act <= 0) {
if (act < 0) {
printf("Negative material index!\n");
CLOG_ERROR(&LOG, "Negative material index!");
}
return NULL;
}
@ -938,7 +942,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
/* this should never happen and used to crash */
if (ob->actcol <= 0) {
printf("%s: invalid material index %d, report a bug!\n", __func__, ob->actcol);
CLOG_ERROR(&LOG, "invalid material index %d, report a bug!", ob->actcol);
BLI_assert(0);
return false;
}

View File

@ -22,6 +22,7 @@
* \ingroup bke
*/
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
@ -67,6 +68,8 @@
# define ASSERT_IS_VALID_MESH(mesh)
#endif
static CLG_LogRef LOG = {"bke.mesh_convert"};
void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
{
DispList *dl;
@ -1088,9 +1091,8 @@ static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
/* ensure we can use mesh vertex count for derived mesh custom data */
if (mesh_src->totvert != mesh_dest->totvert) {
fprintf(stderr,
"%s: vertex size mismatch (mesh/dm) '%s' (%d != %d)\n",
__func__, mesh_src->id.name + 2, mesh_src->totvert, mesh_dest->totvert);
CLOG_ERROR(&LOG, "vertex size mismatch (mesh/dm) '%s' (%d != %d)",
mesh_src->id.name + 2, mesh_src->totvert, mesh_dest->totvert);
return;
}
@ -1099,9 +1101,8 @@ static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
float *array;
if (mesh_src->totvert != kb->totelem) {
fprintf(stderr,
"%s: vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)\n",
__func__, mesh_src->id.name + 2, mesh_src->totvert, kb->name, kb->totelem);
CLOG_ERROR(&LOG, "vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)",
mesh_src->id.name + 2, mesh_src->totvert, kb->name, kb->totelem);
array = MEM_calloc_arrayN((size_t)mesh_src->totvert, 3 * sizeof(float), __func__);
}
else {
@ -1234,7 +1235,7 @@ static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int act
kb->totelem = mesh_src->totvert;
kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), __func__);
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);
}
}
}
@ -1292,8 +1293,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, CustomD
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;
}
@ -1363,7 +1363,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, CustomD
* which should be fed through the modifier
* stack */
if (tmp.totvert != mesh_dst->totvert && !did_shapekeys && mesh_dst->key) {
printf("%s: YEEK! this should be recoded! Shape key loss!: ID '%s'\n", __func__, tmp.id.name);
CLOG_ERROR(&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);
}

View File

@ -31,6 +31,8 @@
#include <limits.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
@ -67,6 +69,8 @@
# include "PIL_time_utildefines.h"
#endif
static CLG_LogRef LOG = {"bke.mesh_evaluate"};
/* -------------------------------------------------------------------- */
/** \name Mesh Normal Calculation
* \{ */
@ -135,7 +139,7 @@ void BKE_mesh_calc_normals_mapping_ex(
/* if we are not calculating verts and no verts were passes then we have nothing to do */
if ((only_face_normals == true) && (r_polyNors == NULL) && (r_faceNors == NULL)) {
printf("%s: called with nothing to do\n", __func__);
CLOG_WARN(&LOG, "called with nothing to do");
return;
}
@ -168,7 +172,7 @@ void BKE_mesh_calc_normals_mapping_ex(
}
else {
/* eek, we're not corresponding to polys */
printf("error in %s: tessellation face indices are incorrect. normals may look bad.\n", __func__);
CLOG_ERROR(&LOG, "tessellation face indices are incorrect. normals may look bad.");
}
}
}

View File

@ -26,6 +26,8 @@
#include <limits.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
@ -49,6 +51,7 @@
#include "BLI_strict_flags.h"
static CLG_LogRef LOG = {"bke.mesh"};
/* -------------------------------------------------------------------- */
/** \name Some generic helpers.
@ -613,7 +616,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(
MEM_freeN(weights);
}
else {
printf("WARNING! Unsupported mesh-to-mesh vertex mapping mode (%d)!\n", mode);
CLOG_WARN(&LOG, "Unsupported mesh-to-mesh vertex mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numverts_dst);
}
@ -940,7 +943,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(
MEM_freeN(weights);
}
else {
printf("WARNING! Unsupported mesh-to-mesh edge mapping mode (%d)!\n", mode);
CLOG_WARN(&LOG, "Unsupported mesh-to-mesh edge mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numedges_dst);
}
@ -2213,7 +2216,7 @@ void BKE_mesh_remap_calc_polys_from_mesh(
BLI_rng_free(rng);
}
else {
printf("WARNING! Unsupported mesh-to-mesh poly mapping mode (%d)!\n", mode);
CLOG_WARN(&LOG, "Unsupported mesh-to-mesh poly mapping mode (%d)!", mode);
memset(r_map->items, 0, sizeof(*r_map->items) * (size_t)numpolys_dst);
}

View File

@ -31,6 +31,8 @@
#include <string.h>
#include <limits.h>
#include "CLG_log.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@ -52,6 +54,7 @@
/* loop v/e are unsigned, so using max uint_32 value as invalid marker... */
#define INVALID_LOOP_EDGE_MARKER 4294967295u
static CLG_LogRef LOG = {"bke.mesh"};
/** \name Internal functions
* \{ */
@ -198,13 +201,12 @@ static int search_polyloop_cmp(const void *v1, const void *v2)
/** \name Mesh Validation
* \{ */
#define PRINT_MSG(...) (void) \
( \
((do_verbose) ? printf(__VA_ARGS__) : 0))
#define PRINT_MSG(...) if(do_verbose) CLOG_INFO(&LOG, 1, __VA_ARGS__)
#define PRINT_ERR(...) (void) \
(is_valid = false, \
((do_verbose) ? printf(__VA_ARGS__) : 0))
#define PRINT_ERR(...) do { \
is_valid = false; \
if (do_verbose) { CLOG_ERROR(&LOG, __VA_ARGS__); } \
} while(0)
/**
* Validate the mesh, \a do_fixes requires \a mesh to be non-null.
@ -272,11 +274,11 @@ bool BKE_mesh_validate_arrays(
free_flag.as_flag = 0;
recalc_flag.as_flag = 0;
PRINT_MSG("%s: verts(%u), edges(%u), loops(%u), polygons(%u)\n",
__func__, totvert, totedge, totloop, totpoly);
PRINT_MSG("verts(%u), edges(%u), loops(%u), polygons(%u)",
totvert, totedge, totloop, totpoly);
if (totedge == 0 && totpoly != 0) {
PRINT_ERR("\tLogical error, %u polygons and 0 edges\n", totpoly);
PRINT_ERR("\tLogical error, %u polygons and 0 edges", totpoly);
recalc_flag.edges = do_fixes;
}
@ -285,7 +287,7 @@ bool BKE_mesh_validate_arrays(
for (j = 0; j < 3; j++) {
if (!isfinite(mv->co[j])) {
PRINT_ERR("\tVertex %u: has invalid coordinate\n", i);
PRINT_ERR("\tVertex %u: has invalid coordinate", i);
if (do_fixes) {
zero_v3(mv->co);
@ -299,7 +301,7 @@ bool BKE_mesh_validate_arrays(
}
if (fix_normal) {
PRINT_ERR("\tVertex %u: has zero normal, assuming Z-up normal\n", i);
PRINT_ERR("\tVertex %u: has zero normal, assuming Z-up normal", i);
if (do_fixes) {
mv->no[2] = SHRT_MAX;
fix_flag.verts = true;
@ -311,20 +313,20 @@ bool BKE_mesh_validate_arrays(
bool remove = false;
if (me->v1 == me->v2) {
PRINT_ERR("\tEdge %u: has matching verts, both %u\n", i, me->v1);
PRINT_ERR("\tEdge %u: has matching verts, both %u", i, me->v1);
remove = do_fixes;
}
if (me->v1 >= totvert) {
PRINT_ERR("\tEdge %u: v1 index out of range, %u\n", i, me->v1);
PRINT_ERR("\tEdge %u: v1 index out of range, %u", i, me->v1);
remove = do_fixes;
}
if (me->v2 >= totvert) {
PRINT_ERR("\tEdge %u: v2 index out of range, %u\n", i, me->v2);
PRINT_ERR("\tEdge %u: v2 index out of range, %u", i, me->v2);
remove = do_fixes;
}
if ((me->v1 != me->v2) && BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) {
PRINT_ERR("\tEdge %u: is a duplicate of %d\n", i,
PRINT_ERR("\tEdge %u: is a duplicate of %d", i,
POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, me->v1, me->v2)));
remove = do_fixes;
}
@ -343,13 +345,13 @@ bool BKE_mesh_validate_arrays(
# define REMOVE_FACE_TAG(_mf) { _mf->v3 = 0; free_flag.faces = do_fixes; } (void)0
# define CHECK_FACE_VERT_INDEX(a, b) \
if (mf->a == mf->b) { \
PRINT_ERR(" face %u: verts invalid, " STRINGIFY(a) "/" STRINGIFY(b) " both %u\n", i, mf->a); \
PRINT_ERR(" face %u: verts invalid, " STRINGIFY(a) "/" STRINGIFY(b) " both %u", i, mf->a); \
remove = do_fixes; \
} (void)0
# define CHECK_FACE_EDGE(a, b) \
if (!BLI_edgehash_haskey(edge_hash, mf->a, mf->b)) { \
PRINT_ERR(" face %u: edge " STRINGIFY(a) "/" STRINGIFY(b) \
" (%u,%u) is missing edge data\n", i, mf->a, mf->b); \
" (%u,%u) is missing edge data", i, mf->a, mf->b); \
recalc_flag.edges = do_fixes; \
} (void)0
@ -361,7 +363,7 @@ bool BKE_mesh_validate_arrays(
SortFace *sf_prev;
unsigned int totsortface = 0;
PRINT_ERR("No Polys, only tessellated Faces\n");
PRINT_ERR("No Polys, only tessellated Faces");
for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) {
bool remove = false;
@ -372,7 +374,7 @@ bool BKE_mesh_validate_arrays(
do {
fv[fidx] = *(&(mf->v1) + fidx);
if (fv[fidx] >= totvert) {
PRINT_ERR("\tFace %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
PRINT_ERR("\tFace %u: 'v%d' index out of range, %u", i, fidx + 1, fv[fidx]);
remove = do_fixes;
}
} while (fidx--);
@ -449,12 +451,12 @@ bool BKE_mesh_validate_arrays(
mf_prev = mfaces + sf_prev->index;
if (mf->v4) {
PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n",
PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)",
sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4,
mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
}
else {
PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n",
PRINT_ERR("\tFace %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)",
sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3,
mf_prev->v1, mf_prev->v2, mf_prev->v3);
}
@ -502,13 +504,13 @@ bool BKE_mesh_validate_arrays(
if (mp->loopstart < 0 || mp->totloop < 3) {
/* Invalid loop data. */
PRINT_ERR("\tPoly %u is invalid (loopstart: %d, totloop: %d)\n",
PRINT_ERR("\tPoly %u is invalid (loopstart: %d, totloop: %d)",
sp->index, mp->loopstart, mp->totloop);
sp->invalid = true;
}
else if (mp->loopstart + mp->totloop > totloop) {
/* Invalid loop data. */
PRINT_ERR("\tPoly %u uses loops out of range (loopstart: %d, loopend: %d, max nbr of loops: %u)\n",
PRINT_ERR("\tPoly %u uses loops out of range (loopstart: %d, loopend: %d, max nbr of loops: %u)",
sp->index, mp->loopstart, mp->loopstart + mp->totloop - 1, totloop - 1);
sp->invalid = true;
}
@ -532,11 +534,11 @@ bool BKE_mesh_validate_arrays(
for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++, v++) {
if (ml->v >= totvert) {
/* Invalid vert idx. */
PRINT_ERR("\tLoop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v);
PRINT_ERR("\tLoop %u has invalid vert reference (%u)", sp->loopstart + j, ml->v);
sp->invalid = true;
}
else if (mverts[ml->v].flag & ME_VERT_TMP_TAG) {
PRINT_ERR("\tPoly %u has duplicated vert reference at corner (%u)\n", i, j);
PRINT_ERR("\tPoly %u has duplicated vert reference at corner (%u)", i, j);
sp->invalid = true;
}
else {
@ -554,7 +556,7 @@ bool BKE_mesh_validate_arrays(
v2 = mloops[sp->loopstart + (j + 1) % mp->totloop].v;
if (!BLI_edgehash_haskey(edge_hash, v1, v2)) {
/* Edge not existing. */
PRINT_ERR("\tPoly %u needs missing edge (%d, %d)\n", sp->index, v1, v2);
PRINT_ERR("\tPoly %u needs missing edge (%d, %d)", sp->index, v1, v2);
if (do_fixes)
recalc_flag.edges = true;
else
@ -567,11 +569,11 @@ bool BKE_mesh_validate_arrays(
int prev_e = ml->e;
ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2));
fix_flag.loops_edge = true;
PRINT_ERR("\tLoop %u has invalid edge reference (%d), fixed using edge %u\n",
PRINT_ERR("\tLoop %u has invalid edge reference (%d), fixed using edge %u",
sp->loopstart + j, prev_e, ml->e);
}
else {
PRINT_ERR("\tLoop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e);
PRINT_ERR("\tLoop %u has invalid edge reference (%u)", sp->loopstart + j, ml->e);
sp->invalid = true;
}
}
@ -584,11 +586,11 @@ bool BKE_mesh_validate_arrays(
int prev_e = ml->e;
ml->e = POINTER_AS_INT(BLI_edgehash_lookup(edge_hash, v1, v2));
fix_flag.loops_edge = true;
PRINT_ERR("\tPoly %u has invalid edge reference (%d, is_removed: %d), fixed using edge %u\n",
PRINT_ERR("\tPoly %u has invalid edge reference (%d, is_removed: %d), fixed using edge %u",
sp->index, prev_e, IS_REMOVED_EDGE(me), ml->e);
}
else {
PRINT_ERR("\tPoly %u has invalid edge reference (%u)\n", sp->index, ml->e);
PRINT_ERR("\tPoly %u has invalid edge reference (%u)", sp->index, ml->e);
sp->invalid = true;
}
}
@ -619,11 +621,12 @@ bool BKE_mesh_validate_arrays(
/* Test same polys. */
if ((p1_nv == p2_nv) && (memcmp(p1_v, p2_v, p1_nv * sizeof(*p1_v)) == 0)) {
if (do_verbose) {
// TODO: convert list to string
PRINT_ERR("\tPolys %u and %u use same vertices (%d",
prev_sp->index, sp->index, *p1_v);
for (j = 1; j < p1_nv; j++)
PRINT_ERR(", %d", p1_v[j]);
PRINT_ERR("), considering poly %u as invalid.\n", sp->index);
PRINT_ERR("), considering poly %u as invalid.", sp->index);
}
else {
is_valid = false;
@ -661,7 +664,7 @@ bool BKE_mesh_validate_arrays(
/* Unused loops. */
if (prev_end < sp->loopstart) {
for (j = prev_end, ml = &mloops[prev_end]; j < sp->loopstart; j++, ml++) {
PRINT_ERR("\tLoop %u is unused.\n", j);
PRINT_ERR("\tLoop %u is unused.", j);
if (do_fixes)
REMOVE_LOOP_TAG(ml);
}
@ -670,7 +673,7 @@ bool BKE_mesh_validate_arrays(
}
/* Multi-used loops. */
else if (prev_end > sp->loopstart) {
PRINT_ERR("\tPolys %u and %u share loops from %d to %d, considering poly %u as invalid.\n",
PRINT_ERR("\tPolys %u and %u share loops from %d to %d, considering poly %u as invalid.",
prev_sp->index, sp->index, sp->loopstart, prev_end, sp->index);
if (do_fixes) {
REMOVE_POLY_TAG((&mpolys[sp->index]));
@ -689,7 +692,7 @@ bool BKE_mesh_validate_arrays(
/* We may have some remaining unused loops to get rid of! */
if (prev_end < totloop) {
for (j = prev_end, ml = &mloops[prev_end]; j < totloop; j++, ml++) {
PRINT_ERR("\tLoop %u is unused.\n", j);
PRINT_ERR("\tLoop %u is unused.", j);
if (do_fixes)
REMOVE_LOOP_TAG(ml);
}
@ -709,14 +712,14 @@ bool BKE_mesh_validate_arrays(
for (j = 0, dw = dv->dw; j < dv->totweight; j++, dw++) {
/* note, greater than max defgroups is accounted for in our code, but not < 0 */
if (!isfinite(dw->weight)) {
PRINT_ERR("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
PRINT_ERR("\tVertex deform %u, group %d has weight: %f", i, dw->def_nr, dw->weight);
if (do_fixes) {
dw->weight = 0.0f;
fix_flag.verts_weight = true;
}
}
else if (dw->weight < 0.0f || dw->weight > 1.0f) {
PRINT_ERR("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
PRINT_ERR("\tVertex deform %u, group %d has weight: %f", i, dw->def_nr, dw->weight);
if (do_fixes) {
CLAMP(dw->weight, 0.0f, 1.0f);
fix_flag.verts_weight = true;
@ -724,7 +727,7 @@ bool BKE_mesh_validate_arrays(
}
if (dw->def_nr < 0) {
PRINT_ERR("\tVertex deform %u, has invalid group %d\n", i, dw->def_nr);
PRINT_ERR("\tVertex deform %u, has invalid group %d", i, dw->def_nr);
if (do_fixes) {
defvert_remove_group(dv, dw);
fix_flag.verts_weight = true;
@ -933,7 +936,7 @@ bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_
bool changed;
if (do_verbose) {
printf("MESH: %s\n", me->id.name + 2);
CLOG_INFO(&LOG, 0, "MESH: %s", me->id.name + 2);
}
is_valid &= BKE_mesh_validate_all_customdata(

View File

@ -80,6 +80,9 @@
#include "MOD_modifiertypes.h"
#include "CLG_log.h"
static CLG_LogRef LOG = {"bke.modifier"};
static ModifierTypeInfo *modifier_types[NUM_MODIFIER_TYPES] = {NULL};
static VirtualModifierData virtualModifierCommonData;
@ -392,6 +395,7 @@ void modifier_setError(ModifierData *md, const char *_format, ...)
md->error = BLI_strdup(buffer);
CLOG_STR_ERROR(&LOG, md->error);
}
/* used for buttons, to find out if the 'draw deformed in editmode' option is

View File

@ -37,6 +37,8 @@
#include <math.h>
#include <float.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
@ -66,7 +68,7 @@
#include "RNA_access.h"
#include "nla_private.h"
static CLG_LogRef LOG = {"bke.nla"};
/* *************************************************** */
/* Data Management */
@ -1712,7 +1714,7 @@ bool BKE_nla_action_stash(AnimData *adt)
/* sanity check */
if (ELEM(NULL, adt, adt->action)) {
printf("%s: Invalid argument - %p %p\n", __func__, adt, adt->action);
CLOG_ERROR(&LOG, "Invalid argument - %p %p", adt, adt->action);
return false;
}
@ -1790,7 +1792,7 @@ void BKE_nla_action_pushdown(AnimData *adt)
*/
/* TODO: what about modifiers? */
if (action_has_motion(adt->action) == 0) {
printf("BKE_nla_action_pushdown(): action has no data\n");
CLOG_ERROR(&LOG, "action has no data");
return;
}

View File

@ -29,6 +29,8 @@
* \ingroup bke
*/
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include <stdlib.h>
@ -83,6 +85,7 @@ bNodeTreeType NodeTreeTypeUndefined;
bNodeType NodeTypeUndefined;
bNodeSocketType NodeSocketTypeUndefined;
static CLG_LogRef LOG = {"bke.node"};
static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType *ntype)
{
@ -525,7 +528,7 @@ void nodeModifySocketType(bNodeTree *ntree, bNode *UNUSED(node), bNodeSocket *so
const char *idname = nodeStaticSocketType(type, subtype);
if (!idname) {
printf("Error: static node socket type %d undefined\n", type);
CLOG_ERROR(&LOG, "static node socket type %d undefined", type);
return;
}
@ -696,7 +699,7 @@ bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree, bNode *node, int in_out, int
bNodeSocket *sock;
if (!idname) {
printf("Error: static node socket type %d undefined\n", type);
CLOG_ERROR(&LOG, "static node socket type %d undefined", type);
return NULL;
}
@ -712,7 +715,7 @@ bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree, bNode *node, int in_out, i
bNodeSocket *sock;
if (!idname) {
printf("Error: static node socket type %d undefined\n", type);
CLOG_ERROR(&LOG, "static node socket type %d undefined", type);
return NULL;
}
@ -929,7 +932,7 @@ bNode *nodeAddStaticNode(const struct bContext *C, bNodeTree *ntree, int type)
}
} NODE_TYPES_END;
if (!idname) {
printf("Error: static node type %d undefined\n", type);
CLOG_ERROR(&LOG, "static node type %d undefined", type);
return NULL;
}
return nodeAddNode(C, ntree, idname);

View File

@ -34,6 +34,8 @@
#include <math.h>
#include <stdio.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
@ -139,6 +141,8 @@
#include "CCGSubSurf.h"
#include "atomic_ops.h"
static CLG_LogRef LOG = {"bke.object"};
/* Vertex parent modifies original BMesh which is not safe for threading.
* Ideally such a modification should be handled as a separate DAG update
* callback for mesh datablock, but for until it is actually supported use
@ -782,7 +786,7 @@ static const char *get_obdata_defname(int type)
case OB_EMPTY: return DATA_("Empty");
case OB_GPENCIL: return DATA_("GPencil");
default:
printf("get_obdata_defname: Internal error, bad type: %d\n", type);
CLOG_ERROR(&LOG, "Internal error, bad type: %d", type);
return DATA_("Empty");
}
}
@ -808,7 +812,7 @@ void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name)
case OB_GPENCIL: return BKE_gpencil_data_addnew(bmain, name);
case OB_EMPTY: return NULL;
default:
printf("%s: Internal error, bad type: %d\n", __func__, type);
CLOG_ERROR(&LOG, "Internal error, bad type: %d", type);
return NULL;
}
}
@ -1563,7 +1567,7 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob)
{
/* paranoia checks */
if (ID_IS_LINKED(ob) || !ID_IS_LINKED(target)) {
printf("cannot make proxy\n");
CLOG_ERROR(&LOG, "cannot make proxy");
return;
}
@ -1981,7 +1985,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4])
/* Make sure the bone is still valid */
pchan = BKE_pose_channel_find_name(par->pose, ob->parsubstr);
if (!pchan || !pchan->bone) {
printf("Object %s with Bone parent: bone %s doesn't exist\n", ob->id.name + 2, ob->parsubstr);
CLOG_ERROR(&LOG, "Object %s with Bone parent: bone %s doesn't exist", ob->id.name + 2, ob->parsubstr);
unit_m4(mat);
return;
}
@ -2065,9 +2069,8 @@ static void give_parvert(Object *par, int nr, float vec[3])
}
}
else {
fprintf(stderr,
"%s: Evaluated mesh is needed to solve parenting, "
"object position can be wrong now\n", __func__);
CLOG_ERROR(&LOG, "Evaluated mesh is needed to solve parenting, "
"object position can be wrong now");
}
}
else if (ELEM(par->type, OB_CURVE, OB_SURF)) {

View File

@ -34,6 +34,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
@ -123,6 +125,8 @@
/* could be made into a pointcache option */
#define DURIAN_POINTCACHE_LIB_OK 1
static CLG_LogRef LOG = {"bke.pointcache"};
static int ptcache_data_size[] = {
sizeof(unsigned int), // BPHYS_DATA_INDEX
3 * sizeof(float), // BPHYS_DATA_LOCATION
@ -1243,7 +1247,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
/* version header */
ptcache_file_read(pf, version, 1, sizeof(char) * 4);
if (!STREQLEN(version, DPAINT_CACHE_VERSION, 4)) {
printf("Dynamic Paint: Invalid cache version: '%c%c%c%c'!\n", UNPACK4(version));
CLOG_ERROR(&LOG, "Dynamic Paint: Invalid cache version: '%c%c%c%c'!", UNPACK4(version));
return 0;
}
@ -2479,7 +2483,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 (pf == NULL) {
if (G.debug & G_DEBUG)
printf("Error opening disk cache file for writing\n");
return 0;

View File

@ -37,6 +37,8 @@
#include <math.h>
#include <limits.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
@ -73,6 +75,10 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#ifdef WITH_BULLET
static CLG_LogRef LOG = {"bke.rigidbody"};
#endif
/* ************************************** */
/* Memory Management */
@ -291,14 +297,14 @@ static rbCollisionShape *rigidbody_get_shape_convexhull_from_mesh(Object *ob, fl
totvert = (mesh) ? mesh->totvert : 0;
}
else {
printf("ERROR: cannot make Convex Hull collision shape for non-Mesh object\n");
CLOG_ERROR(&LOG, "cannot make Convex Hull collision shape for non-Mesh object");
}
if (totvert) {
shape = RB_shape_new_convex_hull((float *)mvert, sizeof(MVert), totvert, margin, can_embed);
}
else {
printf("ERROR: no vertices to define Convex Hull collision shape with\n");
CLOG_ERROR(&LOG, "no vertices to define Convex Hull collision shape with");
}
return shape;
@ -333,7 +339,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
/* sanity checking - potential case when no data will be present */
if ((totvert == 0) || (tottri == 0)) {
printf("WARNING: no geometry data converted for Mesh Collision Shape (ob = %s)\n", ob->id.name + 2);
CLOG_WARN(&LOG, "no geometry data converted for Mesh Collision Shape (ob = %s)", ob->id.name + 2);
}
else {
rbMeshData *mdata;
@ -381,7 +387,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
}
}
else {
printf("ERROR: cannot make Triangular Mesh collision shape for non-Mesh object\n");
CLOG_ERROR(&LOG, "cannot make Triangular Mesh collision shape for non-Mesh object");
}
return shape;

View File

@ -52,6 +52,8 @@
#include <stdlib.h>
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
/* types */
@ -87,6 +89,8 @@
#include "PIL_time.h"
static CLG_LogRef LOG = {"bke.softbody"};
/* callbacks for errors and interrupts and some goo */
static int (*SB_localInterruptCallBack)(void) = NULL;
@ -235,7 +239,7 @@ static float _final_goal(Object *ob, BodyPoint *bp)/*jow_go_for2_5 */
return (f);
}
}
printf("_final_goal failed! sb or bp ==NULL\n");
CLOG_ERROR(&LOG, "sb or bp == NULL");
return f; /*using crude but spot able values some times helps debuggin */
}
@ -247,7 +251,7 @@ static float _final_mass(Object *ob, BodyPoint *bp)
return(bp->mass*sb->nodemass);
}
}
printf("_final_mass failed! sb or bp ==NULL\n");
CLOG_ERROR(&LOG, "sb or bp == NULL");
return 1.0f;
}
/* helper functions for everything is animateble jow_go_for2_5 ------*/
@ -654,7 +658,7 @@ static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *count
notthis = bs->v1;
}
else {
printf("oops we should not get here - add_2nd_order_springs");
CLOG_ERROR(&LOG, "oops we should not get here");
}
}
if (bpo) {/* so now we have a 2nd order humpdidump */
@ -1010,7 +1014,7 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), struct Object
}
else {
/*aye that should be cached*/
printf("missing cache error\n");
CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@ -1080,7 +1084,7 @@ static int sb_detect_face_pointCached(float face_v1[3], float face_v2[3], float
}
else {
/*aye that should be cached*/
printf("missing cache error\n");
CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@ -1179,7 +1183,7 @@ static int sb_detect_face_collisionCached(float face_v1[3], float face_v2[3], fl
}
else {
/*aye that should be cached*/
printf("missing cache error\n");
CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@ -1361,7 +1365,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], fl
}
else {
/*aye that should be cached*/
printf("missing cache error\n");
CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@ -1658,7 +1662,7 @@ static int sb_detect_vertex_collisionCached(
}
else {
/*aye that should be cached*/
printf("missing cache error\n");
CLOG_ERROR(&LOG, "missing cache error");
BLI_ghashIterator_step(ihash);
continue;
}
@ -1867,7 +1871,7 @@ static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, floa
else {
/* TODO make this debug option */
/**/
printf("bodypoint <bpi> is not attached to spring <*bs> --> sb_spring_force()\n");
CLOG_WARN(&LOG, "bodypoint <bpi> is not attached to spring <*bs>");
return;
}
@ -1922,7 +1926,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
float iks;
int bb, do_selfcollision, do_springcollision, do_aero;
int number_of_points_here = ilast - ifirst;
SoftBody *sb= ob->soft; /* is supposed to be there */
SoftBody *sb = ob->soft; /* is supposed to be there */
BodyPoint *bp;
/* initialize */
@ -1935,7 +1939,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
/* --- could be done on object level to squeeze out the last bits of it */
}
else {
printf("Error expected a SB here\n");
CLOG_ERROR(&LOG, "expected a SB here");
return (999);
}
@ -3336,7 +3340,7 @@ static void softbody_step(struct Depsgraph *depsgraph, Scene *scene, Object *ob,
}/*SOLVER SELECT*/
else {
printf("softbody no valid solver ID!");
CLOG_ERROR(&LOG, "softbody no valid solver ID!");
}/*SOLVER SELECT*/
if (sb->plastic) { apply_spring_memory(ob);}