mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-06-06 14:43:47 +00:00
Created application class to manage editor windows, improved camera AABox orbit
This commit is contained in:
parent
d263610d43
commit
3f3735ac7a
@ -154,21 +154,12 @@ void CCamera::SetOrbit(const CVector3f& OrbitTarget, float Distance)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCamera::SetOrbit(const CAABox& OrbitTarget, float DistScale /*= 4.f*/)
|
void CCamera::SetOrbit(const CAABox& OrbitTarget, float DistScale /*= 1.75f*/)
|
||||||
{
|
{
|
||||||
CVector3f Min = OrbitTarget.Min();
|
|
||||||
CVector3f Max = OrbitTarget.Max();
|
|
||||||
|
|
||||||
mOrbitTarget = OrbitTarget.Center();
|
mOrbitTarget = OrbitTarget.Center();
|
||||||
|
|
||||||
// Find largest extent
|
// Determine orbit radius, which should be enough to cover the entire box with some buffer room
|
||||||
CVector3f Extent = (Max - Min) / 2.f;
|
float Dist = OrbitTarget.Center().Distance(OrbitTarget.Max());
|
||||||
float Dist = 0.f;
|
|
||||||
|
|
||||||
if (Extent.X >= Extent.Y && Extent.X >= Extent.Z) Dist = Extent.X;
|
|
||||||
else if (Extent.Y >= Extent.X && Extent.Y >= Extent.Z) Dist = Extent.Y;
|
|
||||||
else Dist = Extent.Z;
|
|
||||||
|
|
||||||
mOrbitDistance = Dist * DistScale;
|
mOrbitDistance = Dist * DistScale;
|
||||||
|
|
||||||
if (mMode == eOrbitCamera)
|
if (mMode == eOrbitCamera)
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
void SetMoveMode(ECameraMoveMode Mode);
|
void SetMoveMode(ECameraMoveMode Mode);
|
||||||
void SetOrbit(const CVector3f& rkOrbitTarget, float Distance);
|
void SetOrbit(const CVector3f& rkOrbitTarget, float Distance);
|
||||||
void SetOrbit(const CAABox& rkOrbitTarget, float DistScale = 4.f);
|
void SetOrbit(const CAABox& rkOrbitTarget, float DistScale = 1.75f);
|
||||||
void SetOrbitTarget(const CVector3f& rkOrbitTarget);
|
void SetOrbitTarget(const CVector3f& rkOrbitTarget);
|
||||||
void SetOrbitDistance(float Distance);
|
void SetOrbitDistance(float Distance);
|
||||||
|
|
||||||
|
37
src/Editor/CEditorApplication.cpp
Normal file
37
src/Editor/CEditorApplication.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include "CEditorApplication.h"
|
||||||
|
#include "CEditorUpdateEvent.h"
|
||||||
|
#include "IEditor.h"
|
||||||
|
#include "CBasicViewport.h"
|
||||||
|
#include <Common/CTimer.h>
|
||||||
|
|
||||||
|
CEditorApplication::CEditorApplication(int& rArgc, char **ppArgv)
|
||||||
|
: QApplication(rArgc, ppArgv)
|
||||||
|
{
|
||||||
|
mLastUpdate = CTimer::GlobalTime();
|
||||||
|
|
||||||
|
connect(&mRefreshTimer, SIGNAL(timeout()), this, SLOT(TickEditors()));
|
||||||
|
mRefreshTimer.start(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorApplication::TickEditors()
|
||||||
|
{
|
||||||
|
double LastUpdate = mLastUpdate;
|
||||||
|
mLastUpdate = CTimer::GlobalTime();
|
||||||
|
double DeltaTime = mLastUpdate - LastUpdate;
|
||||||
|
|
||||||
|
foreach(IEditor *pEditor, mEditorWindows)
|
||||||
|
{
|
||||||
|
if (pEditor->isVisible())
|
||||||
|
{
|
||||||
|
pEditor->EditorTick((float) DeltaTime);
|
||||||
|
|
||||||
|
CBasicViewport *pViewport = pEditor->Viewport();
|
||||||
|
|
||||||
|
if (pViewport && pViewport->isVisible())
|
||||||
|
{
|
||||||
|
pViewport->ProcessInput();
|
||||||
|
pViewport->Render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
src/Editor/CEditorApplication.h
Normal file
33
src/Editor/CEditorApplication.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef CEDITORAPPLICATION_H
|
||||||
|
#define CEDITORAPPLICATION_H
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
class CBasicViewport;
|
||||||
|
class IEditor;
|
||||||
|
|
||||||
|
class CEditorApplication : public QApplication
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
QTimer mRefreshTimer;
|
||||||
|
QVector<IEditor*> mEditorWindows;
|
||||||
|
double mLastUpdate;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CEditorApplication(int& rArgc, char **ppArgv);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void TickEditors();
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
public:
|
||||||
|
inline void AddEditor(IEditor *pEditor) { mEditorWindows << pEditor; }
|
||||||
|
inline void RemoveEditor(IEditor *pEditor) { mEditorWindows.removeOne(pEditor); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#define gpEdApp static_cast<CEditorApplication*>(qApp)
|
||||||
|
|
||||||
|
#endif // CEDITORAPPLICATION_H
|
@ -181,8 +181,8 @@ void CProjectOverviewDialog::LaunchEditor()
|
|||||||
|
|
||||||
void CProjectOverviewDialog::LaunchResourceBrowser()
|
void CProjectOverviewDialog::LaunchResourceBrowser()
|
||||||
{
|
{
|
||||||
CResourceBrowser Browser(this);
|
CResourceBrowser *pBrowser = new CResourceBrowser(mpWorldEditor);
|
||||||
Browser.exec();
|
pBrowser->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProjectOverviewDialog::CookPackage()
|
void CProjectOverviewDialog::CookPackage()
|
||||||
|
@ -11,15 +11,15 @@ const CVector3f CCharacterEditor::skDefaultOrbitTarget = CVector3f(0,0,1);
|
|||||||
const float CCharacterEditor::skDefaultOrbitDistance = 4.f;
|
const float CCharacterEditor::skDefaultOrbitDistance = 4.f;
|
||||||
|
|
||||||
CCharacterEditor::CCharacterEditor(QWidget *parent)
|
CCharacterEditor::CCharacterEditor(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: IEditor(parent)
|
||||||
, ui(new Ui::CCharacterEditor)
|
, ui(new Ui::CCharacterEditor)
|
||||||
, mpScene(new CScene())
|
, mpScene(new CScene())
|
||||||
, mpCharNode(new CCharacterNode(mpScene, -1))
|
, mpCharNode(new CCharacterNode(mpScene, -1))
|
||||||
, mpSelectedBone(nullptr)
|
, mpSelectedBone(nullptr)
|
||||||
, mBindPose(false)
|
, mBindPose(false)
|
||||||
, mAnimTime(0.f)
|
|
||||||
, mPlayAnim(true)
|
, mPlayAnim(true)
|
||||||
, mLoopAnim(true)
|
, mLoopAnim(true)
|
||||||
|
, mAnimTime(0.f)
|
||||||
, mPlaybackSpeed(1.f)
|
, mPlaybackSpeed(1.f)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -43,9 +43,6 @@ CCharacterEditor::CCharacterEditor(QWidget *parent)
|
|||||||
mpAnimComboBox->setMinimumWidth(175);
|
mpAnimComboBox->setMinimumWidth(175);
|
||||||
ui->ToolBar->addWidget(mpAnimComboBox);
|
ui->ToolBar->addWidget(mpAnimComboBox);
|
||||||
|
|
||||||
connect(&mRefreshTimer, SIGNAL(timeout()), this, SLOT(RefreshViewport()));
|
|
||||||
mRefreshTimer.start(0);
|
|
||||||
|
|
||||||
connect(ui->Viewport, SIGNAL(HoverBoneChanged(u32)), this, SLOT(OnViewportHoverBoneChanged(u32)));
|
connect(ui->Viewport, SIGNAL(HoverBoneChanged(u32)), this, SLOT(OnViewportHoverBoneChanged(u32)));
|
||||||
connect(ui->Viewport, SIGNAL(ViewportClick(QMouseEvent*)), this, SLOT(OnViewportClick()));
|
connect(ui->Viewport, SIGNAL(ViewportClick(QMouseEvent*)), this, SLOT(OnViewportClick()));
|
||||||
connect(ui->ActionOpen, SIGNAL(triggered()), this, SLOT(Open()));
|
connect(ui->ActionOpen, SIGNAL(triggered()), this, SLOT(Open()));
|
||||||
@ -84,12 +81,14 @@ CCharacterEditor::~CCharacterEditor()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterEditor::UpdateAnimTime()
|
void CCharacterEditor::EditorTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
double Time = CTimer::GlobalTime();
|
UpdateAnimTime(DeltaTime);
|
||||||
double DeltaTime = Time - mLastAnimUpdate;
|
UpdateCameraOrbit();
|
||||||
mLastAnimUpdate = Time;
|
}
|
||||||
|
|
||||||
|
void CCharacterEditor::UpdateAnimTime(float DeltaTime)
|
||||||
|
{
|
||||||
CAnimation *pAnim = CurrentAnimation();
|
CAnimation *pAnim = CurrentAnimation();
|
||||||
|
|
||||||
if (pAnim && mPlayAnim && !mBindPose && !ui->AnimSlider->isSliderDown())
|
if (pAnim && mPlayAnim && !mBindPose && !ui->AnimSlider->isSliderDown())
|
||||||
@ -216,7 +215,7 @@ void CCharacterEditor::SetActiveAnimSet(CAnimSet *pSet)
|
|||||||
ui->SkeletonHierarchyTreeView->selectionModel()->setCurrentIndex( mSkeletonModel.index(0, 0, RootIndex), QItemSelectionModel::ClearAndSelect );
|
ui->SkeletonHierarchyTreeView->selectionModel()->setCurrentIndex( mSkeletonModel.index(0, 0, RootIndex), QItemSelectionModel::ClearAndSelect );
|
||||||
|
|
||||||
// Run CCamera::SetOrbit to reset orbit distance.
|
// Run CCamera::SetOrbit to reset orbit distance.
|
||||||
ui->Viewport->Camera().SetOrbit(mpCharNode->AABox(), 4.f);
|
ui->Viewport->Camera().SetOrbit(mpCharNode->AABox());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterEditor::SetSelectedBone(CBone *pBone)
|
void CCharacterEditor::SetSelectedBone(CBone *pBone)
|
||||||
@ -229,6 +228,11 @@ void CCharacterEditor::SetSelectedBone(CBone *pBone)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCharacterEditorViewport* CCharacterEditor::Viewport() const
|
||||||
|
{
|
||||||
|
return ui->Viewport;
|
||||||
|
}
|
||||||
|
|
||||||
// ************ PUBLIC SLOTS ************
|
// ************ PUBLIC SLOTS ************
|
||||||
void CCharacterEditor::Open()
|
void CCharacterEditor::Open()
|
||||||
{
|
{
|
||||||
@ -291,8 +295,6 @@ void CCharacterEditor::ToggleOrbit(bool Enable)
|
|||||||
|
|
||||||
void CCharacterEditor::RefreshViewport()
|
void CCharacterEditor::RefreshViewport()
|
||||||
{
|
{
|
||||||
UpdateAnimTime();
|
|
||||||
UpdateCameraOrbit();
|
|
||||||
ui->Viewport->ProcessInput();
|
ui->Viewport->ProcessInput();
|
||||||
ui->Viewport->Render();
|
ui->Viewport->Render();
|
||||||
}
|
}
|
||||||
@ -341,7 +343,6 @@ void CCharacterEditor::SetActiveAnimation(int AnimIndex)
|
|||||||
{
|
{
|
||||||
mCurrentAnim = AnimIndex;
|
mCurrentAnim = AnimIndex;
|
||||||
mpCharNode->SetActiveAnim((u32) AnimIndex);
|
mpCharNode->SetActiveAnim((u32) AnimIndex);
|
||||||
mLastAnimUpdate = CTimer::GlobalTime();
|
|
||||||
|
|
||||||
ui->AnimSlider->blockSignals(true);
|
ui->AnimSlider->blockSignals(true);
|
||||||
ui->AnimSlider->setMaximum((int) (CurrentAnimation() ? CurrentAnimation()->Duration() * 1000 : 0));
|
ui->AnimSlider->setMaximum((int) (CurrentAnimation() ? CurrentAnimation()->Duration() * 1000 : 0));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef CCHARACTEREDITOR_H
|
#ifndef CCHARACTEREDITOR_H
|
||||||
#define CCHARACTEREDITOR_H
|
#define CCHARACTEREDITOR_H
|
||||||
|
|
||||||
|
#include "IEditor.h"
|
||||||
#include "CCharacterEditorViewport.h"
|
#include "CCharacterEditorViewport.h"
|
||||||
#include "CSkeletonHierarchyModel.h"
|
#include "CSkeletonHierarchyModel.h"
|
||||||
#include <Core/Scene/CScene.h>
|
#include <Core/Scene/CScene.h>
|
||||||
@ -14,7 +15,7 @@ namespace Ui {
|
|||||||
class CCharacterEditor;
|
class CCharacterEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CCharacterEditor : public QMainWindow
|
class CCharacterEditor : public IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -26,7 +27,6 @@ class CCharacterEditor : public QMainWindow
|
|||||||
CSkeletonHierarchyModel mSkeletonModel;
|
CSkeletonHierarchyModel mSkeletonModel;
|
||||||
QComboBox *mpCharComboBox;
|
QComboBox *mpCharComboBox;
|
||||||
QComboBox *mpAnimComboBox;
|
QComboBox *mpAnimComboBox;
|
||||||
QTimer mRefreshTimer;
|
|
||||||
|
|
||||||
TResPtr<CAnimSet> mpSet;
|
TResPtr<CAnimSet> mpSet;
|
||||||
u32 mCurrentChar;
|
u32 mCurrentChar;
|
||||||
@ -34,10 +34,9 @@ class CCharacterEditor : public QMainWindow
|
|||||||
bool mBindPose;
|
bool mBindPose;
|
||||||
|
|
||||||
// Playback Controls
|
// Playback Controls
|
||||||
double mLastAnimUpdate;
|
|
||||||
float mAnimTime;
|
|
||||||
bool mPlayAnim;
|
bool mPlayAnim;
|
||||||
bool mLoopAnim;
|
bool mLoopAnim;
|
||||||
|
float mAnimTime;
|
||||||
float mPlaybackSpeed;
|
float mPlaybackSpeed;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
@ -47,12 +46,14 @@ class CCharacterEditor : public QMainWindow
|
|||||||
public:
|
public:
|
||||||
explicit CCharacterEditor(QWidget *parent = 0);
|
explicit CCharacterEditor(QWidget *parent = 0);
|
||||||
~CCharacterEditor();
|
~CCharacterEditor();
|
||||||
void UpdateAnimTime();
|
void EditorTick(float DeltaTime);
|
||||||
|
void UpdateAnimTime(float DeltaTime);
|
||||||
void UpdateCameraOrbit();
|
void UpdateCameraOrbit();
|
||||||
CSkeleton* CurrentSkeleton() const;
|
CSkeleton* CurrentSkeleton() const;
|
||||||
CAnimation* CurrentAnimation() const;
|
CAnimation* CurrentAnimation() const;
|
||||||
void SetActiveAnimSet(CAnimSet *pSet);
|
void SetActiveAnimSet(CAnimSet *pSet);
|
||||||
void SetSelectedBone(CBone *pBone);
|
void SetSelectedBone(CBone *pBone);
|
||||||
|
CCharacterEditorViewport* Viewport() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Open();
|
void Open();
|
||||||
|
@ -168,7 +168,9 @@ HEADERS += \
|
|||||||
ResourceBrowser/CResourceBrowser.h \
|
ResourceBrowser/CResourceBrowser.h \
|
||||||
ResourceBrowser/CResourceTableModel.h \
|
ResourceBrowser/CResourceTableModel.h \
|
||||||
ResourceBrowser/CResourceProxyModel.h \
|
ResourceBrowser/CResourceProxyModel.h \
|
||||||
ResourceBrowser/CVirtualDirectoryModel.h
|
ResourceBrowser/CVirtualDirectoryModel.h \
|
||||||
|
CEditorApplication.h \
|
||||||
|
IEditor.h
|
||||||
|
|
||||||
# Source Files
|
# Source Files
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@ -230,7 +232,8 @@ SOURCES += \
|
|||||||
CharacterEditor/CCharacterEditorViewport.cpp \
|
CharacterEditor/CCharacterEditorViewport.cpp \
|
||||||
CharacterEditor/CSkeletonHierarchyModel.cpp \
|
CharacterEditor/CSkeletonHierarchyModel.cpp \
|
||||||
CProjectOverviewDialog.cpp \
|
CProjectOverviewDialog.cpp \
|
||||||
ResourceBrowser/CResourceBrowser.cpp
|
ResourceBrowser/CResourceBrowser.cpp \
|
||||||
|
CEditorApplication.cpp
|
||||||
|
|
||||||
# UI Files
|
# UI Files
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
21
src/Editor/IEditor.h
Normal file
21
src/Editor/IEditor.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef IEDITOR
|
||||||
|
#define IEDITOR
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include "CEditorApplication.h"
|
||||||
|
|
||||||
|
class IEditor : public QMainWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IEditor(QWidget *pParent)
|
||||||
|
: QMainWindow(pParent)
|
||||||
|
{
|
||||||
|
gpEdApp->AddEditor(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void EditorTick(float /*DeltaTime*/) { }
|
||||||
|
virtual CBasicViewport* Viewport() const { return nullptr; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IEDITOR
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
INodeEditor::INodeEditor(QWidget *pParent)
|
INodeEditor::INodeEditor(QWidget *pParent)
|
||||||
: QMainWindow(pParent)
|
: IEditor(pParent)
|
||||||
, mPickMode(false)
|
, mPickMode(false)
|
||||||
, mpSelection(new CNodeSelection)
|
, mpSelection(new CNodeSelection)
|
||||||
, mSelectionLocked(false)
|
, mSelectionLocked(false)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef INODEEDITOR_H
|
#ifndef INODEEDITOR_H
|
||||||
#define INODEEDITOR_H
|
#define INODEEDITOR_H
|
||||||
|
|
||||||
|
#include "IEditor.h"
|
||||||
#include "CGizmo.h"
|
#include "CGizmo.h"
|
||||||
#include "CNodeSelection.h"
|
#include "CNodeSelection.h"
|
||||||
#include <Math/ETransformSpace.h>
|
#include <Math/ETransformSpace.h>
|
||||||
@ -13,7 +14,7 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
|
||||||
class INodeEditor : public QMainWindow
|
class INodeEditor : public IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
CModelEditorWindow::CModelEditorWindow(QWidget *pParent)
|
CModelEditorWindow::CModelEditorWindow(QWidget *pParent)
|
||||||
: QMainWindow(pParent)
|
: IEditor(pParent)
|
||||||
, ui(new Ui::CModelEditorWindow)
|
, ui(new Ui::CModelEditorWindow)
|
||||||
, mpScene(new CScene())
|
, mpScene(new CScene())
|
||||||
, mpCurrentMat(nullptr)
|
, mpCurrentMat(nullptr)
|
||||||
@ -54,10 +54,6 @@ CModelEditorWindow::CModelEditorWindow(QWidget *pParent)
|
|||||||
ui->PassTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
ui->PassTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
ui->ClearColorPicker->SetColor(QColor(76, 76, 76, 255));
|
ui->ClearColorPicker->SetColor(QColor(76, 76, 76, 255));
|
||||||
|
|
||||||
// Viewport Signal/Slot setup
|
|
||||||
connect(&mRefreshTimer, SIGNAL(timeout()), this, SLOT(RefreshViewport()));
|
|
||||||
mRefreshTimer.start(0);
|
|
||||||
|
|
||||||
// Editor UI Signal/Slot setup
|
// Editor UI Signal/Slot setup
|
||||||
ui->SetSelectionComboBox->setProperty ("ModelEditorWidgetType", eSetSelectComboBox);
|
ui->SetSelectionComboBox->setProperty ("ModelEditorWidgetType", eSetSelectComboBox);
|
||||||
ui->MatSelectionComboBox->setProperty ("ModelEditorWidgetType", eMatSelectComboBox);
|
ui->MatSelectionComboBox->setProperty ("ModelEditorWidgetType", eMatSelectComboBox);
|
||||||
@ -895,3 +891,8 @@ void CModelEditorWindow::closeEvent(QCloseEvent*)
|
|||||||
{
|
{
|
||||||
emit Closed();
|
emit Closed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CModelEditorViewport* CModelEditorWindow::Viewport() const
|
||||||
|
{
|
||||||
|
return ui->Viewport;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef CMODELEDITORWINDOW_H
|
#ifndef CMODELEDITORWINDOW_H
|
||||||
#define CMODELEDITORWINDOW_H
|
#define CMODELEDITORWINDOW_H
|
||||||
|
|
||||||
|
#include "IEditor.h"
|
||||||
#include "CModelEditorViewport.h"
|
#include "CModelEditorViewport.h"
|
||||||
#include <Core/GameProject/CResourceStore.h>
|
#include <Core/GameProject/CResourceStore.h>
|
||||||
#include <Core/Render/CRenderer.h>
|
#include <Core/Render/CRenderer.h>
|
||||||
@ -16,7 +17,7 @@ namespace Ui {
|
|||||||
class CModelEditorWindow;
|
class CModelEditorWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CModelEditorWindow : public QMainWindow
|
class CModelEditorWindow : public IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -28,13 +29,13 @@ class CModelEditorWindow : public QMainWindow
|
|||||||
CMaterial *mpCurrentMat;
|
CMaterial *mpCurrentMat;
|
||||||
CMaterialPass *mpCurrentPass;
|
CMaterialPass *mpCurrentPass;
|
||||||
bool mIgnoreSignals;
|
bool mIgnoreSignals;
|
||||||
QTimer mRefreshTimer;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CModelEditorWindow(QWidget *pParent = 0);
|
explicit CModelEditorWindow(QWidget *pParent = 0);
|
||||||
~CModelEditorWindow();
|
~CModelEditorWindow();
|
||||||
void SetActiveModel(CModel *pModel);
|
void SetActiveModel(CModel *pModel);
|
||||||
void closeEvent(QCloseEvent *pEvent);
|
void closeEvent(QCloseEvent *pEvent);
|
||||||
|
CModelEditorViewport* Viewport() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void RefreshViewport();
|
void RefreshViewport();
|
||||||
|
@ -46,10 +46,6 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
|
|
||||||
mpSelection->SetAllowedNodeTypes(eScriptNode | eLightNode);
|
mpSelection->SetAllowedNodeTypes(eScriptNode | eLightNode);
|
||||||
|
|
||||||
// Start refresh timer
|
|
||||||
connect(&mRefreshTimer, SIGNAL(timeout()), this, SLOT(RefreshViewport()));
|
|
||||||
mRefreshTimer.start(0);
|
|
||||||
|
|
||||||
// Initialize splitter
|
// Initialize splitter
|
||||||
QList<int> SplitterSizes;
|
QList<int> SplitterSizes;
|
||||||
SplitterSizes << width() * 0.775 << width() * 0.225;
|
SplitterSizes << width() * 0.775 << width() * 0.225;
|
||||||
@ -912,7 +908,7 @@ void CWorldEditor::UpdateCameraOrbit()
|
|||||||
if (!mpSelection->IsEmpty())
|
if (!mpSelection->IsEmpty())
|
||||||
pCamera->SetOrbit(mpSelection->Bounds());
|
pCamera->SetOrbit(mpSelection->Bounds());
|
||||||
else if (mpArea)
|
else if (mpArea)
|
||||||
pCamera->SetOrbit(mpArea->AABox(), 1.5f);
|
pCamera->SetOrbit(mpArea->AABox(), 1.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldEditor::OnCameraSpeedChange(double Speed)
|
void CWorldEditor::OnCameraSpeedChange(double Speed)
|
||||||
|
@ -37,7 +37,6 @@ class CWorldEditor : public INodeEditor
|
|||||||
|
|
||||||
TResPtr<CWorld> mpWorld;
|
TResPtr<CWorld> mpWorld;
|
||||||
TResPtr<CGameArea> mpArea;
|
TResPtr<CGameArea> mpArea;
|
||||||
QTimer mRefreshTimer;
|
|
||||||
|
|
||||||
CLinkDialog *mpLinkDialog;
|
CLinkDialog *mpLinkDialog;
|
||||||
CPoiMapEditDialog *mpPoiDialog;
|
CPoiMapEditDialog *mpPoiDialog;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "CStartWindow.h"
|
#include "CEditorApplication.h"
|
||||||
#include "CProjectOverviewDialog.h"
|
#include "CProjectOverviewDialog.h"
|
||||||
#include <Common/Log.h>
|
#include <Common/Log.h>
|
||||||
#include <Core/Resource/Factory/CTemplateLoader.h>
|
#include <Core/Resource/Factory/CTemplateLoader.h>
|
||||||
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// Create application
|
// Create application
|
||||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
QApplication App(argc, argv);
|
CEditorApplication App(argc, argv);
|
||||||
App.setWindowIcon(QIcon(":/icons/AppIcon.ico"));
|
App.setWindowIcon(QIcon(":/icons/AppIcon.ico"));
|
||||||
|
|
||||||
// Init log
|
// Init log
|
||||||
|
Loading…
x
Reference in New Issue
Block a user