Skip to content

Commit 3f57012

Browse files
committed
Mark freight animations' shapes
1 parent f6deb33 commit 3f57012

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,10 +1398,9 @@ private void LoadTrackSound(string filename)
13981398
internal override void Mark()
13991399
{
14001400
TrainCarShape.Mark();
1401-
if (FreightShape != null)
1402-
FreightShape.Mark();
1403-
if (InteriorShape != null)
1404-
InteriorShape.Mark();
1401+
FreightShape?.Mark();
1402+
InteriorShape?.Mark();
1403+
FreightAnimations?.Mark();
14051404
}
14061405
}
14071406
}

Source/RunActivity/Viewer3D/RollingStock/SubSystems/FreightAnimationsViewer.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ public FreightAnimationsViewer(Viewer viewer, MSTSWagon wagon, string wagonFolde
3535
Animations.Add(new FreightAnimationViewer(viewer, wagon, wagonFolderSlash, animation));
3636
}
3737
}
38+
39+
public void Mark()
40+
{
41+
foreach (var animation in Animations)
42+
{
43+
animation.Mark();
44+
}
45+
}
3846
}
3947

4048
public class FreightAnimationViewer
@@ -52,14 +60,14 @@ public FreightAnimationViewer(Viewer viewer, MSTSWagon wagon, string wagonFolder
5260
{
5361
if ( lodControl.DistanceLevels.Length > 0)
5462
{
55-
foreach ( var distanceLevel in lodControl.DistanceLevels)
63+
foreach (var distanceLevel in lodControl.DistanceLevels)
5664
{
5765
if (distanceLevel.SubObjects.Length > 0
5866
&& distanceLevel.SubObjects[0].ShapePrimitives.Length > 0
5967
&& distanceLevel.SubObjects[0].ShapePrimitives[0].Hierarchy.Length > 0)
60-
{
61-
distanceLevel.SubObjects[0].ShapePrimitives[0].Hierarchy[0] = distanceLevel.SubObjects[0].ShapePrimitives[0].Hierarchy.Length;
62-
}
68+
{
69+
distanceLevel.SubObjects[0].ShapePrimitives[0].Hierarchy[0] = distanceLevel.SubObjects[0].ShapePrimitives[0].Hierarchy.Length;
70+
}
6371
}
6472
}
6573
}
@@ -72,5 +80,10 @@ public FreightAnimationViewer(Viewer viewer, MSTSWagon wagon, string wagonFolder
7280
FreightShape.XNAMatrices[0] *= flipper;
7381
}
7482
}
83+
84+
public void Mark()
85+
{
86+
FreightShape.Mark();
87+
}
7588
}
7689
}

0 commit comments

Comments
 (0)