godot: blend shape operations on ArrayMesh work incorrectly
Code below (on git master)
if (p_blend_shapes.size()) {
//validate format for morphs
for (int i = 0; i < p_blend_shapes.size(); i++) {
uint32_t bsformat = 0;
Array arr = p_blend_shapes[i];
for (int j = 0; j < arr.size(); j++) {
if (arr[j].get_type() != Variant::NIL)
bsformat |= (1 << j);
}
ERR_FAIL_COND((bsformat) != (format & (VS::ARRAY_FORMAT_INDEX - 1)));
}
}
generates a lot of errors for simple gdscript:
# helper is ArrayMesh loaded from file via load()
var ret_mesh: = ArrayMesh.new()
var helper_surf_array = helper.surface_get_arrays(0)
var bshapes = helper.surface_get_blend_shape_arrays(0)
for k in range(helper.get_blend_shape_count()):
ret_mesh.add_blend_shape(helper.get_blend_shape_name(k))
ret_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, helper_surf_array, bshapes)
return ret_mesh
which prevents any reasonable manipulation with meshes with blend shapes. Any ideas on fixing this? This used to work fine a few months ago. Original mesh is imported from Blender-2.80 release using godot-blender-exporter aka .escn exporter and works perfectly fine.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (14 by maintainers)
Still present on Godot 4.0.dev 9ca0d66
Here’s the code I used to workaround the problem
Godot isn’t the happiest about this: it prints this error when I add arrays… but the above code does seem to workaround the bug.
ERROR: Storage buffer supplied (binding: 2) is invalid. at: (drivers\vulkan\rendering_device_vulkan.cpp:5152)
It’s a bit offtopic, but just FYI as it’s a convenient feature: you can browse to a file through GitHub’s web UI, select lines by Shift+clicking on line numbers on the left side, and there’s a “…” options menu with “Copy permalink” which gives you a link to those lines at the current HEAD commit:
https://github.com/godotengine/godot/blob/791d7f78b52f5b828aa5541897e12c6a1861ef6f/servers/visual_server.cpp#L975-L989
And when you paste it in an issue/PR, GitHub automatically converts it to the widget seen above with the code.