@@ -476,21 +476,14 @@ public virtual void LoadFromWagFile(string wagFilePath)
476
476
477
477
( Vector3 mainMins , Vector3 mainMaxes ) = wagShape . GetBoundingLimits ( ) ;
478
478
479
- // Repeat for MSTS freight animation bounds
480
- if ( ! string . IsNullOrEmpty ( FreightShapeFileName ) )
481
- {
482
- ShapeFile freightShape = new ShapeFile ( wagonFolderSlash + FreightShapeFileName , true ) ;
483
-
484
- ( Vector3 freightMins , Vector3 freightMaxes ) = freightShape . GetBoundingLimits ( ) ;
485
-
486
- // MSTS freight animations don't have offsets, so can be simply compared
487
- mainMins = Vector3 . Min ( mainMins , freightMins ) ;
488
- mainMaxes = Vector3 . Max ( mainMaxes , freightMaxes ) ;
489
- }
479
+ bool mstsFreightAnim = true ;
490
480
491
481
// And also repeat for ORTS freight animations
492
482
if ( FreightAnimations != null )
493
483
{
484
+ if ( ! FreightAnimations . MSTSFreightAnimEnabled )
485
+ mstsFreightAnim = false ;
486
+
494
487
foreach ( var freightAnim in FreightAnimations . Animations )
495
488
{
496
489
// We will ignore freight animations not attached to the main shape object for simplicity
@@ -528,6 +521,18 @@ public virtual void LoadFromWagFile(string wagFilePath)
528
521
}
529
522
}
530
523
524
+ // And also repeat for MSTS freight animation bounds (if enabled)
525
+ if ( mstsFreightAnim && ! string . IsNullOrEmpty ( FreightShapeFileName ) )
526
+ {
527
+ ShapeFile freightShape = new ShapeFile ( wagonFolderSlash + FreightShapeFileName , true ) ;
528
+
529
+ ( Vector3 freightMins , Vector3 freightMaxes ) = freightShape . GetBoundingLimits ( ) ;
530
+
531
+ // MSTS freight animations don't have offsets, so can be simply compared
532
+ mainMins = Vector3 . Min ( mainMins , freightMins ) ;
533
+ mainMaxes = Vector3 . Max ( mainMaxes , freightMaxes ) ;
534
+ }
535
+
531
536
// Set dimensions of wagon if configured as such
532
537
if ( AutoSize )
533
538
{
0 commit comments