StageBlend: report renderers, not just materials — one material covers the whole stage
The log said "1 of 31 materials corrected" and that read like a one-off fix for one lamp, which prompted the reasonable question of why far more than one lamp got better. The count was right and the unit was wrong. Materials are heavily shared here: roughly 1500 renderers across live10149 draw from 31 unique materials. The single corrected one, mtl_env_live10149_blinklight000 on LightBlinkBlend, is the blink-light material for the entire stage — it appears in all 27 BlinkLight groups, about 1450 renderers: audience_light 95, mob000 570, glow_object 67, glow_ramp 58, the mirror ball flare quads 83, every wash group, and the LED panels. So the same fix that cleared the ground wash wedges is also why the small bulbs stopped rendering as black blocks, which had been sitting in LIVE_TRACKS.md as an unexplained symptom. The log now counts affected renderers alongside materials and prints the per-material tally, so the blast radius is legible without cross-referencing the BlinkLight lines by hand. Both docs are corrected in the same pass. The earlier note narrowed the claim correctly — only materials whose current shader declares the property are touched — but by leading with "only 1" it understated the result in the other direction. That is three scope misstatements about this one fix in a day, so the rule now sits next to it: report the unit that matches the question being asked. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UzXXkLzVC8pNA3JjyUGMbq
This commit is contained in:
@@ -145,13 +145,23 @@ namespace Gallop.Live
|
||||
private void RestoreAuthoredBlendState()
|
||||
{
|
||||
var done = new HashSet<Material>();
|
||||
var fixedMats = new Dictionary<Material, string>();
|
||||
var changed = new List<string>();
|
||||
// 材质在舞台上高度共享(live10149:约 1500 个渲染器只有 31 个材质),
|
||||
// 所以只报材质数会把影响面说小几个数量级 —— 一个 blinklight 材质就铺满整个舞台的灯。
|
||||
// 顺带记渲染器数,日志才说得清「改了 1 个材质」到底意味着什么。
|
||||
var rendererCount = new Dictionary<Material, int>();
|
||||
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true))
|
||||
{
|
||||
foreach (var mat in r.sharedMaterials)
|
||||
{
|
||||
if (mat == null || mat.shader == null || !done.Add(mat)) continue;
|
||||
if (mat == null || mat.shader == null) continue;
|
||||
|
||||
rendererCount.TryGetValue(mat, out int n);
|
||||
rendererCount[mat] = n + 1;
|
||||
|
||||
if (!done.Add(mat)) continue;
|
||||
|
||||
string before = null, after = null;
|
||||
foreach (string prop in kBlendProps)
|
||||
@@ -166,18 +176,27 @@ namespace Gallop.Live
|
||||
}
|
||||
|
||||
if (after != null)
|
||||
changed.Add($"{mat.name}[{mat.shader.name}] {before}→ {after}");
|
||||
fixedMats.Add(mat, $"{mat.name}[{mat.shader.name}] {before}→ {after}");
|
||||
}
|
||||
}
|
||||
|
||||
if (changed.Count == 0)
|
||||
if (fixedMats.Count == 0)
|
||||
{
|
||||
Debug.Log($"[StageBlend] {done.Count} 个材质的混合状态与 shader 声明一致,无需修正");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"[StageBlend] {changed.Count}/{done.Count} 个材质的 _SrcBlend/_DstBlend 与 shader 声明不符," +
|
||||
$"已恢复成 shader 的默认值:\n " + string.Join("\n ", changed));
|
||||
int affected = 0;
|
||||
foreach (var kv in fixedMats)
|
||||
{
|
||||
rendererCount.TryGetValue(kv.Key, out int n);
|
||||
affected += n;
|
||||
changed.Add($"{kv.Value}({n} 个渲染器)");
|
||||
}
|
||||
|
||||
Debug.Log($"[StageBlend] {fixedMats.Count}/{done.Count} 个材质的 _SrcBlend/_DstBlend 与 shader 声明不符," +
|
||||
$"已恢复成 shader 的默认值 —— 共影响 **{affected}** 个渲染器:\n " +
|
||||
string.Join("\n ", changed));
|
||||
}
|
||||
|
||||
private static readonly string[] kBlendProps = { "_SrcBlend", "_DstBlend" };
|
||||
|
||||
Reference in New Issue
Block a user