Merge pull request #2433 from hshakula/gltf2-import-animation-name
Fix inconsistency between animation and node name in glTF2 Importerpull/2450/head
commit
9430696048
|
@ -789,13 +789,16 @@ static void BuildVertexWeightMapping(Mesh::Primitive& primitive, std::vector<std
|
||||||
delete[] indices16;
|
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)
|
aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector<unsigned int>& meshOffsets, glTF2::Ref<glTF2::Node>& ptr)
|
||||||
{
|
{
|
||||||
Node& node = *ptr;
|
Node& node = *ptr;
|
||||||
|
|
||||||
std::string nameOrId = node.name.empty() ? node.id : node.name;
|
aiNode* ainode = new aiNode(GetNodeName(node));
|
||||||
|
|
||||||
aiNode* ainode = new aiNode(nameOrId);
|
|
||||||
|
|
||||||
if (!node.children.empty()) {
|
if (!node.children.empty()) {
|
||||||
ainode->mNumChildren = unsigned(node.children.size());
|
ainode->mNumChildren = unsigned(node.children.size());
|
||||||
|
@ -921,7 +924,7 @@ struct AnimationSamplers {
|
||||||
aiNodeAnim* CreateNodeAnim(glTF2::Asset& r, Node& node, AnimationSamplers& samplers)
|
aiNodeAnim* CreateNodeAnim(glTF2::Asset& r, Node& node, AnimationSamplers& samplers)
|
||||||
{
|
{
|
||||||
aiNodeAnim* anim = new aiNodeAnim();
|
aiNodeAnim* anim = new aiNodeAnim();
|
||||||
anim->mNodeName = node.name;
|
anim->mNodeName = GetNodeName(node);
|
||||||
|
|
||||||
static const float kMillisecondsFromSeconds = 1000.f;
|
static const float kMillisecondsFromSeconds = 1000.f;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue