From 7f3c54687425bebfe673d05a8838b9bbaad2c13a Mon Sep 17 00:00:00 2001
From: Ansgar Philippsen <ansgar.philippsen@gmail.com>
Date: Thu, 5 May 2011 11:09:58 -0400
Subject: [PATCH] fix for BZDNG-85 and BZDNG-248 (autoslab and scene
 initialization issues)

---
 modules/gfx/src/scene.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/gfx/src/scene.cc b/modules/gfx/src/scene.cc
index 146fb41da..bfd73c154 100644
--- a/modules/gfx/src/scene.cc
+++ b/modules/gfx/src/scene.cc
@@ -1578,6 +1578,7 @@ void Scene::BlurSnapshot()
 void Scene::AutoAutoslab(bool f)
 {
   auto_autoslab_=f;
+  do_autoslab_=f;
   RequestRedraw();
 }
 
@@ -1982,6 +1983,8 @@ void Scene::render_stereo()
 
 void Scene::do_autoslab()
 {
+  // skip autoslab if nothing to show yet
+  if(root_node_->GetChildCount()==0) return;
   if(do_autoslab_fast_) {
     geom::AlignedCuboid bb =this->GetBoundingBox(transform_);
     // necessary code duplication due to awkward slab limit impl
@@ -2008,6 +2011,7 @@ void Scene::do_autoslab()
     set_far(zfar_);
     ResetProjection();
   }
+  RequestRedraw();
 }
 
 }} // ns
-- 
GitLab