| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsEditorPrerequisites.h"
- #include "UndoRedo/BsEditorCommand.h"
- #include "UndoRedo/BsUndoRedo.h"
- namespace bs
- {
- /** @addtogroup UndoRedo
- * @{
- */
- /**
- * A command used for undo/redo purposes. It records a scene object parent change operations. It allows you to apply
- * the parent change or revert the object to its original parent as needed.
- */
- class BS_ED_EXPORT CmdReparentSO final : public EditorCommand
- {
- public:
- /**
- * Creates and executes the command on the provided scene object(s). Automatically registers the command with
- * undo/redo system.
- *
- * @param[in] sceneObjects Object(s) to change the parent for.
- * @param[in] newParent New parent for the provided objects.
- * @param[in] description Optional description of what exactly the command does.
- */
- static void execute(const Vector<HSceneObject>& sceneObjects, const HSceneObject& newParent,
- const String& description = StringUtil::BLANK);
- /**
- * Creates and executes the command on the provided scene object. Automatically registers the command with
- * undo/redo system.
- *
- * @param[in] sceneObject Object to change the parent for.
- * @param[in] newParent New parent for the provided objects.
- * @param[in] description Optional description of what exactly the command does.
- */
- static void execute(HSceneObject& sceneObject, const HSceneObject& newParent,
- const String& description = StringUtil::BLANK);
- /** @copydoc EditorCommand::commit */
- void commit() override;
- /** @copydoc EditorCommand::revert */
- void revert() override;
- private:
- friend class UndoRedo;
- CmdReparentSO(const String& description, const Vector<HSceneObject>& sceneObjects, const HSceneObject& newParent);
- Vector<HSceneObject> mSceneObjects;
- Vector<HSceneObject> mOldParents;
- HSceneObject mNewParent;
- };
- /** @} */
- }
|