BsCmdUtility.h 1.4 KB

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