fix: assimp INCOMPLETE flag no longer rejects animation-only FBX
Assimp flags every mesh-less scene as AI_SCENE_FLAGS_INCOMPLETE (FBXConverter), so pure animation FBX never reached clip parsing - the scene was discarded before ParseAnimations ran. Only treat null scene / missing root node as hard failure; log INCOMPLETE as a warning and continue. Final validity stays with ParsedModel::Valid().
This commit is contained in:
@@ -193,22 +193,21 @@ ParsedModel Model::ParseFromDisk(const std::string& path)
|
|||||||
aiProcess_JoinIdenticalVertices |
|
aiProcess_JoinIdenticalVertices |
|
||||||
aiProcess_LimitBoneWeights); // 每顶点限 4 权重(= 顶点格式 boneIds 容量)
|
aiProcess_LimitBoneWeights); // 每顶点限 4 权重(= 顶点格式 boneIds 容量)
|
||||||
|
|
||||||
if (!scene || (scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE) || !scene->mRootNode) {
|
// 硬失败只有两种:scene 为 null(文件损坏/格式不支持)、无根节点。
|
||||||
// scene 可能为 null(文件损坏/格式不支持),先判空再打印资产清单
|
// 注意 INCOMPLETE 不能当失败判据——assimp 对"无网格场景"统一打此
|
||||||
if (scene != nullptr) {
|
// 标记(FBXConverter:没读到 mesh 就置位),纯动画 FBX 必中,数据
|
||||||
ENGINE_WARN("Assimp warn: model dose not have mesh assets\nmodel has following asset:");
|
// 本身完好。继续解析,最终有效性由 Valid()(mesh 或 clip 至少
|
||||||
|
// 其一非空)统一裁决
|
||||||
ENGINE_WARN("\tMeshes Count: {}", scene->mNumMeshes);
|
if (!scene || !scene->mRootNode) {
|
||||||
ENGINE_WARN("\tAnimations Count: {}", scene->mNumAnimations);
|
ENGINE_ERROR("Model parse failed: '{}' ({})",
|
||||||
ENGINE_WARN("\tCameras Count: {}", scene->mNumCameras);
|
path, importer.GetErrorString());
|
||||||
ENGINE_WARN("\tLights Count: {}", scene->mNumLights);
|
|
||||||
ENGINE_WARN("\tMaterials Count: {}", scene->mNumMaterials);
|
|
||||||
ENGINE_WARN("\tSkeletons Count: {}", scene->mNumSkeletons);
|
|
||||||
ENGINE_WARN("\tTextures Count: {}", scene->mNumTextures);
|
|
||||||
}
|
|
||||||
ENGINE_ERROR("Assimp error: {}", importer.GetErrorString());
|
|
||||||
return out; // meshes/clips 空 = 无效
|
return out; // meshes/clips 空 = 无效
|
||||||
}
|
}
|
||||||
|
if (scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE) {
|
||||||
|
ENGINE_WARN("Assimp: no meshes in '{}' (anims: {}, materials: {}) "
|
||||||
|
"- continuing for animation data",
|
||||||
|
path, scene->mNumAnimations, scene->mNumMaterials);
|
||||||
|
}
|
||||||
|
|
||||||
// 骨骼动画三件套:node 表(global 累乘骨架)→ 动画轨道 → 骨骼注册
|
// 骨骼动画三件套:node 表(global 累乘骨架)→ 动画轨道 → 骨骼注册
|
||||||
//(DFS 序;ProcessNode 的 mesh 遍历序与其独立,nodeIdx 靠 name 查表)
|
//(DFS 序;ProcessNode 的 mesh 遍历序与其独立,nodeIdx 靠 name 查表)
|
||||||
|
|||||||
Reference in New Issue
Block a user