From 8e819fd4541d6395b787c391e212731a9b404469 Mon Sep 17 00:00:00 2001 From: Aruki Date: Sun, 21 May 2017 19:20:27 -0600 Subject: [PATCH] Fixed new link line not showing up in the world editor --- src/Editor/CEditorApplication.cpp | 11 ++++------- src/Editor/WorldEditor/CWorldEditor.cpp | 21 ++++++--------------- src/Editor/WorldEditor/CWorldEditor.h | 2 +- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/Editor/CEditorApplication.cpp b/src/Editor/CEditorApplication.cpp index ea016f6b..573421b0 100644 --- a/src/Editor/CEditorApplication.cpp +++ b/src/Editor/CEditorApplication.cpp @@ -217,15 +217,12 @@ void CEditorApplication::TickEditors() { if (pEditor->isVisible()) { - pEditor->EditorTick((float) DeltaTime); - CBasicViewport *pViewport = pEditor->Viewport(); + bool ViewportVisible = (pViewport && pViewport->isVisible() && !pEditor->isMinimized()); - if (pViewport && pViewport->isVisible() && !pEditor->isMinimized()) - { - pViewport->ProcessInput(); - pViewport->Render(); - } + if (ViewportVisible) pViewport->ProcessInput(); + pEditor->EditorTick((float) DeltaTime); + if (ViewportVisible) pViewport->Render(); } } } diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index 3eeb13b2..228b8fb8 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -355,6 +355,12 @@ CSceneViewport* CWorldEditor::Viewport() const } // ************ PUBLIC SLOTS ************ +void CWorldEditor::EditorTick(float) +{ + // Update new link line + UpdateNewLinkLine(); +} + void CWorldEditor::NotifyNodeAboutToBeDeleted(CSceneNode *pNode) { INodeEditor::NotifyNodeAboutToBeDeleted(pNode); @@ -1144,21 +1150,6 @@ void CWorldEditor::OnPickModeExit() UpdateCursor(); } -void CWorldEditor::RefreshViewport() -{ - if (!mGizmo.IsTransforming()) - mGizmo.ResetSelectedAxes(); - - // Process input - ui->MainViewport->ProcessInput(); - - // Update new link line - UpdateNewLinkLine(); - - // Render - ui->MainViewport->Render(); -} - void CWorldEditor::UpdateCameraOrbit() { CCamera *pCamera = &ui->MainViewport->Camera(); diff --git a/src/Editor/WorldEditor/CWorldEditor.h b/src/Editor/WorldEditor/CWorldEditor.h index 4b7707a5..aa3e7873 100644 --- a/src/Editor/WorldEditor/CWorldEditor.h +++ b/src/Editor/WorldEditor/CWorldEditor.h @@ -98,6 +98,7 @@ public: inline bool CanRepack() const { return !mWorldDir.isEmpty() && !mPakFileList.isEmpty() && !mPakTarget.isEmpty(); } public slots: + virtual void EditorTick(float); virtual void NotifyNodeAboutToBeDeleted(CSceneNode *pNode); void Cut(); @@ -150,7 +151,6 @@ private slots: void OnUndoStackIndexChanged(); void OnPickModeEnter(QCursor Cursor); void OnPickModeExit(); - void RefreshViewport(); void UpdateCameraOrbit(); void OnCameraSpeedChange(double Speed); void OnTransformSpinBoxModified(CVector3f Value);