BsCmdCloneSO.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. Clones scene object(s)
  12. * and removes them as an undo operation.
  13. */
  14. class BS_ED_EXPORT CmdCloneSO : public EditorCommand
  15. {
  16. public:
  17. ~CmdCloneSO();
  18. /**
  19. * @brief Creates a new scene object by cloning an existing object.
  20. * Automatically registers the command with undo/redo system.
  21. *
  22. * @param sceneObject Scene object to clone.
  23. * @param description Optional description of what exactly the command does.
  24. *
  25. * @return Cloned object.
  26. */
  27. static HSceneObject execute(const HSceneObject& sceneObject, const WString& description = StringUtil::WBLANK);
  28. /**
  29. * @brief Creates new scene object(s) by cloning existing objects.
  30. * Automatically registers the command with undo/redo system.
  31. *
  32. * @param sceneObjects Scene object(s) to clone.
  33. * @param description Optional description of what exactly the command does.
  34. *
  35. * @return Cloned objects.
  36. */
  37. static Vector<HSceneObject> execute(const Vector<HSceneObject>& sceneObjects, const WString& description = StringUtil::WBLANK);
  38. /**
  39. * @copydoc EditorCommand::commit
  40. */
  41. void commit() override;
  42. /**
  43. * @copydoc EditorCommand::revert
  44. */
  45. void revert() override;
  46. private:
  47. friend class UndoRedo;
  48. CmdCloneSO(const WString& description, const Vector<HSceneObject>& originals);
  49. Vector<HSceneObject> mOriginals;
  50. Vector<HSceneObject> mClones;
  51. };
  52. }