From b0a8b1baa5110d0aed944f462c7c13c7bcd2aac3 Mon Sep 17 00:00:00 2001 From: Theo <58579310+Theo-Asterio@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:11:46 -0800 Subject: [PATCH] Bone and Material Limit updates. Fix UI in Models tab to allow for more than 4 Materials per DT spec. --- Penumbra/Import/Models/Import/ModelImporter.cs | 10 +++++----- Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Penumbra/Import/Models/Import/ModelImporter.cs b/Penumbra/Import/Models/Import/ModelImporter.cs index a141d754..5367e892 100644 --- a/Penumbra/Import/Models/Import/ModelImporter.cs +++ b/Penumbra/Import/Models/Import/ModelImporter.cs @@ -208,10 +208,10 @@ public partial class ModelImporter(ModelRoot model, IoNotifier notifier) if (index >= 0) 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. var count = _materials.Count; - if (count >= 4) + if (count >= 10) return 0; _materials.Add(materialName); @@ -234,10 +234,10 @@ public partial class ModelImporter(ModelRoot model, IoNotifier notifier) boneIndices.Add((ushort)boneIndex); } - if (boneIndices.Count > 64) - throw notifier.Exception("XIV does not support meshes weighted to a total of more than 64 bones."); + if (boneIndices.Count > 128) + 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); var boneTableIndex = _boneTables.Count; diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs index de088736..bbf3dd00 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs @@ -16,7 +16,7 @@ namespace Penumbra.UI.AdvancedWindow; public partial class ModEditWindow { - private const int MdlMaterialMaximum = 4; + private const int MdlMaterialMaximum = 10; private const string MdlImportDocumentation = @"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(); _modelTab.SaveFile(); - } + } private void DrawImportExport(MdlTab tab, bool disabled) { @@ -427,7 +427,7 @@ public partial class ModEditWindow private static void DrawInvalidMaterialMarker() { - using (ImRaii.PushFont(UiBuilder.IconFont)) + using (ImRaii.PushFont(UiBuilder.IconFont)) ImGuiUtil.TextColored(0xFF0000FF, FontAwesomeIcon.TimesCircle.ToIconString()); ImGuiUtil.HoverTooltip(