From ac2430e61c20e56691f20b793f63540c2a10f8e8 Mon Sep 17 00:00:00 2001 From: Aruki Date: Tue, 21 Feb 2017 00:09:03 -0700 Subject: [PATCH] Minor fixes/adjustments --- src/Core/Render/CCamera.cpp | 2 +- src/Core/Render/CCamera.h | 2 ++ src/Editor/WorldEditor/CWorldEditor.cpp | 14 ++++++++------ src/Editor/WorldEditor/CWorldEditor.h | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Core/Render/CCamera.cpp b/src/Core/Render/CCamera.cpp index 4a2da17d..048a7f8f 100644 --- a/src/Core/Render/CCamera.cpp +++ b/src/Core/Render/CCamera.cpp @@ -17,7 +17,7 @@ CCamera::CCamera() , mProjectionDirty(true) , mFrustumPlanesDirty(true) { - SetOrbit(CVector3f(0), 5.f); + ResetOrbit(); } // todo: make it actually look at the target! diff --git a/src/Core/Render/CCamera.h b/src/Core/Render/CCamera.h index ef2ce501..694066f6 100644 --- a/src/Core/Render/CCamera.h +++ b/src/Core/Render/CCamera.h @@ -87,6 +87,8 @@ public: inline void SetLookSpeed(float LookSpeed) { mLookSpeed = LookSpeed; } inline void SetAspectRatio(float AspectRatio) { mAspectRatio = AspectRatio; mProjectionDirty = true; mFrustumPlanesDirty = true; } + inline void ResetOrbit() { SetOrbit(CVector3f::skZero, 5.f); } + // Private private: void ValidatePitch(); diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index d02bb21a..5585132d 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -83,8 +83,8 @@ CWorldEditor::CWorldEditor(QWidget *parent) AddEditModeButton( QIcon(":/icons/World.png"), "Edit World Info",eWEM_EditWorldInfo ); AddEditModeButton( QIcon(":/icons/Modify.png"), "Edit Script", eWEM_EditScript ); - mpPoiMapButton = AddEditModeButton( QIcon(":/icons/PoiSymbol_24px.png"), "Edit POI Mappings", eWEM_EditPOIMappings ); - mpPoiMapButton->setEnabled(false); + mpPoiMapAction = AddEditModeButton( QIcon(":/icons/PoiSymbol_24px.png"), "Edit POI Mappings", eWEM_EditPOIMappings ); + mpPoiMapAction->setVisible(false); ChangeEditMode(eWEM_EditWorldInfo); @@ -546,7 +546,7 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj) { ui->ActionProjectSettings->setEnabled( pProj != nullptr ); ui->ActionCloseProject->setEnabled( pProj != nullptr ); - mpPoiMapButton->setEnabled( pProj != nullptr && pProj->Game() >= eEchoesDemo && pProj->Game() <= eCorruption ); + mpPoiMapAction->setVisible( pProj != nullptr && pProj->Game() >= eEchoesDemo && pProj->Game() <= eCorruption ); ResetCamera(); UpdateWindowTitle(); @@ -925,7 +925,7 @@ void CWorldEditor::UpdateNewLinkLine() } // ************ PROTECTED ************ -QPushButton* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode) +QAction* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode) { ASSERT(mpEditModeButtonGroup->button(Mode) == nullptr); @@ -934,9 +934,9 @@ QPushButton* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorld pButton->setToolTip(ToolTip); pButton->setIconSize(QSize(24, 24)); - ui->EditModeToolBar->addWidget(pButton); + QAction *pAction = ui->EditModeToolBar->addWidget(pButton); mpEditModeButtonGroup->addButton(pButton, Mode); - return pButton; + return pAction; } void CWorldEditor::SetSidebar(CWorldEditorSidebar *pSidebar) @@ -1172,6 +1172,8 @@ void CWorldEditor::UpdateCameraOrbit() pCamera->SetOrbit(mpSelection->Bounds()); else if (mpArea) pCamera->SetOrbit(mpArea->AABox(), 1.2f); + else + pCamera->ResetOrbit(); } void CWorldEditor::OnCameraSpeedChange(double Speed) diff --git a/src/Editor/WorldEditor/CWorldEditor.h b/src/Editor/WorldEditor/CWorldEditor.h index 7c5fe801..4b7707a5 100644 --- a/src/Editor/WorldEditor/CWorldEditor.h +++ b/src/Editor/WorldEditor/CWorldEditor.h @@ -73,7 +73,7 @@ class CWorldEditor : public INodeEditor CScriptEditSidebar *mpScriptSidebar; CPoiMapSidebar *mpPoiMapSidebar; - QPushButton *mpPoiMapButton; + QAction *mpPoiMapAction; public: explicit CWorldEditor(QWidget *parent = 0); @@ -134,7 +134,7 @@ public slots: void UpdateNewLinkLine(); protected: - QPushButton* AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode); + QAction* AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode); void SetSidebar(CWorldEditorSidebar *pSidebar); void GizmoModeChanged(CGizmo::EGizmoMode Mode);