41 lines
930 B
C#
41 lines
930 B
C#
|
|
|
||
|
|
#if TOOLS
|
||
|
|
|
||
|
|
using Godot;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
|
||
|
|
namespace Rokojori;
|
||
|
|
|
||
|
|
[Tool]
|
||
|
|
public partial class DeduplicatingExportPlugin : EditorExportPlugin
|
||
|
|
{
|
||
|
|
private HashSet<string> _seenPaths = new HashSet<string>();
|
||
|
|
|
||
|
|
public override string _GetName() => "RokojoriDeduplicatingExport";
|
||
|
|
|
||
|
|
public override void _ExportBegin( string[] features, bool isDebug, string path, uint flags )
|
||
|
|
{
|
||
|
|
_seenPaths.Clear();
|
||
|
|
GD.Print( "[DeduplicatingExport] Export started: ", path );
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void _ExportFile( string path, string type, string[] features )
|
||
|
|
{
|
||
|
|
if ( ! _seenPaths.Add( path ) )
|
||
|
|
{
|
||
|
|
GD.Print( "[DeduplicatingExport] SKIPPED (duplicate): ", path );
|
||
|
|
Skip();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
GD.Print( "[DeduplicatingExport] included: ", path );
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void _ExportEnd()
|
||
|
|
{
|
||
|
|
GD.Print( "[DeduplicatingExport] Export ended. Total unique files: ", _seenPaths.Count );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|