From 34b4128004d0d5f79e7535dcf99eccc7a0c50b8f Mon Sep 17 00:00:00 2001 From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> Date: Wed, 8 Feb 2023 13:37:47 +0100 Subject: [PATCH] C#: Make include scripts contents an export option --- .../GodotTools/Export/ExportPlugin.cs | 20 +++++++++++++++---- .../GodotTools/GodotTools/GodotSharpEditor.cs | 1 - 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs index a284451a35d..6837b617e07 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs @@ -21,10 +21,22 @@ namespace GodotTools.Export private List _tempFolders = new List(); - public void RegisterExportSettings() + public override Godot.Collections.Array _GetExportOptions(EditorExportPlatform platform) { - // TODO: These would be better as export preset options, but that doesn't seem to be supported yet - GlobalDef("dotnet/export/include_scripts_content", false); + return new Godot.Collections.Array() + { + new Godot.Collections.Dictionary() + { + { + "option", new Godot.Collections.Dictionary() + { + { "name", "dotnet/include_scripts_content" }, + { "type", (int)Variant.Type.Bool } + } + }, + { "default_value", false } + } + }; } private string _maybeLastExportError; @@ -44,7 +56,7 @@ namespace GodotTools.Export // TODO What if the source file is not part of the game's C# project - bool includeScriptsContent = (bool)ProjectSettings.GetSetting("dotnet/export/include_scripts_content"); + bool includeScriptsContent = (bool)GetOption("dotnet/include_scripts_content"); if (!includeScriptsContent) { diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 26239a7ce5d..4e33b38ac25 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -594,7 +594,6 @@ namespace GodotTools // Export plugin var exportPlugin = new ExportPlugin(); AddExportPlugin(exportPlugin); - exportPlugin.RegisterExportSettings(); _exportPluginWeak = WeakRef(exportPlugin); BuildManager.Initialize();