Add Build Actions option to editor settings for build button configuration
This commit is contained in:
@@ -242,8 +242,6 @@ namespace FlaxEditor
|
|||||||
StateMachine = new EditorStateMachine(this);
|
StateMachine = new EditorStateMachine(this);
|
||||||
Undo = new EditorUndo(this);
|
Undo = new EditorUndo(this);
|
||||||
|
|
||||||
ScriptsBuilder.ScriptsReloadBegin += ScriptsBuilder_ScriptsReloadBegin;
|
|
||||||
ScriptsBuilder.ScriptsReloadEnd += ScriptsBuilder_ScriptsReloadEnd;
|
|
||||||
UIControl.FallbackParentGetDelegate += OnUIControlFallbackParentGet;
|
UIControl.FallbackParentGetDelegate += OnUIControlFallbackParentGet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,18 +258,6 @@ namespace FlaxEditor
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ScriptsBuilder_ScriptsReloadBegin()
|
|
||||||
{
|
|
||||||
EnsureState<EditingSceneState>();
|
|
||||||
StateMachine.GoToState<ReloadingScriptsState>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ScriptsBuilder_ScriptsReloadEnd()
|
|
||||||
{
|
|
||||||
EnsureState<ReloadingScriptsState>();
|
|
||||||
StateMachine.GoToState<EditingSceneState>();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void RegisterModule(EditorModule module)
|
internal void RegisterModule(EditorModule module)
|
||||||
{
|
{
|
||||||
Log("Register Editor module " + module);
|
Log("Register Editor module " + module);
|
||||||
@@ -497,9 +483,6 @@ namespace FlaxEditor
|
|||||||
Surface.VisualScriptSurface.NodesCache.Clear();
|
Surface.VisualScriptSurface.NodesCache.Clear();
|
||||||
Instance = null;
|
Instance = null;
|
||||||
|
|
||||||
ScriptsBuilder.ScriptsReloadBegin -= ScriptsBuilder_ScriptsReloadBegin;
|
|
||||||
ScriptsBuilder.ScriptsReloadEnd -= ScriptsBuilder_ScriptsReloadEnd;
|
|
||||||
|
|
||||||
// Invoke new instance if need to open a project
|
// Invoke new instance if need to open a project
|
||||||
if (!string.IsNullOrEmpty(_projectToOpen))
|
if (!string.IsNullOrEmpty(_projectToOpen))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ namespace FlaxEditor.Modules
|
|||||||
_toolStripRotate = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Rotate32, () => Editor.MainTransformGizmo.ActiveMode = TransformGizmoBase.Mode.Rotate).LinkTooltip("Change Gizmo tool mode to Rotate (2)");
|
_toolStripRotate = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Rotate32, () => Editor.MainTransformGizmo.ActiveMode = TransformGizmoBase.Mode.Rotate).LinkTooltip("Change Gizmo tool mode to Rotate (2)");
|
||||||
_toolStripScale = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Scale32, () => Editor.MainTransformGizmo.ActiveMode = TransformGizmoBase.Mode.Scale).LinkTooltip("Change Gizmo tool mode to Scale (3)");
|
_toolStripScale = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Scale32, () => Editor.MainTransformGizmo.ActiveMode = TransformGizmoBase.Mode.Scale).LinkTooltip("Change Gizmo tool mode to Scale (3)");
|
||||||
ToolStrip.AddSeparator();
|
ToolStrip.AddSeparator();
|
||||||
_toolStripBuildScenes = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Build32, Editor.BuildScenesOrCancel).LinkTooltip("Build scenes data - CSG, navmesh, static lighting, env probes (Ctrl+F10)");
|
_toolStripBuildScenes = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Build32, Editor.BuildScenesOrCancel).LinkTooltip("Build scenes data - CSG, navmesh, static lighting, env probes - configurable via Build Actions in editor options (Ctrl+F10)");
|
||||||
ToolStrip.AddSeparator();
|
ToolStrip.AddSeparator();
|
||||||
_toolStripPlay = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Play32, Editor.Simulation.RequestPlayOrStopPlay).LinkTooltip("Start/Stop game (F5)");
|
_toolStripPlay = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Play32, Editor.Simulation.RequestPlayOrStopPlay).LinkTooltip("Start/Stop game (F5)");
|
||||||
_toolStripPause = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Pause32, Editor.Simulation.RequestResumeOrPause).LinkTooltip("Pause/Resume game(F6)");
|
_toolStripPause = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Pause32, Editor.Simulation.RequestResumeOrPause).LinkTooltip("Pause/Resume game(F6)");
|
||||||
|
|||||||
@@ -32,6 +32,42 @@ namespace FlaxEditor.Options
|
|||||||
LastOpened,
|
LastOpened,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The build actions.
|
||||||
|
/// </summary>
|
||||||
|
public enum BuildAction
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Builds Constructive Solid Geometry brushes into meshes.
|
||||||
|
/// </summary>
|
||||||
|
[Tooltip("Builds Constructive Solid Geometry brushes into meshes.")]
|
||||||
|
CSG,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds Env Probes and Sky Lights to prerendered cube textures.
|
||||||
|
/// </summary>
|
||||||
|
[Tooltip("Builds Env Probes and Sky Lights to prerendered cube textures.")]
|
||||||
|
EnvProbes,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds static lighting into lightmaps.
|
||||||
|
/// </summary>
|
||||||
|
[Tooltip("Builds static lighting into lightmaps.")]
|
||||||
|
StaticLighting,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds navigation meshes.
|
||||||
|
/// </summary>
|
||||||
|
[Tooltip("Builds navigation meshes.")]
|
||||||
|
NavMesh,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compiles the scripts.
|
||||||
|
/// </summary>
|
||||||
|
[Tooltip("Compiles the scripts.")]
|
||||||
|
CompileScripts,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the scene to load on editor startup.
|
/// Gets or sets the scene to load on editor startup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -53,6 +89,19 @@ namespace FlaxEditor.Options
|
|||||||
[EditorDisplay("General", "Editor FPS"), EditorOrder(110), Tooltip("Limit for the editor draw/update frames per second rate (FPS). Use higher values if you need more responsive interface or lower values to use less device power. Value 0 disables any limits.")]
|
[EditorDisplay("General", "Editor FPS"), EditorOrder(110), Tooltip("Limit for the editor draw/update frames per second rate (FPS). Use higher values if you need more responsive interface or lower values to use less device power. Value 0 disables any limits.")]
|
||||||
public float EditorFPS { get; set; } = 60.0f;
|
public float EditorFPS { get; set; } = 60.0f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the sequence of actions to perform when using Build Scenes button. Can be used to configure this as button (eg. compile code or just update navmesh).
|
||||||
|
/// </summary>
|
||||||
|
[EditorDisplay("General"), EditorOrder(200), Tooltip("The sequence of actions to perform when using Build Scenes button. Can be used to configure this as button (eg. compile code or just update navmesh).")]
|
||||||
|
public BuildAction[] BuildActions { get; set; } =
|
||||||
|
{
|
||||||
|
BuildAction.CSG,
|
||||||
|
BuildAction.EnvProbes,
|
||||||
|
BuildAction.StaticLighting,
|
||||||
|
BuildAction.EnvProbes,
|
||||||
|
BuildAction.NavMesh,
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether perform automatic scripts reload on main window focus.
|
/// Gets or sets a value indicating whether perform automatic scripts reload on main window focus.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using FlaxEditor.Options;
|
||||||
using FlaxEditor.SceneGraph.Actors;
|
using FlaxEditor.SceneGraph.Actors;
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
using FlaxEngine.Utilities;
|
using FlaxEngine.Utilities;
|
||||||
@@ -16,6 +19,9 @@ namespace FlaxEditor.States
|
|||||||
{
|
{
|
||||||
private sealed class SubStateMachine : StateMachine
|
private sealed class SubStateMachine : StateMachine
|
||||||
{
|
{
|
||||||
|
public int ActionIndex = -1;
|
||||||
|
public readonly List<GeneralOptions.BuildAction> Actions = new List<GeneralOptions.BuildAction>();
|
||||||
|
|
||||||
protected override void SwitchState(State nextState)
|
protected override void SwitchState(State nextState)
|
||||||
{
|
{
|
||||||
if (CurrentState != null && nextState != null)
|
if (CurrentState != null && nextState != null)
|
||||||
@@ -27,10 +33,40 @@ namespace FlaxEditor.States
|
|||||||
|
|
||||||
private abstract class SubState : State
|
private abstract class SubState : State
|
||||||
{
|
{
|
||||||
|
public virtual bool DirtyScenes => true;
|
||||||
|
|
||||||
|
public virtual bool CanReloadScripts => false;
|
||||||
|
|
||||||
|
public virtual void Before()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Update()
|
public virtual void Update()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void Done()
|
||||||
|
{
|
||||||
|
var stateMachine = (SubStateMachine)StateMachine;
|
||||||
|
stateMachine.ActionIndex++;
|
||||||
|
if (stateMachine.ActionIndex < stateMachine.Actions.Count)
|
||||||
|
{
|
||||||
|
var action = stateMachine.Actions[stateMachine.ActionIndex];
|
||||||
|
var state = stateMachine.States.FirstOrDefault(x => x is ActionState a && a.Action == action);
|
||||||
|
if (state != null)
|
||||||
|
{
|
||||||
|
StateMachine.GoToState(state);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Editor.LogError($"Missing or invalid build scene action {action}.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StateMachine.GoToState<EndState>();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Cancel()
|
public virtual void Cancel()
|
||||||
{
|
{
|
||||||
StateMachine.GoToState<EndState>();
|
StateMachine.GoToState<EndState>();
|
||||||
@@ -45,18 +81,31 @@ namespace FlaxEditor.States
|
|||||||
{
|
{
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
var editor = Editor.Instance;
|
var stateMachine = (SubStateMachine)StateMachine;
|
||||||
foreach (var scene in Level.Scenes)
|
var scenesDirty = false;
|
||||||
|
foreach (var state in stateMachine.States)
|
||||||
{
|
{
|
||||||
scene.ClearLightmaps();
|
((SubState)state).Before();
|
||||||
editor.Scene.MarkSceneEdited(scene);
|
scenesDirty |= ((SubState)state).DirtyScenes;
|
||||||
}
|
}
|
||||||
StateMachine.GoToState<CSGState>();
|
if (scenesDirty)
|
||||||
|
{
|
||||||
|
foreach (var scene in Level.Scenes)
|
||||||
|
Editor.Instance.Scene.MarkSceneEdited(scene);
|
||||||
|
}
|
||||||
|
Done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class CSGState : SubState
|
private abstract class ActionState : SubState
|
||||||
{
|
{
|
||||||
|
public abstract GeneralOptions.BuildAction Action { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class CSGState : ActionState
|
||||||
|
{
|
||||||
|
public override GeneralOptions.BuildAction Action => GeneralOptions.BuildAction.CSG;
|
||||||
|
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
foreach (var scene in Level.Scenes)
|
foreach (var scene in Level.Scenes)
|
||||||
@@ -68,13 +117,14 @@ namespace FlaxEditor.States
|
|||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (!Editor.Internal_GetIsCSGActive())
|
if (!Editor.Internal_GetIsCSGActive())
|
||||||
StateMachine.GoToState<EnvProbesNoGIState>();
|
Done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class EnvProbesState : ActionState
|
||||||
private class EnvProbesNoGIState : SubState
|
|
||||||
{
|
{
|
||||||
|
public override GeneralOptions.BuildAction Action => GeneralOptions.BuildAction.EnvProbes;
|
||||||
|
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
Editor.Instance.Scene.ExecuteOnGraph(node =>
|
Editor.Instance.Scene.ExecuteOnGraph(node =>
|
||||||
@@ -94,12 +144,20 @@ namespace FlaxEditor.States
|
|||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (!Editor.Instance.ProgressReporting.BakeEnvProbes.IsActive)
|
if (!Editor.Instance.ProgressReporting.BakeEnvProbes.IsActive)
|
||||||
StateMachine.GoToState<StaticLightingState>();
|
Done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class StaticLightingState : SubState
|
private sealed class StaticLightingState : ActionState
|
||||||
{
|
{
|
||||||
|
public override GeneralOptions.BuildAction Action => GeneralOptions.BuildAction.StaticLighting;
|
||||||
|
|
||||||
|
public override void Before()
|
||||||
|
{
|
||||||
|
foreach (var scene in Level.Scenes)
|
||||||
|
scene.ClearLightmaps();
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
Editor.LightmapsBakeEnd += OnLightmapsBakeEnd;
|
Editor.LightmapsBakeEnd += OnLightmapsBakeEnd;
|
||||||
@@ -110,7 +168,6 @@ namespace FlaxEditor.States
|
|||||||
OnLightmapsBakeEnd(false);
|
OnLightmapsBakeEnd(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void Cancel()
|
public override void Cancel()
|
||||||
{
|
{
|
||||||
Editor.Internal_BakeLightmaps(true);
|
Editor.Internal_BakeLightmaps(true);
|
||||||
@@ -125,21 +182,14 @@ namespace FlaxEditor.States
|
|||||||
|
|
||||||
private void OnLightmapsBakeEnd(bool failed)
|
private void OnLightmapsBakeEnd(bool failed)
|
||||||
{
|
{
|
||||||
StateMachine.GoToState<EnvProbesWithGIState>();
|
Done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class EnvProbesWithGIState : EnvProbesNoGIState
|
private sealed class NavMeshState : ActionState
|
||||||
{
|
{
|
||||||
public override void Update()
|
public override GeneralOptions.BuildAction Action => GeneralOptions.BuildAction.NavMesh;
|
||||||
{
|
|
||||||
if (!Editor.Instance.ProgressReporting.BakeEnvProbes.IsActive)
|
|
||||||
StateMachine.GoToState<NavMeshState>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private sealed class NavMeshState : SubState
|
|
||||||
{
|
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
foreach (var scene in Level.Scenes)
|
foreach (var scene in Level.Scenes)
|
||||||
@@ -151,7 +201,58 @@ namespace FlaxEditor.States
|
|||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (!Navigation.IsBuildingNavMesh)
|
if (!Navigation.IsBuildingNavMesh)
|
||||||
StateMachine.GoToState<EndState>();
|
Done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class CompileScriptsState : ActionState
|
||||||
|
{
|
||||||
|
private bool _compiled, _reloaded;
|
||||||
|
|
||||||
|
public override GeneralOptions.BuildAction Action => GeneralOptions.BuildAction.CompileScripts;
|
||||||
|
|
||||||
|
public override bool DirtyScenes => false;
|
||||||
|
|
||||||
|
public override bool CanReloadScripts => true;
|
||||||
|
|
||||||
|
public override void OnEnter()
|
||||||
|
{
|
||||||
|
_compiled = _reloaded = false;
|
||||||
|
ScriptsBuilder.Compile();
|
||||||
|
|
||||||
|
ScriptsBuilder.CompilationSuccess += OnCompilationSuccess;
|
||||||
|
ScriptsBuilder.CompilationFailed += OnCompilationFailed;
|
||||||
|
ScriptsBuilder.ScriptsReloadEnd += OnScriptsReloadEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnExit(State nextState)
|
||||||
|
{
|
||||||
|
ScriptsBuilder.CompilationSuccess -= OnCompilationSuccess;
|
||||||
|
ScriptsBuilder.CompilationFailed -= OnCompilationFailed;
|
||||||
|
ScriptsBuilder.ScriptsReloadEnd -= OnScriptsReloadEnd;
|
||||||
|
|
||||||
|
base.OnExit(nextState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCompilationSuccess()
|
||||||
|
{
|
||||||
|
_compiled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCompilationFailed()
|
||||||
|
{
|
||||||
|
Cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnScriptsReloadEnd()
|
||||||
|
{
|
||||||
|
_reloaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update()
|
||||||
|
{
|
||||||
|
if (_compiled && _reloaded)
|
||||||
|
Done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,10 +274,10 @@ namespace FlaxEditor.States
|
|||||||
_stateMachine.AddState(new BeginState());
|
_stateMachine.AddState(new BeginState());
|
||||||
_stateMachine.AddState(new SetupState());
|
_stateMachine.AddState(new SetupState());
|
||||||
_stateMachine.AddState(new CSGState());
|
_stateMachine.AddState(new CSGState());
|
||||||
_stateMachine.AddState(new EnvProbesNoGIState());
|
_stateMachine.AddState(new EnvProbesState());
|
||||||
_stateMachine.AddState(new StaticLightingState());
|
_stateMachine.AddState(new StaticLightingState());
|
||||||
_stateMachine.AddState(new EnvProbesWithGIState());
|
|
||||||
_stateMachine.AddState(new NavMeshState());
|
_stateMachine.AddState(new NavMeshState());
|
||||||
|
_stateMachine.AddState(new CompileScriptsState());
|
||||||
_stateMachine.AddState(new EndState());
|
_stateMachine.AddState(new EndState());
|
||||||
_stateMachine.GoToState<BeginState>();
|
_stateMachine.GoToState<BeginState>();
|
||||||
}
|
}
|
||||||
@@ -192,6 +293,9 @@ namespace FlaxEditor.States
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanEditContent => false;
|
public override bool CanEditContent => false;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool CanReloadScripts => ((SubState)_stateMachine.CurrentState).CanReloadScripts;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool IsPerformanceHeavy => true;
|
public override bool IsPerformanceHeavy => true;
|
||||||
|
|
||||||
@@ -215,6 +319,11 @@ namespace FlaxEditor.States
|
|||||||
{
|
{
|
||||||
Editor.Log("Starting scenes build...");
|
Editor.Log("Starting scenes build...");
|
||||||
_startTime = DateTime.Now;
|
_startTime = DateTime.Now;
|
||||||
|
_stateMachine.ActionIndex = -1;
|
||||||
|
_stateMachine.Actions.Clear();
|
||||||
|
var actions = (GeneralOptions.BuildAction[])Editor.Options.Options.General.BuildActions?.Clone();
|
||||||
|
if (actions != null)
|
||||||
|
_stateMachine.Actions.AddRange(actions);
|
||||||
_stateMachine.GoToState<SetupState>();
|
_stateMachine.GoToState<SetupState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
|
using FlaxEngine.Utilities;
|
||||||
|
|
||||||
namespace FlaxEditor.States
|
namespace FlaxEditor.States
|
||||||
{
|
{
|
||||||
@@ -39,5 +40,26 @@ namespace FlaxEditor.States
|
|||||||
{
|
{
|
||||||
UpdateFPS();
|
UpdateFPS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnEnter()
|
||||||
|
{
|
||||||
|
base.OnEnter();
|
||||||
|
|
||||||
|
ScriptsBuilder.ScriptsReloadBegin += OnScriptsReloadBegin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnExit(State nextState)
|
||||||
|
{
|
||||||
|
ScriptsBuilder.ScriptsReloadBegin -= OnScriptsReloadBegin;
|
||||||
|
|
||||||
|
base.OnExit(nextState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnScriptsReloadBegin()
|
||||||
|
{
|
||||||
|
StateMachine.GoToState<ReloadingScriptsState>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
|
using FlaxEngine.Utilities;
|
||||||
|
|
||||||
namespace FlaxEditor.States
|
namespace FlaxEditor.States
|
||||||
{
|
{
|
||||||
@@ -18,5 +19,26 @@ namespace FlaxEditor.States
|
|||||||
: base(editor)
|
: base(editor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnEnter()
|
||||||
|
{
|
||||||
|
base.OnEnter();
|
||||||
|
|
||||||
|
ScriptsBuilder.ScriptsReloadEnd += OnScriptsReloadEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnExit(State nextState)
|
||||||
|
{
|
||||||
|
ScriptsBuilder.ScriptsReloadEnd -= OnScriptsReloadEnd;
|
||||||
|
|
||||||
|
base.OnExit(nextState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnScriptsReloadEnd()
|
||||||
|
{
|
||||||
|
StateMachine.GoToState<EditingSceneState>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ namespace FlaxEngine.Utilities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the state machine.
|
/// Gets the state machine.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// The state machine.
|
|
||||||
/// </value>
|
|
||||||
public StateMachine StateMachine => owner;
|
public StateMachine StateMachine => owner;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ namespace FlaxEngine.Utilities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action StateChanged;
|
public event Action StateChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the states (read-only).
|
||||||
|
/// </summary>
|
||||||
|
public IReadOnlyList<State> States => states;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets state of given type.
|
/// Gets state of given type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user