Remove StageAnimationPlayer: a stand-in with guessed timing is worse than nothing
Its premise was that a single clip is an unambiguous instruction to play. It is not — it means the object has one state, while whether that state is running was AnimationObjectController's per-frame decision, and that class has zero serialized fields, so no amount of dumping recovers it. What was left was policy invented here: the wash lights whipping through a 2-second sweep the original does not perform, and a mirror ball turning at a rate nothing can validate. After today's exclusions it took over exactly one object on live10149. Two hundred lines to spin one ball at a speed we cannot check, in a subsystem that also claims — by existing — that this area has been dealt with. That last part is the real cost: a wrong stand-in reads as done and stops anyone looking again. So the stage's 283 Animation components now play nothing, deliberately. The disco balls do not turn, the wash lights do not sweep, the neon signs do not move. That is the honest state given what is recoverable, and it is the prefab author's pose rather than our invention. The file is renamed to StageMissingScriptCensus.cs, keeping only the census that was sharing it — that one is a genuine progress meter for rebuilt signatures and never had anything to do with animation playback. One finding survives the deletion and is written into LIVE_TRACKS.md so a future attempt starts from it rather than rediscovering it: do not drive stage animation with Animation.Play(), which runs on Unity's own clock and desyncs the moment the live is paused or the scrubber moves. Set AnimationState.time from LiveTimelineControl.currentLiveTime (seconds) and Sample(). The same entry records why the feature is off, what would be needed to revive it (per-stage calibration against reference footage, or IL2CPP metadata), and that the clip assets themselves are fully readable — which is the trap, since knowing the asset says nothing about when the original plays it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UzXXkLzVC8pNA3JjyUGMbq
This commit is contained in:
@@ -1,211 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gallop.Live
|
||||
{
|
||||
/// <summary>
|
||||
/// 舞台自带 <see cref="Animation"/> 的播放。
|
||||
///
|
||||
/// 为什么需要:live10149 的舞台 prefab 引用了 11 个脚本类,UmaViewer 里**只有
|
||||
/// StageController 存在**,另外 10 个(AnimationObjectController、MirrorBallProjector、
|
||||
/// MirrorReflection、CustomLensFlare、UnityLensFlareController、CustomProjector、
|
||||
/// LightProjection、WashLightController、BillboardController、ShaderParamController)
|
||||
/// 全部缺失,那些 MonoBehaviour 反序列化后脚本引用为空,永远不执行。
|
||||
///
|
||||
/// 其中 AnimationObjectController 的缺席后果最直接:舞台上 283 个 Animation 组件
|
||||
/// **全部** `playAutomatically = true`,但**默认 clip(m_Animation)全部为空**。
|
||||
/// Unity 的 playAutomatically 播的是默认 clip,默认 clip 为空就什么都不播 ——
|
||||
/// 原版是靠那个脚本显式 Play("clip名") 的。于是整个舞台的动画一个都没动:
|
||||
/// 迪斯科灯球不转、wash 灯不扫、霓虹灯牌不动。
|
||||
///
|
||||
/// **只处理唯一解的情形。** clip 数量分布:
|
||||
/// 1 个 clip → 4 个对象(mirrorball_flarelight、wash_ground_b/c/d),全是 `*_loop_000`,
|
||||
/// 没有歧义,直接播。
|
||||
/// 3 个 clip → `loop_000` / `up_000` / `loop_001`,是「过渡 + 两个循环态」的状态机,
|
||||
/// 选哪个、何时切换都没有依据。
|
||||
/// 5 个 clip → 272 个对象(占 96%,多半是观众席),同样未知。
|
||||
/// 后两类只打一次日志把 clip 名列出来,**不猜**。选择规则逆出来之后再补。
|
||||
///
|
||||
/// 播放时机走 OnEnable 而不是初始化时一次性 Play:受时间轴控制的灯(名字含
|
||||
/// blinklight/_wash_/laser/spotlight3d)初始是 inactive 的,要等轨道把它们打开,
|
||||
/// 在 inactive 对象上调 Play() 不会生效。镜面球容器
|
||||
/// pfb_env_live10149_blinklight_mirrorball_flarelight 正好就是这种情况。
|
||||
///
|
||||
/// ── 2026-08-07 收窄:wash 灯的扫动 clip 不再 free-run ──
|
||||
///
|
||||
/// 「只有一个 clip」说明的是**这个物件只有一个状态**,不等于**这个状态一直在播** ——
|
||||
/// 后者正是缺失的 `AnimationObjectController` 负责决定的事,我把两者混为一谈了。
|
||||
///
|
||||
/// 实测反例:`wash_ground_b/c/d` 的单 clip 是 `swing_*` 节点 90°→0°→90° 的往返扫动,
|
||||
/// 2.0 s 一个来回(12 盏完全同步)。放出来就是一排灯在疯狂摆头,而**原版 MV 里
|
||||
/// 地面 wash 灯是不扫的,只闪**。所以这三个不接管。
|
||||
///
|
||||
/// 镜面球保留:它的 clip 是绕 Y 单调转到 −359°,是自明的常转 idle,原版里球也确实在转。
|
||||
/// (转速是否 1.0 倍仍无依据,见 CLAUDE.md。)
|
||||
///
|
||||
/// ⚠ 这条排除是**看参考视频得出的观察**,不是从 bundle 数据推出来的。
|
||||
/// 如果哪个舞台的 wash 灯真的该扫,需要新的证据才能放开,别照着这行反推。
|
||||
/// </summary>
|
||||
public static class StageAnimationPlayer
|
||||
{
|
||||
/// <summary>
|
||||
/// 扫动类灯具的名字特征。命中的不接管 —— 见类注释。
|
||||
/// 和 <see cref="StageController"/> 的 `_wash_` 判据同源,那里也是按名字识别 wash 灯的。
|
||||
/// </summary>
|
||||
private static bool IsSweepRig(string name) => name.Contains("_wash_");
|
||||
|
||||
public static void Setup(StageController stage)
|
||||
{
|
||||
if (stage == null) return;
|
||||
|
||||
int single = 0, ambiguous = 0, empty = 0, sweepSkipped = 0;
|
||||
var loggedClipSets = new HashSet<string>();
|
||||
|
||||
foreach (var anim in stage.GetComponentsInChildren<Animation>(true))
|
||||
{
|
||||
if (anim == null || !anim.playAutomatically) continue;
|
||||
|
||||
if (IsSweepRig(anim.gameObject.name))
|
||||
{
|
||||
if (sweepSkipped++ == 0)
|
||||
Debug.Log($"[StageAnim] 跳过扫动类灯具(如 '{anim.gameObject.name}'):" +
|
||||
"单 clip 只说明它只有一个状态,不说明该一直播;原版地面 wash 灯不扫只闪。");
|
||||
continue;
|
||||
}
|
||||
|
||||
var clips = new List<AnimationClip>();
|
||||
foreach (AnimationState st in anim)
|
||||
{
|
||||
if (st != null && st.clip != null) clips.Add(st.clip);
|
||||
}
|
||||
|
||||
if (clips.Count == 0) { empty++; continue; }
|
||||
|
||||
if (clips.Count == 1)
|
||||
{
|
||||
// 唯一解。注意**不要**设 anim.clip、也不要 Play():
|
||||
// playAutomatically 是 true,一旦有了默认 clip,Unity 会用自己的时钟
|
||||
// 自动播放,于是 live 暂停/拖动进度条时舞台照转。必须由时间轴驱动。
|
||||
anim.Stop();
|
||||
var driver = anim.gameObject.GetComponent<StageAnimationAutoPlay>();
|
||||
if (driver == null) driver = anim.gameObject.AddComponent<StageAnimationAutoPlay>();
|
||||
driver.Bind(anim, clips[0]);
|
||||
single++;
|
||||
// 打出时长:镜面球那条 clip 离线量到 2.0s 转满 360°(30 RPM),
|
||||
// 如果运行时 length 不是 2.0,说明转速问题出在 clip 解析而不是编排。
|
||||
Debug.Log($"[StageAnim] 接管 '{anim.gameObject.name}' ← {clips[0].name} " +
|
||||
$"length={clips[0].length:F3}s wrapMode={clips[0].wrapMode}");
|
||||
continue;
|
||||
}
|
||||
|
||||
ambiguous++;
|
||||
var names = new List<string>();
|
||||
foreach (var c in clips) names.Add(c.name);
|
||||
string key = string.Join(",", names);
|
||||
if (loggedClipSets.Add(key))
|
||||
{
|
||||
Debug.Log($"[StageAnim] '{anim.gameObject.name}' 有 {clips.Count} 个 clip," +
|
||||
$"选择规则未知,**未播放**:{key}");
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[StageAnim] 单 clip 已接管 {single} 个;扫动类跳过 {sweepSkipped} 个;" +
|
||||
$"多 clip 未处理 {ambiguous} 个;无 clip {empty} 个");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 缺失脚本的运行时普查,当进度表用:每按原签名实现一个原版脚本,
|
||||
/// 「脚本丢失」就该下降对应的实例数(已验证 BillboardController 令 892→728,正好 −164)。
|
||||
///
|
||||
/// 签名清单、各类实例数、以及「为什么建同名类就能收到字段」见 CLAUDE.md
|
||||
/// 「用原签名重建脚本」。一句话:Unity 按**类名 + namespace + 程序集名**解析 MonoScript,
|
||||
/// 而 `umamusume.asmdef` 的程序集名与 bundle 里写的完全一致 —— 那 892 个空槽位
|
||||
/// 只是没人写,不是读不到。(这条最初记反了,是本普查的结果自己推翻的:
|
||||
/// 存活的 `AssetHolder` 和 `StageController` 正是靠这个机制绑上的。)
|
||||
/// </summary>
|
||||
public static class StageMissingScriptCensus
|
||||
{
|
||||
public static void Dump(StageController stage)
|
||||
{
|
||||
if (stage == null) return;
|
||||
|
||||
int slots = 0, missing = 0, alive = 0;
|
||||
var aliveTypes = new Dictionary<string, int>();
|
||||
|
||||
foreach (var tr in stage.GetComponentsInChildren<Transform>(true))
|
||||
{
|
||||
var comps = tr.GetComponents<Component>();
|
||||
foreach (var c in comps)
|
||||
{
|
||||
// MonoBehaviour 槽位里脚本丢失时,元素为 null。
|
||||
if (c == null) { slots++; missing++; continue; }
|
||||
if (c is MonoBehaviour)
|
||||
{
|
||||
slots++; alive++;
|
||||
string n = c.GetType().Name;
|
||||
aliveTypes.TryGetValue(n, out int k);
|
||||
aliveTypes[n] = k + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var parts = new List<string>();
|
||||
foreach (var kv in aliveTypes) parts.Add($"{kv.Key}x{kv.Value}");
|
||||
Debug.Log($"[StageScripts] MonoBehaviour 槽位 {slots}:脚本丢失 {missing},存活 {alive}" +
|
||||
(parts.Count > 0 ? $"({string.Join(", ", parts)})" : "") +
|
||||
"。基线 892(live10149);每按签名实现一个类,丢失数应下降对应实例数。" +
|
||||
"已验证:BillboardController 令 892→728(-164)。");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用 live 时间轴的时间手动采样 clip。
|
||||
///
|
||||
/// **不能用 Animation.Play()** —— 那跑的是 Unity 自己的时钟,结果是:live 暂停了舞台
|
||||
/// 照转、拖动进度条不跟随、播放速度和歌无关。舞台动画属于演出编排的一部分,
|
||||
/// 必须和 <see cref="LiveTimelineControl.currentLiveTime"/> 同源,
|
||||
/// 所以这里每帧设 AnimationState.time 再 Sample()。
|
||||
///
|
||||
/// 时间取 currentLiveTime,暂停时它不前进,拖动时它跳变,两种情况都自动正确。
|
||||
/// </summary>
|
||||
public class StageAnimationAutoPlay : MonoBehaviour
|
||||
{
|
||||
private Animation _anim;
|
||||
private AnimationClip _clip;
|
||||
private string _clipName;
|
||||
private float _length;
|
||||
private bool _loop;
|
||||
|
||||
public void Bind(Animation anim, AnimationClip clip)
|
||||
{
|
||||
_anim = anim;
|
||||
_clip = clip;
|
||||
_clipName = clip != null ? clip.name : null;
|
||||
_length = clip != null ? clip.length : 0f;
|
||||
// clip 自身的 wrapMode 决定循环与否;live10149 的 22 个 clip 里 16 个是 Loop。
|
||||
_loop = clip != null && (clip.wrapMode == WrapMode.Loop || clip.wrapMode == WrapMode.PingPong);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (_anim == null || _clip == null || _length <= 0f) return;
|
||||
|
||||
var ctrl = Director.instance != null ? Director.instance._liveTimelineControl : null;
|
||||
if (ctrl == null) return;
|
||||
|
||||
float t = ctrl.currentLiveTime;
|
||||
// TODO: PingPong 按 Loop 处理,来回摆的那一半没实现(live10149 上没有 PingPong clip)。
|
||||
float sampleTime = _loop ? Mathf.Repeat(t, _length) : Mathf.Clamp(t, 0f, _length);
|
||||
|
||||
var state = _anim[_clipName];
|
||||
if (state == null) return;
|
||||
state.enabled = true;
|
||||
state.weight = 1f;
|
||||
state.time = sampleTime;
|
||||
_anim.Sample();
|
||||
// 采样完就关掉,避免 Animation 自己再按 Unity 时钟推进一次。
|
||||
state.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,8 +110,12 @@ namespace Gallop.Live
|
||||
// 光柱/闪光类 shader 的混合状态被 bundle 材质里的 URP Lit 属性表压成了不透明,先修回来。
|
||||
RestoreAuthoredBlendState();
|
||||
|
||||
// 舞台自带 Animation 的播放(原版由缺失的 AnimationObjectController 负责)。
|
||||
StageAnimationPlayer.Setup(this);
|
||||
// ⚠ 舞台自带的 283 个 Animation **有意不播**,不是漏了。
|
||||
// 它们全部 playAutomatically=true 但默认 clip 为空,原版靠 AnimationObjectController
|
||||
// 显式 Play("clip名");而那个类实测**零序列化字段**,纯行为,方法体拿不到 ——
|
||||
// 「播哪个 / 何时播 / 多快」没有任何数据能还原。曾写过一版替代品,结果是
|
||||
// wash 灯以 2 秒一个来回疯狂摆头、镜面球转速无从校验,遂整体撤除。
|
||||
// 理由与复活条件见 LIVE_TRACKS.md「缺 ground truth,已禁用」。
|
||||
|
||||
// 缺失脚本普查:每按签名实现一个原版脚本,「脚本丢失」计数就该下降对应实例数。
|
||||
StageMissingScriptCensus.Dump(this);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gallop.Live
|
||||
{
|
||||
/// <summary>
|
||||
/// 缺失脚本的运行时普查,当进度表用:每按原签名实现一个原版脚本,
|
||||
/// 「脚本丢失」就该下降对应的实例数(已验证 BillboardController 令 892→728,正好 −164)。
|
||||
///
|
||||
/// 签名清单、各类实例数、以及「为什么建同名类就能收到字段」见 CLAUDE.md
|
||||
/// 「用原签名重建脚本」。一句话:Unity 按**类名 + namespace + 程序集名**解析 MonoScript,
|
||||
/// 而 `umamusume.asmdef` 的程序集名与 bundle 里写的完全一致 —— 那 892 个空槽位
|
||||
/// 只是没人写,不是读不到。(这条最初记反了,是本普查的结果自己推翻的:
|
||||
/// 存活的 `AssetHolder` 和 `StageController` 正是靠这个机制绑上的。)
|
||||
/// </summary>
|
||||
public static class StageMissingScriptCensus
|
||||
{
|
||||
public static void Dump(StageController stage)
|
||||
{
|
||||
if (stage == null) return;
|
||||
|
||||
int slots = 0, missing = 0, alive = 0;
|
||||
var aliveTypes = new Dictionary<string, int>();
|
||||
|
||||
foreach (var tr in stage.GetComponentsInChildren<Transform>(true))
|
||||
{
|
||||
var comps = tr.GetComponents<Component>();
|
||||
foreach (var c in comps)
|
||||
{
|
||||
// MonoBehaviour 槽位里脚本丢失时,元素为 null。
|
||||
if (c == null) { slots++; missing++; continue; }
|
||||
if (c is MonoBehaviour)
|
||||
{
|
||||
slots++; alive++;
|
||||
string n = c.GetType().Name;
|
||||
aliveTypes.TryGetValue(n, out int k);
|
||||
aliveTypes[n] = k + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var parts = new List<string>();
|
||||
foreach (var kv in aliveTypes) parts.Add($"{kv.Key}x{kv.Value}");
|
||||
Debug.Log($"[StageScripts] MonoBehaviour 槽位 {slots}:脚本丢失 {missing},存活 {alive}" +
|
||||
(parts.Count > 0 ? $"({string.Join(", ", parts)})" : "") +
|
||||
"。基线 892(live10149);每按签名实现一个类,丢失数应下降对应实例数。" +
|
||||
"已验证:BillboardController 令 892→728(-164)。");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user