Skip to content

Commit

Permalink
Merge pull request #134 from Insprill/feature/bogie-validation
Browse files Browse the repository at this point in the history
Add validation for custom bogie meshes
  • Loading branch information
katycat5e authored Feb 20, 2023
2 parents 019a886 + a79fa50 commit d820cb8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CCL_GameScripts/Editor/TrainCarValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,17 @@ private IEnumerator<Result> CheckBogies()
{
yield return Result.Failed($"Missing {CarPartNames.BOGIE_CAR} child for custom front bogie");
}
foreach (MeshFilter filter in bogieCar.GetComponentsInChildren<MeshFilter>(true))
{
if (filter.sharedMesh == null)
{
yield return Result.Warning($"{filter.name} is missing a mesh");
}
else if (!filter.sharedMesh.isReadable)
{
yield return Result.Warning($"Mesh {filter.sharedMesh.name} on {filter.name} doesn't have Read/Write enabled");
}
}
}
}

Expand All @@ -321,6 +332,17 @@ private IEnumerator<Result> CheckBogies()
{
yield return Result.Failed($"Missing {CarPartNames.BOGIE_CAR} child for custom rear bogie");
}
foreach (MeshFilter filter in bogieCar.GetComponentsInChildren<MeshFilter>(true))
{
if (filter.sharedMesh == null)
{
yield return Result.Warning($"{filter.name} is missing a mesh");
}
else if (!filter.sharedMesh.isReadable)
{
yield return Result.Warning($"Mesh {filter.sharedMesh.name} on {filter.name} doesn't have Read/Write enabled");
}
}
}
}
}
Expand Down

0 comments on commit d820cb8

Please sign in to comment.