Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ImportGraphics.csx not importing sprites in wrongly-named folders #795

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions UndertaleModTool/Repackers/ImportGraphics.csx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ using UndertaleModLib.Util;

EnsureDataLoaded();

bool importAsSprite = false;

string importFolder = CheckValidity();

string workDirectory = Path.GetDirectoryName(FilePath) + Path.DirectorySeparatorChar;
Expand Down Expand Up @@ -68,6 +70,14 @@ foreach (Atlas atlas in packer.Atlasses)
string stripped = Path.GetFileNameWithoutExtension(n.Texture.Source);

SpriteType spriteType = GetSpriteType(n.Texture.Source);

if (importAsSprite)
{
if ((spriteType == SpriteType.Unknown) || (spriteType == SpriteType.Font))
{
spriteType = SpriteType.Sprite;
}
}

setTextureTargetBounds(texturePageItem, stripped, n);

Expand Down Expand Up @@ -528,7 +538,6 @@ Do you want to continue?");

//Stop the script if there's missing sprite entries or w/e.
bool hadMessage = false;
bool importAsSprite = false;
string[] dirFiles = Directory.GetFiles(importFolder, "*.png", SearchOption.AllDirectories);
foreach (string file in dirFiles)
{
Expand Down Expand Up @@ -609,4 +618,3 @@ Pressing ""No"" will cause the program to ignore these images.");
}
return importFolder;
}