From 6b16d25f4a7e1810740e8b8903d80d3942845b3f Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Tue, 14 Nov 2023 10:36:58 -0600 Subject: [PATCH] Stop hardcoding skeleton type to flex --- soh/soh/resource/importer/SkeletonFactory.cpp | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index 559da0cea3d..2ce651dee2c 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -103,37 +103,41 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p { std::shared_ptr skel = std::static_pointer_cast(resource); - std::string skeletonType = reader->Attribute("Type"); - // std::string skeletonLimbType = reader->Attribute("LimbType"); - int numLimbs = reader->IntAttribute("LimbCount"); - int numDLs = reader->IntAttribute("DisplayListCount"); - - if (skeletonType == "Flex") { - skel->type = SkeletonType::Flex; - } else if (skeletonType == "Curve") { - skel->type = SkeletonType::Curve; - } else if (skeletonType == "Normal") { - skel->type = SkeletonType::Normal; + skel->type = SkeletonType::Flex; // Default to Flex for legacy reasons + if (reader->FindAttribute("Type")) { + std::string skeletonType = reader->Attribute("Type"); + + if (skeletonType == "Flex") { + skel->type = SkeletonType::Flex; + } else if (skeletonType == "Curve") { + skel->type = SkeletonType::Curve; + } else if (skeletonType == "Normal") { + skel->type = SkeletonType::Normal; + } } - skel->type = SkeletonType::Flex; - skel->limbType = LimbType::LOD; + skel->limbType = LimbType::LOD; // Default to LOD for legacy reasons + if (reader->FindAttribute("LimbType")) { + std::string skeletonLimbType = reader->Attribute("LimbType"); + + if (skeletonLimbType == "Standard") { + skel->limbType = LimbType::Standard; + } else if (skeletonLimbType == "LOD") { + skel->limbType = LimbType::LOD; + } else if (skeletonLimbType == "Curve") { + skel->limbType = LimbType::Curve; + } else if (skeletonLimbType == "Skin") { + skel->limbType = LimbType::Skin; + } else if (skeletonLimbType == "Legacy") { + skel->limbType = LimbType::Legacy; + } + } - // if (skeletonLimbType == "Standard") - // skel->limbType = LimbType::Standard; - // else if (skeletonLimbType == "LOD") - // skel->limbType = LimbType::LOD; - // else if (skeletonLimbType == "Curve") - // skel->limbType = LimbType::Curve; - // else if (skeletonLimbType == "Skin") - // skel->limbType = LimbType::Skin; - // else if (skeletonLimbType == "Legacy") - // Sskel->limbType = LimbType::Legacy; - auto child = reader->FirstChildElement(); + skel->limbCount = reader->IntAttribute("LimbCount"); + skel->dListCount = reader->IntAttribute("DisplayListCount"); - skel->limbCount = numLimbs; - skel->dListCount = numDLs; + auto child = reader->FirstChildElement(); while (child != nullptr) { std::string childName = child->Name();