Project_WL/AgentScripts/WL814x_Probe.cs

94 lines
5.7 KiB
C#
Raw Normal View History

// WL-814x 프로브 1 — 메시·머티리얼·텍스처 실측 (팔레트 아틀라스 UV 설계 근거)
// run_script --file AgentScripts/WL814x_Probe.cs --entry WL814x_Probe.Run
public static class WL814x_Probe
{
const string Out = @"E:\NerdNavis\WL_wt\gameplay\AgentScripts\WL814x_PROBE.txt";
public static string Run()
{
var sb = new System.Text.StringBuilder();
var prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.GameObject>("Assets/Res_Addr/PC/LH_M05.prefab");
if (prefab == null) return "no prefab";
sb.AppendLine("=== LH_M05.prefab 렌더러 ===");
var rs = prefab.GetComponentsInChildren<UnityEngine.Renderer>(true);
foreach (var r in rs)
{
var smr = r as UnityEngine.SkinnedMeshRenderer;
var mf = r.GetComponent<UnityEngine.MeshFilter>();
UnityEngine.Mesh m = smr != null ? smr.sharedMesh : (mf != null ? mf.sharedMesh : null);
sb.AppendLine("[R] " + r.name + " type=" + r.GetType().Name + " enabled=" + r.enabled + " activeSelf=" + r.gameObject.activeSelf);
if (m != null)
{
string path = UnityEditor.AssetDatabase.GetAssetPath(m);
sb.AppendLine(" mesh=" + m.name + " path=" + path + " verts=" + m.vertexCount + " sub=" + m.subMeshCount
+ " tris=" + (m.triangles.Length / 3) + " blendshapes=" + m.blendShapeCount
+ " bones=" + (smr != null && smr.bones != null ? smr.bones.Length : 0)
+ " bindposes=" + m.bindposes.Length + " isReadable=" + m.isReadable);
var uv = m.uv;
if (uv != null && uv.Length > 0)
{
float mnx = 9e9f, mxx = -9e9f, mny = 9e9f, mxy = -9e9f;
for (int i = 0; i < uv.Length; i++) { if (uv[i].x < mnx) mnx = uv[i].x; if (uv[i].x > mxx) mxx = uv[i].x; if (uv[i].y < mny) mny = uv[i].y; if (uv[i].y > mxy) mxy = uv[i].y; }
sb.AppendLine(" uv0 range x[" + mnx.ToString("F3") + "," + mxx.ToString("F3") + "] y[" + mny.ToString("F3") + "," + mxy.ToString("F3") + "]"
+ " uv2=" + (m.uv2 != null && m.uv2.Length > 0) + " colors=" + (m.colors != null && m.colors.Length > 0)
+ " tangents=" + (m.tangents != null && m.tangents.Length > 0) + " normals=" + (m.normals != null && m.normals.Length > 0));
}
}
var mats = r.sharedMaterials;
for (int i = 0; i < mats.Length; i++)
{
var mt = mats[i];
if (mt == null) { sb.AppendLine(" mat[" + i + "] = null"); continue; }
var tex = mt.HasProperty("_BaseMap") ? mt.GetTexture("_BaseMap") : (mt.HasProperty("_MainTex") ? mt.GetTexture("_MainTex") : null);
var stex = mt.HasProperty("_ShadowBaseMap") ? mt.GetTexture("_ShadowBaseMap") : null;
sb.AppendLine(" mat[" + i + "] " + mt.name + " shader=" + mt.shader.name
+ " path=" + UnityEditor.AssetDatabase.GetAssetPath(mt)
+ " base=" + (tex != null ? UnityEditor.AssetDatabase.GetAssetPath(tex) : "-")
+ " shadowbase=" + (stex != null ? UnityEditor.AssetDatabase.GetAssetPath(stex) : "-"));
}
}
sb.AppendLine();
sb.AppendLine("=== 원본 텍스처 임포트 ===");
string[] texPaths = {
"Assets/WL/Look/Character/Textures/M05_WL.png",
"Assets/WL/Look/Character/Textures/Skin_WL.png",
"Assets/WL/Look/Character/Textures/Hair05_WL.png",
"Assets/WL/Look/Character/Textures/face02_WL.png",
"Assets/WL/Look/Character/Textures/face02_V1.png",
"Assets/WL/Look/Character/Textures/Hair05_V1.png",
};
foreach (var p in texPaths)
{
var ti = UnityEditor.AssetImporter.GetAtPath(p) as UnityEditor.TextureImporter;
var t = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.Texture2D>(p);
if (ti == null) { sb.AppendLine(p + " : 없음"); continue; }
sb.AppendLine(p + " : maxSize=" + ti.maxTextureSize + " filter=" + ti.filterMode + " mip=" + ti.mipmapEnabled
+ " sRGB=" + ti.sRGBTexture + " readable=" + ti.isReadable + " npot=" + ti.npotScale
+ " actual=" + (t != null ? t.width + "x" + t.height : "?") + " fmt=" + (t != null ? t.format.ToString() : "?"));
}
sb.AppendLine();
sb.AppendLine("=== SO 현재값 ===");
var so = UnityEditor.AssetDatabase.LoadAssetAtPath<WL.Look.Character.WLCharacterLookSettings>("Assets/WL/Look/Character/Resources/WL/WLCharacterLookSettings.asset");
if (so != null)
{
sb.AppendLine("enabled_=" + so.enabled_ + " mode=" + so.mode + " n=" + (so.originals != null ? so.originals.Length : 0));
for (int i = 0; i < (so.originals != null ? so.originals.Length : 0); i++)
sb.AppendLine(" [" + i + "] orig=" + (so.originals[i] != null ? so.originals[i].name : "-")
+ " m1=" + (so.mode1 != null && i < so.mode1.Length && so.mode1[i] != null ? so.mode1[i].name : "-")
+ " m2=" + (so.mode2 != null && i < so.mode2.Length && so.mode2[i] != null ? so.mode2[i].name : "-")
+ " m3=" + (so.mode3 != null && i < so.mode3.Length && so.mode3[i] != null ? so.mode3[i].name : "-"));
}
sb.AppendLine();
sb.AppendLine("=== 아레나 씬 카메라/캐릭터 ===");
sb.AppendLine("scene=Assets/WL/Look/Arena/Scenes/WL_ArenaProto.unity");
System.IO.File.WriteAllText(Out, sb.ToString());
return "written " + Out + " (" + sb.Length + " chars)";
}
}