Cleaned up some printfs in editors/ - converted some to reports, hid others behind G_DEBUG.

This commit is contained in:
Matt Ebb 2010-01-22 06:48:29 +00:00
parent 0de9b98a31
commit 38aacb92f3
22 changed files with 90 additions and 52 deletions

@ -1051,7 +1051,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
/* try to insert keyframes for the channels specified by KeyingSet */
success= modify_keyframes(scene, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
if (G.f & G_DEBUG)
printf("KeyingSet '%s' - Successfully added %d Keyframes \n", ks->name, success);
BKE_reportf(op->reports, RPT_INFO, "KeyingSet '%s' - Successfully added %d Keyframes \n", ks->name, success);
/* report failure or do updates? */
if (success) {
@ -1320,7 +1320,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
}
}
printf("Ob '%s' - Successfully removed %d keyframes \n", id->name+2, success);
BKE_reportf(op->reports, RPT_INFO, "Ob '%s' - Successfully removed %d keyframes \n", id->name+2, success);
ob->recalc |= OB_RECALC_OB;
}

@ -320,6 +320,7 @@ void ED_armature_from_edit(Object *obedit)
if (fBone->parent==eBone)
fBone->parent= eBone->parent;
}
if (G.f & G_DEBUG)
printf("Warning: removed zero sized bone: %s\n", eBone->name);
bone_free(arm, eBone);
}
@ -3006,8 +3007,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
}
else {
// FIXME.. figure out a method for multiple bones
BKE_report(op->reports, RPT_ERROR, "Too many points selected");
printf("Points selected: %d \n", count);
BKE_reportf(op->reports, RPT_ERROR, "Too many points selected: %d \n", count);
BLI_freelistN(&points);
return OPERATOR_CANCELLED;
}
@ -3047,9 +3047,11 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
/* check if same bone */
if (start == end) {
if (G.f & G_DEBUG) {
printf("Error: same bone! \n");
printf("\tstart = %s, end = %s \n", start->name, end->name);
}
}
/* step 1: add a new bone
* - head = head/tail of start (default head)

@ -1303,7 +1303,8 @@ static void poselib_preview_init_data (bContext *C, wmOperator *op)
if (pld->act->markers.first) {
/* just use first one then... */
pld->marker= pld->act->markers.first;
if (pose_index > -2) printf("PoseLib had no active pose\n");
if (pose_index > -2)
BKE_report(op->reports, RPT_WARNING, "PoseLib had no active pose");
}
else {
BKE_report(op->reports, RPT_ERROR, "PoseLib has no poses to preview/apply");

@ -1004,6 +1004,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
}
if(newu==0 || newv==0) {
if (G.f & G_DEBUG)
printf("Can't duplicate Nurb\n");
}
else {

@ -684,23 +684,19 @@ static void ui_add_link(uiBut *from, uiBut *to)
if( (line= ui_is_a_link(from, to)) ) {
line->flag |= UI_SELECT;
ui_delete_active_linkline(from->block);
printf("already exists, means deletion now\n");
return;
}
if (from->type==INLINK && to->type==INLINK) {
printf("cannot link\n");
return;
}
else if (from->type==LINK && to->type==INLINK) {
if( from->link->tocode != (int)to->hardmin ) {
printf("cannot link\n");
return;
}
}
else if(from->type==INLINK && to->type==LINK) {
if( to->link->tocode == (int)from->hardmin ) {
printf("cannot link\n");
return;
}
}

@ -50,6 +50,7 @@
#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_icons.h"
#include "BKE_utildefines.h"
@ -474,6 +475,7 @@ static void init_internal_icons()
if (BLI_exists(iconfilestr)) {
bbuf = IMB_loadiffname(iconfilestr, IB_rect);
if(bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H) {
if (G.f & G_DEBUG)
printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
IMB_freeImBuf(bbuf);
bbuf= NULL;
@ -694,6 +696,7 @@ int UI_icon_get_width(int icon_id)
icon = BKE_icon_get(icon_id);
if (!icon) {
if (G.f & G_DEBUG)
printf("UI_icon_get_width: Internal error, no icon for icon ID: %d\n", icon_id);
return 0;
}
@ -718,6 +721,7 @@ int UI_icon_get_height(int icon_id)
icon = BKE_icon_get(icon_id);
if (!icon) {
if (G.f & G_DEBUG)
printf("UI_icon_get_height: Internal error, no icon for icon ID: %d\n", icon_id);
return 0;
}
@ -757,6 +761,7 @@ static void icon_create_mipmap(struct PreviewImage* prv_img, int miplevel)
unsigned int size = preview_render_size(miplevel);
if (!prv_img) {
if (G.f & G_DEBUG)
printf("Error: requested preview image does not exist");
}
if (!prv_img->rect[miplevel]) {
@ -772,6 +777,7 @@ static void icon_create_mipmap(struct PreviewImage* prv_img, int miplevel)
static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miplevel)
{
if (!prv_img) {
if (G.f & G_DEBUG)
printf("No preview image for this ID: %s\n", id->name);
return;
}
@ -802,12 +808,13 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
/* draw */
if((w<1 || h<1)) {
// XXX - TODO 2.5 verify whether this case can happen
// and only print in debug
if (G.f & G_DEBUG)
printf("what the heck! - icons are %i x %i pixels?\n", w, h);
}
/* rect contains image in 'rendersize', we only scale if needed */
else if(rw!=w && rh!=h) {
if(w>2000 || h>2000) { /* something has gone wrong! */
if (G.f & G_DEBUG)
printf("insane icon size w=%d h=%d\n",w,h);
}
else {
@ -891,6 +898,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
icon = BKE_icon_get(icon_id);
if (!icon) {
if (G.f & G_DEBUG)
printf("icon_draw_mipmap: Internal error, no icon for icon ID: %d\n", icon_id);
return;
}

@ -291,8 +291,10 @@ void uiStyleInit(void)
font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
}
if (font->blf_id == -1)
if (font->blf_id == -1) {
if (G.f & G_DEBUG)
printf("uiStyleInit error, no fonts available\n");
}
else {
BLF_set(font->blf_id);
/* ? just for speed to initialize?

@ -838,6 +838,7 @@ void UI_view2d_totRect_set_resize (View2D *v2d, int width, int height, int resiz
height -= V2D_SCROLL_HEIGHT;
if (ELEM3(0, v2d, width, height)) {
if (G.f & G_DEBUG)
printf("Error: View2D totRect set exiting: v2d=%p width=%d height=%d \n", v2d, width, height); // XXX temp debug info
return;
}

@ -766,7 +766,8 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op)
else if( convex(neweve[0]->co, neweve[3]->co, neweve[1]->co, neweve[2]->co) ) {
efa= addfacelist(em, neweve[0], neweve[3], neweve[1], neweve[2], NULL, NULL);
}
else printf("cannot find nice quad from concave set of vertices\n");
else BKE_report(op->reports, RPT_ERROR, "cannot find nice quad from concave set of vertices");
}
}
}

@ -432,7 +432,7 @@ void EM_select_face_fgon(EditMesh *em, EditFace *efa, int val)
if(efa->e3->fgoni) index= efa->e3->fgoni;
if(efa->v4 && efa->e4->fgoni) index= efa->e4->fgoni;
if(index==0) printf("wrong fgon select\n");
if((index==0) && (G.f & G_DEBUG))printf("wrong fgon select\n");
// select all ngon faces with index
for(efa= em->faces.first; efa; efa= efa->next) {

@ -682,7 +682,6 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
if (isect!=0.0f) eed->f2= 1;
else eed->f2=0;
eed->tmp.fp= isect;
//printf("isect=%i\n", isect);
}
else {
eed->f2=0;

@ -1397,6 +1397,7 @@ void single_obdata_users(Scene *scene, int flag)
armature_rebuild_pose(ob, ob->data);
break;
default:
if (G.f & G_DEBUG)
printf("ERROR single_obdata_users: can't copy %s\n", id->name);
return;
}

@ -543,6 +543,7 @@ static void vgroup_duplicate(Object *ob)
BLI_snprintf(name, 32, "%s_copy", dg->name);
while(get_named_vertexgroup(ob, name)) {
if((strlen(name) + 6) > 32) {
if (G.f & G_DEBUG)
printf("Internal error: the name for the new vertex group is > 32 characters");
return;
}

@ -44,6 +44,7 @@
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
@ -654,6 +655,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
BLI_bvhtree_find_nearest(bvhtree.tree, key->co, &nearest, bvhtree.nearest_callback, &bvhtree);
if(nearest.index == -1) {
if (G.f & G_DEBUG)
printf("No nearest point found for hair root!");
continue;
}

@ -728,6 +728,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
if(count!=4) {
/* let's stop adding regions */
BLI_init_rcti(remainder, 0, 0, 0, 0);
if (G.f & G_DEBUG)
printf("region quadsplit failed\n");
}
else quad= 1;

@ -1473,6 +1473,7 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
for(old= sc->areabase.first; old; old= old->next)
if(old->full) break;
if(old==NULL) {
if (G.f & G_DEBUG)
printf("something wrong in areafullscreen\n");
return NULL;
}

@ -2268,7 +2268,6 @@ static int header_flip_exec(bContext *C, wmOperator *op)
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
printf("executed header region flip\n");
return OPERATOR_FINISHED;
}
@ -2946,6 +2945,7 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
/* very weak... but 512 characters is quite safe */
if(spos >= str+IMA_RW_MAXTEXT)
if (G.f & G_DEBUG)
printf("WARNING! renderwin text beyond limit \n");
}
@ -3484,15 +3484,23 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
if(ibuf) {
if(BKE_imtype_is_movie(scene->r.imtype)) {
ok= oglrender->mh->append_movie(&scene->r, CFRA, (int*)ibuf->rect, oglrender->sizex, oglrender->sizey, oglrender->reports);
if(ok)
if(ok) {
printf("Append frame %d", scene->r.cfra);
BKE_reportf(op->reports, RPT_INFO, "Appended frame: %d", scene->r.cfra);
}
}
else {
BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION);
ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
if(ok==0) printf("write error: cannot save %s\n", name);
else printf("saved: %s", name);
if(ok==0) {
printf("Write error: cannot save %s\n", name);
BKE_reportf(op->reports, RPT_ERROR, "Write error: cannot save %s", name);
}
else {
printf("Saved: %s", name);
BKE_reportf(op->reports, RPT_INFO, "Saved file: %s", name);
}
}
}

@ -249,9 +249,10 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update)
if(sj->dumprect) {
if(mh) {
if(mh->append_movie(&rd, cfra, (int *)sj->dumprect, sj->dumpsx, sj->dumpsy, &sj->reports))
printf("Append frame %d\n", cfra);
else
if(mh->append_movie(&rd, cfra, (int *)sj->dumprect, sj->dumpsx, sj->dumpsy, &sj->reports)) {
BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", cfra);
printf("Appended frame %d\n", cfra);
} else
break;
}
else {
@ -266,9 +267,13 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update)
if(ok==0) {
printf("Write error: cannot save %s\n", name);
BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
break;
}
else printf("Saved: %s\n", name);
else {
printf("Saved file: %s\n", name);
BKE_reportf(&sj->reports, RPT_INFO, "Saved file: %s", name);
}
/* imbuf knows which rects are not part of ibuf */
IMB_freeImBuf(ibuf);
@ -288,7 +293,8 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update)
if(mh)
mh->end_movie();
printf("screencast job stopped\n");
BKE_report(&sj->reports, RPT_INFO, "Screencast job stopped");
}
static int screencast_exec(bContext *C, wmOperator *op)

