From 1e308918911fe28bd032578e2dc765a90953d5f9 Mon Sep 17 00:00:00 2001 From: Aesylwinn Date: Thu, 31 Mar 2016 23:54:20 -0400 Subject: [PATCH] Broaden selection mask for getting scene bounds if nothing is found. --- apps/opencs/view/render/scenewidget.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index fe8de40e7..051559922 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -319,6 +319,20 @@ void SceneWidget::update(double dt) mRootNode->accept(boundsVisitor); + // Remove mask if nothing is found + if (!boundingBox.valid()) + { + boundsVisitor.reset(); + boundsVisitor.setMask(~0); + mRootNode->accept(boundsVisitor); + } + + // Set a default if there is still nothing found + if (!boundingBox.valid()) + { + boundingBox.set(-1, -1, -1, 1, 1, 1); + } + mCurrentCamControl->setSceneBounds(boundingBox, CameraController::WorldUp); mCamPositionSet = true;