2
0

BsCmdInstantiateSO.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. namespace BansheeEngine
  8. {
  9. /** @addtogroup UndoRedo
  10. * @{
  11. */
  12. /**
  13. * A command used for undo/redo purposes. Instantiates scene object(s) from a prefab and removes them as an undo
  14. * operation.
  15. */
  16. class BS_ED_EXPORT CmdInstantiateSO : public EditorCommand
  17. {
  18. public:
  19. ~CmdInstantiateSO();
  20. /**
  21. * Instantiates the specified prefab. Automatically registers the command with undo/redo system.
  22. *
  23. * @param[in] prefab Prefab to instantiate.
  24. * @param[in] description Optional description of what exactly the command does.
  25. * @return Instantiated object.
  26. */
  27. static HSceneObject execute(const HPrefab& prefab, const WString& description = StringUtil::WBLANK);
  28. /** @copydoc EditorCommand::commit */
  29. void commit() override;
  30. /** @copydoc EditorCommand::revert */
  31. void revert() override;
  32. private:
  33. friend class UndoRedo;
  34. CmdInstantiateSO(const WString& description, const HPrefab& prefab);
  35. HPrefab mPrefab;
  36. HSceneObject mSceneObject;
  37. };
  38. /** @} */
  39. }