BsCmdInstantiateSO.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 "UndoRedo/BsEditorCommand.h"
  6. #include "UndoRedo/BsUndoRedo.h"
  7. namespace bs
  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 final : public EditorCommand
  17. {
  18. public:
  19. /**
  20. * Instantiates the specified prefab. Automatically registers the command with undo/redo system.
  21. *
  22. * @param[in] prefab Prefab to instantiate.
  23. * @param[in] description Optional description of what exactly the command does.
  24. * @return Instantiated object.
  25. */
  26. static HSceneObject execute(const HPrefab& prefab, const String& description = StringUtil::BLANK);
  27. /** @copydoc EditorCommand::commit */
  28. void commit() override;
  29. /** @copydoc EditorCommand::revert */
  30. void revert() override;
  31. private:
  32. friend class UndoRedo;
  33. CmdInstantiateSO(const String& description, const HPrefab& prefab);
  34. HPrefab mPrefab;
  35. HSceneObject mSceneObject;
  36. };
  37. /** @} */
  38. }