CModelEditorWindow: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 04:15:10 -04:00
parent 16225c278d
commit 6cdea11377
2 changed files with 18 additions and 24 deletions

View File

@ -22,19 +22,15 @@
CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent)
: IEditor(pParent)
, ui(new Ui::CModelEditorWindow)
, mpScene(new CScene())
, mpCurrentMat(nullptr)
, mpCurrentModel(nullptr)
, mpCurrentModelNode(new CModelNode(mpScene, -1))
, mpCurrentPass(nullptr)
, mIgnoreSignals(false)
, ui(std::make_unique<Ui::CModelEditorWindow>())
, mpScene(std::make_unique<CScene>())
, mpCurrentModelNode(std::make_unique<CModelNode>(mpScene.get(), UINT32_MAX))
{
ui->setupUi(this);
ui->ActionSave->setEnabled( pModel->Game() == EGame::Prime ); // we don't support saving games later than MP1
REPLACE_WINDOWTITLE_APPVARS;
ui->Viewport->SetNode(mpCurrentModelNode);
ui->Viewport->SetNode(mpCurrentModelNode.get());
ui->Viewport->SetClearColor(CColor(0.3f, 0.3f, 0.3f, 1.f));
CCamera& rCamera = ui->Viewport->Camera();
@ -144,12 +140,7 @@ CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent)
SetActiveModel(pModel);
}
CModelEditorWindow::~CModelEditorWindow()
{
delete mpCurrentModelNode;
delete mpScene;
delete ui;
}
CModelEditorWindow::~CModelEditorWindow() = default;
bool CModelEditorWindow::Save()
{

View File

@ -13,6 +13,8 @@
#include <QMainWindow>
#include <QTimer>
#include <memory>
namespace Ui {
class CModelEditorWindow;
}
@ -22,21 +24,22 @@ class CModelEditorWindow : public IEditor
{
Q_OBJECT
Ui::CModelEditorWindow *ui;
CScene *mpScene;
std::unique_ptr<Ui::CModelEditorWindow> ui;
std::unique_ptr<CScene> mpScene;
QString mOutputFilename;
TResPtr<CModel> mpCurrentModel;
CModelNode *mpCurrentModelNode;
CMaterial *mpCurrentMat;
CMaterialPass *mpCurrentPass;
bool mIgnoreSignals;
std::unique_ptr<CModelNode> mpCurrentModelNode;
CMaterial *mpCurrentMat = nullptr;
CMaterialPass *mpCurrentPass = nullptr;
bool mIgnoreSignals = false;
public:
explicit CModelEditorWindow(CModel *pModel, QWidget *pParent = 0);
~CModelEditorWindow();
bool Save();
explicit CModelEditorWindow(CModel *pModel, QWidget *pParent = nullptr);
~CModelEditorWindow() override;
bool Save() override;
void SetActiveModel(CModel *pModel);
CModelEditorViewport* Viewport() const;
CModelEditorViewport* Viewport() const override;
enum class EModelEditorWidget
{