BsCmdDeleteSO.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsEditorPrerequisites.h"
  5. #include "UndoRedo/BsEditorCommand.h"
  6. #include "Utility/BsEditorUtility.h"
  7. namespace bs
  8. {
  9. class SerializedSceneObject;
  10. /** @addtogroup UndoRedo
  11. * @{
  12. */
  13. /** A command used for undo/redo purposes. Deletes a scene object and restores it as an undo operation. */
  14. class BS_ED_EXPORT CmdDeleteSO final : public EditorCommand
  15. {
  16. public:
  17. /**
  18. * Creates and executes the command on the provided scene object. Automatically registers the command with
  19. * undo/redo system.
  20. *
  21. * @param[in] sceneObject Scene object to delete.
  22. * @param[in] description Optional description of what exactly the command does.
  23. */
  24. static void execute(const HSceneObject& sceneObject, const String& description = StringUtil::BLANK);
  25. /** @copydoc EditorCommand::commit */
  26. void commit() override;
  27. /** @copydoc EditorCommand::revert */
  28. void revert() override;
  29. private:
  30. friend class UndoRedo;
  31. CmdDeleteSO(const String& description, const HSceneObject& sceneObject);
  32. HSceneObject mSceneObject;
  33. SPtr<SerializedSceneObject> mSerialized;
  34. };
  35. /** @} */
  36. }