Merge pull request #54512 from pycbouh/meshtool-fix-bones-crash-3.x

This commit is contained in:
Rémi Verschelde 2021-11-02 15:20:12 +01:00 committed by GitHub
commit a05aefb74b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -412,6 +412,7 @@ Vector<int> MeshDataTool::get_vertex_bones(int p_idx) const {
}
void MeshDataTool::set_vertex_bones(int p_idx, const Vector<int> &p_bones) {
ERR_FAIL_INDEX(p_idx, vertices.size());
ERR_FAIL_COND(p_bones.size() != 4);
vertices.write[p_idx].bones = p_bones;
format |= Mesh::ARRAY_FORMAT_BONES;
}
@ -422,6 +423,7 @@ Vector<float> MeshDataTool::get_vertex_weights(int p_idx) const {
}
void MeshDataTool::set_vertex_weights(int p_idx, const Vector<float> &p_weights) {
ERR_FAIL_INDEX(p_idx, vertices.size());
ERR_FAIL_COND(p_weights.size() != 4);
vertices.write[p_idx].weights = p_weights;
format |= Mesh::ARRAY_FORMAT_WEIGHTS;
}