Skip to content

Commit 076a8d3

Browse files
committed
Forgot check for MSTSFreightAnimEnabled
1 parent ed3f512 commit 076a8d3

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,8 @@ no arguments are specified (ie: ``ORTSAutoSize ()`` was entered in the Wagon sec
753753
offsets are assumed to be 0 meters.
754754

755755
Note that automatic sizing uses the nearest LOD of the main shape file and attached freight animations. LODs for further
756-
distances have no effect on the automatic sizing. :ref:`Shape descriptor overrides <features-shape-manipulation>`
756+
distances have no effect on the automatic sizing. Freight animations using the ``ShapeHierarchy`` feature are also
757+
skipped due to potential unintended behaviors. :ref:`Shape descriptor overrides <features-shape-manipulation>`
757758
are also not considered at this phase, so if any changes are made in the .sd file, this feature may not provide
758759
good results. This method also works best for rolling stock with standard buffers/couplers on each end.
759760
Automatic sizing generally can't produce reasonable results for articulated rolling stock. And should something go

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -476,21 +476,14 @@ public virtual void LoadFromWagFile(string wagFilePath)
476476

477477
(Vector3 mainMins, Vector3 mainMaxes) = wagShape.GetBoundingLimits();
478478

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;
490480

491481
// And also repeat for ORTS freight animations
492482
if (FreightAnimations != null)
493483
{
484+
if (!FreightAnimations.MSTSFreightAnimEnabled)
485+
mstsFreightAnim = false;
486+
494487
foreach (var freightAnim in FreightAnimations.Animations)
495488
{
496489
// We will ignore freight animations not attached to the main shape object for simplicity
@@ -528,6 +521,18 @@ public virtual void LoadFromWagFile(string wagFilePath)
528521
}
529522
}
530523

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+
531536
// Set dimensions of wagon if configured as such
532537
if (AutoSize)
533538
{

0 commit comments

Comments
 (0)