@ -1079,7 +1079,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op)
break;
}
printf("Saved: %s\n", ibuf->name);
BKE_reportf(op->reports, RPT_INFO, "Saved: %s\n", ibuf->name);
ibuf->userflags &= ~IB_BITMAPDIRTY;
}
}

@ -242,6 +242,7 @@ void ED_node_shader_default(Material *ma)
/* but lets check it anyway */
if(ma->nodetree) {
if (G.f & G_DEBUG)
printf("error in shader initialize\n");
return;
}
@ -272,7 +273,8 @@ void ED_node_composit_default(Scene *sce)
/* but lets check it anyway */
if(sce->nodetree) {
printf("error in composit initialize\n");
if (G.f & G_DEBUG)
printf("error in composite initialize\n");
return;
}
@ -306,6 +308,7 @@ void ED_node_texture_default(Tex *tx)
/* but lets check it anyway */
if(tx->nodetree) {
if (G.f & G_DEBUG)
printf("error in texture initialize\n");
return;
}

@ -203,7 +203,7 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
max+= BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr);
if(max<320) strcat(defstr, str);
}
else printf("oh no!\n");
if(tfp->curdef==dvert->dw[i].def_nr) {
init= 0;
tfp->defweightp= &dvert->dw[i].weight;
@ -1135,10 +1135,12 @@ static void redo_cb(bContext *C, void *arg_op, void *arg2)
if(lastop) {
int retval;
if (G.f & G_DEBUG)
printf("operator redo %s\n", lastop->type->name);
ED_undo_pop(C);
retval= WM_operator_repeat(C, lastop);
if((retval & OPERATOR_FINISHED)==0) {
if (G.f & G_DEBUG)
printf("operator redo failed %s\n", lastop->type->name);
ED_undo_redo(C);
}

@ -108,10 +108,12 @@ static void redo_cb(bContext *C, void *arg_op, void *arg2)
if(lastop) {
int retval;
if (G.f & G_DEBUG)
printf("operator redo %s\n", lastop->type->name);
ED_undo_pop_op(C, lastop);
retval= WM_operator_repeat(C, lastop);
if((retval & OPERATOR_FINISHED)==0) {
if (G.f & G_DEBUG)
printf("operator redo failed %s\n", lastop->type->name);
ED_undo_redo(C);
}