Live: fix six silently-failing track paths, add PostFilm data layer
Every fix here is the same shape: the keyframe data was already parsed
correctly and then dropped somewhere downstream, with no error logged.
Found by dumping the authoritative schema with tools/ and comparing against
what the handlers actually consume.
BgColor1 (8) — the largest track in the corpus, 43617 keys / 59 songs
* AlterUpdate_BgColor1 filtered on a `validBgColorNames` whitelist of four
character group names, discarding the other 16 stage groups outright.
On song 1177 that is ~92% of the track's keys. Filter removed; Director
now routes by group name (characters vs stage).
* Stage branch resolves renderers by walking the whole stage hierarchy.
StageObjectMap alone is not enough: it dedupes by name, and crowd groups
have 66-570 same-named objects, so only the first was ever coloured.
* Writes _MulColor0, confirmed by enumerating the shaders' property tables.
_AmbientColor belongs to BgColor2 — they are separate channels on the
same shader and must not be written by both.
* Populates fields the dispatcher had always left at default: colorPower,
scale, vertexColorToonPower, outlineWidthPower, LightBlendMode,
IsSilhouette, IsProjector, TimelineName.
Object (33) — the neon sign never descended from the ceiling
* The group name `neonsign` is a StageController._stageObjectUnits *unit*
name; no GameObject of that name exists, so the whole track never fired.
UpdateObject now falls back to StageObjectUnitMap and applies to each
child of the unit.
* ObjectUpdateInfo.OffsetType was populated by the dispatcher but never
read, so Add-relative positions were written as absolute and objects
snapped to their parent's origin. Now honoured against a lazily captured
base local TRS.
BlinkLight (45) — 19420 keys / 57 songs, the biggest lighting payload
* Wrote _Color, which does not exist on Gallop/3D/Live/Stage/LightBlinkBlend
(its colour channel is _BlinkLightColor), so the write was a no-op and the
lights rendered black. Now probes the shader for the real property.
* Brightness goes to _ColorPower instead of being folded into the colour,
falling back to colour*power only where that property is absent.
* Uses MaterialPropertyBlock; the old path hit Renderer.materials every
frame, allocating and breaking batching.
PostFilm (39) — ~20200 keys / 59 songs, previously recorded as empty
* Data class fields reordered to the bundle's TypeTree order and the five
missing BlinkLight* fields added; LiveTimelineKeyPostFilmDataList created;
postFilmKeys / postFilm2Keys / postFilm3Keys declared on the worksheet.
Runtime now deserializes 100 / 161 / 87 keys on song 1177.
* AlterUpdate_PostFilm dispatch with interpolation, PostFilmUpdateInfo,
a URP ScriptableRendererFeature and a full-screen blit shader.
* Rendering is disabled by default: filmOptionParam's geometry is undefined
anywhere we can read. All 100 keys on song 1177 are Vignette variants, so
that parameter decides the whole look, and the shader that defines it is
not in the `shader` bundle (all 499 searched by name and by property
signature) — it ships inside the app binary.
Diagnostics
* LiveTimelineWorksheetDiag dumps every track field with group names and key
counts, and Probe() tests whether a candidate field name matches the
bundle TypeTree. Confirmed worksheetList.Count == 1 (SheetType MainLive),
and that WashLightList really is spelled with a capital W — upstream
katboi01 uses washLightList, which never populates.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,6 +58,8 @@ namespace Gallop.Live.Cutt
|
||||
|
||||
public event BgColor2UpdateInfoDelegate OnUpdateBgColor2;
|
||||
|
||||
public event PostFilmUpdateInfoDelegate OnUpdatePostFilm;
|
||||
|
||||
public event TransformUpdateInfoDelegate OnUpdateTransform;
|
||||
|
||||
public event ObjectUpdateInfoDelegate OnUpdateObject;
|
||||
@@ -124,6 +126,13 @@ namespace Gallop.Live.Cutt
|
||||
|
||||
public Dictionary<string, GameObject> StageObjectMap = new Dictionary<string, GameObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Object/Transform 轨道的组名不一定是 GameObject 名,也可能是 StageController
|
||||
/// 的 _stageObjectUnits 单元名。例如 live10149 的 'neonsign' 就是一个 unit,
|
||||
/// 底下挂着 glow_neonsign / wash_neonsign_a / wash_neonsign_b 三个子对象。
|
||||
/// </summary>
|
||||
public Dictionary<string, StageObjectUnit> StageObjectUnitMap = new Dictionary<string, StageObjectUnit>();
|
||||
|
||||
public float currentLiveTime
|
||||
{
|
||||
get
|
||||
@@ -371,6 +380,9 @@ namespace Gallop.Live.Cutt
|
||||
AlterUpdate_SimpleListControl(workSheet.chromaticAberrationList, d => d.keys, OnUpdateChromaticAberration, _currentFrame);
|
||||
AlterUpdate_SimpleListControl(workSheet.hdrBloomKeys, d => d.keys, OnUpdateHdrBloom, _currentFrame);
|
||||
AlterUpdate_SimpleListControl(workSheet.colorCorrectionDataLists, d => d.keys, OnUpdateColorCorrection, _currentFrame);
|
||||
AlterUpdate_PostFilm(workSheet.postFilmKeys, 0, _currentFrame);
|
||||
AlterUpdate_PostFilm(workSheet.postFilm2Keys, 1, _currentFrame);
|
||||
AlterUpdate_PostFilm(workSheet.postFilm3Keys, 2, _currentFrame);
|
||||
|
||||
_isNowAlterUpdate = false;
|
||||
|
||||
@@ -1721,22 +1733,24 @@ namespace Gallop.Live.Cutt
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<string> validBgColorNames = new HashSet<string> { "CharaCenter", "CharaLeft", "CharaRight", "CharaColor" };
|
||||
/// <summary>BgColor1 里指向角色的组名;其余组名都是舞台物件,由 StageObjectMap 解析。</summary>
|
||||
public static readonly HashSet<string> CharaBgColorNames =
|
||||
new HashSet<string> { "CharaCenter", "CharaLeft", "CharaRight", "CharaColor" };
|
||||
|
||||
private void AlterUpdate_BgColor1(LiveTimelineWorkSheet sheet, float currentFrame) {
|
||||
int count = sheet.bgColor1List.Count;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
LiveTimelineKeyBgColor1DataList keys = sheet.bgColor1List[i].keys;
|
||||
var groupData = sheet.bgColor1List[i];
|
||||
LiveTimelineKeyBgColor1DataList keys = groupData.keys;
|
||||
if (keys.HasAttribute(LiveTimelineKeyDataListAttr.Disable) || !keys.EnablePlayModeTimeline(_playMode))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (!validBgColorNames.Contains(sheet.bgColor1List[i].name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// 这里原本只放行 validBgColorNames(4 个角色组),把舞台物件组全丢了。
|
||||
// 实测一首歌 20 组 / 1239 keys 里有 17 组是舞台物件,约 92% 的数据被丢弃。
|
||||
// 现在全部下发,由 Director 按 TimelineName 分流到角色 or 舞台。
|
||||
FindTimelineKey(out var curKey, out var nextKey, keys, currentFrame);
|
||||
if (curKey == null)
|
||||
{
|
||||
@@ -1745,6 +1759,24 @@ namespace Gallop.Live.Cutt
|
||||
BgColor1UpdateInfo updateInfo = default;
|
||||
LiveTimelineKeyBgColor1Data bgColorData = curKey as LiveTimelineKeyBgColor1Data;
|
||||
LiveTimelineKeyBgColor1Data bgColorData2 = nextKey as LiveTimelineKeyBgColor1Data;
|
||||
|
||||
updateInfo.TimelineName = groupData.name;
|
||||
updateInfo.TimelineNameHash = string.IsNullOrEmpty(groupData.name) ? 0 : Animator.StringToHash(groupData.name);
|
||||
updateInfo.TargetCharaIdArray = groupData.TargetCharaIdArray;
|
||||
updateInfo.TargetDressIdArray = groupData.TargetDressIdArray;
|
||||
|
||||
// 以下字段此前从未填充,handler 拿到的一直是 default。
|
||||
updateInfo.colorPower = bgColorData.power;
|
||||
updateInfo.scale = bgColorData.scale;
|
||||
updateInfo.vertexColorToonPower = bgColorData.vertexColorToonPower;
|
||||
updateInfo.outlineWidthPower = bgColorData.outlineWidthPower;
|
||||
updateInfo.LightBlendMode = bgColorData.LightBlendMode;
|
||||
updateInfo.IsSilhouette = bgColorData.IsSilhouette;
|
||||
updateInfo.IsProjector = bgColorData.IsProjector;
|
||||
updateInfo.CurrentColorType = bgColorData.ColorType;
|
||||
updateInfo.CurrentColor = bgColorData.color;
|
||||
updateInfo.CurrentFlags = bgColorData.flags;
|
||||
|
||||
if (bgColorData2 != null && bgColorData2.interpolateType != 0)
|
||||
{
|
||||
float t = CalculateInterpolationValue(bgColorData, bgColorData2, currentFrame);
|
||||
@@ -1770,6 +1802,67 @@ namespace Gallop.Live.Cutt
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PostFilm (39)。postFilmKeys 是直接的 key 列表(不是分组列表),
|
||||
/// 所以不能走 AlterUpdate_SimpleListControl,得自己找 key 和插值。
|
||||
/// </summary>
|
||||
private void AlterUpdate_PostFilm(LiveTimelineKeyPostFilmDataList keys, int layerIndex, float currentFrame)
|
||||
{
|
||||
if (OnUpdatePostFilm == null || keys == null || keys.Count == 0) return;
|
||||
if (keys.HasAttribute(LiveTimelineKeyDataListAttr.Disable) || !keys.EnablePlayModeTimeline(_playMode))
|
||||
return;
|
||||
|
||||
FindTimelineKey(out var curKey, out var nextKey, keys, currentFrame);
|
||||
var cur = curKey as LiveTimelineKeyPostFilmData;
|
||||
if (cur == null) return;
|
||||
var next = nextKey as LiveTimelineKeyPostFilmData;
|
||||
|
||||
PostFilmUpdateInfo info = default;
|
||||
info.layerIndex = layerIndex;
|
||||
info.filmMode = cur.filmMode;
|
||||
info.colorType = cur.colorType;
|
||||
info.layerMode = cur.layerMode;
|
||||
info.colorBlend = cur.colorBlend;
|
||||
info.movieResId = cur.movieResId;
|
||||
info.movieFrameOffset = cur.movieFrameOffset;
|
||||
info.movieSpeed = cur.movieSpeed;
|
||||
info.enable = cur.filmMode != PostFilmMode.None;
|
||||
|
||||
if (next != null && next.interpolateType != 0)
|
||||
{
|
||||
float t = CalculateInterpolationValue(cur, next, currentFrame);
|
||||
info.filmPower = Mathf.Lerp(cur.filmPower, next.filmPower, t);
|
||||
info.color0 = Color.Lerp(cur.color0, next.color0, t);
|
||||
info.color1 = Color.Lerp(cur.color1, next.color1, t);
|
||||
info.color2 = Color.Lerp(cur.color2, next.color2, t);
|
||||
info.color3 = Color.Lerp(cur.color3, next.color3, t);
|
||||
info.filmOffsetParam = Vector2.Lerp(cur.filmOffsetParam, next.filmOffsetParam, t);
|
||||
info.filmOptionParam = Vector4.Lerp(cur.filmOptionParam, next.filmOptionParam, t);
|
||||
info.filmScale = Vector2.Lerp(cur.FilmScale, next.FilmScale, t);
|
||||
info.rollAngle = Mathf.Lerp(cur.RollAngle, next.RollAngle, t);
|
||||
info.depthPower = Mathf.Lerp(cur.depthPower, next.depthPower, t);
|
||||
info.depthClip = Mathf.Lerp(cur.DepthClip, next.DepthClip, t);
|
||||
info.colorBlendFactor = Mathf.Lerp(cur.colorBlendFactor, next.colorBlendFactor, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.filmPower = cur.filmPower;
|
||||
info.color0 = cur.color0;
|
||||
info.color1 = cur.color1;
|
||||
info.color2 = cur.color2;
|
||||
info.color3 = cur.color3;
|
||||
info.filmOffsetParam = cur.filmOffsetParam;
|
||||
info.filmOptionParam = cur.filmOptionParam;
|
||||
info.filmScale = cur.FilmScale;
|
||||
info.rollAngle = cur.RollAngle;
|
||||
info.depthPower = cur.depthPower;
|
||||
info.depthClip = cur.DepthClip;
|
||||
info.colorBlendFactor = cur.colorBlendFactor;
|
||||
}
|
||||
|
||||
OnUpdatePostFilm.Invoke(ref info);
|
||||
}
|
||||
|
||||
private void AlterUpdate_BgColor2(LiveTimelineWorkSheet sheet, float currentFrame)
|
||||
{
|
||||
if (OnUpdateBgColor2 == null) return;
|
||||
@@ -1847,7 +1940,8 @@ namespace Gallop.Live.Cutt
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (!StageObjectMap.ContainsKey(sheet.objectList[i].name))
|
||||
else if (!StageObjectMap.ContainsKey(sheet.objectList[i].name) &&
|
||||
!StageObjectUnitMap.ContainsKey(sheet.objectList[i].name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
+28
-12
@@ -53,17 +53,33 @@ namespace Gallop.Live.Cutt
|
||||
public float DepthClip; // 0x98
|
||||
public float RollAngle; // 0x9C
|
||||
public Vector2 FilmScale; // 0xA0
|
||||
public LiveTimelineKeyLoopType loopType; // 0xA8
|
||||
public int loopCount; // 0xAC
|
||||
public int loopExecutedCount; // 0xB0
|
||||
public int loopIntervalFrame; // 0xB4
|
||||
public bool isPasteLoopUnit; // 0xB8
|
||||
public bool isChangeLoopInterpolate; // 0xB9
|
||||
public LiveTimelineKeyPostFilmData.LayerMode layerMode; // 0xBC
|
||||
public int movieResId; // 0xC0
|
||||
public int movieFrameOffset; // 0xC4
|
||||
public float movieSpeed; // 0xC8
|
||||
public LiveTimelineKeyPostFilmData.ColorBlend colorBlend; // 0xCC
|
||||
public float colorBlendFactor; // 0xD0
|
||||
|
||||
// 以下顺序按 bundle TypeTree 的权威顺序排列
|
||||
// (tools/dump_cutt_typetree.py --tree postFilmKeys 1177)。
|
||||
// 原来的声明把 loop* 组提到了 layerMode 之前,且缺 BlinkLight* 五个字段。
|
||||
public LiveTimelineKeyPostFilmData.LayerMode layerMode;
|
||||
public int movieResId;
|
||||
public int movieFrameOffset;
|
||||
public float movieSpeed;
|
||||
public LiveTimelineKeyPostFilmData.ColorBlend colorBlend;
|
||||
public float colorBlendFactor;
|
||||
|
||||
public string BlinkLightName;
|
||||
public int BlinkLightNameHash;
|
||||
public int BlinkLightContainerIndex;
|
||||
public float BlinkLightBrightnessPower;
|
||||
public bool IsAdjustedBlinkLightColor;
|
||||
|
||||
public LiveTimelineKeyLoopType loopType;
|
||||
public int loopCount;
|
||||
public int loopExecutedCount;
|
||||
public int loopIntervalFrame;
|
||||
public bool isPasteLoopUnit;
|
||||
public bool isChangeLoopInterpolate;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class LiveTimelineKeyPostFilmDataList : LiveTimelineKeyDataListTemplate<LiveTimelineKeyPostFilmData>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -944,6 +944,7 @@ namespace Gallop.Live.Cutt
|
||||
[SerializeField] public List<LiveTimelineLightShaftsData> lightShaftsKeysLine;
|
||||
[SerializeField] public List<LiveTimelineParticleData> particleList;
|
||||
[SerializeField] public List<LiveTimelineParticleGroupData> particleGroupList;
|
||||
// 字段名已用 A/B 探针验证过命中 bundle TypeTree(大写 W 正确,小写不填充)。
|
||||
[SerializeField] public List<LiveTimelineWashLightData> WashLightList;
|
||||
[SerializeField] public List<LiveTimelineLaserData> laserList;
|
||||
[SerializeField] public List<LiveTimelineBlinkLightData> blinkLightList;
|
||||
@@ -951,6 +952,13 @@ namespace Gallop.Live.Cutt
|
||||
[SerializeField] public List<LiveTimelineHdrBloomData> hdrBloomKeys;
|
||||
[SerializeField] public List<LiveTimelineColorCorrectionData> colorCorrectionDataLists;
|
||||
|
||||
// PostFilm (39):全语料 ~20200 keys / 59 首,是未实现轨道里数据量最大的一块。
|
||||
// 旧扫描把它记成「58/58 首存在但全部 0 keyframe(空占位)」,实测是错的
|
||||
// (song 1177 分别有 100 / 161 / 87 keys)。字段名取自 bundle TypeTree。
|
||||
[SerializeField] public LiveTimelineKeyPostFilmDataList postFilmKeys;
|
||||
[SerializeField] public LiveTimelineKeyPostFilmDataList postFilm2Keys;
|
||||
[SerializeField] public LiveTimelineKeyPostFilmDataList postFilm3Keys;
|
||||
|
||||
/*
|
||||
//���ڿ��Ե���AB���ˣ���Ȼ���淢��ûʲô��...˵����ʲôʱ�����õ�
|
||||
private void Start()
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gallop.Live.Cutt
|
||||
{
|
||||
/// <summary>
|
||||
/// 临时诊断。当前用途:核对 WorkSheet 字段名是否命中 bundle 的 TypeTree。
|
||||
///
|
||||
/// Unity 从 AssetBundle 反序列化 ScriptableObject 时按字段名严格匹配(区分大小写)。
|
||||
/// 名字没命中的字段不会被赋值,保持 C# 默认值 null;名字命中但本曲没数据的,
|
||||
/// 会被填成空列表。所以 null 与「空」是两件事:
|
||||
/// NULL -> 字段名很可能拼错了,该轨道在所有歌里都收不到数据
|
||||
/// 空 -> 名字是对的,只是这首歌没有这条轨道
|
||||
///
|
||||
/// 结论出来后整个文件可删,调用点只有 Director.InitializeTimeline 一处。
|
||||
/// </summary>
|
||||
public static class LiveTimelineWorksheetDiag
|
||||
{
|
||||
private const BindingFlags kPublicInstance = BindingFlags.Public | BindingFlags.Instance;
|
||||
|
||||
public static void Dump(LiveTimelineData data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
Debug.LogWarning("[WorksheetDiag] data == null");
|
||||
return;
|
||||
}
|
||||
if (data.worksheetList == null)
|
||||
{
|
||||
Debug.LogWarning("[WorksheetDiag] data.worksheetList == null");
|
||||
return;
|
||||
}
|
||||
|
||||
int sheetCount = data.worksheetList.Count;
|
||||
Debug.Log($"[WorksheetDiag] ===== worksheetList.Count = {sheetCount} =====");
|
||||
|
||||
FieldInfo[] sheetFields = typeof(LiveTimelineWorkSheet).GetFields(kPublicInstance);
|
||||
var nullFieldsAllSheets = new List<string>();
|
||||
|
||||
for (int i = 0; i < sheetCount; i++)
|
||||
{
|
||||
LiveTimelineWorkSheet sheet = data.worksheetList[i];
|
||||
if (sheet == null)
|
||||
{
|
||||
Debug.Log($"[WorksheetDiag] [{i}] <null>");
|
||||
continue;
|
||||
}
|
||||
|
||||
var populated = new List<string>();
|
||||
var empty = new List<string>();
|
||||
var nulls = new List<string>();
|
||||
|
||||
foreach (FieldInfo f in sheetFields)
|
||||
{
|
||||
if (!IsTrackField(f.FieldType)) continue;
|
||||
|
||||
object value;
|
||||
try { value = f.GetValue(sheet); }
|
||||
catch { continue; }
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
nulls.Add(f.Name);
|
||||
nullFieldsAllSheets.Add($"[{i}].{f.Name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
string detail = Describe(value);
|
||||
if (detail == null) empty.Add(f.Name);
|
||||
else populated.Add($"{f.Name}: {detail}");
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($"[WorksheetDiag] [{i}] SheetType={sheet.SheetType} version='{sheet.version}' " +
|
||||
$"targetCameraIndex={sheet.targetCameraIndex} TotalTimeLength={sheet.TotalTimeLength}");
|
||||
|
||||
sb.AppendLine($" --- 有数据 ({populated.Count}) ---");
|
||||
foreach (string s in populated) sb.AppendLine($" {s}");
|
||||
|
||||
sb.AppendLine($" --- 空,名字对但本曲无此轨道 ({empty.Count}) ---");
|
||||
sb.AppendLine($" {string.Join(", ", empty)}");
|
||||
|
||||
sb.AppendLine($" --- NULL,字段名未命中 TypeTree ({nulls.Count}) ---");
|
||||
sb.AppendLine($" {string.Join(", ", nulls)}");
|
||||
|
||||
Debug.Log(sb.ToString());
|
||||
}
|
||||
|
||||
if (nullFieldsAllSheets.Count > 0)
|
||||
{
|
||||
Debug.LogWarning("[WorksheetDiag] 以下字段为 NULL,字段名很可能与 bundle 不匹配 -> " +
|
||||
string.Join(", ", nullFieldsAllSheets));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 注意:Unity 加载 bundle 时会把所有 List 字段初始化为空列表,
|
||||
// 所以「没有 NULL」并不能证明字段名都正确,只能靠 A/B 段判断。
|
||||
Debug.Log("[WorksheetDiag] 无 NULL 字段(但这不能证明名字都对,见 WashLight A/B 段)。");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字段名探针。新增一个轨道字段后,用它确认名字是否命中 bundle 的 TypeTree:
|
||||
/// 名字对且本曲有数据 -> 「★ 有数据」;名字错 -> 恒为「空」。
|
||||
/// 拿不准大小写时,并列声明两个拼写各探一次即可(WashLightList 就是这么定下来的)。
|
||||
/// </summary>
|
||||
public static void Probe(LiveTimelineWorkSheet sheet, string fieldName)
|
||||
{
|
||||
if (sheet == null) { Debug.LogWarning($"[WorksheetDiag] Probe({fieldName}): sheet == null"); return; }
|
||||
|
||||
FieldInfo f = typeof(LiveTimelineWorkSheet).GetField(fieldName, kPublicInstance);
|
||||
if (f == null) { Debug.LogWarning($"[WorksheetDiag] Probe: C# 里没有字段 '{fieldName}'"); return; }
|
||||
|
||||
Debug.Log($"[WorksheetDiag] Probe {fieldName}: {DescribeOrEmpty(f.GetValue(sheet))}");
|
||||
}
|
||||
|
||||
/// <summary>区分 null、空列表、有数据三种状态。</summary>
|
||||
private static string DescribeOrEmpty(object value)
|
||||
{
|
||||
if (value == null) return "null";
|
||||
string detail = Describe(value);
|
||||
if (detail != null) return "★ 有数据 -> " + detail;
|
||||
return (value is IList list) ? $"空({list.Count} 组)" : "空";
|
||||
}
|
||||
|
||||
/// <summary>只关心时间轴轨道字段,跳过 version / targetCameraIndex 之类的普通字段。</summary>
|
||||
private static bool IsTrackField(System.Type type)
|
||||
{
|
||||
if (typeof(ILiveTimelineKeyDataList).IsAssignableFrom(type)) return true;
|
||||
if (type.IsArray) return type.GetElementType().Name.StartsWith("LiveTimeline");
|
||||
if (type.IsGenericType)
|
||||
{
|
||||
System.Type[] args = type.GetGenericArguments();
|
||||
return args.Length == 1 && args[0].Name.StartsWith("LiveTimeline");
|
||||
}
|
||||
return type.Name.StartsWith("LiveTimeline");
|
||||
}
|
||||
|
||||
/// <summary>返回该字段的关键帧摘要;没有任何关键帧时返回 null。</summary>
|
||||
private static string Describe(object value)
|
||||
{
|
||||
if (value == null) return null;
|
||||
|
||||
if (value is ILiveTimelineKeyDataList keyList)
|
||||
return keyList.Count > 0 ? $"{keyList.Count} keys" : null;
|
||||
|
||||
if (value is IList list && !(value is string))
|
||||
{
|
||||
int totalKeys = 0;
|
||||
var entries = new List<string>();
|
||||
|
||||
foreach (object element in list)
|
||||
{
|
||||
if (element == null) continue;
|
||||
|
||||
int keys = CountKeys(element, 0);
|
||||
if (keys <= 0) continue;
|
||||
|
||||
totalKeys += keys;
|
||||
string name = (element as ILiveTimelineGroupDataWithName)?.name;
|
||||
entries.Add(string.IsNullOrEmpty(name) ? $"?({keys})" : $"{name}({keys})");
|
||||
}
|
||||
|
||||
if (totalKeys == 0) return null;
|
||||
return $"{entries.Count} 组 / {totalKeys} keys -> {string.Join(", ", entries)}";
|
||||
}
|
||||
|
||||
int nested = CountKeys(value, 0);
|
||||
return nested > 0 ? $"{nested} keys" : null;
|
||||
}
|
||||
|
||||
/// <summary>递归统计对象里所有 ILiveTimelineKeyDataList 的关键帧总数。</summary>
|
||||
private static int CountKeys(object obj, int depth)
|
||||
{
|
||||
if (obj == null || depth > 2) return 0;
|
||||
|
||||
if (obj is ILiveTimelineKeyDataList keyList)
|
||||
return keyList.Count;
|
||||
|
||||
System.Type type = obj.GetType();
|
||||
if (type.IsPrimitive || type.IsEnum || obj is string) return 0;
|
||||
|
||||
int total = 0;
|
||||
foreach (FieldInfo f in type.GetFields(kPublicInstance))
|
||||
{
|
||||
object value;
|
||||
try { value = f.GetValue(obj); }
|
||||
catch { continue; }
|
||||
if (value == null) continue;
|
||||
|
||||
if (value is ILiveTimelineKeyDataList nestedList)
|
||||
{
|
||||
total += nestedList.Count;
|
||||
}
|
||||
else if (value is IList inner && !(value is string))
|
||||
{
|
||||
foreach (object element in inner)
|
||||
total += CountKeys(element, depth + 1);
|
||||
}
|
||||
else if (!f.FieldType.IsPrimitive && !f.FieldType.IsEnum && f.FieldType != typeof(string))
|
||||
{
|
||||
total += CountKeys(value, depth + 1);
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7c7166ff241f1c4197a58591a0ef069
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -9,6 +9,8 @@ namespace Gallop.Live.Cutt
|
||||
public struct BgColor1UpdateInfo
|
||||
{
|
||||
// Fields
|
||||
// TimelineName 不在原版结构里,是为了按名字路由到舞台物件而加的(原版只传 hash)。
|
||||
public string TimelineName;
|
||||
public int TimelineNameHash; // 0x10
|
||||
public int[] TargetCharaIdArray; // 0x18
|
||||
public int[] TargetDressIdArray; // 0x20
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gallop.Live.Cutt
|
||||
{
|
||||
/// <summary>
|
||||
/// PostFilm (39) 的每帧结果。三条轨道 postFilmKeys / postFilm2Keys / postFilm3Keys
|
||||
/// 各自独立叠加,用 layerIndex 区分(0/1/2)。
|
||||
/// </summary>
|
||||
public struct PostFilmUpdateInfo
|
||||
{
|
||||
public int layerIndex;
|
||||
public bool enable;
|
||||
|
||||
public PostFilmMode filmMode;
|
||||
public PostColorType colorType;
|
||||
public float filmPower;
|
||||
|
||||
public Color color0;
|
||||
public Color color1;
|
||||
public Color color2;
|
||||
public Color color3;
|
||||
|
||||
public Vector2 filmOffsetParam;
|
||||
public Vector4 filmOptionParam;
|
||||
public Vector2 filmScale;
|
||||
public float rollAngle;
|
||||
|
||||
public float depthPower;
|
||||
public float depthClip;
|
||||
|
||||
public LiveTimelineKeyPostFilmData.LayerMode layerMode;
|
||||
public LiveTimelineKeyPostFilmData.ColorBlend colorBlend;
|
||||
public float colorBlendFactor;
|
||||
|
||||
// layerMode == UVMovie 时用;内容资源是 live/uvmovie/gal_uvmovie_<songid>_<NNN>。
|
||||
// 寻址规则尚未确定,先透传。
|
||||
public int movieResId;
|
||||
public int movieFrameOffset;
|
||||
public float movieSpeed;
|
||||
}
|
||||
|
||||
public delegate void PostFilmUpdateInfoDelegate(ref PostFilmUpdateInfo updateInfo);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7dcf9b3ef7cb374fa8054e51711a9e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user