Skip to content

Commit 5c6e070

Browse files
ackwellOttermandias
authored andcommitted
Simplify EID handling because IDFK at this point
1 parent a4bd015 commit 5c6e070

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

Penumbra/Import/Models/Import/MeshImporter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ private Mesh Create()
8080
StartIndex = 0,
8181
IndexCount = (uint)_indices.Count,
8282

83-
// TODO: import material names
8483
MaterialIndex = 0,
8584
SubMeshIndex = 0,
8685
SubMeshCount = (ushort)_subMeshes.Count,

Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -220,24 +220,9 @@ private static void MergeAttributes(MdlFile target, MdlFile source)
220220
/// <param name="source"> Model to copy element ids from. </param>
221221
private static void MergeElementIds(MdlFile target, MdlFile source)
222222
{
223-
var elementIds = new List<MdlStructs.ElementIdStruct>();
224-
225-
foreach (var sourceElement in source.ElementIds)
226-
{
227-
var sourceBone = source.Bones[sourceElement.ParentBoneName];
228-
var targetIndex = target.Bones.IndexOf(sourceBone);
229-
// Given that there's no means of authoring these at the moment, this should probably remain a hard error.
230-
if (targetIndex == -1)
231-
throw new Exception(
232-
$"Failed to merge element IDs. Original model contains element IDs targeting bone {sourceBone}, which is not present on the imported model.");
233-
234-
elementIds.Add(sourceElement with
235-
{
236-
ParentBoneName = (uint)targetIndex,
237-
});
238-
}
239-
240-
target.ElementIds = [.. elementIds];
223+
// This is overly simplistic, but effectively reproduces what TT did, sort of.
224+
// 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.
225+
target.ElementIds = [.. source.ElementIds];
241226
}
242227

243228
private void BeginIo()

0 commit comments

Comments
 (0)