Add profile events for Editor startup
This commit is contained in:
@@ -625,6 +625,7 @@ bool Editor::Init()
|
|||||||
exit(failed ? 1 : 0);
|
exit(failed ? 1 : 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
PROFILE_CPU();
|
||||||
|
|
||||||
// If during last lightmaps baking engine crashed we could try to restore the progress
|
// If during last lightmaps baking engine crashed we could try to restore the progress
|
||||||
ShadowsOfMordor::Builder::Instance()->CheckIfRestoreState();
|
ShadowsOfMordor::Builder::Instance()->CheckIfRestoreState();
|
||||||
@@ -633,10 +634,13 @@ bool Editor::Init()
|
|||||||
Managed = New<ManagedEditor>();
|
Managed = New<ManagedEditor>();
|
||||||
|
|
||||||
// Show splash screen
|
// Show splash screen
|
||||||
if (EditorImpl::Splash == nullptr)
|
{
|
||||||
EditorImpl::Splash = New<SplashScreen>();
|
PROFILE_CPU_NAMED("Splash");
|
||||||
EditorImpl::Splash->SetTitle(Project->Name);
|
if (EditorImpl::Splash == nullptr)
|
||||||
EditorImpl::Splash->Show();
|
EditorImpl::Splash = New<SplashScreen>();
|
||||||
|
EditorImpl::Splash->SetTitle(Project->Name);
|
||||||
|
EditorImpl::Splash->Show();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize managed editor
|
// Initialize managed editor
|
||||||
Managed->Init();
|
Managed->Init();
|
||||||
|
|||||||
@@ -84,97 +84,97 @@ namespace FlaxEditor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The windows module.
|
/// The windows module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly WindowsModule Windows;
|
public WindowsModule Windows;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UI module.
|
/// The UI module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly UIModule UI;
|
public UIModule UI;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The thumbnails module.
|
/// The thumbnails module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ThumbnailsModule Thumbnails;
|
public ThumbnailsModule Thumbnails;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The simulation module.
|
/// The simulation module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly SimulationModule Simulation;
|
public SimulationModule Simulation;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The scene module.
|
/// The scene module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly SceneModule Scene;
|
public SceneModule Scene;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The prefabs module.
|
/// The prefabs module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly PrefabsModule Prefabs;
|
public PrefabsModule Prefabs;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The scene editing module.
|
/// The scene editing module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly SceneEditingModule SceneEditing;
|
public SceneEditingModule SceneEditing;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The progress reporting module.
|
/// The progress reporting module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ProgressReportingModule ProgressReporting;
|
public ProgressReportingModule ProgressReporting;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The content editing module.
|
/// The content editing module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ContentEditingModule ContentEditing;
|
public ContentEditingModule ContentEditing;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The content database module.
|
/// The content database module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ContentDatabaseModule ContentDatabase;
|
public ContentDatabaseModule ContentDatabase;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The content importing module.
|
/// The content importing module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ContentImportingModule ContentImporting;
|
public ContentImportingModule ContentImporting;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The content finder module.
|
/// The content finder module.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ContentFindingModule ContentFinding;
|
public ContentFindingModule ContentFinding;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The scripts editing
|
/// The scripts editing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly CodeEditingModule CodeEditing;
|
public CodeEditingModule CodeEditing;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The scripts documentation
|
/// The scripts documentation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly CodeDocsModule CodeDocs;
|
public CodeDocsModule CodeDocs;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The editor state machine.
|
/// The editor state machine.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly EditorStateMachine StateMachine;
|
public EditorStateMachine StateMachine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The editor options manager.
|
/// The editor options manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly OptionsModule Options;
|
public OptionsModule Options;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The editor per-project cache manager.
|
/// The editor per-project cache manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ProjectCacheModule ProjectCache;
|
public ProjectCacheModule ProjectCache;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The undo/redo
|
/// The undo/redo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly EditorUndo Undo;
|
public EditorUndo Undo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The icons container.
|
/// The icons container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly EditorIcons Icons;
|
public EditorIcons Icons;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the main transform gizmo used by the <see cref="SceneEditorWindow"/>.
|
/// Gets the main transform gizmo used by the <see cref="SceneEditorWindow"/>.
|
||||||
@@ -209,26 +209,36 @@ namespace FlaxEditor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The game project info.
|
/// The game project info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ProjectInfo GameProject;
|
public ProjectInfo GameProject;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The engine project info.
|
/// The engine project info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly ProjectInfo EngineProject;
|
public ProjectInfo EngineProject;
|
||||||
|
|
||||||
internal Editor()
|
internal Editor()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Init(bool isHeadless, bool skipCompile, bool newProject, Guid startupScene)
|
||||||
|
{
|
||||||
Log("Setting up C# Editor...");
|
Log("Setting up C# Editor...");
|
||||||
|
_isHeadlessMode = isHeadless;
|
||||||
|
_startupSceneCmdLine = startupScene;
|
||||||
|
|
||||||
|
Profiler.BeginEvent("Projects");
|
||||||
EngineProject = ProjectInfo.Load(StringUtils.CombinePaths(Globals.StartupFolder, "Flax.flaxproj"));
|
EngineProject = ProjectInfo.Load(StringUtils.CombinePaths(Globals.StartupFolder, "Flax.flaxproj"));
|
||||||
GameProject = ProjectInfo.Load(Internal_GetProjectPath());
|
GameProject = ProjectInfo.Load(Internal_GetProjectPath());
|
||||||
|
Profiler.EndEvent();
|
||||||
|
|
||||||
|
Profiler.BeginEvent("Icons");
|
||||||
Icons = new EditorIcons();
|
Icons = new EditorIcons();
|
||||||
Icons.LoadIcons();
|
Icons.LoadIcons();
|
||||||
|
Profiler.EndEvent();
|
||||||
|
|
||||||
// Create common editor modules
|
// Create common editor modules
|
||||||
|
Profiler.BeginEvent("Modules");
|
||||||
RegisterModule(Options = new OptionsModule(this));
|
RegisterModule(Options = new OptionsModule(this));
|
||||||
RegisterModule(ProjectCache = new ProjectCacheModule(this));
|
RegisterModule(ProjectCache = new ProjectCacheModule(this));
|
||||||
RegisterModule(Scene = new SceneModule(this));
|
RegisterModule(Scene = new SceneModule(this));
|
||||||
@@ -245,46 +255,15 @@ namespace FlaxEditor
|
|||||||
RegisterModule(CodeDocs = new CodeDocsModule(this));
|
RegisterModule(CodeDocs = new CodeDocsModule(this));
|
||||||
RegisterModule(ProgressReporting = new ProgressReportingModule(this));
|
RegisterModule(ProgressReporting = new ProgressReportingModule(this));
|
||||||
RegisterModule(ContentFinding = new ContentFindingModule(this));
|
RegisterModule(ContentFinding = new ContentFindingModule(this));
|
||||||
|
Profiler.EndEvent();
|
||||||
|
|
||||||
StateMachine = new EditorStateMachine(this);
|
StateMachine = new EditorStateMachine(this);
|
||||||
Undo = new EditorUndo(this);
|
Undo = new EditorUndo(this);
|
||||||
|
|
||||||
UIControl.FallbackParentGetDelegate += OnUIControlFallbackParentGet;
|
UIControl.FallbackParentGetDelegate += OnUIControlFallbackParentGet;
|
||||||
}
|
|
||||||
|
|
||||||
private ContainerControl OnUIControlFallbackParentGet(UIControl control)
|
|
||||||
{
|
|
||||||
// Check if prefab root control is this UIControl
|
|
||||||
var loadingPreview = Viewport.Previews.PrefabPreview.LoadingPreview;
|
|
||||||
if (loadingPreview != null)
|
|
||||||
{
|
|
||||||
// Link it to the prefab preview to see it in the editor
|
|
||||||
loadingPreview.customControlLinked = control;
|
|
||||||
return loadingPreview;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void RegisterModule(EditorModule module)
|
|
||||||
{
|
|
||||||
Log("Register Editor module " + module);
|
|
||||||
|
|
||||||
_modules.Add(module);
|
|
||||||
if (_isAfterInit)
|
|
||||||
_modules.Sort((a, b) => a.InitOrder - b.InitOrder);
|
|
||||||
if (_areModulesInited)
|
|
||||||
module.OnInit();
|
|
||||||
if (_areModulesAfterInitEnd)
|
|
||||||
module.OnEndInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Init(bool isHeadless, bool skipCompile, bool newProject, Guid startupScene)
|
|
||||||
{
|
|
||||||
if (newProject)
|
if (newProject)
|
||||||
InitProject();
|
InitProject();
|
||||||
EnsureState<LoadingState>();
|
EnsureState<LoadingState>();
|
||||||
_isHeadlessMode = isHeadless;
|
|
||||||
_startupSceneCmdLine = startupScene;
|
|
||||||
Log("Editor init");
|
Log("Editor init");
|
||||||
if (isHeadless)
|
if (isHeadless)
|
||||||
Log("Running in headless mode");
|
Log("Running in headless mode");
|
||||||
@@ -333,6 +312,32 @@ namespace FlaxEditor
|
|||||||
StateMachine.LoadingState.StartInitEnding(skipCompile);
|
StateMachine.LoadingState.StartInitEnding(skipCompile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ContainerControl OnUIControlFallbackParentGet(UIControl control)
|
||||||
|
{
|
||||||
|
// Check if prefab root control is this UIControl
|
||||||
|
var loadingPreview = Viewport.Previews.PrefabPreview.LoadingPreview;
|
||||||
|
if (loadingPreview != null)
|
||||||
|
{
|
||||||
|
// Link it to the prefab preview to see it in the editor
|
||||||
|
loadingPreview.customControlLinked = control;
|
||||||
|
return loadingPreview;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void RegisterModule(EditorModule module)
|
||||||
|
{
|
||||||
|
Log("Register Editor module " + module);
|
||||||
|
|
||||||
|
_modules.Add(module);
|
||||||
|
if (_isAfterInit)
|
||||||
|
_modules.Sort((a, b) => a.InitOrder - b.InitOrder);
|
||||||
|
if (_areModulesInited)
|
||||||
|
module.OnInit();
|
||||||
|
if (_areModulesAfterInitEnd)
|
||||||
|
module.OnEndInit();
|
||||||
|
}
|
||||||
|
|
||||||
internal void EndInit()
|
internal void EndInit()
|
||||||
{
|
{
|
||||||
EnsureState<LoadingState>();
|
EnsureState<LoadingState>();
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ namespace FlaxEditor
|
|||||||
return _projectsCache[i];
|
return _projectsCache[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Profiler.BeginEvent(path);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Load
|
// Load
|
||||||
@@ -205,6 +206,10 @@ namespace FlaxEditor
|
|||||||
Editor.LogError("Failed to load project \"" + path + "\".");
|
Editor.LogError("Failed to load project \"" + path + "\".");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Profiler.EndEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ int32 GameBase::LoadProduct()
|
|||||||
|
|
||||||
bool GameBase::Init()
|
bool GameBase::Init()
|
||||||
{
|
{
|
||||||
|
PROFILE_CPU();
|
||||||
|
|
||||||
// Preload splash screen texture
|
// Preload splash screen texture
|
||||||
if (GameBaseImpl::HeaderFlags & GameHeaderFlags::ShowSplashScreen)
|
if (GameBaseImpl::HeaderFlags & GameHeaderFlags::ShowSplashScreen)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user