Revision: 41529
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41529
Author:   nazgul
Date:     2011-11-04 15:53:34 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
Fix #28865: Draw_bounds_type does not display Polyhedron or Capsule types

Separate DNA properties for bounding box used for bounding box display
in 3d viewport and bounding box used for collision detection in game engine.

Bumped subversion for proper updating old files to new system, but it
need more complex testing.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_blender.h
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/makesdna/DNA_object_types.h
    trunk/blender/source/blender/makesrna/intern/rna_object.c
    trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h       2011-11-04 
15:53:20 UTC (rev 41528)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h       2011-11-04 
15:53:34 UTC (rev 41529)
@@ -42,7 +42,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION                        260
-#define BLENDER_SUBVERSION             0
+#define BLENDER_SUBVERSION             1
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c   2011-11-04 
15:53:20 UTC (rev 41528)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c   2011-11-04 
15:53:34 UTC (rev 41529)
@@ -12157,8 +12157,13 @@
 
        }
 
-       /* put compatibility code here until next subversion bump */
-       {
+       if (main->versionfile < 260 || (main->versionfile == 260 && 
main->subversionfile < 1)){
+               Object *ob;
+
+               for (ob= main->object.first; ob; ob= ob->id.next) {
+                       ob->collision_boundtype= ob->boundtype;
+               }
+
                {
                        Camera *cam;
                        for(cam= main->camera.first; cam; cam= cam->id.next) {
@@ -12171,6 +12176,11 @@
                }
        }
 
+       /* put compatibility code here until next subversion bump */
+       {
+               
+       }
+
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! 
*/
        /* WATCH IT 2!: Userdef struct init has to be in 
editors/interface/resources.c! */
 

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c      
2011-11-04 15:53:20 UTC (rev 41528)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c      
2011-11-04 15:53:34 UTC (rev 41529)
@@ -107,7 +107,7 @@
        ((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);
+static void draw_bounding_volume(Scene *scene, Object *ob, short type);
 
 static void drawcube_size(float size);
 static void drawcircle_size(float size);
@@ -2703,7 +2703,7 @@
 
        if(dt==OB_BOUNDBOX) {
                if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= 
OB_WIRE)==0)
-                       draw_bounding_volume(scene, ob);
+                       draw_bounding_volume(scene, ob, ob->boundtype);
        }
        else if(hasHaloMat || (totface==0 && totedge==0)) {
                glPointSize(1.5);
@@ -5508,7 +5508,7 @@
        gluDeleteQuadric(qobj); 
 }
 
-static void draw_bounding_volume(Scene *scene, Object *ob)
+static void draw_bounding_volume(Scene *scene, Object *ob, short type)
 {
        BoundBox *bb= NULL;
        
@@ -5534,8 +5534,8 @@
        
        if(bb==NULL) return;
        
-       if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec);
-       else draw_bb_quadric(bb, ob->boundtype);
+       if(type==OB_BOUND_BOX) draw_box(bb->vec);
+       else draw_bb_quadric(bb, type);
        
 }
 
@@ -6101,7 +6101,7 @@
                        }
                        else if(dt==OB_BOUNDBOX) {
                                if((v3d->flag2 & V3D_RENDER_OVERRIDE && 
v3d->drawtype >= OB_WIRE)==0)
-                                       draw_bounding_volume(scene, ob);
+                                       draw_bounding_volume(scene, ob, 
ob->boundtype);
                        }
                        else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb 
? ob->bb : cu->bb))
                                empty_object= drawDispList(scene, v3d, rv3d, 
base, dt);
@@ -6117,7 +6117,7 @@
                        }
                        else if(dt==OB_BOUNDBOX) {
                                if((v3d->flag2 & V3D_RENDER_OVERRIDE && 
v3d->drawtype >= OB_WIRE)==0)
-                                       draw_bounding_volume(scene, ob);
+                                       draw_bounding_volume(scene, ob, 
ob->boundtype);
                        }
                        else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb 
