CCharacterEditor: Make use of in-class initializers where applicable
This commit is contained in:
parent
1266b9f041
commit
2f767d6b9a
|
@ -7,25 +7,19 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
const CVector3f CCharacterEditor::skDefaultOrbitTarget = CVector3f(0,0,1);
|
constexpr CVector3f skDefaultOrbitTarget{0, 0, 1};
|
||||||
const float CCharacterEditor::skDefaultOrbitDistance = 4.f;
|
constexpr float skDefaultOrbitDistance = 4.f;
|
||||||
|
|
||||||
CCharacterEditor::CCharacterEditor(CAnimSet *pSet, QWidget *parent)
|
CCharacterEditor::CCharacterEditor(CAnimSet *pSet, QWidget *parent)
|
||||||
: IEditor(parent)
|
: IEditor(parent)
|
||||||
, ui(new Ui::CCharacterEditor)
|
, ui(std::make_unique<Ui::CCharacterEditor>())
|
||||||
, mpScene(new CScene())
|
, mpScene(std::make_unique<CScene>())
|
||||||
, mpSelectedBone(nullptr)
|
|
||||||
, mBindPose(false)
|
|
||||||
, mPlayAnim(true)
|
|
||||||
, mLoopAnim(true)
|
|
||||||
, mAnimTime(0.f)
|
|
||||||
, mPlaybackSpeed(1.f)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
REPLACE_WINDOWTITLE_APPVARS;
|
REPLACE_WINDOWTITLE_APPVARS;
|
||||||
|
|
||||||
mpCharNode = new CCharacterNode(mpScene, -1);
|
mpCharNode = std::make_unique<CCharacterNode>(mpScene.get(), UINT32_MAX);
|
||||||
ui->Viewport->SetNode(mpCharNode);
|
ui->Viewport->SetNode(mpCharNode.get());
|
||||||
|
|
||||||
CCamera& rCamera = ui->Viewport->Camera();
|
CCamera& rCamera = ui->Viewport->Camera();
|
||||||
rCamera.SetMoveSpeed(0.5f);
|
rCamera.SetMoveSpeed(0.5f);
|
||||||
|
@ -77,12 +71,7 @@ CCharacterEditor::CCharacterEditor(CAnimSet *pSet, QWidget *parent)
|
||||||
SetActiveAnimSet(pSet);
|
SetActiveAnimSet(pSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCharacterEditor::~CCharacterEditor()
|
CCharacterEditor::~CCharacterEditor() = default;
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
delete mpScene;
|
|
||||||
delete mpCharNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCharacterEditor::EditorTick(float DeltaTime)
|
void CCharacterEditor::EditorTick(float DeltaTime)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CCharacterEditor;
|
class CCharacterEditor;
|
||||||
}
|
}
|
||||||
|
@ -19,32 +21,28 @@ class CCharacterEditor : public IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Ui::CCharacterEditor *ui;
|
std::unique_ptr<Ui::CCharacterEditor> ui;
|
||||||
CScene *mpScene;
|
std::unique_ptr<CScene> mpScene;
|
||||||
CCharacterNode *mpCharNode;
|
std::unique_ptr<CCharacterNode> mpCharNode;
|
||||||
CBone *mpSelectedBone;
|
CBone *mpSelectedBone = nullptr;
|
||||||
|
|
||||||
CSkeletonHierarchyModel mSkeletonModel;
|
CSkeletonHierarchyModel mSkeletonModel;
|
||||||
QComboBox *mpCharComboBox;
|
QComboBox *mpCharComboBox = nullptr;
|
||||||
QComboBox *mpAnimComboBox;
|
QComboBox *mpAnimComboBox = nullptr;
|
||||||
|
|
||||||
TResPtr<CAnimSet> mpSet;
|
TResPtr<CAnimSet> mpSet;
|
||||||
uint32 mCurrentChar;
|
uint32 mCurrentChar = 0;
|
||||||
uint32 mCurrentAnim;
|
uint32 mCurrentAnim = 0;
|
||||||
bool mBindPose;
|
bool mBindPose = false;
|
||||||
|
|
||||||
// Playback Controls
|
// Playback Controls
|
||||||
bool mPlayAnim;
|
bool mPlayAnim = true;
|
||||||
bool mLoopAnim;
|
bool mLoopAnim = true;
|
||||||
float mAnimTime;
|
float mAnimTime = 0.0f;
|
||||||
float mPlaybackSpeed;
|
float mPlaybackSpeed = 1.0f;
|
||||||
|
|
||||||
// Constants
|
|
||||||
static const CVector3f skDefaultOrbitTarget;
|
|
||||||
static const float skDefaultOrbitDistance;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CCharacterEditor(CAnimSet *pSet, QWidget *parent = 0);
|
explicit CCharacterEditor(CAnimSet *pSet, QWidget *parent = nullptr);
|
||||||
~CCharacterEditor();
|
~CCharacterEditor();
|
||||||
void EditorTick(float DeltaTime);
|
void EditorTick(float DeltaTime);
|
||||||
void UpdateAnimTime(float DeltaTime);
|
void UpdateAnimTime(float DeltaTime);
|
||||||
|
|
Loading…
Reference in New Issue