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