BsCmdCreateSO.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 "UndoRedo/BsUndoRedo.h"
  7. namespace bs
  8. {
  9. /** @addtogroup UndoRedo
  10. * @{
  11. */
  12. /** A command used for undo/redo purposes. Creates a scene object and removes it as an undo operation. */
  13. class BS_ED_EXPORT CmdCreateSO final : public EditorCommand
  14. {
  15. public:
  16. /**
  17. * Creates a new scene object. Automatically registers the command with undo/redo system.
  18. *
  19. * @param[in] name Name of the scene object.
  20. * @param[in] flags Optional creation flags for the scene object.
  21. * @param[in] description Optional description of what exactly the command does.
  22. * @return Newly created scene object.
  23. */
  24. static HSceneObject execute(const String& name, UINT32 flags, 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. CmdCreateSO(const String& description, const String& name, UINT32 flags);
  32. String mName;
  33. UINT32 mFlags;
  34. HSceneObject mSceneObject;
  35. };
  36. /** @} */
  37. }