Skip to content

Commit

Permalink
Merge pull request #795 from NyakoFox/importgraphics-fixes
Browse files Browse the repository at this point in the history
Fix ImportGraphics.csx not importing sprites in wrongly-named folders
  • Loading branch information
Grossley authored Mar 18, 2022
2 parents 8c8674d + e385b5a commit 8ab147e
Showing 1 changed file with 10 additions and 2 deletions.
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;
}

0 comments on commit 8ab147e

Please sign in to comment.