From f7664d4bb95c287399cf62cdfc66eaecb997ef1e Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Tue, 4 Apr 2017 18:54:58 -0400 Subject: [PATCH 1/3] Editor: reset camera after cell drag and drop When replacing a viewed cell via drag and drop the camera position is not updated to better view the new cell. This flags the camera position as not being set so a better default is set. --- apps/opencs/view/render/unpagedworldspacewidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/opencs/view/render/unpagedworldspacewidget.cpp b/apps/opencs/view/render/unpagedworldspacewidget.cpp index de999db0f..28e269ded 100644 --- a/apps/opencs/view/render/unpagedworldspacewidget.cpp +++ b/apps/opencs/view/render/unpagedworldspacewidget.cpp @@ -92,6 +92,7 @@ bool CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vectorgetId(); mCell.reset (new Cell (getDocument().getData(), mRootNode, mCellId)); + mCamPositionSet = false; update(); emit cellChanged(*universalIdData.begin()); From 84bad9316d9b49c8f29dcc9c1d655c3fe6ac19a2 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Thu, 6 Apr 2017 19:40:26 -0400 Subject: [PATCH 2/3] Editor: flag orbit camera for re-initialization After swapping cells the orbit cam controller needs to be re-initialized to properly center on the new cell. --- apps/opencs/view/render/cameracontroller.cpp | 5 +++++ apps/opencs/view/render/cameracontroller.hpp | 3 +++ apps/opencs/view/render/unpagedworldspacewidget.cpp | 2 ++ 3 files changed, 10 insertions(+) diff --git a/apps/opencs/view/render/cameracontroller.cpp b/apps/opencs/view/render/cameracontroller.cpp index 7e3570657..288e2da07 100644 --- a/apps/opencs/view/render/cameracontroller.cpp +++ b/apps/opencs/view/render/cameracontroller.cpp @@ -632,6 +632,11 @@ namespace CSVRender getCamera()->getViewMatrix().orthoNormal(getCamera()->getViewMatrix()); } + void OrbitCameraController::reset() + { + mInitialized = false; + } + void OrbitCameraController::onActivate() { mInitialized = false; diff --git a/apps/opencs/view/render/cameracontroller.hpp b/apps/opencs/view/render/cameracontroller.hpp index 97af85790..f15cec231 100644 --- a/apps/opencs/view/render/cameracontroller.hpp +++ b/apps/opencs/view/render/cameracontroller.hpp @@ -159,6 +159,9 @@ namespace CSVRender void update(double dt); + /// \brief Flag controller to be re-initialized. + void reset(); + private: void onActivate(); diff --git a/apps/opencs/view/render/unpagedworldspacewidget.cpp b/apps/opencs/view/render/unpagedworldspacewidget.cpp index 28e269ded..b82aa45b2 100644 --- a/apps/opencs/view/render/unpagedworldspacewidget.cpp +++ b/apps/opencs/view/render/unpagedworldspacewidget.cpp @@ -15,6 +15,7 @@ #include "../widget/scenetooltoggle.hpp" #include "../widget/scenetooltoggle2.hpp" +#include "cameracontroller.hpp" #include "mask.hpp" #include "tagbase.hpp" @@ -93,6 +94,7 @@ bool CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vectorreset(); update(); emit cellChanged(*universalIdData.begin()); From 0ff56677f6f93898569f2657291e61efb0fa3525 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Thu, 6 Apr 2017 19:56:18 -0400 Subject: [PATCH 3/3] Remove unused code --- apps/opencs/view/render/cameracontroller.cpp | 5 ----- apps/opencs/view/render/cameracontroller.hpp | 4 ---- 2 files changed, 9 deletions(-) diff --git a/apps/opencs/view/render/cameracontroller.cpp b/apps/opencs/view/render/cameracontroller.cpp index 288e2da07..7b802b0ef 100644 --- a/apps/opencs/view/render/cameracontroller.cpp +++ b/apps/opencs/view/render/cameracontroller.cpp @@ -637,11 +637,6 @@ namespace CSVRender mInitialized = false; } - void OrbitCameraController::onActivate() - { - mInitialized = false; - } - void OrbitCameraController::initialize() { static const int DefaultStartDistance = 10000.f; diff --git a/apps/opencs/view/render/cameracontroller.hpp b/apps/opencs/view/render/cameracontroller.hpp index f15cec231..a2ebba51a 100644 --- a/apps/opencs/view/render/cameracontroller.hpp +++ b/apps/opencs/view/render/cameracontroller.hpp @@ -63,8 +63,6 @@ namespace CSVRender protected: - virtual void onActivate(){} - void addShortcut(CSMPrefs::Shortcut* shortcut); private: @@ -164,8 +162,6 @@ namespace CSVRender private: - void onActivate(); - void initialize(); void rotateHorizontal(double value);