50 lines
2.3 KiB
C#
50 lines
2.3 KiB
C#
|
|
using UnityEditor;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace TKS.EditorTools
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 지형 기믹 그림 임포트 설정(PD 2026-11-10): `Resources/Gimmicks/Tiles/` = 지대 굽기용 반복 타일(코드가 픽셀을 읽음 → Read/Write · 무압축) ·
|
||
|
|
/// `Resources/Gimmicks/Art/` = 세우는 물체 스프라이트(Single · FullRect · 무압축). 그리는 법 = `Resources/Gimmicks/gimmick_art.csv` → `Runtime/Gimmicks/GimmickArt`.
|
||
|
|
/// </summary>
|
||
|
|
public class GimmickArtImporter : AssetPostprocessor
|
||
|
|
{
|
||
|
|
public const string TileRoot = "Assets/Resources/Gimmicks/Tiles/";
|
||
|
|
public const string ArtRoot = "Assets/Resources/Gimmicks/Art/";
|
||
|
|
|
||
|
|
void OnPreprocessTexture()
|
||
|
|
{
|
||
|
|
string path = assetPath.Replace('\\', '/');
|
||
|
|
var ti = (TextureImporter)assetImporter;
|
||
|
|
if (path.StartsWith(TileRoot))
|
||
|
|
{
|
||
|
|
ti.textureType = TextureImporterType.Default;
|
||
|
|
ti.isReadable = true;
|
||
|
|
ti.mipmapEnabled = false;
|
||
|
|
ti.wrapMode = TextureWrapMode.Repeat;
|
||
|
|
ti.filterMode = FilterMode.Bilinear;
|
||
|
|
ti.textureCompression = TextureImporterCompression.Uncompressed;
|
||
|
|
ti.npotScale = TextureImporterNPOTScale.None;
|
||
|
|
ti.maxTextureSize = 1024;
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if (path.StartsWith(ArtRoot))
|
||
|
|
{
|
||
|
|
ti.textureType = TextureImporterType.Sprite;
|
||
|
|
ti.spriteImportMode = SpriteImportMode.Single;
|
||
|
|
ti.mipmapEnabled = true; // 크게 그린 지형 그림을 작게 보여 줄 때 외곽선 거칠어짐 방지(PD 2026-11-11 「해상도가 매우 낮게」)
|
||
|
|
ti.filterMode = FilterMode.Trilinear;
|
||
|
|
ti.alphaIsTransparency = true;
|
||
|
|
ti.textureCompression = TextureImporterCompression.Uncompressed;
|
||
|
|
ti.maxTextureSize = 2048; // patch(9-slice) 원본 1280~1536 px
|
||
|
|
ti.spritePixelsPerUnit = 100f;
|
||
|
|
var s = new TextureImporterSettings();
|
||
|
|
ti.ReadTextureSettings(s);
|
||
|
|
s.spriteMeshType = SpriteMeshType.FullRect;
|
||
|
|
s.spriteAlignment = (int)SpriteAlignment.Center;
|
||
|
|
ti.SetTextureSettings(s);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|