CommandCanvasPropertiesChange.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 <QUndoCommand>
  10. class CommandCanvasPropertiesChange
  11. : public QUndoCommand
  12. {
  13. public:
  14. void undo() override;
  15. void redo() override;
  16. static void Push(UndoStack* stack,
  17. AZStd::string& undoXml,
  18. AZStd::string& redoXml,
  19. EditorWindow* editorWindow,
  20. const char* commandName);
  21. private:
  22. CommandCanvasPropertiesChange(UndoStack* stack,
  23. AZStd::string& undoXml,
  24. AZStd::string& redoXml,
  25. EditorWindow* editorWindow,
  26. const char* commandName);
  27. void Recreate(bool isUndo);
  28. UndoStack* m_stack;
  29. // The first execution of redo() is done in REACTION to a Qt
  30. // event that has ALREADY completed the necessary work. We ONLY
  31. // want to execute redo() on SUBSEQUENT calls.
  32. bool m_isFirstExecution;
  33. // If the selection was empty when the command first occured then it should be set to empty on undo/redo
  34. // This is so that the use can see the change in the properties pane on undo/redo
  35. bool m_selectionWasEmpty;
  36. AZStd::string m_undoXml;
  37. AZStd::string m_redoXml;
  38. EditorWindow* m_editorWindow;
  39. };