Fix missing content database load when opening project without code compilation

#2469
This commit is contained in:
Wojtek Figat
2025-02-25 17:43:56 +01:00
committed by Ari Vuollet
parent 5c06d413b0
commit 56b2c96b3b
3 changed files with 13 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ namespace FlaxEditor.Modules
private bool _enableEvents; private bool _enableEvents;
private bool _isDuringFastSetup; private bool _isDuringFastSetup;
private bool _rebuildFlag; private bool _rebuildFlag;
private bool _rebuildInitFlag;
private int _itemsCreated; private int _itemsCreated;
private int _itemsDeleted; private int _itemsDeleted;
private readonly HashSet<MainContentTreeNode> _dirtyNodes = new HashSet<MainContentTreeNode>(); private readonly HashSet<MainContentTreeNode> _dirtyNodes = new HashSet<MainContentTreeNode>();
@@ -820,6 +821,7 @@ namespace FlaxEditor.Modules
Profiler.BeginEvent("ContentDatabase.Rebuild"); Profiler.BeginEvent("ContentDatabase.Rebuild");
var startTime = Platform.TimeSeconds; var startTime = Platform.TimeSeconds;
_rebuildFlag = false; _rebuildFlag = false;
_rebuildInitFlag = false;
_enableEvents = false; _enableEvents = false;
// Load all folders // Load all folders
@@ -1240,6 +1242,15 @@ namespace FlaxEditor.Modules
FlaxEngine.Scripting.InvokeOnUpdate(() => OnImportFileDone(path)); FlaxEngine.Scripting.InvokeOnUpdate(() => OnImportFileDone(path));
}; };
_enableEvents = true; _enableEvents = true;
_rebuildInitFlag = true;
}
/// <inheritdoc />
public override void OnEndInit()
{
// Handle init when project was loaded without scripts loading ()
if (_rebuildInitFlag)
RebuildInternal();
} }
private void OnImportFileDone(string path) private void OnImportFileDone(string path)

View File

@@ -58,7 +58,7 @@ namespace FlaxEditor.Modules
: base(editor) : base(editor)
{ {
// After editor cache but before the windows // After editor cache but before the windows
InitOrder = -900; InitOrder = -800;
} }
/// <summary> /// <summary>

View File

@@ -160,7 +160,7 @@ namespace FlaxEditor.Modules
internal UIModule(Editor editor) internal UIModule(Editor editor)
: base(editor) : base(editor)
{ {
InitOrder = -90; InitOrder = -70;
VisjectSurfaceBackground = FlaxEngine.Content.LoadAsyncInternal<Texture>("Editor/VisjectSurface"); VisjectSurfaceBackground = FlaxEngine.Content.LoadAsyncInternal<Texture>("Editor/VisjectSurface");
ColorValueBox.ShowPickColorDialog += ShowPickColorDialog; ColorValueBox.ShowPickColorDialog += ShowPickColorDialog;
} }