134 lines
6.8 KiB
C#
134 lines
6.8 KiB
C#
|
|
// WL-816h — ③ WL 워터 복사본 3단(A/B/C) 만들기 + SO 배선 (에디트 모드)
|
||
|
|
// 🔴 `Assets/WL/Materials/WL_Water_Ocean.mat` 원본은 **복사만** 한다(0줄 수정).
|
||
|
|
// 🔴 `Assets/FarmingIsland/**` 0줄.
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEditor;
|
||
|
|
|
||
|
|
public static class WL816h_Build
|
||
|
|
{
|
||
|
|
const string SrcOcean = "Assets/WL/Materials/WL_Water_Ocean.mat";
|
||
|
|
const string Dir = "Assets/WL/Look/Farm/Materials/";
|
||
|
|
const string SO = "Assets/WL/Look/Farm/Resources/WL/WLIslandLookSettings.asset";
|
||
|
|
const string FiWater = "Assets/FarmingIsland/Materials/SimpleWater.mat"; // 확인 후 대체
|
||
|
|
|
||
|
|
// ToonWaterU 프로퍼티 참조 이름 (shadergraph 실측)
|
||
|
|
const string P_Size = "Vector1_07238257334b4a149e675e2451801030";
|
||
|
|
const string P_FoamDistance = "Vector1_101dc4546b684d40bc2ff2fc59ab43d5";
|
||
|
|
const string P_FoamScale = "Vector1_11671d7a4cdb4d059a6c69e39f3f7b3f";
|
||
|
|
const string P_FoamSpeed = "Vector1_3089b6a325a44c1686907af4ee3b0776";
|
||
|
|
const string P_FoamEdge = "Vector1_34f757bec6b8422b9aef3b9d97117a6e";
|
||
|
|
const string P_DeepDistance = "Vector1_566e288f42864b8e9432d81fbdb83f38";
|
||
|
|
const string P_Height = "Vector1_d813b569a4d541d1b2ac4ea9bc66a3b9";
|
||
|
|
const string P_WaweSpeed = "Vector1_ff7a2780aaa94ddd86e156c4707e39a2";
|
||
|
|
const string P_Strength = "Vector1_99cc56b5c6fd474082f07f00a6df94f9";
|
||
|
|
const string P_Speed = "Vector1_8e22a98f75c94b218c49e6c4805e799d";
|
||
|
|
const string P_Alpha = "Vector1_7090c8ca8ea84e2d85858ae4beb5be38";
|
||
|
|
const string P_WaterColor = "Color_9af4ad59934f40d1ae6565e6ab22c45e";
|
||
|
|
const string P_DarkColor = "Color_ca031ae309ff42bdb95f777248fb961d";
|
||
|
|
const string P_FoamColor = "Color_e1f155248d144786a62fc1585ca21e9a";
|
||
|
|
const string P_FoamShadow = "Color_2323d69962e04c499c5d5f0925432b55";
|
||
|
|
|
||
|
|
public static void Run()
|
||
|
|
{
|
||
|
|
var sb = new System.Text.StringBuilder();
|
||
|
|
var src = AssetDatabase.LoadAssetAtPath<Material>(SrcOcean);
|
||
|
|
if (src == null) { sb.AppendLine("🔴 원본 없음 " + SrcOcean); Dump(sb); return; }
|
||
|
|
sb.AppendLine("원본 " + SrcOcean + " shader=" + src.shader.name);
|
||
|
|
|
||
|
|
// ── A = WL_Water_Ocean 그대로 (기준) ──────────────────────────
|
||
|
|
var a = Copy(SrcOcean, Dir + "Farm_Water_WL_A.mat", sb);
|
||
|
|
|
||
|
|
// ── B = 데모 톤 (816a 실측 = 데모 Water.mat 의 깊은물/얕은물) ──
|
||
|
|
var b = Copy(SrcOcean, Dir + "Farm_Water_WL_B.mat", sb);
|
||
|
|
if (b != null)
|
||
|
|
{
|
||
|
|
b.SetColor(P_WaterColor, new Color(0.298f, 0.800f, 1.000f, 1f));
|
||
|
|
b.SetColor(P_DarkColor, new Color(0.133f, 0.518f, 0.745f, 1f));
|
||
|
|
b.SetColor(P_FoamShadow, new Color(0.80f, 0.90f, 0.96f, 1f));
|
||
|
|
b.SetFloat(P_FoamDistance, 3f);
|
||
|
|
b.SetFloat(P_FoamScale, 36f);
|
||
|
|
b.SetFloat(P_DeepDistance, 5f);
|
||
|
|
b.SetFloat(P_Height, 0.12f);
|
||
|
|
b.SetFloat(P_WaweSpeed, 0.5f);
|
||
|
|
EditorUtility.SetDirty(b);
|
||
|
|
}
|
||
|
|
|
||
|
|
// ── C = 차분(채도↓ · 파도·거품 작게) ───────────────────────────
|
||
|
|
var c = Copy(SrcOcean, Dir + "Farm_Water_WL_C.mat", sb);
|
||
|
|
if (c != null)
|
||
|
|
{
|
||
|
|
c.SetColor(P_WaterColor, new Color(0.360f, 0.690f, 0.820f, 1f));
|
||
|
|
c.SetColor(P_DarkColor, new Color(0.170f, 0.420f, 0.570f, 1f));
|
||
|
|
c.SetColor(P_FoamShadow, new Color(0.78f, 0.86f, 0.92f, 1f));
|
||
|
|
c.SetFloat(P_FoamDistance, 2.2f);
|
||
|
|
c.SetFloat(P_FoamScale, 28f);
|
||
|
|
c.SetFloat(P_DeepDistance, 7f);
|
||
|
|
c.SetFloat(P_Height, 0.09f);
|
||
|
|
c.SetFloat(P_WaweSpeed, 0.4f);
|
||
|
|
c.SetFloat(P_FoamSpeed, 0.4f);
|
||
|
|
EditorUtility.SetDirty(c);
|
||
|
|
}
|
||
|
|
|
||
|
|
AssetDatabase.SaveAssets();
|
||
|
|
|
||
|
|
// ── FI 원본 물 머티리얼 찾기 (remap 의 from 을 그대로 재사용) ──
|
||
|
|
Material fiWater = null;
|
||
|
|
var so = AssetDatabase.LoadAssetAtPath<WL.Look.Farm.WLIslandLookSettings>(SO);
|
||
|
|
if (so != null && so.materialRemap != null)
|
||
|
|
foreach (var e in so.materialRemap)
|
||
|
|
if (e != null && e.from != null && e.from.shader != null
|
||
|
|
&& e.from.shader.name == "Shader Graphs/Simple Water") fiWater = e.from;
|
||
|
|
sb.AppendLine("FI 원본 물 = " + (fiWater == null ? "🔴 못 찾음" : AssetDatabase.GetAssetPath(fiWater)));
|
||
|
|
|
||
|
|
// ── SO 배선 ───────────────────────────────────────────────────
|
||
|
|
if (so != null)
|
||
|
|
{
|
||
|
|
so.waterFrom = fiWater;
|
||
|
|
so.waterTo = b; // 1차 기본 = B (3단 비교 뒤 확정)
|
||
|
|
so.waterMode = 1;
|
||
|
|
so.skyScopeEnabled = 1;
|
||
|
|
if (so.skyScenes == null || so.skyScenes.Length < 4)
|
||
|
|
so.skyScenes = new string[] { "Level01", "WL_FarmLook", "WL_Dungeon01", "WL_Dungeon02" };
|
||
|
|
EditorUtility.SetDirty(so);
|
||
|
|
AssetDatabase.SaveAssets();
|
||
|
|
sb.AppendLine("SO 배선 완료 — waterMode=" + so.waterMode + " waterTo=" + (so.waterTo ? so.waterTo.name : "없음")
|
||
|
|
+ " skyScopeEnabled=" + so.skyScopeEnabled + " skyScenes=" + string.Join(",", so.skyScenes));
|
||
|
|
}
|
||
|
|
else sb.AppendLine("🔴 SO 못 읽음 " + SO);
|
||
|
|
|
||
|
|
Dump(sb);
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>3단 중 하나를 SO 에 물린다 (비교 캡처용).</summary>
|
||
|
|
public static void PickA() { Pick("Farm_Water_WL_A"); }
|
||
|
|
public static void PickB() { Pick("Farm_Water_WL_B"); }
|
||
|
|
public static void PickC() { Pick("Farm_Water_WL_C"); }
|
||
|
|
public static void PickOff() { Pick(null); }
|
||
|
|
|
||
|
|
static void Pick(string name)
|
||
|
|
{
|
||
|
|
var so = AssetDatabase.LoadAssetAtPath<WL.Look.Farm.WLIslandLookSettings>(SO);
|
||
|
|
if (so == null) { Debug.Log("[816h] SO 없음"); return; }
|
||
|
|
if (name == null) { so.waterMode = 0; }
|
||
|
|
else { so.waterMode = 1; so.waterTo = AssetDatabase.LoadAssetAtPath<Material>(Dir + name + ".mat"); }
|
||
|
|
EditorUtility.SetDirty(so); AssetDatabase.SaveAssets();
|
||
|
|
Debug.Log("[816h] 물 = " + (name ?? "지금(FarmingIsland)") + " mode=" + so.waterMode);
|
||
|
|
}
|
||
|
|
|
||
|
|
static Material Copy(string src, string dst, System.Text.StringBuilder sb)
|
||
|
|
{
|
||
|
|
if (System.IO.File.Exists(dst)) AssetDatabase.DeleteAsset(dst);
|
||
|
|
if (!AssetDatabase.CopyAsset(src, dst)) { sb.AppendLine("🔴 복사 실패 " + dst); return null; }
|
||
|
|
AssetDatabase.ImportAsset(dst);
|
||
|
|
var m = AssetDatabase.LoadAssetAtPath<Material>(dst);
|
||
|
|
sb.AppendLine("복사 " + dst + " = " + (m == null ? "null" : m.shader.name));
|
||
|
|
return m;
|
||
|
|
}
|
||
|
|
|
||
|
|
static void Dump(System.Text.StringBuilder sb)
|
||
|
|
{
|
||
|
|
System.IO.File.WriteAllText("AgentScripts/WL816h_BUILD.txt", sb.ToString());
|
||
|
|
Debug.Log("[816h build]\n" + sb);
|
||
|
|
}
|
||
|
|
}
|