diff --git a/Penumbra/Import/Models/Import/ModelImporter.cs b/Penumbra/Import/Models/Import/ModelImporter.cs
index abe87934..1c49d4bd 100644
--- a/Penumbra/Import/Models/Import/ModelImporter.cs
+++ b/Penumbra/Import/Models/Import/ModelImporter.cs
@@ -4,7 +4,7 @@ using SharpGLTF.Schema2;
namespace Penumbra.Import.Models.Import;
-public partial class ModelImporter(ModelRoot _model)
+public partial class ModelImporter(ModelRoot model)
{
public static MdlFile Import(ModelRoot model)
{
@@ -99,7 +99,7 @@ public partial class ModelImporter(ModelRoot _model)
/// Returns an iterator over sorted, grouped mesh nodes.
private IEnumerable> GroupedMeshNodes()
- => _model.LogicalNodes
+ => model.LogicalNodes
.Where(node => node.Mesh != null)
.Select(node =>
{
@@ -171,6 +171,14 @@ public partial class ModelImporter(ModelRoot _model)
_shapeValues.AddRange(meshShapeKey.ShapeValues);
}
+
+ // The number of shape values in a model is bounded by the count
+ // value, which is stored as a u16.
+ // While technically there are similar bounds on other shape struct
+ // arrays, values is practically guaranteed to be the highest of the
+ // group, so a failure on any of them will be a failure on it.
+ if (_shapeValues.Count > ushort.MaxValue)
+ throw new Exception($"Importing this file would require more than the maximum of {ushort.MaxValue} shape values.\nTry removing or applying shape keys that do not need to be changed at runtime in-game.");
}
private ushort BuildBoneTable(List boneNames)
diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs
index 28f41936..d8818b21 100644
--- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs
+++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs
@@ -138,7 +138,7 @@ public partial class ModEditWindow
var spaceAvail = ImGui.GetContentRegionAvail().X - ImGui.GetStyle().ItemSpacing.X - 100;
foreach (var exception in tab.IoExceptions)
{
- var message = $"{exception.GetType().Name}: {exception.Message} {exception.Message}";
+ var message = $"{exception.GetType().Name}: {exception.Message}";
var textSize = ImGui.CalcTextSize(message).X;
if (textSize > spaceAvail)
message = message.Substring(0, (int)Math.Floor(message.Length * (spaceAvail / textSize))) + "...";