? ob->bb : cu->bb)) {
                                empty_object= drawDispList(scene, v3d, rv3d, 
base, dt);
@@ -6134,7 +6134,7 @@
                                drawmball(scene, v3d, rv3d, base, dt);
                        else if(dt==OB_BOUNDBOX) {
                                if((v3d->flag2 & V3D_RENDER_OVERRIDE && 
v3d->drawtype >= OB_WIRE)==0)
-                                       draw_bounding_volume(scene, ob);
+                                       draw_bounding_volume(scene, ob, 
ob->boundtype);
                        }
                        else 
                                empty_object= drawmball(scene, v3d, rv3d, base, 
dt);
@@ -6376,6 +6376,14 @@
                        }
                }
 
+               if(ob->gameflag & OB_BOUNDS) {
+                       if(ob->boundtype!=ob->collision_boundtype || (dtx & 
OB_BOUNDBOX)==0) {
+                               setlinestyle(2);
+                               draw_bounding_volume(scene, ob, 
ob->collision_boundtype);
+                               setlinestyle(0);
+                       }
+               }
+
                /* draw extra: after normal draw because of makeDispList */
                if(dtx && (G.f & G_RENDER_OGL)==0) {
 
@@ -6383,8 +6391,7 @@
                                drawaxes(1.0f, OB_ARROWS);
                        }
                        if(dtx & OB_BOUNDBOX) {
-                               if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
-                                       draw_bounding_volume(scene, ob);
+                               draw_bounding_volume(scene, ob, ob->boundtype);
                        }
                        if(dtx & OB_TEXSPACE) drawtexspace(ob);
                        if(dtx & OB_DRAWNAME) {

Modified: trunk/blender/source/blender/makesdna/DNA_object_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_types.h    2011-11-04 
15:53:20 UTC (rev 41528)
+++ trunk/blender/source/blender/makesdna/DNA_object_types.h    2011-11-04 
15:53:34 UTC (rev 41529)
@@ -265,7 +265,9 @@
        ListBase *duplilist;    /* for temporary dupli list storage, only for 
use by RNA API */
 
        float ima_ofs[2];               /* offset for image empties */
-       char pad3[8];
+
+       short collision_boundtype;      /* bounding box type used for collision 
*/
+       char pad3[6];
 } Object;
 
 /* Warning, this is not used anymore because hooks are now modifiers */

Modified: trunk/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object.c   2011-11-04 
15:53:20 UTC (rev 41528)
+++ trunk/blender/source/blender/makesrna/intern/rna_object.c   2011-11-04 
15:53:34 UTC (rev 41529)
@@ -948,10 +948,10 @@
                if (ob->type == OB_MESH) {
                        /* this is needed to refresh the derived meshes draw 
func */
                        DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
-                       WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data);
                }
        }
 
+       WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data);
 }
 
 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
@@ -1532,9 +1532,10 @@
        prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
        RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a 
collision bounds type other than the default");
+       RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
        prop= RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, 
PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "boundtype");
+       RNA_def_property_enum_sdna(prop, NULL, "collision_boundtype");
        RNA_def_property_enum_items(prop, collision_bounds_items);
        RNA_def_property_enum_funcs(prop, NULL, NULL, 
"rna_Object_collision_bounds_itemf");
        RNA_def_property_ui_text(prop, "Collision Bounds",  "Select the 
collision type");
@@ -1803,8 +1804,6 @@
                {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as 
sphere"},
                {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as 
cylinder"},
                {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"},
-               {OB_BOUND_TRIANGLE_MESH, "POLYHEDRON", 0, "Polyhedron", "Draw 
bounds as polyhedron"},
-               {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as 
capsule"},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem dupli_items[] = {

Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp      
2011-11-04 15:53:20 UTC (rev 41528)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp      
2011-11-04 15:53:34 UTC (rev 41529)
@@ -1579,7 +1579,7 @@
        
my_get_local_bounds(blenderobject,dm,objprop.m_boundobject.box.m_center,bb.m_extends);
        if (blenderobject->gameflag & OB_BOUNDS)
        {
-               switch (blenderobject->boundtype)
+               switch (blenderobject->collision_boundtype)
                {
                        case OB_BOUND_BOX:
                                objprop.m_boundclass = KX_BOUNDBOX;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to