From 0b5a995cfdca70c844186a3af9b2a01fed5e5d3f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Aug 2012 18:21:54 +0000 Subject: code cleanup: rename G.rt to G.debug_value --- source/blender/blenkernel/BKE_global.h | 14 ++++++++++---- source/blender/blenkernel/intern/cloth.c | 8 ++++---- source/blender/blenkernel/intern/implicit.c | 4 ++-- source/blender/blenkernel/intern/softbody.c | 14 +++++++------- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/mesh/editface.c | 2 +- source/blender/editors/render/render_internal.c | 2 +- source/blender/editors/screen/area.c | 14 +++++++------- source/blender/editors/screen/screen_edit.c | 2 +- source/blender/editors/space_logic/logic_window.c | 2 +- source/blender/editors/space_node/node_buttons.c | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 10 +++++----- source/blender/editors/transform/transform_manipulator.c | 6 +++--- source/blender/modifiers/intern/MOD_cloth.c | 2 +- source/blender/modifiers/intern/MOD_collision.c | 2 +- source/blender/modifiers/intern/MOD_meshdeform.c | 4 ++-- source/blender/nodes/composite/node_composite_tree.c | 2 +- source/blender/python/intern/bpy_app.c | 4 ++-- source/blender/windowmanager/intern/wm_operators.c | 4 ++-- source/creator/creator.c | 2 +- 20 files changed, 54 insertions(+), 48 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 2d30844af80..f71f82eca17 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -60,20 +60,26 @@ typedef struct Global { /* strings of recent opened files */ struct ListBase recent_files; - + short afbreek, moving, file_loaded; char background; char factory_startup; short winpos, displaymode; /* used to be in Render */ short rendering; /* to indicate render is busy, prevent renderwindow events etc */ - short rt; + /* debug value, can be set from the UI and python, used for testing nonstandard features */ + short debug_value; + + /* saved to the blend file as FileGlobal.globalf, + * however this is now only used for runtime options */ int f; + + /* debug flag, G_DEBUG, G_DEBUG_PYTHON & friends, set python or command line args */ int debug; /* Used for BMesh transformations */ struct BME_Glob *editBMesh; - + /* Frank's variables */ int save_over; @@ -88,7 +94,7 @@ typedef struct Global { /* this variable is written to / read from FileGlobal->fileflags */ int fileflags; - + /* save the allowed windowstate of blender when using -W or -w */ int windowstate; } Global; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 74bfa0d60fc..694bb3f1afd 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -662,7 +662,7 @@ void cloth_free_modifier(ClothModifierData *clmd ) void cloth_free_modifier_extern(ClothModifierData *clmd ) { Cloth *cloth = NULL; - if (G.rt > 0) + if (G.debug_value > 0) printf("cloth_free_modifier_extern\n"); if ( !clmd ) @@ -671,7 +671,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd ) cloth = clmd->clothObject; if ( cloth ) { - if (G.rt > 0) + if (G.debug_value > 0) printf("cloth_free_modifier_extern in\n"); // If our solver provides a free function, call it @@ -852,7 +852,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d // If we have a clothObject, free it. if ( clmd->clothObject != NULL ) { cloth_free_modifier ( clmd ); - if (G.rt > 0) + if (G.debug_value > 0) printf("cloth_free_modifier cloth_from_object\n"); } @@ -1278,7 +1278,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) cloth->edgehash = edgehash; - if (G.rt > 0) + if (G.debug_value > 0) printf("avg_len: %f\n", clmd->sim_parms->avg_spring_len); return 1; diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 8a573aaa676..fdc3a8f4317 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -710,7 +710,7 @@ int implicit_init(Object *UNUSED(ob), ClothModifierData *clmd) Implicit_Data *id = NULL; LinkNode *search = NULL; - if (G.rt > 0) + if (G.debug_value > 0) printf("implicit_init\n"); // init memory guard @@ -1918,7 +1918,7 @@ void implicit_set_positions(ClothModifierData *clmd) copy_v3_v3(id->X[i], verts[i].x); copy_v3_v3(id->V[i], verts[i].v); } - if (G.rt > 0) + if (G.debug_value > 0) printf("implicit_set_positions\n"); } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 26ca3805c28..008dc332710 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1941,7 +1941,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], } } - if ((deflected < 2)&& (G.rt != 444)) { /* we did not hit a face until now */ + if ((deflected < 2)&& (G.debug_value != 444)) { /* we did not hit a face until now */ /* see if 'outer' hits an edge */ float dist; @@ -2493,7 +2493,7 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, float timenow, int nl_flags) { /* redirection to the new threaded Version */ - if (!(G.rt & 0x10)) { // 16 + if (!(G.debug_value & 0x10)) { // 16 softbody_calc_forcesEx(scene, ob, forcetime, timenow, nl_flags); return; } @@ -2504,7 +2504,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa /*backward compatibility note: fixing bug [17428] which forces adaptive step size to tiny steps in some situations - .. keeping G.rt==17 0x11 option for old files 'needing' the bug*/ + .. keeping G.debug_value==17 0x11 option for old files 'needing' the bug*/ /* rule we never alter free variables :bp->vec bp->pos in here ! * this will ruin adaptive stepsize AKA heun! (BM) @@ -2756,9 +2756,9 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa if (sb_deflect_face(ob, bp->pos, facenormal, defforce, &cf, timenow, vel, &intrusion)) { if ((!nl_flags)&&(intrusion < 0.0f)) { - if (G.rt & 0x01) { // 17 we did check for bit 0x10 before + if (G.debug_value & 0x01) { // 17 we did check for bit 0x10 before /*fixing bug [17428] this forces adaptive step size to tiny steps - in some situations .. keeping G.rt==17 option for old files 'needing' the bug + in some situations .. keeping G.debug_value==17 option for old files 'needing' the bug */ /*bjornmose: uugh.. what an evil hack violation of the 'don't touch bp->pos in here' rule @@ -2837,7 +2837,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if ((G.rt == 32) && (nl_flags & NLF_BUILD)) { + if ((G.debug_value == 32) && (nl_flags & NLF_BUILD)) { printf("####MEE#####\n"); nlPrintMatrix(); } @@ -2849,7 +2849,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa float f; int index =0; /* for debug purpose .. anyhow cropping B vector looks like working */ - if (G.rt ==32) + if (G.debug_value ==32) for (a=2*sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { f=nlGetVariable(0, index); printf("(%f ", f);index++; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 93a3b17369a..1f3662e62cd 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9430,7 +9430,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); /* allow typing in a new lib path */ - if (G.rt == -666) { + if (G.debug_value == -666) { while (fd == NULL) { char newlib_path[FILE_MAX] = {0}; printf("Missing library...'\n"); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index addd0b14916..bce69cb7d1d 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -502,7 +502,7 @@ void seam_mark_clear_tface(Scene *scene, short mode) BLI_edgehash_free(ehash2, NULL); } -// XXX if (G.rt == 8) +// XXX if (G.debug_value == 8) // unwrap_lscm(1); me->drawflag |= ME_DRAWSEAMS; diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 6eaef62ec40..9716b6d8a81 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -505,7 +505,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) WM_jobs_stop_all(CTX_wm_manager(C)); /* get main */ - if (G.rt == 101) { + if (G.debug_value == 101) { /* thread-safety experiment, copy main from the undo buffer */ mainp = BKE_undo_get_main(&scene); } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index b4f1f4b3022..92281dc0645 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -372,11 +372,11 @@ void ED_area_overdraw(bContext *C) if (az->ar) { /* only display tab or icons when the region is hidden */ if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { - if (G.rt == 3) + if (G.debug_value == 3) region_draw_azone_icon(az); - else if (G.rt == 2) + else if (G.debug_value == 2) region_draw_azone_tria(az); - else if (G.rt == 1) + else if (G.debug_value == 1) region_draw_azone_tab(az); else region_draw_azone_tab_plus(az); @@ -858,11 +858,11 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge) az->edge = edge; if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { - if (G.rt == 3) + if (G.debug_value == 3) region_azone_icon(sa, az, ar); - else if (G.rt == 2) + else if (G.debug_value == 2) region_azone_tria(sa, az, ar); - else if (G.rt == 1) + else if (G.debug_value == 1) region_azone_tab(sa, az, ar); else region_azone_tab_plus(sa, az, ar); @@ -1113,7 +1113,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int static void area_calc_totrct(ScrArea *sa, int sizex, int sizey) { - short rt = 0; // CLAMPIS(G.rt, 0, 16); + short rt = 0; // CLAMPIS(G.debug_value, 0, 16); if (sa->v1->vec.x > 0) sa->totrct.xmin = sa->v1->vec.x + 1 + rt; else sa->totrct.xmin = sa->v1->vec.x; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index dda4bfede9c..d1458fec94b 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -913,7 +913,7 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center) short y2 = sa->v3->vec.y; short a, rt; - rt = 0; // CLAMPIS(G.rt, 0, 16); + rt = 0; // CLAMPIS(G.debug_value, 0, 16); if (center == 0) { cpack(0x505050); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 08842698214..915e5c20e99 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -4783,7 +4783,7 @@ void logic_buttons(bContext *C, ARegion *ar) * pin so changing states dosnt hide the logic brick */ char pin; - if (G.rt == 0) { + if (G.debug_value == 0) { logic_buttons_new(C, ar); return; } diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 3297b785765..e50b1dc4ba6 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -136,7 +136,7 @@ static int node_sockets_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode = CTX_wm_space_node(C); - return (snode && snode->nodetree && G.rt == 777); + return (snode && snode->nodetree && G.debug_value == 777); } static void node_sockets_panel(const bContext *C, Panel *pa) diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 85a4d911df5..7249d4e343b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1532,7 +1532,7 @@ exit: /* ************************************************************* */ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, - const short do_forground, const short do_camera_frame) + const short do_foreground, const short do_camera_frame) { RegionView3D *rv3d = ar->regiondata; BGpic *bgpic; @@ -1541,7 +1541,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, ImBuf *ibuf = NULL, *freeibuf; float vec[4], fac, asp, zoomx, zoomy; float x1, y1, x2, y2, cx, cy; - int fg_flag = do_forground ? V3D_BGPIC_FOREGROUND : 0; + int fg_flag = do_foreground ? V3D_BGPIC_FOREGROUND : 0; for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) { @@ -1772,7 +1772,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, } static void view3d_draw_bgpic_test(Scene *scene, ARegion *ar, View3D *v3d, - const short do_forground, const short do_camera_frame) + const short do_foreground, const short do_camera_frame) { RegionView3D *rv3d = ar->regiondata; @@ -1788,11 +1788,11 @@ static void view3d_draw_bgpic_test(Scene *scene, ARegion *ar, View3D *v3d, if ((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) { if (rv3d->persp == RV3D_CAMOB) { - view3d_draw_bgpic(scene, ar, v3d, do_forground, do_camera_frame); + view3d_draw_bgpic(scene, ar, v3d, do_foreground, do_camera_frame); } } else { - view3d_draw_bgpic(scene, ar, v3d, do_forground, do_camera_frame); + view3d_draw_bgpic(scene, ar, v3d, do_foreground, do_camera_frame); } } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 31250e3a50c..a89ba06c1af 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -855,7 +855,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, float size, unitmat[4][4]; float cywid = 0.33f * 0.01f * (float)U.tw_handlesize; float cusize = cywid * 0.65f; - int arcs = (G.rt != 2); + int arcs = (G.debug_value != 2); int colcode; int ortho; @@ -1517,7 +1517,7 @@ void BIF_draw_manipulator(const bContext *C) glEnable(GL_BLEND); if (v3d->twtype & V3D_MANIP_ROTATE) { - if (G.rt == 3) { + if (G.debug_value == 3) { if (G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL); else draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB); } @@ -1561,7 +1561,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl /* do the drawing */ if (v3d->twtype & V3D_MANIP_ROTATE) { - if (G.rt == 3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB); + if (G.debug_value == 3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB); else draw_manipulator_rotate(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype); } if (v3d->twtype & V3D_MANIP_SCALE) diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 2c38bc42a8f..dc6fef9b617 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -169,7 +169,7 @@ static void freeData(ModifierData *md) ClothModifierData *clmd = (ClothModifierData *) md; if (clmd) { - if (G.rt > 0) + if (G.debug_value > 0) printf("clothModifier_freeData\n"); cloth_free_modifier_extern(clmd); diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 45296e322b5..b9384e6208e 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -132,7 +132,7 @@ static void deformVerts(ModifierData *md, Object *ob, current_time = BKE_scene_frame_get(md->scene); - if (G.rt > 0) + if (G.debug_value > 0) printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew); numverts = dm->getNumVerts(dm); diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 12209fd69fb..aafb21b3c34 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -274,7 +274,7 @@ static void meshdeformModifier_do( /* get cage vertex in world space with binding transform */ copy_v3_v3(co, cagecos[a]); - if (G.rt != 527) { + if (G.debug_value != 527) { mul_m4_v3(mmd->bindmat, co); /* compute difference with world space bind coord */ sub_v3_v3v3(dco[a], co, bindcagecos[a]); @@ -324,7 +324,7 @@ static void meshdeformModifier_do( if (totweight > 0.0f) { mul_v3_fl(co, fac / totweight); mul_m3_v3(icagemat, co); - if (G.rt != 527) + if (G.debug_value != 527) add_v3_v3(vertexCos[b], co); else copy_v3_v3(vertexCos[b], co); diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 917c1163096..c6ad97c31da 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -692,7 +692,7 @@ void *COM_linker_hack = NULL; void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int do_preview) { #ifdef WITH_COMPOSITOR - if (G.rt == 200) + if (G.debug_value == 200) ntreeCompositExecTreeOld(ntree, rd, do_preview); else COM_execute(rd, ntree, rendering); diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 44979700d94..ccce0d8c5ae 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -195,7 +195,7 @@ PyDoc_STRVAR(bpy_app_debug_value_doc, ); static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure)) { - return PyLong_FromSsize_t(G.rt); + return PyLong_FromSsize_t(G.debug_value); } static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) @@ -207,7 +207,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void return -1; } - G.rt = param; + G.debug_value = param; return 0; } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 78495f9b874..685ef467ad3 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1194,7 +1194,7 @@ int WM_operator_redo_popup(bContext *C, wmOperator *op) static int wm_debug_menu_exec(bContext *C, wmOperator *op) { - G.rt = RNA_int_get(op->ptr, "debug_value"); + G.debug_value = RNA_int_get(op->ptr, "debug_value"); ED_screen_refresh(CTX_wm_manager(C), CTX_wm_window(C)); WM_event_add_notifier(C, NC_WINDOW, NULL); @@ -1203,7 +1203,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op) static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - RNA_int_set(op->ptr, "debug_value", G.rt); + RNA_int_set(op->ptr, "debug_value", G.debug_value); return WM_operator_props_dialog_popup(C, op, 9 * UI_UNIT_X, UI_UNIT_Y); } diff --git a/source/creator/creator.c b/source/creator/creator.c index 7479935c179..6773fbb4f13 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -390,7 +390,7 @@ static int debug_mode_libmv(int UNUSED(argc), const char **UNUSED(argv), void *U static int set_debug_value(int argc, const char **argv, void *UNUSED(data)) { if (argc > 1) { - G.rt = atoi(argv[1]); + G.debug_value = atoi(argv[1]); return 1; } -- cgit v1.2.3