改,加,TrackGlobalColorChange

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-10-01 20:41:06 +08:00
parent 25a458dd8c
commit b29654e423
37 changed files with 630986 additions and 21442 deletions

View File

@@ -617,6 +617,51 @@ namespace Ichni.Editor
pathnode.Refresh();
}
}
public static void FloorAnim()
{
if (inspector.connectedGameElement == null)
{
LogWindow.Log("Please select a Element first!");
return;
}
List<AnimationBase> elements = inspector.connectedGameElement.GetAllGameElementsFromThis().OfType<AnimationBase>().ToList();
// 预先缓存属性信息(如果在循环外部知道具体类型)
var propertiesToCheck = typeof(GameElement).GetProperties()
.Where(p => p.PropertyType == typeof(FlexibleFloat))
.ToArray();
foreach (var element in elements)
{
bool needsRefresh = false;
foreach (var prop in propertiesToCheck)
{
var ff = prop.GetValue(element) as FlexibleFloat;
if (ff?.animations?.Count > 0 && ff.animations[0] != null)
{
var firstAnimation = ff.animations[0];
if (firstAnimation.startTime > 0)
{
ff.animations.Insert(0, new AnimatedFloat(
0,
Math.Min(firstAnimation.startTime, 1),
firstAnimation.startValue,
firstAnimation.startValue,
AnimationCurveType.Linear
));
needsRefresh = true;
Debug.Log($"Added 0 keyframe to {element.elementName}'s {prop.Name}");
}
}
}
if (needsRefresh)
{
element.Refresh();
element.animatedObject?.Refresh(); // 使用空条件运算符
}
}
}
}
}