- view bounds (now split from collision bounds) was still being used for bge physics...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 5 Nov 2011 02:30:25 +0000 (02:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 5 Nov 2011 02:30:25 +0000 (02:30 +0000)
- cleanup Object struct - remove pad and unused flags, convert some shot's to char's, saving 24 bytes.

source/blender/blenkernel/intern/object.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/object/object_edit.c
source/blender/editors/space_view3d/drawobject.c
source/blender/makesdna/DNA_object_types.h
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index a7acf09..1e0ece1 100644 (file)
@@ -1107,7 +1107,6 @@ Object *add_only_object(int type, const char *name)
        ob->obstacleRad = 1.;
        
        /* NT fluid sim defaults */
-       ob->fluidsimFlag = 0;
        ob->fluidsimSettings = NULL;
 
        ob->pc_ids.first = ob->pc_ids.last = NULL;
index 678d0e1..fc0f302 100644 (file)
@@ -8245,7 +8245,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        if(main->versionfile <= 233) {
                bScreen *sc;
                Material *ma= main->mat.first;
-               Object *ob= main->object.first;
+               /* Object *ob= main->object.first; */
                
                while(ma) {
                        if(ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
@@ -8255,11 +8255,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
                
                /* this should have been done loooong before! */
+#if 0   /* deprecated in 2.5+ */
                while(ob) {
                        if(ob->ipowin==0) ob->ipowin= ID_OB;
                        ob= ob->id.next;
                }
-               
+#endif
                for (sc= main->screen.first; sc; sc= sc->id.next) {
                        ScrArea *sa;
                        for (sa= sc->areabase.first; sa; sa= sa->next) {
index d347322..f2997dc 100644 (file)
@@ -1182,7 +1182,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
                                        base->object->min_vel= ob->min_vel;
                                        base->object->max_vel= ob->max_vel;
                                        if (ob->gameflag & OB_BOUNDS) {
-                                               base->object->boundtype = ob->boundtype;
+                                               base->object->collision_boundtype = ob->collision_boundtype;
                                        }
                                        base->object->margin= ob->margin;
                                        base->object->bsoft= copy_bulletsoftbody(ob->bsoft);
index 6a8e850..cb3bc29 100644 (file)
        ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \
        (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
 
-static void draw_bounding_volume(Scene *scene, Object *ob, short type);
+static void draw_bounding_volume(Scene *scene, Object *ob, char type);
 
 static void drawcube_size(float size);
 static void drawcircle_size(float size);
@@ -5469,7 +5469,7 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
 }
 #endif
 
-static void draw_bb_quadric(BoundBox *bb, short type)
+static void draw_bb_quadric(BoundBox *bb, char type)
 {
        float size[3], cent[3];
        GLUquadricObj *qobj = gluNewQuadric(); 
@@ -5508,7 +5508,7 @@ static void draw_bb_quadric(BoundBox *bb, short type)
        gluDeleteQuadric(qobj); 
 }
 
-static void draw_bounding_volume(Scene *scene, Object *ob, short type)
+static void draw_bounding_volume(Scene *scene, Object *ob, char type)
 {
        BoundBox *bb= NULL;
        
index d158f22..c5fd17e 100644 (file)
@@ -164,9 +164,10 @@ typedef struct Object {
        short transflag, protectflag;   /* transformation settings and transform locks  */
        short trackflag, upflag;
        short nlaflag, ipoflag;         // xxx depreceated... old animation system
-       short ipowin, scaflag;          /* ipowin: blocktype last ipowindow */
-       short scavisflag, boundtype;
-       
+       short scaflag;          /* ipowin: blocktype last ipowindow */
+       char scavisflag;
+       char pad5;
+
        int dupon, dupoff, dupsta, dupend;
 
        float sf, ctime; /* sf is time-offset, ctime is the objects current time (XXX timing needs to be revised) */
@@ -193,12 +194,16 @@ typedef struct Object {
        float min_vel; /* clamp the maximum velocity 0.0 is disabled */
        float m_contactProcessingThreshold;
        float obstacleRad;
-       char pad0[4];
-       
+
        short rotmode;          /* rotation mode - uses defines set out in DNA_action_types.h for PoseChannel rotations... */
-       
+
+       char boundtype;            /* bounding box use for drawing */
+       char collision_boundtype;  /* bounding box type used for collision */
+
+       char  restrictflag;                     /* for restricting view, select, render etc. accessible in outliner */
+
        char dt, dtx;
-       char empty_drawtype, pad1[3];
+       char empty_drawtype;
        float empty_drawsize;
        float dupfacesca;       /* dupliface scale */
        
@@ -206,7 +211,7 @@ typedef struct Object {
        ListBase sensors;
        ListBase controllers;
        ListBase actuators;
-    
+
        float bbsize[3];
        short index;                    /* custom index, for renderpasses */
        unsigned short actdef;  /* current deformation group, note: index starts at 1 */
@@ -242,16 +247,12 @@ typedef struct Object {
        struct PartDeflect *pd;         /* particle deflector/attractor/collision data */
        struct SoftBody *soft;          /* if exists, saved in file */
        struct Group *dup_group;        /* object duplicator for group */
-       
-       short fluidsimFlag;                     /* NT toggle fluidsim participation on/off */
-       
-       short restrictflag;                     /* for restricting view, select, render etc. accessible in outliner */
 
-       short shapenr, shapeflag;       /* current shape key for menu or pinned, flag for pinning */
+       char  body_type;                        /* for now used to temporarily holds the type of collision object */
+       char  shapeflag;                        /* flag for pinning */
+       short shapenr;                          /* current shape key for menu or pinned */
        float smoothresh;                       /* smoothresh is phong interpolation ray_shadow correction in render */
-       short recalco;                          /* recalco for temp storage of ob->recalc, bad design warning */
-       short body_type;                        /* for now used to temporarily holds the type of collision object */
-       
+
        struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
 
        struct DerivedMesh *derivedDeform, *derivedFinal;
@@ -265,9 +266,6 @@ typedef struct Object {
        ListBase *duplilist;    /* for temporary dupli list storage, only for use by RNA API */
 
        float ima_ofs[2];               /* offset for image empties */
-
-       short collision_boundtype;      /* bounding box type used for collision */
-       char pad3[6];
 } Object;
 
 /* Warning, this is not used anymore because hooks are now modifiers */
index 779d794..57611d6 100644 (file)
@@ -1648,7 +1648,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
        }
 
        
-       objprop.m_concave = (blenderobject->boundtype & 4) != 0;
+       objprop.m_concave = (blenderobject->collision_boundtype == OB_BOUND_TRIANGLE_MESH);
        
        switch (physics_engine)
        {