diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 0bc31de89c..c7a830945c 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -916,47 +916,6 @@ const char* Command::keySequenceToAccel(int sk) const return (strings[sk] = static_cast(data)).c_str(); } -void Command::adjustCameraPosition() -{ - Gui::Document* doc = Gui::Application::Instance->activeDocument(); - if (doc) { - auto view = static_cast(doc->getActiveView()); - Gui::View3DInventorViewer* viewer = view->getViewer(); - SoCamera* camera = viewer->getSoRenderManager()->getCamera(); - if (!camera || !camera->isOfType(SoOrthographicCamera::getClassTypeId())) - return; - - // get scene bounding box - SoGetBoundingBoxAction action(viewer->getSoRenderManager()->getViewportRegion()); - action.apply(viewer->getSceneGraph()); - SbBox3f box = action.getBoundingBox(); - if (box.isEmpty()) - return; - - // get cirumscribing sphere and check if camera is inside - SbVec3f cam_pos = camera->position.getValue(); - SbVec3f box_cnt = box.getCenter(); - SbSphere bs; - bs.circumscribe(box); - float radius = bs.getRadius(); - float distance_to_midpoint = (box_cnt-cam_pos).length(); - if (radius >= distance_to_midpoint) { - // Move the camera to the edge of the bounding sphere, while still - // pointing at the scene. - SbVec3f direction = cam_pos - box_cnt; - (void) direction.normalize(); // we know this is not a null vector - camera->position.setValue(box_cnt + direction * radius); - - // New distance to mid point - distance_to_midpoint = - (camera->position.getValue() - box.getCenter()).length(); - camera->nearDistance = distance_to_midpoint - radius; - camera->farDistance = distance_to_midpoint + radius; - camera->focalDistance = distance_to_midpoint; - } - } -} - void Command::printConflictingAccelerators() const { auto cmd = Application::Instance->commandManager().checkAcceleratorForConflicts(sAccel, this); diff --git a/src/Gui/Command.h b/src/Gui/Command.h index 50809a8f45..db158d0596 100644 --- a/src/Gui/Command.h +++ b/src/Gui/Command.h @@ -575,11 +575,6 @@ public: /// Obtain the current shortcut of this command virtual QString getShortcut() const; - /** @name arbitrary helper methods */ - //@{ - void adjustCameraPosition(); - //@} - /// Helper class to disable python console log class LogDisabler { public: