{"record":{"id":"723dd446a43e2985","repo":"FyroxEngine/Fyrox","slug":"failed-to-import-animation","errorCode":null,"errorMessage":"Failed to import animation: {}","messagePattern":"Failed to import animation: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"fyrox-impl/src/resource/gltf/animation.rs","lineNumber":295,"sourceCode":"/// a handle can be looked up using the index of a node within the document. Animations in glTF specify their target\n/// nodes by their index within the node list of the document, and these indices need to be translated into handles.\n///\n/// * `buffers`: A slice containing a list of byte-vectors, one for each buffer in the glTF document.\n/// Animations in glTF make reference to data stored in the document's list of buffers by index.\n/// This slcie allows an index into the document's list of buffers to be translated into actual bytes of data.\npub fn import_animations(\n    doc: &gltf::Document,\n    node_handles: &[Handle<Node>],\n    graph: &Graph,\n    buffers: &[Vec<u8>],\n) -> Vec<Animation> {\n    let mut imports: Vec<ImportedAnimation> = Vec::with_capacity(doc.animations().len());\n    for animation in doc.animations() {\n        if let Ok(mut import) = import_animation(&animation, node_handles, buffers) {\n            import.simplify_curves();\n            imports.push(import);\n        } else {\n            Log::err(format!(\n                \"Failed to import animation: {}\",\n                animation.name().unwrap_or(\"[Unnamed]\")\n            ));\n        }\n    }\n    remove_fixed_targets(imports.as_mut_slice(), graph);\n    let mut result: Vec<Animation> = Vec::with_capacity(imports.len());\n    for import in imports {\n        result.push(import.into_animation());\n    }\n    result\n}\n\nfn import_animation(\n    animation: &gltf::Animation,\n    node_handles: &[Handle<Node>],\n    buffers: &[Vec<u8>],\n) -> Result<ImportedAnimation> {","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-impl/src/resource/gltf/animation.rs#L277-L313","documentation":"During glTF animation import, import_animation returned Err for one animation; the loader logs this error with the animation's name and simply skips it, so the resulting model has fewer animations than the source glTF. The actual reason is only in the inner error, which is discarded here.","triggerScenarios":"import_from_slice loading a glTF whose animation references nodes that couldn't be mapped to handles, samplers/channels with invalid accessors or unsupported interpolation, or empty/ corrupt buffers.","commonSituations":"glTF animations targeting nodes pruned during import, animations on skeleton bones not shared with the skin, exporters writing non-standard sampler data, or glb files with truncated buffer views.","solutions":["Check the glTF in a validator (gltf-validator / gltf.report) to find the invalid animation channel/sampler","Ensure animated nodes are part of the imported scene graph (skin hierarchy included in the node mapping)","Re-export from the DCC tool with animation sampling enabled and only supported interpolation modes","Log the inner import_animation error (modify code or check for related warnings) to identify the exact failing channel"],"exampleFix":"// before: animation silently missing\nlet model = resource_manager.request::<Model>(\"character.glb\");\n// after: confirm animations count matches source\nlet model = resource_manager.request::<Model>(\"character.glb\");\nif let ResourceState::Ok(m) = model.state() {\n    assert_eq!(m.animations_ref().len(), expected_animation_count, \"glTF animation failed to import\");\n}","handlingStrategy":"validation","validationCode":"// After model load, verify animations count matches the source glTF\nlet doc = gltf::Gltf::from_slice(&bytes)?;\nassert_eq!(doc.animations().len(), model_resource.animations_len(), \"animation skipped during import\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate glTF files with gltf-validator in your asset pipeline","Ensure animated nodes belong to the imported scene/skin hierarchy","Re-export animations with sampling enabled and standard interpolation","Count imported animations after load and compare with the source file"],"tags":["gltf","animation","asset-import"],"backgroundTag":"asset-import-failed","analyzedSha":"76c91aad8eca488ce527b1af707be8b3b24ad72d","analyzedAt":"2026-09-10T16:04:01.633Z","contentChangedAt":"2026-09-10T16:04:01.633Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}