1f9b284de2
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Code/Editor/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin_precompiled.h # Code/Editor/Plugins/EditorCommon/EditorCommon_precompiled.h # Code/Editor/Plugins/EditorCommon/stdafx.cpp # Code/Editor/Plugins/FFMPEGPlugin/FFMPEGPlugin_precompiled.h # Code/Editor/Plugins/PerforcePlugin/PerforcePlugin_precompiled.h # Code/Editor/Plugins/ProjectSettingsTool/ProjectSettingsTool_precompiled.h # Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFramework_precompiled.h # Code/Tools/AssetProcessor/native/precompiled.h # Code/Tools/Standalone/StandaloneTools_precompiled.h # Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer_precompiled.h # Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessing_precompiled.h # Gems/Atom/RHI/DX12/Code/Source/RHI/Atom_RHI_DX12_precompiled.h # Gems/Atom/RHI/Metal/Code/Include/Platform/Mac/Atom_RHI_Metal_precompiled_Platform.h # Gems/Atom/RHI/Metal/Code/Include/Platform/iOS/Atom_RHI_Metal_precompiled_Platform.h # Gems/Atom/RHI/Metal/Code/Source/Atom_RHI_Metal_precompiled.h # Gems/Atom/RHI/Metal/Code/atom_rhi_metal_common_files.cmake # Gems/Atom/RHI/Null/Code/Source/Atom_RHI_Null_precompiled.h # Gems/Atom/RHI/Null/Code/atom_rhi_null_common_files.cmake # Gems/Atom/RHI/Vulkan/Code/Include/Platform/Android/Atom_RHI_Vulkan_precompiled_Platform.h # Gems/Atom/RHI/Vulkan/Code/Include/Platform/Linux/Atom_RHI_Vulkan_precompiled_Platform.h # Gems/Atom/RHI/Vulkan/Code/Include/Platform/Mac/Atom_RHI_Vulkan_precompiled_Platform.h # Gems/Atom/RHI/Vulkan/Code/Include/Platform/Windows/Atom_RHI_Vulkan_precompiled_Platform.h # Gems/Atom/RHI/Vulkan/Code/Source/Atom_RHI_Vulkan_precompiled.h # Gems/Atom/RHI/Vulkan/Code/Source/RHI/SwapChain.cpp # Gems/Atom/RHI/Vulkan/Code/atom_rhi_vulkan_common_files.cmake # Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont_precompiled.h # Gems/Blast/Code/Source/StdAfx.cpp # Gems/Camera/Code/Source/Camera_precompiled.h # Gems/EMotionFX/Code/Source/EMotionFX_precompiled.h # Gems/FastNoise/Code/Source/FastNoise_precompiled.h # Gems/Gestures/Code/Source/Gestures_precompiled.h # Gems/GradientSignal/Code/Source/GradientSignal_precompiled.h # Gems/GraphCanvas/Code/precompiled.h # Gems/ImGui/Code/Source/ImGui_precompiled.h # Gems/InAppPurchases/Code/Source/InAppPurchases_precompiled.h # Gems/LmbrCentral/Code/Source/LmbrCentral_precompiled.h # Gems/LmbrCentral/Code/Tests/ShapeGeometryUtilTest.cpp # Gems/LyShine/Code/Editor/UiCanvasEditor_precompiled.h # Gems/LyShine/Code/Source/Animation/LyShine_precompiled.h # Gems/LyShine/Code/Source/LyShine_precompiled.h # Gems/LyShineExamples/Code/Source/LyShineExamples_precompiled.h # Gems/Maestro/Code/Source/Cinematics/Maestro_precompiled.h # Gems/Maestro/Code/Source/Maestro_precompiled.h # Gems/MessagePopup/Code/Source/MessagePopup_precompiled.h # Gems/Metastream/Code/Source/Metastream_precompiled.h # Gems/Microphone/Code/Source/Microphone_precompiled.h # Gems/Multiplayer/Code/Source/Multiplayer_precompiled.h # Gems/PhysX/Code/NumericalMethods/Source/NumericalMethods_precompiled.h # Gems/PhysX/Code/Source/PhysXUnsupported_precompiled.h # Gems/PhysX/Code/Source/PhysX_precompiled.h # Gems/PhysX/Code/physx_unsupported_files.cmake # Gems/PhysXDebug/Code/Source/PhysXDebugUnsupported_precompiled.h # Gems/PhysXDebug/Code/Source/PhysXDebug_precompiled.h # Gems/ScriptCanvas/Code/Editor/precompiled.h # Gems/ScriptCanvas/Code/Source/precompiled.h # Gems/ScriptCanvasDeveloper/Code/Source/precompiled.h # Gems/ScriptCanvasPhysics/Code/Source/ScriptCanvasPhysics_precompiled.h # Gems/ScriptEvents/Code/Source/precompiled.h # Gems/ScriptEvents/Code/Tests/Editor/EditorTests.cpp # Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweener_precompiled.h # Gems/SliceFavorites/Code/Source/SliceFavorites_precompiled.h # Gems/StartingPointCamera/Code/Source/StartingPointCamera_precompiled.h # Gems/StartingPointInput/Code/Source/StartingPointInput_precompiled.h # Gems/StartingPointMovement/Code/Source/StartingPointMovement_precompiled.h # Gems/SurfaceData/Code/Source/SurfaceData_precompiled.h # Gems/TextureAtlas/Code/Source/TextureAtlas_precompiled.h # Gems/TickBusOrderViewer/Code/Source/TickBusOrderViewer_precompiled.h # Gems/Twitch/Code/Source/Twitch_precompiled.h # Gems/VirtualGamepad/Code/Source/VirtualGamepad_precompiled.h # Gems/WhiteBox/Code/Source/WhiteBoxUnsupported_precompiled.h # Gems/WhiteBox/Code/Source/WhiteBox_precompiled.h
435 lines
11 KiB
C++
435 lines
11 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "UiAnimViewTrack.h"
|
|
|
|
#include "UiAnimUndoObject.h"
|
|
#include "UiAnimUndo.h"
|
|
|
|
#include <QtCore/QString>
|
|
|
|
class QWidget;
|
|
|
|
class CUiAnimViewNode;
|
|
class CUiAnimViewSequence;
|
|
class CUiAnimViewAnimNode;
|
|
|
|
/** Undo object for sequence settings
|
|
*/
|
|
class CUndoSequenceSettings
|
|
: public UiAnimUndoObject
|
|
{
|
|
public:
|
|
CUndoSequenceSettings(CUiAnimViewSequence* pSequence);
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); }
|
|
virtual const char* GetDescription() override { return "Undo Sequence Settings"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
|
|
private:
|
|
CUiAnimViewSequence* m_pSequence;
|
|
|
|
Range m_oldTimeRange;
|
|
Range m_newTimeRange;
|
|
IUiAnimSequence::EUiAnimSequenceFlags m_newFlags;
|
|
IUiAnimSequence::EUiAnimSequenceFlags m_oldFlags;
|
|
};
|
|
|
|
/** Undo object stored when keys were selected
|
|
*/
|
|
class CUndoAnimKeySelection
|
|
: public UiAnimUndoObject
|
|
{
|
|
friend class CUndoTrackObject;
|
|
public:
|
|
CUndoAnimKeySelection(CUiAnimViewSequence* pSequence);
|
|
|
|
// Checks if the selection was actually changed
|
|
bool IsSelectionChanged() const;
|
|
|
|
protected:
|
|
CUndoAnimKeySelection(CUiAnimViewTrack* pTrack);
|
|
|
|
virtual int GetSize() override { return sizeof(*this); }
|
|
virtual const char* GetDescription() override { return "Undo Sequence Key Selection"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
|
|
std::vector<bool> SaveKeyStates(CUiAnimViewSequence* pSequence) const;
|
|
void RestoreKeyStates(CUiAnimViewSequence* pSequence, const std::vector<bool> keyStates);
|
|
|
|
CUiAnimViewSequence* m_pSequence;
|
|
std::vector<bool> m_undoKeyStates;
|
|
std::vector<bool> m_redoKeyStates;
|
|
};
|
|
|
|
/** Undo object stored when track is modified.
|
|
*/
|
|
class CUndoTrackObject
|
|
: public CUndoAnimKeySelection
|
|
{
|
|
public:
|
|
CUndoTrackObject(CUiAnimViewTrack* pTrack, bool bStoreKeySelection = true);
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); }
|
|
virtual const char* GetDescription() override { return "Undo Track Modify"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
|
|
private:
|
|
CUiAnimViewTrack* m_pTrack;
|
|
bool m_bStoreKeySelection;
|
|
|
|
CUiAnimViewTrackMemento m_undo;
|
|
CUiAnimViewTrackMemento m_redo;
|
|
};
|
|
|
|
/** Base class for sequence add/remove
|
|
*/
|
|
class CAbstractUndoSequenceTransaction
|
|
: public UiAnimUndoObject
|
|
{
|
|
public:
|
|
CAbstractUndoSequenceTransaction(CUiAnimViewSequence* pSequence);
|
|
|
|
protected:
|
|
void AddSequence();
|
|
void RemoveSequence(bool bAquireOwnership);
|
|
|
|
CUiAnimViewSequence* m_pSequence;
|
|
|
|
// This smart pointer is used to hold the sequence if not in AnimView anymore
|
|
std::unique_ptr<CUiAnimViewSequence> m_pStoredUiAnimViewSequence;
|
|
};
|
|
|
|
/** Undo for adding a sequence
|
|
*/
|
|
class CUndoSequenceAdd
|
|
: public CAbstractUndoSequenceTransaction
|
|
{
|
|
public:
|
|
CUndoSequenceAdd(CUiAnimViewSequence* pNewSequence)
|
|
: CAbstractUndoSequenceTransaction(pNewSequence) {}
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Add Sequence"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
};
|
|
|
|
/** Undo for remove a sequence
|
|
*/
|
|
class CUndoSequenceRemove
|
|
: public CAbstractUndoSequenceTransaction
|
|
{
|
|
public:
|
|
CUndoSequenceRemove(CUiAnimViewSequence* pRemovedSequence);
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Remove Sequence"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
};
|
|
|
|
/** Undo for changing current sequence
|
|
*/
|
|
class CUndoSequenceChange
|
|
: public UiAnimUndoObject
|
|
{
|
|
public:
|
|
CUndoSequenceChange(CUiAnimViewSequence* oldSequence, CUiAnimViewSequence* newSequence);
|
|
|
|
protected:
|
|
int GetSize() override { return sizeof(*this); }
|
|
const char* GetDescription() override { return "Undo Change Sequence"; }
|
|
|
|
virtual void ChangeSequence(CUiAnimViewSequence* sequence);
|
|
void Undo(bool undo) override;
|
|
void Redo() override;
|
|
|
|
CUiAnimViewSequence* m_oldSequence;
|
|
CUiAnimViewSequence* m_newSequence;
|
|
};
|
|
|
|
/** Base class for anim node add/remove
|
|
*/
|
|
class CAbstractUndoAnimNodeTransaction
|
|
: public UiAnimUndoObject
|
|
{
|
|
public:
|
|
CAbstractUndoAnimNodeTransaction(CUiAnimViewAnimNode* pNode);
|
|
|
|
protected:
|
|
void AddNode();
|
|
void RemoveNode(bool bAquireOwnership);
|
|
|
|
CUiAnimViewAnimNode* m_pParentNode;
|
|
CUiAnimViewAnimNode* m_pNode;
|
|
|
|
// This smart pointer is used to hold the node if not in the sequence anymore.
|
|
std::unique_ptr<CUiAnimViewNode> m_pStoredUiAnimViewNode;
|
|
};
|
|
|
|
/** Undo for adding a sub node to a node
|
|
*/
|
|
class CUndoAnimNodeAdd
|
|
: public CAbstractUndoAnimNodeTransaction
|
|
{
|
|
public:
|
|
CUndoAnimNodeAdd(CUiAnimViewAnimNode* pNewNode)
|
|
: CAbstractUndoAnimNodeTransaction(pNewNode) {}
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Add Animation Node"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
};
|
|
|
|
/** Undo for remove a sub node from a node
|
|
*/
|
|
class CUndoAnimNodeRemove
|
|
: public CAbstractUndoAnimNodeTransaction
|
|
{
|
|
public:
|
|
CUndoAnimNodeRemove(CUiAnimViewAnimNode* pRemovedNode);
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Remove Animation Node"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
};
|
|
|
|
/** Base class for anim track add/remove
|
|
*/
|
|
class CAbstractUndoTrackTransaction
|
|
: public UiAnimUndoObject
|
|
{
|
|
public:
|
|
CAbstractUndoTrackTransaction(CUiAnimViewTrack* pTrack);
|
|
|
|
protected:
|
|
void AddTrack();
|
|
void RemoveTrack(bool bAquireOwnership);
|
|
|
|
private:
|
|
CUiAnimViewAnimNode* m_pParentNode;
|
|
CUiAnimViewTrack* m_pTrack;
|
|
|
|
// This smart pointers is used to hold the track if not in the sequence anymore.
|
|
std::unique_ptr<CUiAnimViewNode> m_pStoredUiAnimViewTrack;
|
|
};
|
|
|
|
/** Undo for adding a track to a node
|
|
*/
|
|
class CUndoTrackAdd
|
|
: public CAbstractUndoTrackTransaction
|
|
{
|
|
public:
|
|
CUndoTrackAdd(CUiAnimViewTrack* pNewTrack)
|
|
: CAbstractUndoTrackTransaction(pNewTrack) {}
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Add Animation Track"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
};
|
|
|
|
/** Undo for removing a track from a node
|
|
*/
|
|
class CUndoTrackRemove
|
|
: public CAbstractUndoTrackTransaction
|
|
{
|
|
public:
|
|
CUndoTrackRemove(CUiAnimViewTrack* pRemovedTrack);
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Remove Animation Track"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
};
|
|
|
|
/** Undo for re-parenting an anim node
|
|
*/
|
|
class CUndoAnimNodeReparent
|
|
: public CAbstractUndoAnimNodeTransaction
|
|
{
|
|
public:
|
|
CUndoAnimNodeReparent(CUiAnimViewAnimNode* pAnimNode, CUiAnimViewAnimNode* pNewParent);
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Reparent Animation Node"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
|
|
private:
|
|
void Reparent(CUiAnimViewAnimNode* pNewParent);
|
|
void AddParentsInChildren(CUiAnimViewAnimNode* pCurrentNode);
|
|
|
|
CUiAnimViewAnimNode* m_pNewParent;
|
|
CUiAnimViewAnimNode* m_pOldParent;
|
|
};
|
|
|
|
/* Undo for renaming an anim node
|
|
*/
|
|
class CUndoAnimNodeRename
|
|
: public UiAnimUndoObject
|
|
{
|
|
public:
|
|
CUndoAnimNodeRename(CUiAnimViewAnimNode* pNode, const string& oldName);
|
|
|
|
protected:
|
|
virtual int GetSize() override { return sizeof(*this); };
|
|
virtual const char* GetDescription() override { return "Undo Rename Animation Node"; };
|
|
|
|
virtual void Undo(bool bUndo) override;
|
|
virtual void Redo() override;
|
|
|
|
private:
|
|
CUiAnimViewAnimNode* m_pNode;
|
|
string m_newName;
|
|
string m_oldName;
|
|
};
|
|
|
|
/** Base class for track event transactions
|
|
*/
|
|
class CAbstractUndoTrackEventTransaction
|
|
: public UiAnimUndoObject
|
|
{
|
|
public:
|
|
CAbstractUndoTrackEventTransaction(CUiAnimViewSequence* pSequence, const QString& eventName);
|
|
|
|
protected:
|
|
CUiAnimViewSequence* m_pSequence;
|
|
QString m_eventName;
|
|
};
|
|
|
|
/** Undo for adding a track event
|
|
*/
|
|
class CUndoTrackEventAdd
|
|
: public CAbstractUndoTrackEventTransaction
|
|
{
|
|
public:
|
|
CUndoTrackEventAdd(CUiAnimViewSequence* pSequence, const QString& eventName)
|
|
: CAbstractUndoTrackEventTransaction(pSequence, eventName) {}
|
|
|
|
protected:
|
|
int GetSize() override { return sizeof(*this); };
|
|
const char* GetDescription() override { return "Undo Add Track Event"; };
|
|
|
|
void Undo(bool bUndo) override;
|
|
void Redo() override;
|
|
};
|
|
|
|
/** Undo for removing a track event
|
|
*/
|
|
class CUndoTrackEventRemove
|
|
: public CAbstractUndoTrackEventTransaction
|
|
{
|
|
public:
|
|
CUndoTrackEventRemove(CUiAnimViewSequence* pSequence, const QString& eventName);
|
|
|
|
protected:
|
|
int GetSize() override { return sizeof(*this); };
|
|
const char* GetDescription() override { return "Undo Remove Track Event"; };
|
|
|
|
void Undo(bool bUndo) override;
|
|
void Redo() override;
|
|
|
|
CUiAnimViewKeyBundle m_changedKeys;
|
|
};
|
|
|
|
/** Undo for renaming a track event
|
|
*/
|
|
class CUndoTrackEventRename
|
|
: public CAbstractUndoTrackEventTransaction
|
|
{
|
|
public:
|
|
CUndoTrackEventRename(CUiAnimViewSequence* pSequence, const QString& eventName, const QString& newEventName);
|
|
|
|
protected:
|
|
int GetSize() override { return sizeof(*this); };
|
|
const char* GetDescription() override { return "Undo Rename Track Event"; };
|
|
|
|
void Undo(bool bUndo) override;
|
|
void Redo() override;
|
|
|
|
QString m_newEventName;
|
|
};
|
|
|
|
/** Base class for undoing moving a track event
|
|
*/
|
|
class CAbstractUndoTrackEventMove
|
|
: public CAbstractUndoTrackEventTransaction
|
|
{
|
|
public:
|
|
CAbstractUndoTrackEventMove(CUiAnimViewSequence* pSequence, const QString& eventName)
|
|
: CAbstractUndoTrackEventTransaction(pSequence, eventName) {}
|
|
|
|
protected:
|
|
void MoveUp();
|
|
void MoveDown();
|
|
};
|
|
|
|
/** Undo for moving up a track event
|
|
*/
|
|
class CUndoTrackEventMoveUp
|
|
: public CAbstractUndoTrackEventMove
|
|
{
|
|
public:
|
|
CUndoTrackEventMoveUp(CUiAnimViewSequence* pSequence, const QString& eventName)
|
|
: CAbstractUndoTrackEventMove(pSequence, eventName) {}
|
|
|
|
protected:
|
|
int GetSize() override { return sizeof(*this); };
|
|
const char* GetDescription() override { return "Undo Move Up Track Event"; };
|
|
|
|
void Undo(bool bUndo) override;
|
|
void Redo() override;
|
|
};
|
|
|
|
/** Undo for moving down a track event
|
|
*/
|
|
class CUndoTrackEventMoveDown
|
|
: public CAbstractUndoTrackEventMove
|
|
{
|
|
public:
|
|
CUndoTrackEventMoveDown(CUiAnimViewSequence* pSequence, const QString& eventName)
|
|
: CAbstractUndoTrackEventMove(pSequence, eventName) {}
|
|
|
|
protected:
|
|
int GetSize() override { return sizeof(*this); };
|
|
const char* GetDescription() override { return "Undo Move Down Track Event"; };
|
|
|
|
void Undo(bool bUndo) override;
|
|
void Redo() override;
|
|
};
|