0 votes

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

Godot version 3.4
in Engine by (12 points)

1 Answer

0 votes

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.

by (7,309 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.