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,38 +103,42 @@ 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);
std::string skeletonType = reader->Attribute("Type"); skel->type = SkeletonType::Flex; // Default to Flex for legacy reasons
// std::string skeletonLimbType = reader->Attribute("LimbType"); if (reader->FindAttribute("Type")) {
int numLimbs = reader->IntAttribute("LimbCount"); std::string skeletonType = reader->Attribute("Type");
int numDLs = reader->IntAttribute("DisplayListCount");
if (skeletonType == "Flex") { if (skeletonType == "Flex") {
skel->type = SkeletonType::Flex; skel->type = SkeletonType::Flex;
} else if (skeletonType == "Curve") { } else if (skeletonType == "Curve") {
skel->type = SkeletonType::Curve; skel->type = SkeletonType::Curve;
} 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
skel->limbType = LimbType::LOD; if (reader->FindAttribute("LimbType")) {
std::string skeletonLimbType = reader->Attribute("LimbType");
// if (skeletonLimbType == "Standard") if (skeletonLimbType == "Standard") {
// skel->limbType = LimbType::Standard; skel->limbType = LimbType::Standard;
// else if (skeletonLimbType == "LOD") } else if (skeletonLimbType == "LOD") {
// skel->limbType = LimbType::LOD; skel->limbType = LimbType::LOD;
// else if (skeletonLimbType == "Curve") } else if (skeletonLimbType == "Curve") {
// skel->limbType = LimbType::Curve; skel->limbType = LimbType::Curve;
// else if (skeletonLimbType == "Skin") } else if (skeletonLimbType == "Skin") {
// skel->limbType = LimbType::Skin; skel->limbType = LimbType::Skin;
// else if (skeletonLimbType == "Legacy") } else if (skeletonLimbType == "Legacy") {
// Sskel->limbType = LimbType::Legacy; skel->limbType = LimbType::Legacy;
}
}
skel->limbCount = reader->IntAttribute("LimbCount");
skel->dListCount = reader->IntAttribute("DisplayListCount");
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();