Search code examples
c++animationassimpskeletal-animation

Assimp Error acessing aiNode name


I'm trying to load an animated mesh (skeletal) with assimp but I'm having some problems.

When I try to access (the root Node) aiNode*'s name, the programs crashes. In Visual Studio's output, it says it failed to read string characters.

(I'm following 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
(...)
}

Solution

  • If anyone is having the same problem i just discovered that when the Assimp::Importer class is destroyed, the scene is too.

    My importer class was local so it was destroyed, thus causing the error.