1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:59:57 +00:00

Convert underscores in bone names to whitespaces

This commit is contained in:
Nelsson Huotari 2021-02-02 17:33:40 +02:00
parent 83ee1cc582
commit 7d3f2bc113

View file

@ -60,7 +60,19 @@ namespace SceneUtil
void NodeMapVisitor::apply(osg::MatrixTransform& trans)
{
// Take transformation for first found node in file
const std::string nodeName = Misc::StringUtils::lowerCase(trans.getName());
std::string originalNodeName = Misc::StringUtils::lowerCase(trans.getName());
// Convert underscores to whitespaces as a workaround for Collada (OpenMW's animation system uses whitespace-separated names)
std::string underscore = "_";
std::size_t foundUnderscore = originalNodeName.find(underscore);
if (foundUnderscore != std::string::npos)
{
std::replace(originalNodeName.begin(), originalNodeName.end(), '_', ' ');
//originalNodeName.replace(foundUnderscore.begin(), foundPageNumberEnd - foundPageNumber - 6, " ") );
}
const std::string nodeName = originalNodeName;
mMap.emplace(nodeName, &trans);
traverse(trans);