mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-01 19:03:36 +00:00
CWorldEditor: Make use of in-class initializers where applicable
This commit is contained in:
parent
75f805f0ff
commit
4df036a837
@ -37,15 +37,10 @@
|
|||||||
|
|
||||||
CWorldEditor::CWorldEditor(QWidget *parent)
|
CWorldEditor::CWorldEditor(QWidget *parent)
|
||||||
: INodeEditor(parent)
|
: INodeEditor(parent)
|
||||||
, ui(new Ui::CWorldEditor)
|
, ui(std::make_unique<Ui::CWorldEditor>())
|
||||||
, mpArea(nullptr)
|
|
||||||
, mpWorld(nullptr)
|
|
||||||
, mpLinkDialog(new CLinkDialog(this, this))
|
, mpLinkDialog(new CLinkDialog(this, this))
|
||||||
, mpGeneratePropertyNamesDialog(new CGeneratePropertyNamesDialog(this))
|
, mpGeneratePropertyNamesDialog(new CGeneratePropertyNamesDialog(this))
|
||||||
, mpTweakEditor(new CTweakEditor(this))
|
, mpTweakEditor(new CTweakEditor(this))
|
||||||
, mIsMakingLink(false)
|
|
||||||
, mpNewLinkSender(nullptr)
|
|
||||||
, mpNewLinkReceiver(nullptr)
|
|
||||||
{
|
{
|
||||||
debugf("Creating World Editor");
|
debugf("Creating World Editor");
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -226,7 +221,6 @@ CWorldEditor::~CWorldEditor()
|
|||||||
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
|
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
|
||||||
|
|
||||||
delete mpScriptSidebar; // For some reason WCreateTab filters an event during the viewport's destructor
|
delete mpScriptSidebar; // For some reason WCreateTab filters an event during the viewport's destructor
|
||||||
delete ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWorldEditor::CloseWorld()
|
bool CWorldEditor::CloseWorld()
|
||||||
|
@ -33,6 +33,9 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CWorldEditor;
|
class CWorldEditor;
|
||||||
}
|
}
|
||||||
@ -47,11 +50,11 @@ enum EWorldEditorMode
|
|||||||
class CWorldEditor : public INodeEditor
|
class CWorldEditor : public INodeEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
static const int mskMaxRecentProjects = 10;
|
static constexpr int mskMaxRecentProjects = 10;
|
||||||
|
|
||||||
Ui::CWorldEditor* ui;
|
std::unique_ptr<Ui::CWorldEditor> ui;
|
||||||
QMenu* mpOpenRecentMenu;
|
QMenu* mpOpenRecentMenu;
|
||||||
QAction* mRecentProjectsActions[ mskMaxRecentProjects ];
|
std::array<QAction*, mskMaxRecentProjects> mRecentProjectsActions;
|
||||||
|
|
||||||
TResPtr<CWorld> mpWorld;
|
TResPtr<CWorld> mpWorld;
|
||||||
TResPtr<CGameArea> mpArea;
|
TResPtr<CGameArea> mpArea;
|
||||||
@ -61,9 +64,9 @@ class CWorldEditor : public INodeEditor
|
|||||||
CGeneratePropertyNamesDialog* mpGeneratePropertyNamesDialog;
|
CGeneratePropertyNamesDialog* mpGeneratePropertyNamesDialog;
|
||||||
CTweakEditor* mpTweakEditor;
|
CTweakEditor* mpTweakEditor;
|
||||||
|
|
||||||
bool mIsMakingLink;
|
bool mIsMakingLink = false;
|
||||||
CScriptObject* mpNewLinkSender;
|
CScriptObject* mpNewLinkSender = nullptr;
|
||||||
CScriptObject* mpNewLinkReceiver;
|
CScriptObject* mpNewLinkReceiver = nullptr;
|
||||||
|
|
||||||
// Quickplay
|
// Quickplay
|
||||||
QAction* mpQuickplayAction;
|
QAction* mpQuickplayAction;
|
||||||
@ -81,27 +84,28 @@ class CWorldEditor : public INodeEditor
|
|||||||
QAction* mpPoiMapAction;
|
QAction* mpPoiMapAction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CWorldEditor(QWidget *parent = 0);
|
explicit CWorldEditor(QWidget *parent = nullptr);
|
||||||
~CWorldEditor();
|
~CWorldEditor() override;
|
||||||
|
|
||||||
bool CloseWorld();
|
bool CloseWorld();
|
||||||
bool SetArea(CWorld *pWorld, int AreaIndex);
|
bool SetArea(CWorld *pWorld, int AreaIndex);
|
||||||
void ResetCamera();
|
void ResetCamera();
|
||||||
bool HasAnyScriptNodesSelected() const;
|
bool HasAnyScriptNodesSelected() const;
|
||||||
bool IsQuickplayEnabled() const;
|
bool IsQuickplayEnabled() const;
|
||||||
|
|
||||||
inline CWorld* ActiveWorld() const { return mpWorld; }
|
CWorld* ActiveWorld() const { return mpWorld; }
|
||||||
inline CGameArea* ActiveArea() const { return mpArea; }
|
CGameArea* ActiveArea() const { return mpArea; }
|
||||||
inline EGame CurrentGame() const { return gpEdApp->CurrentGame(); }
|
EGame CurrentGame() const { return gpEdApp->CurrentGame(); }
|
||||||
inline CLinkDialog* LinkDialog() const { return mpLinkDialog; }
|
CLinkDialog* LinkDialog() const { return mpLinkDialog; }
|
||||||
inline CGeneratePropertyNamesDialog* NameGeneratorDialog() const { return mpGeneratePropertyNamesDialog; }
|
CGeneratePropertyNamesDialog* NameGeneratorDialog() const { return mpGeneratePropertyNamesDialog; }
|
||||||
inline CTweakEditor* TweakEditor() { return mpTweakEditor; }
|
CTweakEditor* TweakEditor() { return mpTweakEditor; }
|
||||||
CResourceBrowser* ResourceBrowser() const;
|
CResourceBrowser* ResourceBrowser() const;
|
||||||
CSceneViewport* Viewport() const override;
|
CSceneViewport* Viewport() const override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void EditorTick(float) override;
|
void EditorTick(float) override;
|
||||||
virtual void NotifyNodeAboutToBeDeleted(CSceneNode *pNode) override;
|
void NotifyNodeAboutToBeDeleted(CSceneNode *pNode) override;
|
||||||
virtual bool Save() override;
|
bool Save() override;
|
||||||
|
|
||||||
void Cut();
|
void Cut();
|
||||||
void Copy();
|
void Copy();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user