BsCmdCreateSO.h 1.4 KB

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