Fix error when ContentDatabase gets rebuilt while initializing editor
This commit is contained in:
@@ -144,26 +144,6 @@ namespace FlaxEditor.Windows
|
|||||||
|
|
||||||
FlaxEditor.Utilities.Utils.SetupCommonInputActions(this);
|
FlaxEditor.Utilities.Utils.SetupCommonInputActions(this);
|
||||||
|
|
||||||
// Content database events
|
|
||||||
editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true;
|
|
||||||
editor.ContentDatabase.ItemRemoved += OnContentDatabaseItemRemoved;
|
|
||||||
editor.ContentDatabase.WorkspaceRebuilding += () => { _workspaceRebuildLocation = SelectedNode?.Path; };
|
|
||||||
editor.ContentDatabase.WorkspaceRebuilt += () =>
|
|
||||||
{
|
|
||||||
var selected = Editor.ContentDatabase.Find(_workspaceRebuildLocation);
|
|
||||||
if (selected is ContentFolder selectedFolder)
|
|
||||||
{
|
|
||||||
_navigationUnlocked = false;
|
|
||||||
RefreshView(selectedFolder.Node);
|
|
||||||
_tree.Select(selectedFolder.Node);
|
|
||||||
UpdateItemsSearch();
|
|
||||||
_navigationUnlocked = true;
|
|
||||||
UpdateUI();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ShowRoot();
|
|
||||||
};
|
|
||||||
|
|
||||||
var options = Editor.Options;
|
var options = Editor.Options;
|
||||||
options.OptionsChanged += OnOptionsChanged;
|
options.OptionsChanged += OnOptionsChanged;
|
||||||
|
|
||||||
@@ -1029,6 +1009,26 @@ namespace FlaxEditor.Windows
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnInit()
|
public override void OnInit()
|
||||||
{
|
{
|
||||||
|
// Content database events
|
||||||
|
Editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true;
|
||||||
|
Editor.ContentDatabase.ItemRemoved += OnContentDatabaseItemRemoved;
|
||||||
|
Editor.ContentDatabase.WorkspaceRebuilding += () => { _workspaceRebuildLocation = SelectedNode?.Path; };
|
||||||
|
Editor.ContentDatabase.WorkspaceRebuilt += () =>
|
||||||
|
{
|
||||||
|
var selected = Editor.ContentDatabase.Find(_workspaceRebuildLocation);
|
||||||
|
if (selected is ContentFolder selectedFolder)
|
||||||
|
{
|
||||||
|
_navigationUnlocked = false;
|
||||||
|
RefreshView(selectedFolder.Node);
|
||||||
|
_tree.Select(selectedFolder.Node);
|
||||||
|
UpdateItemsSearch();
|
||||||
|
_navigationUnlocked = true;
|
||||||
|
UpdateUI();
|
||||||
|
}
|
||||||
|
else if (_root != null)
|
||||||
|
ShowRoot();
|
||||||
|
};
|
||||||
|
|
||||||
// Setup content root node
|
// Setup content root node
|
||||||
_root = new RootContentTreeNode
|
_root = new RootContentTreeNode
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user