Project_WL/Assets/WL/Look/Character/WLCharacterPaletteSettings.cs

62 lines
2.8 KiB
C#

// ─────────────────────────────────────────────────────────────────────────────
// WLCharacterPaletteSettings.cs — 팔레트 아틀라스 UV(도트) 되돌리기 스위치 (WL-814x)
//
// PD 지시 #814 · 발주서 WL-814x §4
//
// 🔴 enabled_ = 0 → 이 기능 전체 off = 814s + 814t 상태 100 %
// (814s 의 WLCharacterLookSettings 는 그대로 두고, 그 **뒤에** 얹는 별도 스위치다.
// 그래서 이 SO 를 꺼도 기존 되돌리기 동작이 조금도 바뀌지 않는다.)
//
// 무엇을 바꾸나 = 렌더러별로 ① 메시를 「팔레트 UV 복사본」으로 ② 머티리얼을 팔레트 머티리얼로.
// 원본 FBX·원본 png·프리팹은 손대지 않는다 — 전부 런타임 교체다.
//
// 🔴 Debug.LogError / Debug.LogException 을 쓰지 않는다(813z 규칙).
// ─────────────────────────────────────────────────────────────────────────────
using UnityEngine;
namespace WL.Look.Character
{
public class WLCharacterPaletteSettings : ScriptableObject
{
[Header("스위치")]
[Tooltip("0 이면 이 기능 전체 off (= 814s+814t 상태 100 %)")]
public int enabled_ = 1;
[Tooltip("1 이면 적용 내역을 로그로 남긴다")]
public int verboseLog = 0;
[Header("렌더러별 표 (같은 인덱스끼리 짝)")]
[Tooltip("LH_M05 프리팹 안의 렌더러 GameObject 이름")]
public string[] rendererNames;
[Tooltip("팔레트 UV 메시 복사본 (비어 있으면 메시는 안 바꾼다 = 얼굴)")]
public Mesh[] paletteMeshes;
[Tooltip("팔레트 머티리얼")]
public Material[] paletteMaterials;
// ───────────────────────────────────────── 싱글턴(Resources)
public const string ResourcePath = "WL/WLCharacterPaletteSettings";
static WLCharacterPaletteSettings s_inst;
static bool s_tried;
public static WLCharacterPaletteSettings Instance
{
get
{
if (s_inst == null && !s_tried)
{
s_tried = true;
s_inst = Resources.Load<WLCharacterPaletteSettings>(ResourcePath);
}
return s_inst;
}
}
public static void Invalidate() { s_inst = null; s_tried = false; }
public static bool Enabled { get { var c = Instance; return c != null && c.enabled_ != 0; } }
}
}