BsCmdUtility.h 1.7 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. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Contains various utility methods and structures used by EditorCommand%s.
  9. */
  10. class CmdUtility
  11. {
  12. public:
  13. /**
  14. * @brief Contains stored information about stored scene object instance data,
  15. * including all of its children and components.
  16. *
  17. * @note When object is serialized it will receive new instance data (as if it was a new
  18. * object). But we want to restore the original object completely (including any references
  19. * other objects might have to it) so we need store the instance data.
  20. */
  21. struct SceneObjProxy
  22. {
  23. GameObjectInstanceDataPtr instanceData;
  24. Vector<GameObjectInstanceDataPtr> componentInstanceData;
  25. Vector<SceneObjProxy> children;
  26. };
  27. /**
  28. * @brief Parses the scene object hierarchy and components and generates a
  29. * hierarchy of instance data required to restore the object identities.
  30. */
  31. static SceneObjProxy createProxy(const HSceneObject& sceneObject);
  32. /**
  33. * @brief Restores original object instance data from the provided scene object proxy
  34. * that was previously generated using ::createProxy.
  35. *
  36. * @param restored New instance of the object.
  37. * @param proxy Proxy data containing the original object instance data
  38. * we want to restore.
  39. */
  40. static void restoreIds(const HSceneObject& restored, SceneObjProxy& proxy);
  41. };
  42. }