WhiteBoxMeshAssetUndoCommand.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "WhiteBoxMeshAsset.h"
  10. #include <AzToolsFramework/Undo/UndoSystem.h>
  11. namespace WhiteBox
  12. {
  13. //! Records undo/redo states when modifying an asset.
  14. class WhiteBoxMeshAssetUndoCommand : public AzToolsFramework::UndoSystem::URSequencePoint
  15. {
  16. public:
  17. AZ_CLASS_ALLOCATOR_DECL
  18. AZ_RTTI(
  19. WhiteBoxMeshAssetUndoCommand, "{C99CD86C-035A-4FC9-AADC-4C746C38F119}",
  20. AzToolsFramework::UndoSystem::URSequencePoint)
  21. explicit WhiteBoxMeshAssetUndoCommand();
  22. WhiteBoxMeshAssetUndoCommand(const WhiteBoxMeshAssetUndoCommand& other) = delete;
  23. WhiteBoxMeshAssetUndoCommand& operator=(const WhiteBoxMeshAssetUndoCommand& other) = delete;
  24. ~WhiteBoxMeshAssetUndoCommand() override = default;
  25. void SetAsset(AZ::Data::Asset<Pipeline::WhiteBoxMeshAsset> asset);
  26. void SetUndoState(const Api::WhiteBoxMeshStream& undoState);
  27. void SetRedoState(const Api::WhiteBoxMeshStream& redoState);
  28. // AzToolsFramework::UndoSystem::URSequencePoint ...
  29. void Undo() override;
  30. void Redo() override;
  31. bool Changed() const override;
  32. protected:
  33. AZ::Data::Asset<Pipeline::WhiteBoxMeshAsset> m_asset;
  34. Api::WhiteBoxMeshStream m_undoState;
  35. Api::WhiteBoxMeshStream m_redoState;
  36. };
  37. } // namespace WhiteBox