BsCmdCreateSO.h 1.1 KB

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