BsEditorApplication.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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(RenderAPIPlugin renderAPI);
  13. virtual ~EditorApplication();
  14. /**
  15. * @brief Starts the editorn with the specified render system.
  16. */
  17. static void startUp(RenderAPIPlugin renderAPI);
  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. /**
  48. * @brief Returns a set of serializable project settings that contain
  49. * every customizable property specific to a project.
  50. */
  51. ProjectSettingsPtr getProjectSettings() const { return mProjectSettings; }
  52. /**
  53. * @brief Saves the current editor settings at the default location.
  54. */
  55. void saveEditorSettings();
  56. /**
  57. * @brief Saves the current project settings at the default location.
  58. * Does nothing if no project is loaded.
  59. */
  60. void saveProjectSettings();
  61. private:
  62. virtual void onStartUp() override;
  63. virtual void onShutDown() override;
  64. virtual void preUpdate() override;
  65. virtual void postUpdate() override;
  66. /**
  67. * @brief Loads the previously saved editor widget layout from the default location.
  68. * Can return null if no layout was previously saved.
  69. */
  70. EditorWidgetLayoutPtr loadWidgetLayout();
  71. /**
  72. * @brief Saves the provided widget layout at the default layout location.
  73. */
  74. void saveWidgetLayout(const EditorWidgetLayoutPtr& layout);
  75. /**
  76. * @brief Loads the previously saved editor settings from the default location.
  77. * Overwrites any current settings.
  78. */
  79. void loadEditorSettings();
  80. /**
  81. * @brief Loads the previously saved project settings from the default location
  82. * within the active project. Loads default settings if no project is active.
  83. * Overwrites any current settings.
  84. */
  85. void loadProjectSettings();
  86. /**
  87. * @copydoc Application::getShaderIncludeHandler
  88. */
  89. virtual ShaderIncludeHandlerPtr getShaderIncludeHandler() const override;
  90. private:
  91. static const Path WIDGET_LAYOUT_PATH;
  92. static const Path BUILD_DATA_PATH;
  93. static const Path EDITOR_SETTINGS_PATH;
  94. static const Path PROJECT_SETTINGS_PATH;
  95. RenderAPIPlugin mActiveRAPIPlugin;
  96. EditorSettingsPtr mEditorSettings;
  97. ProjectSettingsPtr mProjectSettings;
  98. DynLib* mSBansheeEditorPlugin;
  99. // DEBUG ONLY
  100. HShader mTestShader;
  101. HMaterial mTestMaterial;
  102. HTexture mTestTexRef;
  103. HMesh mDbgMeshRef;
  104. };
  105. /**
  106. * @brief Returns the globally accessible instance of editor application.
  107. */
  108. BS_ED_EXPORT EditorApplication& gEditorApplication();
  109. }