Export GLTF Will Not Save The Blendshape Weights

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By matthewyan

I have an imported .glb scene, there is a MeshInstance in the scene and it has blendshaps.

I use the script to set the blendshape weights and the change can be seen in the game. However, I export the scene to a new .glb file, and find that the blendshapes weights are reset to 0.

My script is as follows:


gltf_handler = PackedSceneGLTF.new()

var loaded_scene = gltf_handler.import_gltf_scene(model_path, 1, 25)

var mesh = loaded_scene.get_children()[0] # this is the mesh instance

mesh.set('blend_shapes/bs0', 1.0) # weight of blendshape 0 changed to 1.0
mesh.set('blend_shapes/bs5', 1.0) # weight of blendshape 5 changed to 1.0

add_child(loaded_scene) # now I can see the change in the game window

gltf_handler.export_gltf(loaded_scene, save_path) # the scene can be exported, however, the blendshape weights are 0.

I am not sure if this is normal that Godot does not support the modification of blendshape weights to be saved? Or is there a way to save the weights as well?

I am using Godot 3.4.stable

:bust_in_silhouette: Reply From: Inces

I don’t really understand how You try to modify imported scene with your gltf_handler method, but I suspect You should use tool EditorScenePostImport for this, because Godot won’t let any modifications to .glb file that was already succesfully imported. Extend script from EditorScenePostImport and override method func post_import(scene):, and insert this script in script slot of scenes Import tab, finally - press reimport.