CModelEditorWindow: Make use of in-class initializers where applicable
This commit is contained in:
parent
16225c278d
commit
6cdea11377
|
@ -22,19 +22,15 @@
|
||||||
|
|
||||||
CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent)
|
CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent)
|
||||||
: IEditor(pParent)
|
: IEditor(pParent)
|
||||||
, ui(new Ui::CModelEditorWindow)
|
, ui(std::make_unique<Ui::CModelEditorWindow>())
|
||||||
, mpScene(new CScene())
|
, mpScene(std::make_unique<CScene>())
|
||||||
, mpCurrentMat(nullptr)
|
, mpCurrentModelNode(std::make_unique<CModelNode>(mpScene.get(), UINT32_MAX))
|
||||||
, mpCurrentModel(nullptr)
|
|
||||||
, mpCurrentModelNode(new CModelNode(mpScene, -1))
|
|
||||||
, mpCurrentPass(nullptr)
|
|
||||||
, mIgnoreSignals(false)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->ActionSave->setEnabled( pModel->Game() == EGame::Prime ); // we don't support saving games later than MP1
|
ui->ActionSave->setEnabled( pModel->Game() == EGame::Prime ); // we don't support saving games later than MP1
|
||||||
REPLACE_WINDOWTITLE_APPVARS;
|
REPLACE_WINDOWTITLE_APPVARS;
|
||||||
|
|
||||||
ui->Viewport->SetNode(mpCurrentModelNode);
|
ui->Viewport->SetNode(mpCurrentModelNode.get());
|
||||||
ui->Viewport->SetClearColor(CColor(0.3f, 0.3f, 0.3f, 1.f));
|
ui->Viewport->SetClearColor(CColor(0.3f, 0.3f, 0.3f, 1.f));
|
||||||
|
|
||||||
CCamera& rCamera = ui->Viewport->Camera();
|
CCamera& rCamera = ui->Viewport->Camera();
|
||||||
|
@ -144,12 +140,7 @@ CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent)
|
||||||
SetActiveModel(pModel);
|
SetActiveModel(pModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelEditorWindow::~CModelEditorWindow()
|
CModelEditorWindow::~CModelEditorWindow() = default;
|
||||||
{
|
|
||||||
delete mpCurrentModelNode;
|
|
||||||
delete mpScene;
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CModelEditorWindow::Save()
|
bool CModelEditorWindow::Save()
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CModelEditorWindow;
|
class CModelEditorWindow;
|
||||||
}
|
}
|
||||||
|
@ -22,21 +24,22 @@ class CModelEditorWindow : public IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Ui::CModelEditorWindow *ui;
|
std::unique_ptr<Ui::CModelEditorWindow> ui;
|
||||||
CScene *mpScene;
|
std::unique_ptr<CScene> mpScene;
|
||||||
QString mOutputFilename;
|
QString mOutputFilename;
|
||||||
TResPtr<CModel> mpCurrentModel;
|
TResPtr<CModel> mpCurrentModel;
|
||||||
CModelNode *mpCurrentModelNode;
|
std::unique_ptr<CModelNode> mpCurrentModelNode;
|
||||||
CMaterial *mpCurrentMat;
|
CMaterial *mpCurrentMat = nullptr;
|
||||||
CMaterialPass *mpCurrentPass;
|
CMaterialPass *mpCurrentPass = nullptr;
|
||||||
bool mIgnoreSignals;
|
bool mIgnoreSignals = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CModelEditorWindow(CModel *pModel, QWidget *pParent = 0);
|
explicit CModelEditorWindow(CModel *pModel, QWidget *pParent = nullptr);
|
||||||
~CModelEditorWindow();
|
~CModelEditorWindow() override;
|
||||||
bool Save();
|
|
||||||
|
bool Save() override;
|
||||||
void SetActiveModel(CModel *pModel);
|
void SetActiveModel(CModel *pModel);
|
||||||
CModelEditorViewport* Viewport() const;
|
CModelEditorViewport* Viewport() const override;
|
||||||
|
|
||||||
enum class EModelEditorWidget
|
enum class EModelEditorWidget
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue