【问题标题】:Assimp Error acessing aiNode nameAssimp 访问 aiNode 名称时出错
【发布时间】:2017-01-11 00:21:11
【问题描述】:

我正在尝试使用 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
(...)
}

【问题讨论】:

  • 检查 NULL 很好,但 pNode 变量是否正确初始化?
  • 是的,pNode 是场景中的根节点,assimp 表示它始终处于初始化状态,除非文件加载失败。 (文件正在加载,如果我停用动画,我可以完美地看到模型)

标签: c++ animation assimp skeletal-animation


【解决方案1】:

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

我的导入器类是本地的,所以它被破坏了,从而导致了错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-03
    • 1970-01-01
    • 1970-01-01
    • 2019-01-11
    • 1970-01-01
    • 1970-01-01
    • 2014-09-11
    • 2020-12-27
    相关资源
    最近更新 更多