|
|
@@ -6,6 +6,9 @@ using BansheeEngine;
|
|
|
|
|
|
namespace BansheeEditor
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// Available tools in the scene view.
|
|
|
+ /// </summary>
|
|
|
public enum SceneViewTool
|
|
|
{
|
|
|
View,
|
|
|
@@ -14,69 +17,125 @@ namespace BansheeEditor
|
|
|
Scale
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Pivot mode used by the scene view tools.
|
|
|
+ /// </summary>
|
|
|
public enum HandlePivotMode
|
|
|
{
|
|
|
Center,
|
|
|
Pivot
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Coordinate mode used by the scene view tools.
|
|
|
+ /// </summary>
|
|
|
public enum HandleCoordinateMode
|
|
|
{
|
|
|
Local,
|
|
|
World
|
|
|
}
|
|
|
|
|
|
- public enum EditorPlatformType
|
|
|
- {
|
|
|
- Windows
|
|
|
- }
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// Manages various generic and global settings relating to the editor.
|
|
|
+ /// </summary>
|
|
|
public class EditorApplication
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// Determines the active tool shown in the scene view.
|
|
|
+ /// </summary>
|
|
|
public static SceneViewTool ActiveSceneTool
|
|
|
{
|
|
|
get { return EditorSettings.ActiveSceneTool; }
|
|
|
set { EditorSettings.ActiveSceneTool = value; }
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Determines the coordinate mode used by the tools in the scene view.
|
|
|
+ /// </summary>
|
|
|
public static HandleCoordinateMode ActiveCoordinateMode
|
|
|
{
|
|
|
get { return EditorSettings.ActiveCoordinateMode; }
|
|
|
set { EditorSettings.ActiveCoordinateMode = value; }
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Determines the pivot mode used by the tools in the scene view.
|
|
|
+ /// </summary>
|
|
|
public static HandlePivotMode ActivePivotMode
|
|
|
{
|
|
|
get { return EditorSettings.ActivePivotMode; }
|
|
|
set { EditorSettings.ActivePivotMode = value; }
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Camera used for rendering the scene view.
|
|
|
+ /// </summary>
|
|
|
public static Camera SceneViewCamera
|
|
|
{
|
|
|
get { return EditorWindow.GetWindow<SceneWindow>().Camera; }
|
|
|
}
|
|
|
|
|
|
- public static EditorPlatformType EditorPlatform
|
|
|
- {
|
|
|
- get { return EditorPlatformType.Windows; } // TODO - Set this properly once we have support for more platforms
|
|
|
- }
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// Absolute path to the folder containing the currently open project.
|
|
|
+ /// </summary>
|
|
|
public static string ProjectPath { get { return Internal_GetProjectPath(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Name of the currently open project.
|
|
|
+ /// </summary>
|
|
|
public static string ProjectName { get { return Internal_GetProjectName(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Checks is any project currently loaded.
|
|
|
+ /// </summary>
|
|
|
public static bool IsProjectLoaded { get { return Internal_GetProjectLoaded(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Returns the path where the script compiler is located at.
|
|
|
+ /// </summary>
|
|
|
internal static string CompilerPath { get { return Internal_GetCompilerPath(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Returns the path to the folder where the builtin script assemblies are located at.
|
|
|
+ /// </summary>
|
|
|
internal static string BuiltinAssemblyPath { get { return Internal_GetBuiltinAssemblyPath(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Returns the path to the folder where the custom script assemblies are located at.
|
|
|
+ /// </summary>
|
|
|
internal static string ScriptAssemblyPath { get { return Internal_GetScriptAssemblyPath(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Returns the path to the folder where the .NET framework assemblies are located at.
|
|
|
+ /// </summary>
|
|
|
internal static string FrameworkAssemblyPath { get { return Internal_GetFrameworkAssemblyPath(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Name of the builtin assembly containing engine specific types.
|
|
|
+ /// </summary>
|
|
|
internal static string EngineAssembly { get { return Internal_GetEngineAssemblyName(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Name of the builtin assembly containing editor specific types.
|
|
|
+ /// </summary>
|
|
|
internal static string EditorAssembly { get { return Internal_GetEditorAssemblyName(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Name of the custom assembly compiled from non-editor scripts within the project.
|
|
|
+ /// </summary>
|
|
|
internal static string ScriptGameAssembly { get { return Internal_GetScriptGameAssemblyName(); } }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Name of the custom assembly compiled from editor scripts within the project.
|
|
|
+ /// </summary>
|
|
|
internal static string ScriptEditorAssembly { get { return Internal_GetScriptEditorAssemblyName(); } }
|
|
|
|
|
|
private static EditorApplication instance;
|
|
|
-
|
|
|
private static FolderMonitor monitor;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Constructs a new editor application. Called at editor start-up by the runtime.
|
|
|
+ /// </summary>
|
|
|
internal EditorApplication()
|
|
|
{
|
|
|
instance = this;
|
|
|
@@ -105,30 +164,27 @@ namespace BansheeEditor
|
|
|
inputConfig.RegisterButton(SceneWindow.DuplicateBinding, ButtonCode.D, ButtonModifier.Ctrl);
|
|
|
}
|
|
|
|
|
|
- private static void OnEditorLoad()
|
|
|
- {
|
|
|
- if (EditorSettings.AutoLoadLastProject)
|
|
|
- {
|
|
|
- string projectPath = EditorSettings.LastOpenProject;
|
|
|
- if (Internal_IsValidProject(projectPath))
|
|
|
- LoadProject(projectPath);
|
|
|
- else
|
|
|
- ProjectWindow.Open();
|
|
|
- }
|
|
|
- else
|
|
|
- ProjectWindow.Open();
|
|
|
- }
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// Triggered when the folder monitor detects an asset in the monitored folder was modified.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="path">Path to the modified file or folder.</param>
|
|
|
private static void OnAssetModified(string path)
|
|
|
{
|
|
|
ProjectLibrary.Refresh(path);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Called 60 times per second by the runtime.
|
|
|
+ /// </summary>
|
|
|
internal void OnEditorUpdate()
|
|
|
{
|
|
|
ProjectLibrary.Update();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Opens a dialog that allows the user to select a new prefab to load as the current scene. If current scene
|
|
|
+ /// is modified the user is offered a chance to save it.
|
|
|
+ /// </summary>
|
|
|
[MenuItem("File/Open Scene", ButtonModifier.Ctrl, ButtonCode.L, 10050, true)]
|
|
|
private static void LoadScene()
|
|
|
{
|
|
|
@@ -140,6 +196,10 @@ namespace BansheeEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Opens a dialog to allows the user to select a location where to save the current scene. If scene was previously
|
|
|
+ /// saved it is instead automatically saved at the last location.
|
|
|
+ /// </summary>
|
|
|
[MenuItem("File/Save Scene", ButtonModifier.Ctrl, ButtonCode.S, 10049)]
|
|
|
private static void SaveScene()
|
|
|
{
|
|
|
@@ -152,6 +212,9 @@ namespace BansheeEditor
|
|
|
SaveSceneAs();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Opens a dialog to allows the user to select a location where to save the current scene.
|
|
|
+ /// </summary>
|
|
|
[MenuItem("File/Save Scene As", 10048)]
|
|
|
private static void SaveSceneAs()
|
|
|
{
|
|
|
@@ -171,6 +234,11 @@ namespace BansheeEditor
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Loads a prefab as the current scene at the specified path. If current scene is modified the user is offered a
|
|
|
+ /// chance to save it.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="path">Path to a valid prefab, relative to the resource folder.</param>
|
|
|
public static void LoadScene(string path)
|
|
|
{
|
|
|
Action<string> continueLoad =
|
|
|
@@ -203,22 +271,38 @@ namespace BansheeEditor
|
|
|
continueLoad(path);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Checks does the folder at the provieded path contain a valid project.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="path">Absolute path to the root project folder.</param>
|
|
|
+ /// <returns>True if the folder contains a valid project.</returns>
|
|
|
public static bool IsValidProject(string path)
|
|
|
{
|
|
|
return Internal_IsValidProject(path);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Contains a new project in the provided folder.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="path">Absolute path to the folder to create the project in. Name of this folder will be used as the
|
|
|
+ /// project's name.</param>
|
|
|
public static void CreateProject(string path)
|
|
|
{
|
|
|
Internal_CreateProject(path);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Opens a Project Window allowing you to browse for or create a project.
|
|
|
+ /// </summary>
|
|
|
[MenuItem("File/Open Project", 10100)]
|
|
|
public static void BrowseForProject()
|
|
|
{
|
|
|
ProjectWindow.Open();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Saves all data in the currently open project.
|
|
|
+ /// </summary>
|
|
|
[MenuItem("File/Save Project", 10099)]
|
|
|
public static void SaveProject()
|
|
|
{
|
|
|
@@ -227,7 +311,11 @@ namespace BansheeEditor
|
|
|
Internal_SaveProject();
|
|
|
}
|
|
|
|
|
|
- // Note: Async, runs next frame
|
|
|
+ /// <summary>
|
|
|
+ /// Loads the project at the specified path. This method executes asynchronously and will trigger
|
|
|
+ /// <see cref="OnProjectLoaded"/> when done.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="path">Absolute path to the project's root folder.</param>
|
|
|
public static void LoadProject(string path)
|
|
|
{
|
|
|
if (IsProjectLoaded && path == ProjectPath)
|
|
|
@@ -254,6 +342,9 @@ namespace BansheeEditor
|
|
|
Internal_OpenExternally(path);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Triggered when <see cref="LoadProject"/> method completes.
|
|
|
+ /// </summary>
|
|
|
private static void OnProjectLoaded()
|
|
|
{
|
|
|
if (!IsProjectLoaded)
|
|
|
@@ -304,6 +395,10 @@ namespace BansheeEditor
|
|
|
Scene.Load(ProjectSettings.LastOpenScene);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Unloads the currently loaded project. Offers the user a chance to save the current scene if it is modified.
|
|
|
+ /// Automatically saves all project data before unloading.
|
|
|
+ /// </summary>
|
|
|
private static void UnloadProject()
|
|
|
{
|
|
|
Action continueUnload =
|