Remove ERR_EXPLAIN from scene/* code

This commit is contained in:
Tomasz Chabora 2019-08-08 22:11:48 +02:00
parent d2a67c9c1f
commit af5e0fff66
36 changed files with 157 additions and 473 deletions

View file

@ -883,10 +883,7 @@ int ArrayMesh::get_surface_count() const {
void ArrayMesh::add_blend_shape(const StringName &p_name) {
if (surfaces.size()) {
ERR_EXPLAIN("Can't add a shape key count if surfaces are already created.");
ERR_FAIL_COND(surfaces.size());
}
ERR_FAIL_COND_MSG(surfaces.size(), "Can't add a shape key count if surfaces are already created.");
StringName name = p_name;
@ -914,10 +911,7 @@ StringName ArrayMesh::get_blend_shape_name(int p_index) const {
}
void ArrayMesh::clear_blend_shapes() {
if (surfaces.size()) {
ERR_EXPLAIN("Can't set shape key count if surfaces are already created.");
ERR_FAIL_COND(surfaces.size());
}
ERR_FAIL_COND_MSG(surfaces.size(), "Can't set shape key count if surfaces are already created.");
blend_shapes.clear();
}
@ -1109,8 +1103,7 @@ struct ArrayMeshLightmapSurface {
Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texel_size) {
ERR_FAIL_COND_V(!array_mesh_lightmap_unwrap_callback, ERR_UNCONFIGURED);
ERR_EXPLAIN("Can't unwrap mesh with blend shapes");
ERR_FAIL_COND_V(blend_shapes.size() != 0, ERR_UNAVAILABLE);
ERR_FAIL_COND_V_MSG(blend_shapes.size() != 0, ERR_UNAVAILABLE, "Can't unwrap mesh with blend shapes.");
Vector<float> vertices;
Vector<float> normals;
@ -1124,15 +1117,9 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe
ArrayMeshLightmapSurface s;
s.primitive = surface_get_primitive_type(i);
if (s.primitive != Mesh::PRIMITIVE_TRIANGLES) {
ERR_EXPLAIN("Only triangles are supported for lightmap unwrap");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
ERR_FAIL_COND_V_MSG(s.primitive != Mesh::PRIMITIVE_TRIANGLES, ERR_UNAVAILABLE, "Only triangles are supported for lightmap unwrap.");
s.format = surface_get_format(i);
if (!(s.format & ARRAY_FORMAT_NORMAL)) {
ERR_EXPLAIN("Normals are required for lightmap unwrap");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
ERR_FAIL_COND_V_MSG(!(s.format & ARRAY_FORMAT_NORMAL), ERR_UNAVAILABLE, "Normals are required for lightmap unwrap.");
Array arrays = surface_get_arrays(i);
s.material = surface_get_material(i);