Stop hardcoding skeleton type to flex (#3397)

This commit is contained in:
Garrett Cox 2023-11-14 15:36:05 -06:00 committed by GitHub
parent 4e9040d761
commit bf31f2b330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,10 +103,9 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p
{ {
std::shared_ptr<Skeleton> skel = std::static_pointer_cast<Skeleton>(resource); std::shared_ptr<Skeleton> skel = std::static_pointer_cast<Skeleton>(resource);
skel->type = SkeletonType::Flex; // Default to Flex for legacy reasons
if (reader->FindAttribute("Type")) {
std::string skeletonType = reader->Attribute("Type"); 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") { if (skeletonType == "Flex") {
skel->type = SkeletonType::Flex; skel->type = SkeletonType::Flex;
@ -115,26 +114,31 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p
} else if (skeletonType == "Normal") { } else if (skeletonType == "Normal") {
skel->type = SkeletonType::Normal; skel->type = SkeletonType::Normal;
} }
}
skel->type = SkeletonType::Flex; 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; 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; skel->limbCount = reader->IntAttribute("LimbCount");
// else if (skeletonLimbType == "LOD") skel->dListCount = reader->IntAttribute("DisplayListCount");
// 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(); auto child = reader->FirstChildElement();
skel->limbCount = numLimbs;
skel->dListCount = numDLs;
while (child != nullptr) { while (child != nullptr) {
std::string childName = child->Name(); std::string childName = child->Name();