diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-19 22:11:02 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-19 22:11:02 +0300 |
commit | 3bda5490f7f50a795cd8b2c3d841c9375723aee9 (patch) | |
tree | cdcd6b5a08cc8566a0d3c8e8e1518fe990d5826f /source/blender/editors | |
parent | 12ad72ba8f4ab598c558428567707413e208eac7 (diff) |
2.5: globals cleanup
* G.version removed, use BLENDER_VERSION
* G.order removed, ENDIAN_ORDER
* G.vd, G.sipo, G.buts, G.sima, .. removed.
* G.qual removed
* G.simulf removed (was unused in 2.4x)
* error() and some other unused stubs removed
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/BIF_glutil.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_util.h | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/glutil.c | 8 | ||||
-rw-r--r-- | source/blender/editors/screen/stubs.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 38 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 6 | ||||
-rw-r--r-- | source/blender/editors/util/ed_markers.c | 4 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 15 |
9 files changed, 38 insertions, 53 deletions
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index b354591fc5f..6364b8bf1af 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -210,7 +210,7 @@ void setlinestyle(int nr); /* own working polygon offset */ -void bglPolygonOffset(float dist); +void bglPolygonOffset(float viewdist, float dist); /* For caching opengl matrices (gluProject/gluUnProject) */ typedef struct bglMats { diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index ab09e7ff96a..93bb5ef1208 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -30,7 +30,7 @@ /* ************** XXX OLD CRUFT WARNING ************* */ -void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert); +void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert); int GetButStringLength(char *str); #endif /* ED_UTIL_H */ diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index f4739a218d6..d500c9f37c1 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -739,12 +739,8 @@ void bgl_get_mats(bglMats *mats) /* *************** glPolygonOffset hack ************* */ -// both temporal, so here for now (ton) -#include "BKE_global.h" -#include "DNA_view3d_types.h" - /* dist is only for ortho now... */ -void bglPolygonOffset(float dist) +void bglPolygonOffset(float viewdist, float dist) { static float winmat[16], offset=0.0; @@ -760,7 +756,7 @@ void bglPolygonOffset(float dist) /* dist is from camera to center point */ - if(winmat[15]>0.5) offs= 0.00001*dist*G.vd->dist; // ortho tweaking + if(winmat[15]>0.5) offs= 0.00001*dist*viewdist; // ortho tweaking else offs= 0.0005*dist; // should be clipping value or so... winmat[14]-= offs; diff --git a/source/blender/editors/screen/stubs.c b/source/blender/editors/screen/stubs.c index 1cc657be985..aca51463885 100644 --- a/source/blender/editors/screen/stubs.c +++ b/source/blender/editors/screen/stubs.c @@ -29,14 +29,8 @@ #include <string.h> /* various UI stuff */ -void blender_test_break() {} -void error() {} void set_timecursor() {} -void waitcursor() {} void mainqenter() {} -void saveover() {} -void BIF_icons_free() {} -void BIF_icons_init() {} char texstr[20][12]; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index a0a76bb6d15..58a9c126324 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -194,7 +194,7 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index) else return 0; } -static void draw_tfaces3D(Object *ob, Mesh *me, DerivedMesh *dm) +static void draw_tfaces3D(View3D *v3d, Object *ob, Mesh *me, DerivedMesh *dm) { struct { Mesh *me; EdgeHash *eh; } data; @@ -203,7 +203,7 @@ static void draw_tfaces3D(Object *ob, Mesh *me, DerivedMesh *dm) glEnable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); - bglPolygonOffset(1.0); + bglPolygonOffset(v3d->dist, 1.0); /* Draw (Hidden) Edges */ UI_ThemeColor(TH_EDGE_FACESEL); @@ -230,7 +230,7 @@ static void draw_tfaces3D(Object *ob, Mesh *me, DerivedMesh *dm) glDisable(GL_BLEND); } - bglPolygonOffset(1.0); + bglPolygonOffset(v3d->dist, 1.0); /* Draw Stippled Outline for selected faces */ glColor3ub(255, 255, 255); @@ -240,7 +240,7 @@ static void draw_tfaces3D(Object *ob, Mesh *me, DerivedMesh *dm) dm->drawMappedEdges(dm, draw_tfaces3D__setActiveOpts, &data); - bglPolygonOffset(0.0); // resets correctly now, even after calling accumulated offsets + bglPolygonOffset(v3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets BLI_edgehash_free(data.eh, NULL); } @@ -567,7 +567,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, Object *ob, DerivedMesh *dm, /* draw edges and selected faces over textured mesh */ if(!G.obedit && faceselect) - draw_tfaces3D(ob, me, dm); + draw_tfaces3D(v3d, ob, me, dm); /* reset from negative scale correction */ glFrontFace(GL_CCW); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 01bdc1ba941..ca813e919fc 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1804,7 +1804,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em) if(v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0) glDisable(GL_DEPTH_TEST); - if(v3d->zbuf) bglPolygonOffset(5.0); + if(v3d->zbuf) bglPolygonOffset(v3d->dist, 5.0); if(G.f & G_DRAW_EDGELEN) { UI_GetThemeColor3fv(TH_TEXT, col); @@ -1939,7 +1939,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em) if(v3d->zbuf) { glEnable(GL_DEPTH_TEST); - bglPolygonOffset(0.0); + bglPolygonOffset(v3d->dist, 0.0); } } @@ -2014,7 +2014,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, Object *ob, EditMesh *em, D // write to show selected edge wires better UI_ThemeColor(TH_WIRE); - bglPolygonOffset(1.0); + bglPolygonOffset(v3d->dist, 1.0); glDepthMask(0); } else { @@ -2117,7 +2117,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, Object *ob, EditMesh *em, D if(dt>OB_WIRE) { glDepthMask(1); - bglPolygonOffset(0.0); + bglPolygonOffset(v3d->dist, 0.0); GPU_disable_material(); } @@ -2349,7 +2349,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, Base *base, int dt, int f * otherwise this wire is to overlay solid mode faces so do some depth buffer tricks. */ if (dt!=OB_WIRE && draw_wire==2) { - bglPolygonOffset(1.0); + bglPolygonOffset(v3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better } @@ -2357,7 +2357,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, Base *base, int dt, int f if (dt!=OB_WIRE && draw_wire==2) { glDepthMask(1); - bglPolygonOffset(0.0); + bglPolygonOffset(v3d->dist, 0.0); } } @@ -2388,7 +2388,7 @@ static int draw_mesh_object(Scene *scene, View3D *v3d, Base *base, int dt, int f if(dt>OB_WIRE) { // no transp in editmode, the fancy draw over goes bad then glsl = draw_glsl_material(scene, ob, v3d, dt); - GPU_set_object_materials(scene, ob, glsl, NULL); + GPU_set_object_materials(v3d, scene, ob, glsl, NULL); } draw_em_fancy(scene, v3d, ob, G.editMesh, cageDM, finalDM, dt); @@ -2407,7 +2407,7 @@ static int draw_mesh_object(Scene *scene, View3D *v3d, Base *base, int dt, int f check_alpha = check_material_alpha(base, ob, glsl); if(dt==OB_SOLID || glsl) { - GPU_set_object_materials(scene, ob, glsl, + GPU_set_object_materials(v3d, scene, ob, glsl, (check_alpha)? &do_alpha_pass: NULL); } @@ -2722,7 +2722,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt) } else { if(draw_glsl_material(scene, ob, v3d, dt)) { - GPU_set_object_materials(scene, ob, 1, NULL); + GPU_set_object_materials(v3d, scene, ob, 1, NULL); drawDispListsolid(lb, ob, 1); } else if(dt == OB_SHADED) { @@ -2730,7 +2730,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt) drawDispListshaded(lb, ob); } else { - GPU_set_object_materials(scene, ob, 0, NULL); + GPU_set_object_materials(v3d, scene, ob, 0, NULL); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); } @@ -2760,7 +2760,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt) if(dl->nors==NULL) addnormalsDispList(ob, lb); if(draw_glsl_material(scene, ob, v3d, dt)) { - GPU_set_object_materials(scene, ob, 1, NULL); + GPU_set_object_materials(v3d, scene, ob, 1, NULL); drawDispListsolid(lb, ob, 1); } else if(dt==OB_SHADED) { @@ -2768,7 +2768,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt) drawDispListshaded(lb, ob); } else { - GPU_set_object_materials(scene, ob, 0, NULL); + GPU_set_object_materials(v3d, scene, ob, 0, NULL); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); @@ -2788,7 +2788,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt) if(solid) { if(draw_glsl_material(scene, ob, v3d, dt)) { - GPU_set_object_materials(scene, ob, 1, NULL); + GPU_set_object_materials(v3d, scene, ob, 1, NULL); drawDispListsolid(lb, ob, 1); } else if(dt == OB_SHADED) { @@ -2797,7 +2797,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt) drawDispListshaded(lb, ob); } else { - GPU_set_object_materials(scene, ob, 0, NULL); + GPU_set_object_materials(v3d, scene, ob, 0, NULL); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); @@ -4593,7 +4593,7 @@ static void drawWireExtra(Scene *scene, View3D *v3d, Object *ob) } } - bglPolygonOffset(1.0); + bglPolygonOffset(v3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { @@ -4610,7 +4610,7 @@ static void drawWireExtra(Scene *scene, View3D *v3d, Object *ob) } glDepthMask(1); - bglPolygonOffset(0.0); + bglPolygonOffset(v3d->dist, 0.0); } /* should be called in view space */ @@ -5376,7 +5376,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, Object *ob) em_solidoffs= bbs_mesh_solid_EM(scene, v3d, dm, scene->selectmode & SCE_SELECT_FACE); - bglPolygonOffset(1.0); + bglPolygonOffset(v3d->dist, 1.0); // we draw edges always, for loop (select) tools em_wireoffs= bbs_mesh_wire(dm, em_solidoffs); @@ -5386,7 +5386,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, Object *ob) em_vertoffs= bbs_mesh_verts(dm, em_wireoffs); else em_vertoffs= em_wireoffs; - bglPolygonOffset(0.0); + bglPolygonOffset(v3d->dist, 0.0); dm->release(dm); @@ -5430,7 +5430,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, Object *ob, int if(dm) { glsl = draw_glsl_material(scene, ob, v3d, dt); - GPU_set_object_materials(scene, ob, glsl, NULL); + GPU_set_object_materials(v3d, scene, ob, glsl, NULL); } else { glEnable(GL_COLOR_MATERIAL); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index f7a1206c164..9f50b75ceaa 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -921,7 +921,7 @@ void initlocalview(Scene *scene, ARegion *ar, View3D *v3d) else { base= FIRSTBASE; while(base) { - if TESTBASE(base) { + if TESTBASE(v3d, base) { minmax_object(base->object, min, max); base->lay |= locallay; base->object->lay= base->lay; @@ -1003,7 +1003,7 @@ void centerview(ARegion *ar, View3D *v3d) /* like a localview without local! */ /* this is weak code this way, we should make a generic active/selection callback interface once... */ Base *base; for(base=FIRSTBASE; base; base= base->next) { - if(TESTBASELIB(base)) { + if(TESTBASELIB(v3d, base)) { if(base->object->type==OB_ARMATURE) if(base->object->flag & OB_POSEMODE) break; @@ -1047,7 +1047,7 @@ void centerview(ARegion *ar, View3D *v3d) /* like a localview without local! */ else { Base *base= FIRSTBASE; while(base) { - if TESTBASE(base) { + if TESTBASE(v3d, base) { minmax_object(base->object, min, max); /* account for duplis */ minmax_object_duplis(base->object, min, max); diff --git a/source/blender/editors/util/ed_markers.c b/source/blender/editors/util/ed_markers.c index 96f7f15f8c9..6c27219c9c7 100644 --- a/source/blender/editors/util/ed_markers.c +++ b/source/blender/editors/util/ed_markers.c @@ -394,9 +394,9 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) fac= ((float)(evt->x - mm->firstx)*dx); if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) - apply_keyb_grid(&fac, 0.0, FPS, 0.1*FPS, 0); + apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1*FPS, 0); else - apply_keyb_grid(&fac, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID); + apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID); offs= (int)fac; RNA_int_set(op->ptr, "frs", offs); diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 841c5cd3cb5..5113326cff1 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -47,19 +47,14 @@ /* now only used in 2d spaces, like time, ipo, nla, sima... */ -/* XXX clean G.qual */ -void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert) +/* XXX shift/ctrl not configurable */ +void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert) { /* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */ - int ctrl; + if(invert) + ctrl= !ctrl; - if(invert) { - if(G.qual & LR_CTRLKEY) ctrl= 0; - else ctrl= 1; - } - else ctrl= (G.qual & LR_CTRLKEY); - - if(ctrl && (G.qual & LR_SHIFTKEY)) { + if(ctrl && shift) { if(fac3!= 0.0) *val= fac3*floor(*val/fac3 +.5); } else if(ctrl) { |