From 8d2166a4039f3937a9c7ff941ba3f2a29464d4c6 Mon Sep 17 00:00:00 2001 From: wannkunstbeikor <93538252+wannkunstbeikor@users.noreply.github.com> Date: Sun, 17 Sep 2023 09:21:48 +0200 Subject: [PATCH] [MeshSetPlugin] Fixed issue with naming --- Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs | 35 ++++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs index 691f55e27..a2d3d6fd2 100644 --- a/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs +++ b/Plugins/MeshSetPlugin/FrostyMeshSetEditor.cs @@ -707,7 +707,7 @@ private void FBXCreateMesh(FbxScene scene, MeshSetLod lod, List boneNod { FbxNode actor = FBXExportSubObject(scene, section, lod.VertexBufferSize, indexSize, reader); if (flattenHierarchy) - actor.Name = $"{section.Name}.lod{lodIdx}"; + actor.Name = $"{section.Name}:lod{lodIdx}"; meshNode.AddChild(actor); if ((lod.Type == MeshType.MeshType_Skinned || lod.Type == MeshType.MeshType_Composite) && boneNodes.Count > 0) @@ -1612,27 +1612,14 @@ public void ImportFBX(string filename, MeshSet inMeshSet, EbxAsset asset, EbxAss foreach (FbxNode child in scene.RootNode.Children) { string nodeName = child.Name.ToLower(); - int lodIndex = 0; - string possibleLodIndex = nodeName.Substring(nodeName.LastIndexOf(".") + 4); - // If the node doesn't contain a .0xx, it must be lod 0 - if (int.TryParse(possibleLodIndex, out lodIndex)) - { - if (lodNodes[lodIndex] == null) - { - lodNodes[lodIndex] = new List(); - lodCount++; - } - lodNodes[lodIndex].Add(child); - } - /*if (nodeName.Contains("lod")) + if (nodeName.Contains("lod")) { if (nodeName.Contains(":")) { - // flat hierarchy, contains section:lod names - nodeName = nodeName.Substring(nodeName.Length - 1); - int lodIndex = -1; + // flat hierarchy, contains section:lodX + nodeName = nodeName.Substring(nodeName.LastIndexOf(':') + 4); - if (int.TryParse(nodeName, out lodIndex)) + if (int.TryParse(nodeName, out int lodIndex)) { if (lodNodes[lodIndex] == null) { @@ -1646,9 +1633,8 @@ public void ImportFBX(string filename, MeshSet inMeshSet, EbxAsset asset, EbxAss { // standard hierarchy nodeName = nodeName.Substring(nodeName.Length - 1); - int lodIndex = -1; - if (int.TryParse(nodeName, out lodIndex)) + if (int.TryParse(nodeName, out int lodIndex)) { if (lodNodes[lodIndex] == null) { @@ -1658,7 +1644,7 @@ public void ImportFBX(string filename, MeshSet inMeshSet, EbxAsset asset, EbxAss lodNodes[lodIndex].AddRange(child.Children); } } - }*/ + } } if (lodCount < meshSet.Lods.Count) @@ -1799,7 +1785,12 @@ private void ProcessLod(List nodes, int lodIndex, ref List foreach (var node in sectionNodes) { - string sectionName = node.Name.Substring(0, node.Name.LastIndexOf(".")); // remove .lodx from the name + string sectionName = node.Name; + if (sectionName.Contains(':')) + { + // remove the lod portion of the name + sectionName = sectionName.Remove(sectionName.IndexOf(':')); + } int idx = meshSections.FindIndex((a) => a.Name == sectionName); if (idx != -1 && sectionNodeMapping[idx] == null)