fix [#31474] Crash when object has parent and dupli_type == 'FRAMES' and show_x_ray...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 16 May 2012 08:42:50 +0000 (08:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 16 May 2012 08:42:50 +0000 (08:42 +0000)
dupli objects should never be added to after-draw, added an assert to ensure this (and make fixing such bugs easier).

source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c

index 5413aa88ab6e133d0c77a63762e350ac85774f85..95797fd9afcaf74ae49e52bf31caf8de00620366 100644 (file)
@@ -3603,19 +3603,21 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                }
        }
        
-       /* GPU_begin_object_materials checked if this is needed */
-       if (do_alpha_after) {
-               if (ob->dtx & OB_DRAWXRAY) {
-                       add_view3d_after(&v3d->afterdraw_xraytransp, base, flag);
-               }
-               else {
-                       add_view3d_after(&v3d->afterdraw_transp, base, flag);
+       if ((flag & DRAW_PICKING) == 0 && (base->flag & OB_FROMDUPLI) == 0) {
+               /* GPU_begin_object_materials checked if this is needed */
+               if (do_alpha_after) {
+                       if (ob->dtx & OB_DRAWXRAY) {
+                               add_view3d_after(&v3d->afterdraw_xraytransp, base, flag);
+                       }
+                       else {
+                               add_view3d_after(&v3d->afterdraw_transp, base, flag);
+                       }
                }
-       }
-       else if (ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
-               /* special case xray+transp when alpha is 1.0, without this the object vanishes */
-               if (v3d->xray == 0 && v3d->transp == 0) {
-                       add_view3d_after(&v3d->afterdraw_xray, base, flag);
+               else if (ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
+                       /* special case xray+transp when alpha is 1.0, without this the object vanishes */
+                       if (v3d->xray == 0 && v3d->transp == 0) {
+                               add_view3d_after(&v3d->afterdraw_xray, base, flag);
+                       }
                }
        }
        
index 682d895044010a8200b414f6d24365440ab38e48..6eff4a6dce987f76f825e445929587a5db0d7034 100644 (file)
@@ -1715,6 +1715,7 @@ typedef struct View3DAfter {
 void add_view3d_after(ListBase *lb, Base *base, int flag)
 {
        View3DAfter *v3da = MEM_callocN(sizeof(View3DAfter), "View 3d after");
+       BLI_assert((base->flag & OB_FROMDUPLI) == 0);
        BLI_addtail(lb, v3da);
        v3da->base = base;
        v3da->flag = flag;