mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Simplify EID handling because IDFK at this point
This commit is contained in:
parent
a4bd015836
commit
5c6e0701d9
2 changed files with 3 additions and 19 deletions
|
|
@ -80,7 +80,6 @@ public class MeshImporter(IEnumerable<Node> nodes, IoNotifier notifier)
|
||||||
StartIndex = 0,
|
StartIndex = 0,
|
||||||
IndexCount = (uint)_indices.Count,
|
IndexCount = (uint)_indices.Count,
|
||||||
|
|
||||||
// TODO: import material names
|
|
||||||
MaterialIndex = 0,
|
MaterialIndex = 0,
|
||||||
SubMeshIndex = 0,
|
SubMeshIndex = 0,
|
||||||
SubMeshCount = (ushort)_subMeshes.Count,
|
SubMeshCount = (ushort)_subMeshes.Count,
|
||||||
|
|
|
||||||
|
|
@ -220,24 +220,9 @@ public partial class ModEditWindow
|
||||||
/// <param name="source"> Model to copy element ids from. </param>
|
/// <param name="source"> Model to copy element ids from. </param>
|
||||||
private static void MergeElementIds(MdlFile target, MdlFile source)
|
private static void MergeElementIds(MdlFile target, MdlFile source)
|
||||||
{
|
{
|
||||||
var elementIds = new List<MdlStructs.ElementIdStruct>();
|
// 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.
|
||||||
foreach (var sourceElement in source.ElementIds)
|
target.ElementIds = [.. 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];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BeginIo()
|
private void BeginIo()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue