Can't import mesh containing morph targets
See original GitHub issueDescribe the bug If a mesh contain the morph target which is on any primitive other than 1st, then it failed to import it.
To Reproduce Steps to reproduce the behavior:
- Import the attached .glb file.
Expected behavior not crash and import the file with all the morph targets.
File F_MED_BLK_Red_Head_01_LOD0.glb
Version
- OS: Windows
- Blender Version 3.0.0 and 3.1.2
Additional context
glTF file was written using SharpGLTF. Traceback:
Python: Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\__init__.py", line 1109, in execute
return self.import_gltf2(context)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\__init__.py", line 1137, in import_gltf2
if self.unit_import(path, import_settings) == {'FINISHED'}:
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\__init__.py", line 1157, in unit_import
BlenderGlTF.create(gltf_importer)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_gltf.py", line 42, in create
BlenderGlTF._create(gltf)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_gltf.py", line 49, in _create
BlenderScene.create(gltf)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_scene.py", line 47, in create
BlenderNode.create_vnode(gltf, 'root')
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 55, in create_vnode
BlenderNode.create_vnode(gltf, child)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 55, in create_vnode
BlenderNode.create_vnode(gltf, child)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 41, in create_vnode
obj = BlenderNode.create_object(gltf, vnode_id)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 62, in create_object
obj = BlenderNode.create_mesh_object(gltf, vnode)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_node.py", line 234, in create_mesh_object
mesh = BlenderMesh.create(gltf, pynode.mesh, pynode.skin)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_mesh.py", line 35, in create
return create_mesh(gltf, mesh_idx, skin_idx)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_mesh.py", line 56, in create_mesh
do_primitives(gltf, mesh_idx, skin_idx, mesh, tmp_ob)
File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\scripts\addons\io_scene_gltf2\blender\imp\gltf2_blender_mesh.py", line 192, in do_primitives
if pymesh.shapekey_names[morph_i] is None:
IndexError: list index out of range
https://github.khronos.org/glTF-Validator/ Result
{
"uri": "F_MED_BLK_Red_Head_01_LOD0.glb",
"mimeType": "model/gltf-binary",
"validatorVersion": "2.0.0-dev.3.7",
"validatedAt": "2022-04-30T09:46:57.050Z",
"issues": {
"numErrors": 0,
"numWarnings": 0,
"numInfos": 18,
"numHints": 0,
"messages": [
{
"code": "UNUSED_MESH_TANGENT",
"message": "Tangents are not used because the material has no normal texture.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TANGENT"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_0"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_1"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_2"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_3"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_4"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_5"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_6"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/0/attributes/TEXCOORD_7"
},
{
"code": "UNUSED_MESH_TANGENT",
"message": "Tangents are not used because the material has no normal texture.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TANGENT"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_0"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_1"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_2"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_3"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_4"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_5"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_6"
},
{
"code": "UNUSED_OBJECT",
"message": "This object may be unused.",
"severity": 2,
"pointer": "/meshes/0/primitives/1/attributes/TEXCOORD_7"
}
],
"truncated": false
},
"info": {
"version": "2.0",
"generator": "SharpGLTF 1.0.0-alpha0023",
"resources": [
{
"pointer": "/buffers/0",
"mimeType": "application/gltf-buffer",
"storage": "glb",
"byteLength": 848792
}
],
"animationCount": 0,
"materialCount": 2,
"hasMorphTargets": true,
"hasSkins": true,
"hasTextures": false,
"hasDefaultScene": true,
"drawCallCount": 2,
"totalVertexCount": 5420,
"totalTriangleCount": 7880,
"maxUVs": 8,
"maxInfluences": 4,
"maxAttributes": 14
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Cannot import morph targets with skeletal mesh
Hello, When I try to import morph targets using the latest version of the Editor. They don't import, even though I checked to...
Read more >Importing Morph Targets Always Fails - Epic Games Forums
I made a test cube mesh with different morph targets just to experiment with the process, but everytime I try to import it,...
Read more >UE4 Importing Morph Targets - YouTube
How to import and control morph targets. ... playback doesn't begin shortly, try restarting your device. Your browser can't play this video.
Read more >Maya 2019 fbx import with morphs problem - Autodesk Forums
when I import a fbx file with morphs in it (daz genesis 3 fbx with blendshapes), the morph targets don't show in the...
Read more >Morph targets not showing from blender : r/unrealengine
Created a simple mesh with 5 shape keys in blender. Exported with animations and imported as a skeletal mesh into unreal with animation....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s the patch I wrote. It allows mixing in prims without targets, and also mixing prims that do and do not morph POSITION in the same target.
Patch
Okay, so since there are multiple ways to read the spec, this should probably be fixed anyway. There’s some other issues with morph targets now that I look. I can probably put up a patch later today.edit: Changed my mind again. Based on the fact the validator flags this if the primitives are in the other order, it seems the fact this isn’t flagged invalid is just a minor bug in the validator.