diff --git a/CMakeLists.txt b/CMakeLists.txt index 373301ddc7..aa6d76a4f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -810,6 +810,7 @@ if (APPLE) set(\${default_embedded_path_var} \"\${path}\" PARENT_SCOPE) endif() endfunction() + cmake_policy(SET CMP0009 OLD) fixup_bundle(\"${INSTALLED_OPENMW_APP}\" \"${PLUGINS}\" \"\") fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\") diff --git a/apps/opencs/model/world/cellcoordinates.hpp b/apps/opencs/model/world/cellcoordinates.hpp index f8851a6d94..6ff4e4b5dc 100644 --- a/apps/opencs/model/world/cellcoordinates.hpp +++ b/apps/opencs/model/world/cellcoordinates.hpp @@ -38,7 +38,9 @@ namespace CSMWorld /// \note The worldspace part of \a id is ignored static std::pair fromId (const std::string& id); + /// \return cell coordinates such that given world coordinates are in it. static std::pair coordinatesToCellIndex (float x, float y); + }; bool operator== (const CellCoordinates& left, const CellCoordinates& right); diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index a01df43926..3baf4e9721 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -17,6 +17,7 @@ #include "editmode.hpp" #include "mask.hpp" +#include "cameracontroller.hpp" bool CSVRender::PagedWorldspaceWidget::adjustCells() { @@ -477,12 +478,15 @@ void CSVRender::PagedWorldspaceWidget::useViewHint (const std::string& hint) { char ignore1; // : or ; char ignore2; // # + // Current coordinate int x, y; + // Loop throught all the coordinates to add them to selection while (stream >> ignore1 >> ignore2 >> x >> y) selection.add (CSMWorld::CellCoordinates (x, y)); - - /// \todo adjust camera position + + // Setup camera + mCurrentCamControl->setup(mRootNode, Mask_Reference | Mask_Terrain, CameraController::WorldUp); } } else if (hint[0]=='r') diff --git a/apps/opencs/view/render/pagedworldspacewidget.hpp b/apps/opencs/view/render/pagedworldspacewidget.hpp index 6920007087..e96cb9e8ea 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.hpp +++ b/apps/opencs/view/render/pagedworldspacewidget.hpp @@ -83,6 +83,8 @@ namespace CSVRender virtual ~PagedWorldspaceWidget(); + /// \brief Decodes the the hint string to set of cell that are rendered. + /// Calculates avarage of cell's coordinates to be new camera location. void useViewHint (const std::string& hint); void setCellSelection(const CSMWorld::CellSelection& selection); diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index b2b5b30d63..a36ff8c49f 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -31,7 +31,6 @@ RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) , mRootNode(0) { - osgViewer::CompositeViewer& viewer = CompositeViewer::get(); osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); @@ -314,15 +313,7 @@ void SceneWidget::keyReleaseEvent (QKeyEvent *event) void SceneWidget::update(double dt) { - if (mCamPositionSet) - { - mCurrentCamControl->update(dt); - } - else - { - mCurrentCamControl->setup(mRootNode, Mask_Reference | Mask_Terrain, CameraController::WorldUp); - mCamPositionSet = true; - } + mCurrentCamControl->update(dt); } void SceneWidget::settingChanged (const CSMPrefs::Setting *setting) diff --git a/apps/opencs/view/render/scenewidget.hpp b/apps/opencs/view/render/scenewidget.hpp index 4df49543a3..d3ab28adc3 100644 --- a/apps/opencs/view/render/scenewidget.hpp +++ b/apps/opencs/view/render/scenewidget.hpp @@ -121,9 +121,6 @@ namespace CSVRender std::map, std::string> mButtonMapping; - private: - bool mCamPositionSet; - public slots: void update(double dt);