2.5: globals cleanup
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 19 Dec 2008 19:11:02 +0000 (19:11 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 19 Dec 2008 19:11:02 +0000 (19:11 +0000)
* 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

27 files changed:
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/include/BIF_glutil.h
source/blender/editors/include/ED_util.h
source/blender/editors/screen/glutil.c
source/blender/editors/screen/stubs.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/util/ed_markers.c
source/blender/editors/util/ed_util.c
source/blender/gpu/GPU_draw.h
source/blender/gpu/intern/gpu_draw.c
source/blender/imbuf/intern/amiga.c
source/blender/imbuf/intern/anim.c
source/blender/imbuf/intern/tiff.c
source/blender/makesdna/DNA_scene_types.h
source/blender/radiosity/extern/include/radio.h
source/blender/radiosity/intern/source/radpreprocess.c
source/blender/render/extern/include/RE_render_ext.h
source/blender/render/intern/source/convertblender.c
source/blender/yafray/intern/yafray_Render.h
source/creator/creator.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

index 284d41e7891e1c96407a2208d1096db0ed2fa793..2edf10f846ed60228405795820b45015276d59f2 100644 (file)
@@ -66,15 +66,6 @@ struct BME_Glob;
 typedef struct Global {
 
        /* active pointers */
-       struct View3D *vd;
-       struct View2D *v2d;
-       struct SpaceIpo *sipo;
-       struct SpaceButs *buts;
-       struct SpaceImage *sima;
-       struct SpaceOops *soops;
-       struct SpaceSound *ssound;
-       struct SpaceAction *saction;            /* __NLA */
-       struct SpaceNla *snla;
        struct Main *main;
        struct Scene *scene;                    /* denk aan file.c */
        struct bScreen *curscreen;
@@ -99,14 +90,11 @@ typedef struct Global {
        int totvert, totedge, totface, totvertsel, totedgesel, totfacesel;
     
        short afbreek, moving;
-       short qual, background;
+       short background;
        short winpos, displaymode;      /* used to be in Render */
        short rendering;                        /* to indicate render is busy, prevent renderwindow events etc */
-       /**
-        * The current version of Blender.
-        */
-       short version;
-       short simulf, order, rt;
+
+       short rt;
        int f;
 
        /* Editmode lists */
@@ -235,28 +223,11 @@ typedef struct Global {
 #define G_WINDOWSTATE_BORDER           1
 #define G_WINDOWSTATE_FULLSCREEN       2
 
-/* G.simulf */
-#define G_LOADFILE     2
-#define G_RESTART      4
-#define G_QUIT         8
-#define G_SETSCENE     16
-
-/* G.qual */
-#define R_SHIFTKEY             1
-#define L_SHIFTKEY             2
-#define LR_SHIFTKEY    3
-#define R_ALTKEY               4
-#define L_ALTKEY               8
-#define LR_ALTKEY              12
-#define R_CTRLKEY              16
-#define L_CTRLKEY              32
-#define LR_CTRLKEY     48
-#define LR_COMMANDKEY  64
-
-/* G.order: indicates what endianness the platform where the file was
+/* ENDIAN_ORDER: indicates what endianness the platform where the file was
  * written had. */
 #define L_ENDIAN       1
 #define B_ENDIAN       0
+extern short ENDIAN_ORDER;
 
 /* G.moving, signals drawing in (3d) window to denote transform */
 #define G_TRANSFORM_OBJ                        1
index 2ab12c12ab8ba965627bf3c73da0b8366f92c11e..6cadd57e390cf3dcfbbcc160d72f89ad618819e2 100644 (file)
@@ -94,6 +94,7 @@
 Global G;
 UserDef U;
 ListBase WMlist= {NULL, NULL};
+short ENDIAN_ORDER;
 
 char versionstr[48]= "";
 
@@ -200,15 +201,13 @@ void initglobals(void)
 
        strcpy(G.ima, "//");
 
-       G.version= BLENDER_VERSION;
-
-       G.order= 1;
-       G.order= (((char*)&G.order)[0])?L_ENDIAN:B_ENDIAN;
+       ENDIAN_ORDER= 1;
+       ENDIAN_ORDER= (((char*)&ENDIAN_ORDER)[0])? L_ENDIAN: B_ENDIAN;
 
        if(BLENDER_SUBVERSION)
-               sprintf(versionstr, "www.blender.org %d.%d", G.version, BLENDER_SUBVERSION);
+               sprintf(versionstr, "www.blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION);
        else
-               sprintf(versionstr, "www.blender.org %d", G.version);
+               sprintf(versionstr, "www.blender.org %d", BLENDER_VERSION);
 
 #ifdef _WIN32  // FULLSCREEN
        G.windowstate = G_WINDOWSTATE_USERDEF;
@@ -244,13 +243,6 @@ static void clear_global(void)
        G.main= NULL;
        
        G.obedit= NULL;
-       G.saction= NULL;
-       G.buts= NULL;
-       G.v2d= NULL;
-       G.vd= NULL;
-       G.soops= NULL;
-       G.sima= NULL;
-       G.sipo= NULL;
        
        G.f &= ~(G_WEIGHTPAINT + G_VERTEXPAINT + G_FACESELECT + G_PARTICLEEDIT);
 }
index 28ed74aa9db476b34a22eb31bf539ece189121f5..1570f735fc5d37f3f955e25f55d3ceaed7573fe9 100644 (file)
 #include "BLI_arithb.h"
 #include "BLI_editVert.h"
 
+#include "BKE_blender.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_mesh.h"
@@ -181,7 +182,7 @@ static int is_stl(char *str)
     return;                                             \
   }                                                     \
   else {                                                \
-    if (G.order==B_ENDIAN) {                            \
+    if (ENDIAN_ORDER==B_ENDIAN) {                       \
       SWITCH_INT(mvert->co[0]);                         \
       SWITCH_INT(mvert->co[1]);                         \
       SWITCH_INT(mvert->co[2]);                         \
@@ -250,7 +251,7 @@ static void read_stl_mesh_binary(char *str)
 
        fseek(fpSTL, 80, SEEK_SET);
        fread(&numfacets, 4*sizeof(char), 1, fpSTL);
-       if (G.order==B_ENDIAN) {
+       if (ENDIAN_ORDER==B_ENDIAN) {
                 SWITCH_INT(numfacets);
         }
 
@@ -2459,7 +2460,7 @@ static void write_vert_stl(Object *ob, MVert *verts, int index, FILE *fpSTL)
        VECCOPY(vert, verts[(index)].co);
        Mat4MulVecfl(ob->obmat, vert);
 
-       if (G.order==B_ENDIAN) {
+       if (ENDIAN_ORDER==B_ENDIAN) {
                SWITCH_INT(vert[0]);
                SWITCH_INT(vert[1]);
                SWITCH_INT(vert[2]);
@@ -2564,7 +2565,7 @@ void write_stl(char *str)
        */
        fseek(fpSTL, 80, SEEK_SET);
 
-       if (G.order==B_ENDIAN) {
+       if (ENDIAN_ORDER==B_ENDIAN) {
                 SWITCH_INT(numfacets);
         }
        fwrite(&numfacets, 4*sizeof(char), 1, fpSTL);
@@ -2605,7 +2606,7 @@ static void write_videoscape_mesh(Object *ob, char *str)
                        cp[1]= (unsigned char) (255.0*ma->b);
                        cp[2]= (unsigned char) (255.0*ma->g);
                        cp[3]= (unsigned char) (255.0*ma->r);
-                       if(G.order==L_ENDIAN) SWITCH_INT(kleur[a]);
+                       if(ENDIAN_ORDER==L_ENDIAN) SWITCH_INT(kleur[a]);
                }
                else kleur[a]= 0x00C0C0C0;
        
@@ -3026,7 +3027,7 @@ void write_vrml(char *str)
        
        /* FIRST: write all the datablocks */
        
-       fprintf(fp, "#VRML V1.0 ascii\n\n# Blender V%d\n\n# 'Switch' is used as a hack, to ensure it is not part of the drawing\n\n", G.version);
+       fprintf(fp, "#VRML V1.0 ascii\n\n# Blender V%d\n\n# 'Switch' is used as a hack, to ensure it is not part of the drawing\n\n", BLENDER_VERSION);
        fprintf(fp, "Separator {\n");
        fprintf(fp, "Switch {\n");
 
index 7008f2548718192277f7391d82c9e8cbcbf5e442..3ac3ed4f7aa63dd1b44635389e80ed34605d16f8 100644 (file)
@@ -302,7 +302,7 @@ static AVFrame* generate_video_frame(uint8_t* pixels)
        /* Do RGBA-conversion and flipping in one step depending
           on CPU-Endianess */
 
-       if (G.order == L_ENDIAN) {
+       if (ENDIAN_ORDER == L_ENDIAN) {
                int y;
                for (y = 0; y < height; y++) {
                        uint8_t* target = rgb_frame->data[0]
index c5fa2f8d282fa31c92fa8140d80cf459831002c2..eb915bb0d00d9e93d9c186c4ee4e79fd1fbd26dc 100644 (file)
@@ -2071,7 +2071,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
 
        wd= bgnwrite(handle, compare, current, write_flags);
        
-       sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (G.order==B_ENDIAN)?'V':'v', G.version);
+       sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (ENDIAN_ORDER==B_ENDIAN)?'V':'v', BLENDER_VERSION);
        mywrite(wd, buf, 12);
 
        write_renderinfo(wd, mainvar);
index b354591fc5f5af0ab14cc8edfa1173b53df00127..6364b8bf1af63113b257a62304c2113f5b7b9c3f 100644 (file)
@@ -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 {
index ab09e7ff96ae74837a79dd0dab40f4648b72d02b..93bb5ef12083d1e6732ce99db7af0fd2d91f593b 100644 (file)
@@ -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 */
index f4739a218d6c46f95c1581c75a5ee11c109ee9ac..d500c9f37c190fd27b7fc9ec88fe349bfa39ccc7 100644 (file)
@@ -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;
index 1cc657be9854c3685c1c0d646302e85ebfaa8bfa..aca51463885336a24df77cd52bc11a6564bf5b16 100644 (file)
 #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];
 
index a0a76bb6d15e08624962c737992703418e8440c0..58a9c12632404ac1d06772d4b4489c0fda7ba39a 100644 (file)
@@ -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);
index 01bdc1ba941c86fab5036e4c806e1e9f4c397ddf..ca813e919fc6c7f30c7f9afa32dd146946888aa2 100644 (file)
@@ -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);
index f7a1206c1645ee3a9ffed5e339a1087d8ed768fb..9f50b75ceaa9eef0077b91b62e399992accb8477 100644 (file)
@@ -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);
index 96f7f15f8c966e820f719de8838258b9070bdf74..6c27219c9c788bb7a4881bbd2e307964b9257f39 100644 (file)
@@ -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);
index 841c5cd3cb51422c814c92f92c0e709da4e62b4b..5113326cff1c68319d6769b63517ccad856863fc 100644 (file)
 
 
 /* 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) {
index 2399e7b6a8c56908049baed53ff0747ad1ba8a52..69f44cb256644d29a9f60b65ad1993bab438b053 100644 (file)
 extern "C" {
 #endif
 
-struct MTFace;
 struct Image;
-struct Scene;
+struct MTFace;
 struct Object;
+struct Scene;
+struct View3d;
 
 /* OpenGL drawing functions related to shading. These are also
  * shared with the game engine, where there were previously
@@ -61,8 +62,8 @@ void GPU_state_init(void);
  *   GPU_enable_material returns 0 if drawing should be skipped
  * - after drawing, the material must be disabled again */
 
-void GPU_set_object_materials(struct Scene *scene, struct Object *ob,
-       int glsl, int *do_alpha_pass);
+void GPU_set_object_materials(struct View3D *v3d, struct Scene *scene,
+       struct Object *ob, int glsl, int *do_alpha_pass);
 int GPU_enable_material(int nr, void *attribs);
 void GPU_disable_material(void);
 
index 4025a12a867ba993b08518af1575124d311206c8..237aa802ed81b07167cc004497d3241e57dc48c2 100644 (file)
@@ -757,6 +757,9 @@ static struct GPUMaterialState {
        Material *gboundmat;
        Object *gob;
        Scene *gscene;
+       int glay;
+       float (*gviewmat)[4];
+       float (*gviewinv)[4];
 
        GPUBlendMode blendmode[MAXMATBUF];
        int alphapass;
@@ -779,7 +782,7 @@ Material *gpu_active_node_material(Material *ma)
        return ma;
 }
 
-void GPU_set_object_materials(Scene *scene, Object *ob, int glsl, int *do_alpha_pass)
+void GPU_set_object_materials(View3D *v3d, Scene *scene, Object *ob, int glsl, int *do_alpha_pass)
 {
        extern Material defmaterial; /* from material.c */
        Material *ma;
@@ -796,8 +799,11 @@ void GPU_set_object_materials(Scene *scene, Object *ob, int glsl, int *do_alpha_
        GMS.gob = ob;
        GMS.gscene = scene;
        GMS.totmat= ob->totcol;
+       GMS.glay= v3d->lay;
+       GMS.gviewmat= v3d->viewmat;
+       GMS.gviewinv= v3d->viewinv;
 
-       GMS.alphapass = (G.vd && G.vd->transp);
+       GMS.alphapass = (v3d && v3d->transp);
        if(do_alpha_pass)
                *do_alpha_pass = 0;
 
@@ -918,8 +924,8 @@ int GPU_enable_material(int nr, void *attribs)
 
                        gpumat = GPU_material_from_blender(GMS.gscene, mat);
                        GPU_material_vertex_attributes(gpumat, gattribs);
-                       GPU_material_bind(gpumat, GMS.gob->lay, G.vd->lay, 1.0);
-                       GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, G.vd->viewmat, G.vd->viewinv, GMS.gob->col);
+                       GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0);
+                       GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col);
                        GMS.gboundmat= mat;
 
                        if(GMS.alphapass) glDepthMask(1);
index 534e4945aa34fd3dbd5e54d0c33a056c5a33562d..f84740826ae7707cadf0d31df16c5849ef942360 100644 (file)
@@ -532,7 +532,7 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
 
        if (ibuf) {
                if (ibuf->rect) 
-                       if (G.order == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+                       if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
        }
        
        return (ibuf);
index 80bf401bec01e56d7cba827c6e8c7b0cde23a3e8..9d70dd3fc6083df4737c07b79ccee07eea572d3b 100644 (file)
@@ -778,7 +778,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
                                        }
                                }
 
-                               if (G.order == B_ENDIAN) {
+                               if (ENDIAN_ORDER == B_ENDIAN) {
                                        int * dstStride 
                                                = anim->pFrameRGB->linesize;
                                        uint8_t** dst = anim->pFrameRGB->data;
index 194082d3e19fa232483083211b9dc453f5276c8f..b2465d6cc2f5dd3f5a90ac0e54ec24dd7c09819b 100644 (file)
@@ -410,7 +410,7 @@ struct ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
        /* close the client layer interface to the in-memory file */
        libtiff_TIFFClose(image);
 
-       if (G.order == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+       if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
 
        /* return successfully */
        return (ibuf);
index 859b3abd7e2b150c5589939d0d22f96cd224008d..9157475c331160a48a2a883b377567e7d57db0a7 100644 (file)
@@ -721,9 +721,9 @@ typedef struct Scene {
 #define MINFRAME       1
 #define MINFRAMEF      1.0
 
-#define TESTBASE(base) ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) )
-#define TESTBASELIB(base)      ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
-#define BASE_SELECTABLE(base)   ((base->lay & G.vd->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0)
+#define TESTBASE(v3d, base)    ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) )
+#define TESTBASELIB(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
+#define BASE_SELECTABLE(v3d, base)      ((base->lay & v3d->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0)
 #define FIRSTBASE              G.scene->base.first
 #define LASTBASE               G.scene->base.last
 #define BASACT                 (G.scene->basact)
index b50560438fb1edbaf228660e2e190202d98cb8e4..847d2fb1ae9044cdbd44bc7d79ca5d7bea35a01c 100644 (file)
@@ -41,6 +41,7 @@
 #include "radio_types.h"
 
 extern RadGlobal RG;
+struct View3D;
 
 /* radfactors.c */
 extern float calcStokefactor(RPatch *shoot, RPatch *rp, RNode *rn, float *area);
@@ -111,7 +112,7 @@ extern void splitconnected(void);
 extern int vergedge(const void *v1,const void *v2);
 extern void addedge(float *v1, float *v2, EdSort *es);
 extern void setedgepointers(void);
-extern void rad_collect_meshes(void);
+extern void rad_collect_meshes(struct View3D *v3d);
 extern void countelem(RNode *rn);
 extern void countglobaldata(void);
 extern void addelem(RNode ***el, RNode *rn, RPatch *rp);
index eec75942da0f9efb9acca20d161d5db8e4f8ca84..30d2e000bb731153cbe24bad562ef83e3d9155ca 100644 (file)
@@ -293,7 +293,7 @@ static int materialIndex(Material *ma)
        return -1;
 }
 
-void rad_collect_meshes()
+void rad_collect_meshes(View3D *v3d)
 {
        extern Material defmaterial;
        Base *base;
@@ -309,7 +309,7 @@ void rad_collect_meshes()
        float *vd, *v1, *v2, *v3, *v4 = NULL;
        int a, b, offs, index, mfdatatot;
        
-       if (G.vd==NULL) {
+       if (v3d==NULL) {
                printf("Error, trying to collect radiosity meshes with no 3d view\n");
                return;
        }
@@ -330,7 +330,7 @@ void rad_collect_meshes()
        RG.totface= 0;
        base= (G.scene->base.first);
        while(base) {
-               if(((base)->flag & SELECT) && ((base)->lay & G.vd->lay) ) {
+               if(((base)->flag & SELECT) && ((base)->lay & v3d->lay) ) {
                        if(base->object->type==OB_MESH) {
                                base->flag |= OB_RADIO;
                                me= base->object->data;
@@ -353,7 +353,7 @@ void rad_collect_meshes()
        /* min-max and material array */
        base= (G.scene->base.first);
        while(base) {
-               if( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) ) {
+               if( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) ) {
                        if(base->object->type==OB_MESH) {
                                me= base->object->data;
                                mvert= me->mvert;
@@ -420,7 +420,7 @@ void rad_collect_meshes()
        
        base= (G.scene->base.first);
        while(base) {
-               if( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) )  {
+               if( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) )  {
                        if(base->object->type==OB_MESH) {
                                ob= base->object;
                                me= ob->data;
index e61de5bc3e6b42e2d0508bdf6490fc301de29f72..08df53221c8024473359e223f77622bd2be9db2a 100644 (file)
@@ -35,7 +35,9 @@
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 
 /* called by meshtools */
-void   RE_make_sticky(void);
+struct View3D;
+
+void   RE_make_sticky(struct View3D *v3d);
        
 /* for radiosity module */     
 struct RadView;
index e2692113d16bb4898e91bcd7771c9fa501e4d03a..e24748fecff33f6bd26290a848c910bfb9423db1 100644 (file)
@@ -5512,7 +5512,7 @@ void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob)
 /* Sticky texture coords                                                                                                        */
 /* ------------------------------------------------------------------------- */
 
-void RE_make_sticky(void)
+void RE_make_sticky(View3D *v3d)
 {
        Object *ob;
        Base *base;
@@ -5523,7 +5523,7 @@ void RE_make_sticky(void)
        float ho[4], mat[4][4];
        int a;
        
-       if(G.vd==NULL) {
+       if(v3d==NULL) {
                printf("Need a 3d view to make sticky\n");
                return;
        }
@@ -5549,7 +5549,7 @@ void RE_make_sticky(void)
        RE_SetView(re, mat);
        
        for(base= FIRSTBASE; base; base= base->next) {
-               if TESTBASELIB(base) {
+               if TESTBASELIB(v3d, base) {
                        if(base->object->type==OB_MESH) {
                                ob= base->object;
                                
index 43d2c6c602abada47055a2cf77a167742a76ec6a..165cfefdbd001429b8542a8595f95caa3637d9fb 100644 (file)
@@ -34,9 +34,6 @@ extern "C" {
 
 #include "BLI_blenlib.h"
 
-/* need error(), so extern declare here */
-extern void error (char *fmt, ...);
-
 #ifdef __cplusplus
 }
 #endif
index f96edf99029dde87a690c117dfa1d0a55d7b64d6..471ea6bbe5bb84ea4ab8565e7a6b0bb3c58abd76 100644 (file)
@@ -144,20 +144,20 @@ static void blender_esc(int sig)
 static void print_version(void)
 {
 #ifdef BUILD_DATE
-       printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION);
+       printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
        printf ("\tbuild date: %s\n", build_date);
        printf ("\tbuild time: %s\n", build_time);
        printf ("\tbuild revision: %s\n", build_rev);
        printf ("\tbuild platform: %s\n", build_platform);
        printf ("\tbuild type: %s\n", build_type);
 #else
-       printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION);
+       printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
 #endif
 }
 
 static void print_help(void)
 {
-       printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION);
+       printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
        printf ("Usage: blender [args ...] [file] [args ...]\n");
        printf ("\nRender options:\n");
        printf ("  -b <file>\tRender <file> in background (doesn't load the user defaults .B.blend file)\n");
@@ -429,7 +429,7 @@ int main(int argc, char **argv)
                                        break;
                                case 'd':
                                        G.f |= G_DEBUG;         /* std output printf's */ 
-                                       printf ("Blender %d.%02d (sub %d) Build\n", G.version/100, G.version%100, BLENDER_SUBVERSION);
+                                       printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
                                        MEM_set_memory_debug();
 #ifdef NAN_BUILDINFO
                                        printf("Build: %s %s %s %s\n", build_date, build_time, build_platform, build_type);
index 6c2e110db76eca73b09df9a7b50f1977ead47c5d..01eedc68964ac5ad5f7dd47a1313377a4a745bed 100644 (file)
@@ -210,7 +210,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                int tmp_lay= G.scene->lay;
                Object *tmp_camera = G.scene->camera;
 
-               if (G.vd->scenelock==0){
+               if (v3d->scenelock==0){
                        G.scene->lay= v3d->lay;
                        G.scene->camera= v3d->camera;
                }
@@ -477,7 +477,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                        gameLogic_keys = NULL;
                }
                //lock frame and camera enabled - restoring global values
-               if (G.vd->scenelock==0){
+               if (v3d->scenelock==0){
                        G.scene->lay= tmp_lay;
                        G.scene->camera= tmp_camera;
                }