CommandPropertiesChange.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 CommandPropertiesChange
  11. : public QUndoCommand
  12. {
  13. public:
  14. void undo() override;
  15. void redo() override;
  16. static void Push(UndoStack* stack,
  17. HierarchyWidget* hierarchy,
  18. SerializeHelpers::SerializedEntryList& preValueChanges,
  19. const char* commandName);
  20. private:
  21. CommandPropertiesChange(UndoStack* stack,
  22. HierarchyWidget* hierarchy,
  23. SerializeHelpers::SerializedEntryList& preValueChanges,
  24. const char* commandName);
  25. void Recreate(bool isUndo);
  26. UndoStack* m_stack;
  27. // The first execution of redo() is done in REACTION to a Qt
  28. // event that has ALREADY completed the necessary work. We ONLY
  29. // want to execute redo() on SUBSEQUENT calls.
  30. bool m_isFirstExecution;
  31. // This command can fail because of missing parents.
  32. // When it does, we don't want to try to execute it again.
  33. bool m_hasPreviouslyFailed;
  34. HierarchyWidget* m_hierarchy;
  35. SerializeHelpers::SerializedEntryList m_entryList;
  36. };