BsEditorApplication.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsApplication.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Primary editor class containing the editor entry point.
  8. */
  9. class BS_ED_EXPORT EditorApplication : public Application
  10. {
  11. public:
  12. EditorApplication(RenderSystemPlugin renderSystemPlugin);
  13. virtual ~EditorApplication();
  14. /**
  15. * @brief Starts the editorn with the specified render system.
  16. */
  17. static void startUp(RenderSystemPlugin renderSystemPlugin);
  18. /**
  19. * @brief Checks whether the editor currently has a project loaded.
  20. */
  21. bool isProjectLoaded() const;
  22. /**
  23. * @brief Returns the path to the currently loaded project.
  24. */
  25. const Path& getProjectPath() const;
  26. /**
  27. * @brief Returns the name of the currently loaded project.
  28. */
  29. const WString& getProjectName() const;
  30. /**
  31. * @brief Returns the absolute path to the built-in managed editor assembly file.
  32. */
  33. Path getEditorAssemblyPath() const;
  34. /**
  35. * @brief Returns the absolute path of the managed editor script assembly file.
  36. */
  37. Path getEditorScriptAssemblyPath() const;
  38. /**
  39. * @copydoc Application::getScriptAssemblyFolder
  40. */
  41. Path getScriptAssemblyFolder() const override;
  42. /**
  43. * @brief Returns a set of serializable editor settings that contain
  44. * every globally customizable editor property.
  45. */
  46. EditorSettingsPtr getEditorSettings() const { return mEditorSettings; }
  47. private:
  48. virtual void onStartUp() override;
  49. virtual void onShutDown() override;
  50. virtual void preUpdate() override;
  51. virtual void postUpdate() override;
  52. /**
  53. * @brief Loads the previously saved editor widget layout from the default location.
  54. * Can return null if no layout was previously saved.
  55. */
  56. EditorWidgetLayoutPtr loadWidgetLayout();
  57. /**
  58. * @brief Saves the provided widget layout at the default layout location.
  59. */
  60. void saveWidgetLayout(const EditorWidgetLayoutPtr& layout);
  61. /**
  62. * @copydoc Application::getShaderIncludeHandler
  63. */
  64. virtual ShaderIncludeHandlerPtr getShaderIncludeHandler() const override;
  65. private:
  66. static const Path WIDGET_LAYOUT_PATH;
  67. static const Path BUILD_DATA_PATH;
  68. RenderSystemPlugin mActiveRSPlugin;
  69. EditorSettingsPtr mEditorSettings;
  70. DynLib* mSBansheeEditorPlugin;
  71. // DEBUG ONLY
  72. HShader mTestShader;
  73. HMaterial mTestMaterial;
  74. HTexture mTestTexRef;
  75. HMesh mDbgMeshRef;
  76. };
  77. /**
  78. * @brief Returns the globally accessible instance of editor application.
  79. */
  80. BS_ED_EXPORT EditorApplication& gEditorApplication();
  81. }