| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsEditorPrerequisites.h"
- #include "BsApplication.h"
- #include "Utility/BsTimer.h"
- namespace bs
- {
- /** @addtogroup Application-Editor
- * @{
- */
- /** Primary editor class containing the editor entry point. */
- class BS_ED_EXPORT EditorApplication : public Application
- {
- public:
- EditorApplication();
- virtual ~EditorApplication();
- /** Starts the editor with the specified render and audio systems. */
- static void startUp();
- /** Checks whether the editor currently has a project loaded. */
- bool isProjectLoaded() const { return mIsProjectLoaded; }
- /** Returns the path to the currently loaded project. */
- const Path& getProjectPath() const { return mProjectPath; }
- /** Returns the name of the currently loaded project. */
- const String& getProjectName() const { return mProjectName; }
- /** Returns a set of serializable editor settings that contain every globally customizable editor property. */
- SPtr<EditorSettings> getEditorSettings() const { return mEditorSettings; }
- /** Returns a set of serializable project settings that contain every customizable property specific to a project. */
- SPtr<ProjectSettings> getProjectSettings() const { return mProjectSettings; }
- /** Saves the current editor settings at the default location. */
- void saveEditorSettings();
- /** Saves the current project settings at the default location. Does nothing if no project is loaded. */
- void saveProjectSettings();
- /** Saves any project specific data, if a project is currently loaded. */
- void saveProject();
- /** Unloads the currently loaded project, if any. */
- void unloadProject();
- /**
- * Loads a new project, unloading the current one.
- *
- * @param[in] path Absolute path to the root project folder. Must be pointing to a valid project.
- */
- void loadProject(const Path& path);
- /**
- * Creates a new project at the specified path.
- *
- * @param[in] path Path to the folder where to create the project in. Name of this folder will be the name of
- * the project.
- */
- void createProject(const Path& path);
- /**
- * Checks is the provided folder a valid project.
- *
- * @param[in] path Absolute path to the root project folder.
- */
- bool isValidProjectPath(const Path& path);
- /** @copydoc Application::isEditor */
- bool isEditor() const override { return true; }
- /** Callback when the user requests application exit. The receiver is expected to handle shutdown if required. */
- Event<void()> onQuitRequested;
- private:
- /** @copydoc Module::onStartUp */
- void onStartUp() override;
- /** @copydoc Module::onShutDown */
- void onShutDown() override;
- /** @copydoc CoreApplication::preUpdate */
- void preUpdate() override;
- /** @copydoc CoreApplication::postUpdate */
- void postUpdate() override;
- /** @copydoc CoreApplication::quitRequested */
- void quitRequested() override;
- /** @copydoc Application::startUpRenderer */
- void startUpRenderer() override;
- /** @copydoc Application::startUpScriptManager */
- void startUpScriptManager() override;
- /** @copydoc Application::updateScriptManager */
- void updateScriptManager() override;
- /**
- * Loads the previously saved editor widget layout from the default location. Can return null if no layout was
- * previously saved.
- */
- SPtr<EditorWidgetLayout> loadWidgetLayout();
- /** Saves the provided widget layout at the default layout location. */
- void saveWidgetLayout(const SPtr<EditorWidgetLayout>& layout);
- /** Saves the default widget layout in the provided folder. */
- void saveDefaultWidgetLayout(const Path& folder);
- /** Loads the previously saved editor settings from the default location. Overwrites any current settings. */
- void loadEditorSettings();
- /**
- * Loads the previously saved project settings from the default location within the active project. Loads default
- * settings if no project is active. Overwrites any current settings.
- */
- void loadProjectSettings();
- /** @copydoc Application::getShaderIncludeHandler */
- SPtr<IShaderIncludeHandler> getShaderIncludeHandler() const override;
- private:
- static const Path WIDGET_LAYOUT_PATH;
- static const Path BUILD_DATA_PATH;
- static const Path PROJECT_SETTINGS_PATH;
- SPtr<EditorSettings> mEditorSettings;
- SPtr<ProjectSettings> mProjectSettings;
- bool mIsProjectLoaded;
- Path mProjectPath;
- String mProjectName;
- Timer mSplashScreenTimer;
- bool mSplashScreenShown = true;
- };
- /** Easy way to access EditorApplication. */
- BS_ED_EXPORT EditorApplication& gEditorApplication();
- /** @} */
- }
|