Skip to content

Commit 81ce560

Browse files
committed
[WIP] Welcome Dialog
1 parent ca112c3 commit 81ce560

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

src/Godot.EditorIntegration/DotNetEditorPlugin.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ protected override void _EnterTree()
243243

244244
if (File.Exists(EditorPath.ProjectCSProjPath))
245245
{
246-
var efs = EditorInterface.Singleton.GetResourceFilesystem();
247-
efs.Connect(EditorFileSystem.SignalName.FilesystemChanged, Callable.From(RunUpgradeAssistant), (uint)ConnectFlags.OneShot);
246+
RunUpgradeAssistant();
248247
}
249248
else
250249
{
250+
EditorInternal.EditorResumeStartupSceneOpening();
251251
_msbuildPanel.Close();
252252
_toolBarBuildButton.Hide();
253253
}
@@ -364,6 +364,22 @@ private void UpdateWorkspaceProjectPath()
364364
}
365365

366366
private void RunUpgradeAssistant()
367+
{
368+
var efs = EditorInterface.Singleton.GetResourceFilesystem();
369+
if (efs.IsScanning())
370+
{
371+
// If the filesystem is still scanning, we delay running the upgrade assistant
372+
// until it's done so we know the scenes and resources are ready.
373+
efs.Connect(EditorFileSystem.SignalName.FilesystemChanged, Callable.From(RunUpgradeAssistantCore), (uint)ConnectFlags.OneShot);
374+
}
375+
else
376+
{
377+
// Otherwise, we just run it directly.
378+
RunUpgradeAssistantCore();
379+
}
380+
}
381+
382+
private void RunUpgradeAssistantCore()
367383
{
368384
if (!File.Exists(EditorPath.ProjectCSProjPath))
369385
{
@@ -399,6 +415,8 @@ private void RunUpgradeAssistant()
399415
// Unregister temporary classes in reverse order.
400416
GodotRegistry.UnregisterClass<ResourceFormatLoaderCSharpScript>();
401417
GodotRegistry.UnregisterClass<CSharpScript>();
418+
419+
EditorInternal.EditorResumeStartupSceneOpening();
402420
}
403421
}
404422

src/Godot.EditorIntegration/Internals/EditorInternal.Functions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ public static void StatusPanelSetContent(Control? content)
9595
_status_panel_set_content(content?.NativePtr ?? 0);
9696
}
9797

98+
private static delegate* unmanaged[Cdecl]<void> _editor_resume_startup_scene_opening;
99+
100+
public static void EditorResumeStartupSceneOpening()
101+
{
102+
Debug.Assert(_editor_resume_startup_scene_opening is not null);
103+
_editor_resume_startup_scene_opening();
104+
}
105+
98106
private static delegate* unmanaged[Cdecl]<NativeGodotString*, void> _get_editor_assemblies_path;
99107

100108
public static string GetEditorAssembliesPath()

src/Godot.EditorIntegration/Internals/EditorInternal.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static unsafe void Initialize(nint getProcAddress)
2525
_status_indicator_notify_state_changed = (delegate* unmanaged[Cdecl]<void>)LoadProcAddress("status_indicator_notify_state_changed"u8);
2626
_status_indicator_update_severity = (delegate* unmanaged[Cdecl]<long, void>)LoadProcAddress("status_indicator_update_severity"u8);
2727
_status_panel_set_content = (delegate* unmanaged[Cdecl]<nint, void>)LoadProcAddress("status_panel_set_content"u8);
28+
_editor_resume_startup_scene_opening = (delegate* unmanaged[Cdecl]<void>)LoadProcAddress("editor_resume_startup_scene_opening"u8);
2829
_get_editor_assemblies_path = (delegate* unmanaged[Cdecl]<NativeGodotString*, void>)LoadProcAddress("get_editor_assemblies_path"u8);
2930
_get_project_assemblies_path = (delegate* unmanaged[Cdecl]<NativeGodotString*, void>)LoadProcAddress("get_project_assemblies_path"u8);
3031
_get_project_output_path = (delegate* unmanaged[Cdecl]<NativeGodotString*, NativeGodotString*, void>)LoadProcAddress("get_project_output_path"u8);

0 commit comments

Comments
 (0)