BsCmdCreateSO.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 "BsEditorCommand.h"
  6. #include "BsUndoRedo.h"
  7. #include "BsCmdUtility.h"
  8. namespace BansheeEngine
  9. {
  10. /** @addtogroup UndoRedo
  11. * @{
  12. */
  13. /** A command used for undo/redo purposes. Creates a scene object and removes it as an undo operation. */
  14. class BS_ED_EXPORT CmdCreateSO : public EditorCommand
  15. {
  16. public:
  17. ~CmdCreateSO();
  18. /**
  19. * Creates a new scene object. Automatically registers the command with undo/redo system.
  20. *
  21. * @param[in] name Name of the scene object.
  22. * @param[in] flags Optional creation flags for the scene object.
  23. * @param[in] description Optional description of what exactly the command does.
  24. * @return Newly created scene object.
  25. */
  26. static HSceneObject execute(const String& name, UINT32 flags, const WString& description = StringUtil::WBLANK);
  27. /** @copydoc EditorCommand::commit */
  28. void commit() override;
  29. /** @copydoc EditorCommand::revert */
  30. void revert() override;
  31. private:
  32. friend class UndoRedo;
  33. CmdCreateSO(const WString& description, const String& name, UINT32 flags);
  34. String mName;
  35. UINT32 mFlags;
  36. HSceneObject mSceneObject;
  37. };
  38. /** @} */
  39. }