Skip to content

Commit

Permalink
Sighhh...
Browse files Browse the repository at this point in the history
  • Loading branch information
pzgulyas committed Feb 24, 2023
1 parent 91f5421 commit 1c81177
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/RunActivity/Viewer3D/GltfShape.cs
Expand Up @@ -346,7 +346,7 @@ public GltfDistanceLevel(GltfShape shape, int lodId, Gltf gltfFile, string gltfF
TempStack.Clear();
Array.ForEach(GltfFile.Scenes.ElementAtOrDefault(GltfFile.Scene ?? 0).Nodes, node => TempStack.Push(node));
KHR_lights gltfLights = null;
object extension;
object extension = null;
if (GltfFile.Extensions?.TryGetValue("KHR_lights_punctual", out extension) ?? false)
gltfLights = Newtonsoft.Json.JsonConvert.DeserializeObject<KHR_lights>(extension.ToString());

Expand Down Expand Up @@ -657,7 +657,7 @@ void GetBinaryData(GltfShape shape, Gltf gltfFile, string gltfFileName)
if (morphWarning && ShapeWarnings)
Trace.TraceInformation($"glTF morphing animation is unsupported in file {gltfFileName}");

object extension;
object extension = null;
var names = gltfFile.Nodes.Select((n, i) => ((n.Extras?.TryGetValue("OPENRAILS_animation_name", out extension) ?? false) && extension is string a ? a : null, i)).Where(n => n.Item1 != null);
var dimensions = gltfFile.Nodes.Select(n => (n.Extras?.TryGetValue("OPENRAILS_animation_wheelradius", out extension) ?? false) && extension is string dim && float.TryParse(dim, out var d) ? d : 0f);
GltfAnimations.AddRange(names.Select(n => new GltfAnimation(n.Item1) { ExtrasWheelRadius = dimensions.ElementAt(n.i), Channels = { new GltfAnimationChannel() { TargetNode = n.i } } }));
Expand Down

0 comments on commit 1c81177

Please sign in to comment.