OnlyAtlas AssetPostprocessors 추가

This commit is contained in:
NTG_Lenovo 2025-07-28 16:11:02 +09:00
parent 698fa977f4
commit 441964bb68
3 changed files with 27 additions and 2 deletions

View File

@ -21,6 +21,10 @@ private void OnPreprocessTexture()
{ {
AssetPostprocessorSprite.OnPreprocessTexture(importer); AssetPostprocessorSprite.OnPreprocessTexture(importer);
} }
else if (upperPath.Contains(PathConstants.RawOnlyAtlasPathUpper))
{
AssetPostprocessorSprite.OnPreprocessTextureOnlyAtlas(importer);
}
} }
public static void OnPostprocessAllAssets(string[] importedAssets, string[] deleteAssets, string[] movedAssets, public static void OnPostprocessAllAssets(string[] importedAssets, string[] deleteAssets, string[] movedAssets,

View File

@ -69,6 +69,17 @@ public static void OnPreprocessTextureForUi(TextureImporter importer)
importer.SetTextureSettings(textureSettings); importer.SetTextureSettings(textureSettings);
} }
public static void OnPreprocessTextureOnlyAtlas(TextureImporter importer)
{
if (importer.textureType == TextureImporterType.Sprite)
{
return;
}
importer.textureType = TextureImporterType.Sprite;
importer.spriteImportMode = SpriteImportMode.Single;
}
private static void TryApplyPivotAfterImport(string path) private static void TryApplyPivotAfterImport(string path)
{ {
if (string.IsNullOrEmpty(path)) return; if (string.IsNullOrEmpty(path)) return;
@ -129,7 +140,8 @@ public static void OnRemove(string path, string movePath)
var upperPath = path.ToUpper(); var upperPath = path.ToUpper();
bool isValid = (upperPath.Contains(PathConstants.RawSpritesPathUpper) || bool isValid = (upperPath.Contains(PathConstants.RawSpritesPathUpper) ||
upperPath.Contains(PathConstants.RawUiPathUpper)) upperPath.Contains(PathConstants.RawUiPathUpper) ||
upperPath.Contains(PathConstants.RawOnlyAtlasPathUpper))
&& upperPath.Contains(ExtenstionConstants.PngExtensionUpper); && upperPath.Contains(ExtenstionConstants.PngExtensionUpper);
if (!isValid) return; if (!isValid) return;
@ -145,7 +157,8 @@ public static void OnAdd(string path)
var upperPath = path.ToUpper(); var upperPath = path.ToUpper();
bool isValid = (upperPath.Contains(PathConstants.RawSpritesPathUpper) || bool isValid = (upperPath.Contains(PathConstants.RawSpritesPathUpper) ||
upperPath.Contains(PathConstants.RawUiPathUpper)) upperPath.Contains(PathConstants.RawUiPathUpper) ||
upperPath.Contains(PathConstants.RawOnlyAtlasPathUpper))
&& upperPath.Contains(ExtenstionConstants.PngExtensionUpper); && upperPath.Contains(ExtenstionConstants.PngExtensionUpper);
if (!isValid) return; if (!isValid) return;

View File

@ -37,6 +37,7 @@ public static class PathConstants
{ {
public const string RawSpritesPathUpper = "ASSETS/_DDD/_RAW/SPRITES/"; public const string RawSpritesPathUpper = "ASSETS/_DDD/_RAW/SPRITES/";
public const string RawUiPathUpper = "ASSETS/_DDD/_RAW/UI/"; public const string RawUiPathUpper = "ASSETS/_DDD/_RAW/UI/";
public const string RawOnlyAtlasPathUpper = "ASSETS/_DDD/_RAW/ONLYATLAS/";
public const string RawFolderPath = "/_Raw"; public const string RawFolderPath = "/_Raw";
public const string AddressablesFolderPath = "/_Addressables"; public const string AddressablesFolderPath = "/_Addressables";
} }
@ -47,4 +48,11 @@ public static class ExtenstionConstants
public const string PngExtensionLower = ".png"; public const string PngExtensionLower = ".png";
public const string SpriteAtlasExtenstionLower = ".spriteatlasv2"; public const string SpriteAtlasExtenstionLower = ".spriteatlasv2";
} }
public static class TextureImportConstants
{
public const string Processed = "processed";
public const string Force = "force";
public const string Skip = "skip";
}
} }