Minor fixes/adjustments

This commit is contained in:
Aruki 2017-02-21 00:09:03 -07:00
parent d350e983d9
commit ac2430e61c
4 changed files with 13 additions and 9 deletions

View File

@ -17,7 +17,7 @@ CCamera::CCamera()
, mProjectionDirty(true) , mProjectionDirty(true)
, mFrustumPlanesDirty(true) , mFrustumPlanesDirty(true)
{ {
SetOrbit(CVector3f(0), 5.f); ResetOrbit();
} }
// todo: make it actually look at the target! // todo: make it actually look at the target!

View File

@ -87,6 +87,8 @@ public:
inline void SetLookSpeed(float LookSpeed) { mLookSpeed = LookSpeed; } inline void SetLookSpeed(float LookSpeed) { mLookSpeed = LookSpeed; }
inline void SetAspectRatio(float AspectRatio) { mAspectRatio = AspectRatio; mProjectionDirty = true; mFrustumPlanesDirty = true; } inline void SetAspectRatio(float AspectRatio) { mAspectRatio = AspectRatio; mProjectionDirty = true; mFrustumPlanesDirty = true; }
inline void ResetOrbit() { SetOrbit(CVector3f::skZero, 5.f); }
// Private // Private
private: private:
void ValidatePitch(); void ValidatePitch();

View File

@ -83,8 +83,8 @@ CWorldEditor::CWorldEditor(QWidget *parent)
AddEditModeButton( QIcon(":/icons/World.png"), "Edit World Info",eWEM_EditWorldInfo ); AddEditModeButton( QIcon(":/icons/World.png"), "Edit World Info",eWEM_EditWorldInfo );
AddEditModeButton( QIcon(":/icons/Modify.png"), "Edit Script", eWEM_EditScript ); AddEditModeButton( QIcon(":/icons/Modify.png"), "Edit Script", eWEM_EditScript );
mpPoiMapButton = AddEditModeButton( QIcon(":/icons/PoiSymbol_24px.png"), "Edit POI Mappings", eWEM_EditPOIMappings ); mpPoiMapAction = AddEditModeButton( QIcon(":/icons/PoiSymbol_24px.png"), "Edit POI Mappings", eWEM_EditPOIMappings );
mpPoiMapButton->setEnabled(false); mpPoiMapAction->setVisible(false);
ChangeEditMode(eWEM_EditWorldInfo); ChangeEditMode(eWEM_EditWorldInfo);
@ -546,7 +546,7 @@ void CWorldEditor::OnActiveProjectChanged(CGameProject *pProj)
{ {
ui->ActionProjectSettings->setEnabled( pProj != nullptr ); ui->ActionProjectSettings->setEnabled( pProj != nullptr );
ui->ActionCloseProject->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(); ResetCamera();
UpdateWindowTitle(); UpdateWindowTitle();
@ -925,7 +925,7 @@ void CWorldEditor::UpdateNewLinkLine()
} }
// ************ PROTECTED ************ // ************ PROTECTED ************
QPushButton* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode) QAction* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode)
{ {
ASSERT(mpEditModeButtonGroup->button(Mode) == nullptr); ASSERT(mpEditModeButtonGroup->button(Mode) == nullptr);
@ -934,9 +934,9 @@ QPushButton* CWorldEditor::AddEditModeButton(QIcon Icon, QString ToolTip, EWorld
pButton->setToolTip(ToolTip); pButton->setToolTip(ToolTip);
pButton->setIconSize(QSize(24, 24)); pButton->setIconSize(QSize(24, 24));
ui->EditModeToolBar->addWidget(pButton); QAction *pAction = ui->EditModeToolBar->addWidget(pButton);
mpEditModeButtonGroup->addButton(pButton, Mode); mpEditModeButtonGroup->addButton(pButton, Mode);
return pButton; return pAction;
} }
void CWorldEditor::SetSidebar(CWorldEditorSidebar *pSidebar) void CWorldEditor::SetSidebar(CWorldEditorSidebar *pSidebar)
@ -1172,6 +1172,8 @@ void CWorldEditor::UpdateCameraOrbit()
pCamera->SetOrbit(mpSelection->Bounds()); pCamera->SetOrbit(mpSelection->Bounds());
else if (mpArea) else if (mpArea)
pCamera->SetOrbit(mpArea->AABox(), 1.2f); pCamera->SetOrbit(mpArea->AABox(), 1.2f);
else
pCamera->ResetOrbit();
} }
void CWorldEditor::OnCameraSpeedChange(double Speed) void CWorldEditor::OnCameraSpeedChange(double Speed)

View File

@ -73,7 +73,7 @@ class CWorldEditor : public INodeEditor
CScriptEditSidebar *mpScriptSidebar; CScriptEditSidebar *mpScriptSidebar;
CPoiMapSidebar *mpPoiMapSidebar; CPoiMapSidebar *mpPoiMapSidebar;
QPushButton *mpPoiMapButton; QAction *mpPoiMapAction;
public: public:
explicit CWorldEditor(QWidget *parent = 0); explicit CWorldEditor(QWidget *parent = 0);
@ -134,7 +134,7 @@ public slots:
void UpdateNewLinkLine(); void UpdateNewLinkLine();
protected: protected:
QPushButton* AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode); QAction* AddEditModeButton(QIcon Icon, QString ToolTip, EWorldEditorMode Mode);
void SetSidebar(CWorldEditorSidebar *pSidebar); void SetSidebar(CWorldEditorSidebar *pSidebar);
void GizmoModeChanged(CGizmo::EGizmoMode Mode); void GizmoModeChanged(CGizmo::EGizmoMode Mode);