Merge pull request #17902 from Noshyaar/outline

Mesh: fix crash when creating mesh outline from QuadMesh
This commit is contained in:
Rémi Verschelde 2018-04-03 11:55:01 +02:00 committed by GitHub
commit a10be201de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -344,6 +344,10 @@ void MeshInstanceEditor::_create_outline_mesh() {
err_dialog->set_text(TTR("Mesh has not surface to create outlines from!"));
err_dialog->popup_centered_minsize();
return;
} else if (mesh->get_surface_count() == 1 && mesh->surface_get_primitive_type(0) != Mesh::PRIMITIVE_TRIANGLES) {
err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES!"));
err_dialog->popup_centered_minsize();
return;
}
Ref<Mesh> mesho = mesh->create_outline(outline_size->get_value());

View File

@ -315,6 +315,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
}
}
ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>());
{
PoolVector<int>::Write ir;
PoolVector<int> indices = arrays[ARRAY_INDEX];