From 547fba40011be94e27a9400c33f787454e1ac36e Mon Sep 17 00:00:00 2001 From: hybridherbst Date: Mon, 13 Nov 2023 13:09:12 +0100 Subject: [PATCH] fix: animated colors on arbitrary components, and camera background color, should be linear --- Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs b/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs index 8a7bba33f..3a51ff3d6 100644 --- a/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs +++ b/Runtime/Scripts/SceneExporter/ExporterAnimationPointer.cs @@ -70,6 +70,7 @@ public void AddAnimationData(Object animatedObject, string propertyName, GLTFAni bool convertToLinearColor = false; string secondPropertyName = null; string extensionName = null; + var propertyType = values[0]?.GetType(); switch (animatedObject) { @@ -337,6 +338,7 @@ public void AddAnimationData(Object animatedObject, string propertyName, GLTFAni propertyName = "perspective/zfar"; break; case "backgroundColor": + convertToLinearColor = true; break; default: Debug.Log(LogType.Warning, "Unknown property name on Camera " + camera + ": " + propertyName); @@ -397,6 +399,11 @@ public void AddAnimationData(Object animatedObject, string propertyName, GLTFAni { return; } + + // If the animated property is a color, we need to convert to linear – + // we're doing the same on regular non-animated property export. + if (propertyType == typeof(Color)) + convertToLinearColor = true; } break; }