From 5c6e0701d96f626ba7f58fcf7541ddc1b62be930 Mon Sep 17 00:00:00 2001 From: ackwell Date: Sun, 25 Feb 2024 22:09:55 +1100 Subject: [PATCH] Simplify EID handling because IDFK at this point --- Penumbra/Import/Models/Import/MeshImporter.cs | 1 - .../ModEditWindow.Models.MdlTab.cs | 21 +++---------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/Penumbra/Import/Models/Import/MeshImporter.cs b/Penumbra/Import/Models/Import/MeshImporter.cs index efebdba4..1d4b223d 100644 --- a/Penumbra/Import/Models/Import/MeshImporter.cs +++ b/Penumbra/Import/Models/Import/MeshImporter.cs @@ -80,7 +80,6 @@ public class MeshImporter(IEnumerable nodes, IoNotifier notifier) StartIndex = 0, IndexCount = (uint)_indices.Count, - // TODO: import material names MaterialIndex = 0, SubMeshIndex = 0, SubMeshCount = (ushort)_subMeshes.Count, diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs index 7adc4379..637c8401 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs @@ -220,24 +220,9 @@ public partial class ModEditWindow /// Model to copy element ids from. private static void MergeElementIds(MdlFile target, MdlFile source) { - var elementIds = new List(); - - foreach (var sourceElement in source.ElementIds) - { - var sourceBone = source.Bones[sourceElement.ParentBoneName]; - var targetIndex = target.Bones.IndexOf(sourceBone); - // Given that there's no means of authoring these at the moment, this should probably remain a hard error. - if (targetIndex == -1) - throw new Exception( - $"Failed to merge element IDs. Original model contains element IDs targeting bone {sourceBone}, which is not present on the imported model."); - - elementIds.Add(sourceElement with - { - ParentBoneName = (uint)targetIndex, - }); - } - - target.ElementIds = [.. elementIds]; + // This is overly simplistic, but effectively reproduces what TT did, sort of. + // TODO: Get a better idea of what these values represent. `ParentBoneName`, if it is a pointer into the bone array, does not seem to be _bounded_ by the bone array length, at least in the model. I'm guessing it _may_ be pointing into a .sklb instead? (i.e. the weapon's skeleton). EID stuff in general needs more work. + target.ElementIds = [.. source.ElementIds]; } private void BeginIo()