Skip to content

Commit 24b6012

Browse files
committed
ImportGML: Fix GML file filter and fix link prompt
1 parent f2d2660 commit 24b6012

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

UndertaleModTool/Scripts/Resource Importers/ImportGML.csx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,24 @@ string importFolder = PromptChooseDirectory();
1414
if (importFolder == null)
1515
throw new ScriptException("The import folder was not set.");
1616

17-
string[] dirFiles = Directory.GetFiles(importFolder);
17+
string[] dirFiles = Directory.GetFiles(importFolder, "*.gml");
1818
if (dirFiles.Length == 0)
19-
throw new ScriptException("The selected folder is empty.");
20-
else if (!dirFiles.Any(x => x.EndsWith(".gml")))
21-
throw new ScriptException("The selected folder doesn't contain any GML file.");
19+
throw new ScriptException("The selected folder doesn't contain any GML files.");
2220

2321
// Ask whether they want to link code. If no, will only generate code entry.
2422
// If yes, will try to add code to objects and scripts depending upon its name
25-
bool doParse = ScriptQuestion("Do you want to automatically attempt to link imported code?");
23+
bool doLink = ScriptQuestion("Do you want to automatically attempt to link imported code?");
2624

2725
SetProgressBar(null, "Files", 0, dirFiles.Length);
2826
StartProgressBarUpdater();
2927

3028
SyncBinding("Strings, Code, CodeLocals, Scripts, GlobalInitScripts, GameObjects, Functions, Variables", true);
3129
await Task.Run(() =>
3230
{
33-
UndertaleModLib.Compiler.CodeImportGroup importGroup = new(Data);
31+
UndertaleModLib.Compiler.CodeImportGroup importGroup = new(Data)
32+
{
33+
AutoCreateAssets = doLink
34+
};
3435
foreach (string file in dirFiles)
3536
{
3637
IncrementProgress();

0 commit comments

Comments
 (0)