Bone and Material Limit updates.

Fix UI in Models tab to allow for more than 4 Materials per DT spec.
This commit is contained in:
Theo 2024-12-16 19:11:46 -08:00 committed by GitHub
parent b5a469c524
commit d73005f118
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

@ -208,10 +208,10 @@ public partial class ModelImporter(ModelRoot model, IoNotifier notifier)
if (index >= 0) if (index >= 0)
return (ushort)index; return (ushort)index;
// If there's already 4 materials, we can't add any more. // If there's already 10 materials, we can't add any more.
// TODO: permit, with a warning to reduce, and validation in MdlTab. // TODO: permit, with a warning to reduce, and validation in MdlTab.
var count = _materials.Count; var count = _materials.Count;
if (count >= 4) if (count >= 10)
return 0; return 0;
_materials.Add(materialName); _materials.Add(materialName);
@ -234,10 +234,10 @@ public partial class ModelImporter(ModelRoot model, IoNotifier notifier)
boneIndices.Add((ushort)boneIndex); boneIndices.Add((ushort)boneIndex);
} }
if (boneIndices.Count > 64) if (boneIndices.Count > 128)
throw notifier.Exception("XIV does not support meshes weighted to a total of more than 64 bones."); throw notifier.Exception("XIV does not support meshes weighted to a total of more than 128 bones.");
var boneIndicesArray = new ushort[64]; var boneIndicesArray = new ushort[128];
Array.Copy(boneIndices.ToArray(), boneIndicesArray, boneIndices.Count); Array.Copy(boneIndices.ToArray(), boneIndicesArray, boneIndices.Count);
var boneTableIndex = _boneTables.Count; var boneTableIndex = _boneTables.Count;

View file

@ -16,7 +16,7 @@ namespace Penumbra.UI.AdvancedWindow;
public partial class ModEditWindow public partial class ModEditWindow
{ {
private const int MdlMaterialMaximum = 4; private const int MdlMaterialMaximum = 10;
private const string MdlImportDocumentation = private const string MdlImportDocumentation =
@"https://github.com/xivdev/Penumbra/wiki/Model-IO#user-content-9b49d296-23ab-410a-845b-a3be769b71ea"; @"https://github.com/xivdev/Penumbra/wiki/Model-IO#user-content-9b49d296-23ab-410a-845b-a3be769b71ea";
@ -93,7 +93,7 @@ public partial class ModEditWindow
tab.Mdl.ConvertV5ToV6(); tab.Mdl.ConvertV5ToV6();
_modelTab.SaveFile(); _modelTab.SaveFile();
} }
private void DrawImportExport(MdlTab tab, bool disabled) private void DrawImportExport(MdlTab tab, bool disabled)
{ {
@ -427,7 +427,7 @@ public partial class ModEditWindow
private static void DrawInvalidMaterialMarker() private static void DrawInvalidMaterialMarker()
{ {
using (ImRaii.PushFont(UiBuilder.IconFont)) using (ImRaii.PushFont(UiBuilder.IconFont))
ImGuiUtil.TextColored(0xFF0000FF, FontAwesomeIcon.TimesCircle.ToIconString()); ImGuiUtil.TextColored(0xFF0000FF, FontAwesomeIcon.TimesCircle.ToIconString());
ImGuiUtil.HoverTooltip( ImGuiUtil.HoverTooltip(