Skip to content

Commit

Permalink
C#: Make include scripts contents an export option
Browse files Browse the repository at this point in the history
  • Loading branch information
RedworkDE committed Apr 18, 2023
1 parent 3ff3af4 commit 34b4128
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
20 changes: 16 additions & 4 deletions modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@ public partial class ExportPlugin : EditorExportPlugin

private List<string> _tempFolders = new List<string>();

public void RegisterExportSettings()
public override Godot.Collections.Array<Godot.Collections.Dictionary> _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<Godot.Collections.Dictionary>()
{
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;
Expand All @@ -44,7 +56,7 @@ public override void _ExportFile(string path, string type, string[] features)

// 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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ public override void _EnablePlugin()
// Export plugin
var exportPlugin = new ExportPlugin();
AddExportPlugin(exportPlugin);
exportPlugin.RegisterExportSettings();
_exportPluginWeak = WeakRef(exportPlugin);

BuildManager.Initialize();
Expand Down

0 comments on commit 34b4128

Please sign in to comment.