Fix inconsistency between animation and node name in glTF2 Importer

pull/2433/head
Heorhii Shakula 2019-04-24 16:58:35 +03:00
parent 36bce5fa00
commit 0b42d55f73
1 changed files with 7 additions and 4 deletions

View File

@ -789,13 +789,16 @@ static void BuildVertexWeightMapping(Mesh::Primitive& primitive, std::vector<std
delete[] indices16;
}
static std::string GetNodeName(const Node& node)
{
return node.name.empty() ? node.id : node.name;
}
aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>& meshOffsets, glTF2::Ref<glTF2::Node>& ptr)
{
Node& node = *ptr;
std::string nameOrId = node.name.empty() ? node.id : node.name;
aiNode* ainode = new aiNode(nameOrId);
aiNode* ainode = new aiNode(GetNodeName(node));
if (!node.children.empty()) {
ainode->mNumChildren = unsigned(node.children.size());
@ -921,7 +924,7 @@ struct AnimationSamplers {
aiNodeAnim* CreateNodeAnim(glTF2::Asset& r, Node& node, AnimationSamplers& samplers)
{
aiNodeAnim* anim = new aiNodeAnim();
anim->mNodeName = node.name;
anim->mNodeName = GetNodeName(node);
static const float kMillisecondsFromSeconds = 1000.f;