Assimp错误获取aiNode名称

时间:2016-09-02 20:01:34

标签: c++ animation assimp skeletal-animation

我试图用assimp加载一个动画网格(骨架),但我遇到了一些问题。

当我尝试访问(根节点)aiNode*的名称时,程序崩溃了。在Visual Studio的输出中,它表示无法读取字符串字符。

(我跟随this tutorial。)

void Mesh::ReadNodeHierarchy(float AnimationTime, aiScene* scene, aiNode* pNode, const aiMatrix4x4& ParentTransform) {
if (pNode == NULL) {
    std::cerr << "NODE NULL\n";
    return;
}

std::cerr << pNode->mName.length; // I tried to check the length of the string but it caused the same error

std::string NodeName(pNode->mName.data); // Throws error
(...)
}

1 个答案:

答案 0 :(得分:2)

如果有人遇到同样的问题,我发现当Assimp :: Importer类被销毁时,场景也是如此。

我的导入器类是本地的,因此它被销毁,从而导致错误。

相关问题