CTranslateNodeCommand: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 06:09:33 -04:00
parent 9c554fc052
commit 2cf3ac718b
2 changed files with 10 additions and 12 deletions

View File

@ -3,16 +3,13 @@
#include "Editor/INodeEditor.h" #include "Editor/INodeEditor.h"
CTranslateNodeCommand::CTranslateNodeCommand() CTranslateNodeCommand::CTranslateNodeCommand()
: IUndoCommand("Translate"), : IUndoCommand("Translate")
mpEditor(nullptr),
mCommandEnded(false)
{ {
} }
CTranslateNodeCommand::CTranslateNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& rkNodes, const CVector3f& Delta, ETransformSpace TransformSpace) CTranslateNodeCommand::CTranslateNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& rkNodes, const CVector3f& Delta, ETransformSpace TransformSpace)
: IUndoCommand("Translate"), : IUndoCommand("Translate"),
mpEditor(pEditor), mpEditor(pEditor)
mCommandEnded(false)
{ {
mNodeList.reserve(rkNodes.size()); mNodeList.reserve(rkNodes.size());

View File

@ -16,17 +16,18 @@ class CTranslateNodeCommand : public IUndoCommand
CVector3f NewPos; CVector3f NewPos;
}; };
QList<SNodeTranslate> mNodeList; QList<SNodeTranslate> mNodeList;
INodeEditor *mpEditor; INodeEditor *mpEditor = nullptr;
bool mCommandEnded; bool mCommandEnded = false;
public: public:
CTranslateNodeCommand(); CTranslateNodeCommand();
CTranslateNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& rkNodes, const CVector3f& rkDelta, ETransformSpace TransformSpace); CTranslateNodeCommand(INodeEditor *pEditor, const QList<CSceneNode*>& rkNodes, const CVector3f& rkDelta, ETransformSpace TransformSpace);
int id() const;
bool mergeWith(const QUndoCommand *pkOther); int id() const override;
void undo(); bool mergeWith(const QUndoCommand *pkOther) override;
void redo(); void undo() override;
bool AffectsCleanState() const { return true; } void redo() override;
bool AffectsCleanState() const override { return true; }
static CTranslateNodeCommand* End(); static CTranslateNodeCommand* End();
}; };