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