1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Merge pull request #44649 from lyuma/bone_aabb_blendshapes

Fix blendshapes and calculation of bone_aabbs
This commit is contained in:
Rémi Verschelde
2020-12-24 17:20:07 +01:00
committed by GitHub
2 changed files with 11 additions and 3 deletions

View File

@@ -2408,9 +2408,6 @@ void RendererStorageRD::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_su
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
//ensure blend shape consistency
ERR_FAIL_COND(mesh->blend_shape_count && p_surface.bone_aabbs.size() != mesh->bone_aabbs.size());
#ifdef DEBUG_ENABLED
//do a validation, to catch errors first
{
@@ -2576,6 +2573,11 @@ void RendererStorageRD::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_su
mesh->bone_aabbs = p_surface.bone_aabbs;
mesh->aabb = p_surface.aabb;
} else {
if (mesh->bone_aabbs.size() < p_surface.bone_aabbs.size()) {
// ArrayMesh::_surface_set_data only allocates bone_aabbs up to max_bone
// Each surface may affect different numbers of bones.
mesh->bone_aabbs.resize(p_surface.bone_aabbs.size());
}
for (int i = 0; i < p_surface.bone_aabbs.size(); i++) {
mesh->bone_aabbs.write[i].merge_with(p_surface.bone_aabbs[i]);
}