|
@@ -250,7 +250,7 @@ Error GLTFDocument::_serialize_gltf_extensions(Ref<GLTFState> p_state) const {
|
|
|
}
|
|
|
|
|
|
Error GLTFDocument::_serialize_scenes(Ref<GLTFState> p_state) {
|
|
|
- ERR_FAIL_COND_V_MSG(p_state->root_nodes.size() == 0, ERR_INVALID_DATA, "GLTF export: The scene must have at least one root node.");
|
|
|
+ ERR_FAIL_COND_V_MSG(p_state->root_nodes.is_empty(), ERR_INVALID_DATA, "GLTF export: The scene must have at least one root node.");
|
|
|
// Godot only supports one scene per glTF file.
|
|
|
Array scenes;
|
|
|
Dictionary scene_dict;
|
|
@@ -807,7 +807,7 @@ Error GLTFDocument::_parse_buffers(Ref<GLTFState> p_state, const String &p_base_
|
|
|
uri = uri.uri_decode();
|
|
|
uri = p_base_path.path_join(uri).replace("\\", "/"); // Fix for Windows.
|
|
|
buffer_data = FileAccess::get_file_as_bytes(uri);
|
|
|
- ERR_FAIL_COND_V_MSG(buffer.size() == 0, ERR_PARSE_ERROR, "glTF: Couldn't load binary file as an array: " + uri);
|
|
|
+ ERR_FAIL_COND_V_MSG(buffer.is_empty(), ERR_PARSE_ERROR, "glTF: Couldn't load binary file as an array: " + uri);
|
|
|
}
|
|
|
|
|
|
ERR_FAIL_COND_V(!buffer.has("byteLength"), ERR_PARSE_ERROR);
|
|
@@ -1545,7 +1545,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_ints(Ref<GLTFState> p_state,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- ERR_FAIL_COND_V(attribs.size() == 0, -1);
|
|
|
+ ERR_FAIL_COND_V(attribs.is_empty(), -1);
|
|
|
|
|
|
Ref<GLTFAccessor> accessor;
|
|
|
accessor.instantiate();
|
|
@@ -1904,7 +1904,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_floats(Ref<GLTFState> p_stat
|
|
|
_calc_accessor_min_max(i, element_count, type_max, attribs, type_min);
|
|
|
}
|
|
|
|
|
|
- ERR_FAIL_COND_V(!attribs.size(), -1);
|
|
|
+ ERR_FAIL_COND_V(attribs.is_empty(), -1);
|
|
|
|
|
|
Ref<GLTFAccessor> accessor;
|
|
|
accessor.instantiate();
|
|
@@ -2222,7 +2222,7 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> p_state) {
|
|
|
Dictionary attributes;
|
|
|
{
|
|
|
Vector<Vector3> a = array[Mesh::ARRAY_VERTEX];
|
|
|
- ERR_FAIL_COND_V(!a.size(), ERR_INVALID_DATA);
|
|
|
+ ERR_FAIL_COND_V(a.is_empty(), ERR_INVALID_DATA);
|
|
|
attributes["POSITION"] = _encode_accessor_as_vec3(p_state, a, true);
|
|
|
vertex_num = a.size();
|
|
|
}
|
|
@@ -2789,7 +2789,7 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {
|
|
|
} else if (primitive == Mesh::PRIMITIVE_TRIANGLES) {
|
|
|
//generate indices because they need to be swapped for CW/CCW
|
|
|
const Vector<Vector3> &vertices = array[Mesh::ARRAY_VERTEX];
|
|
|
- ERR_FAIL_COND_V(vertices.size() == 0, ERR_PARSE_ERROR);
|
|
|
+ ERR_FAIL_COND_V(vertices.is_empty(), ERR_PARSE_ERROR);
|
|
|
Vector<int> indices;
|
|
|
const int vs = vertices.size();
|
|
|
indices.resize(vs);
|
|
@@ -2920,7 +2920,7 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {
|
|
|
if (t.has("TANGENT")) {
|
|
|
const Vector<Vector3> tangents_v3 = _decode_accessor_as_vec3(p_state, t["TANGENT"], true);
|
|
|
const Vector<float> src_tangents = array[Mesh::ARRAY_TANGENT];
|
|
|
- ERR_FAIL_COND_V(src_tangents.size() == 0, ERR_PARSE_ERROR);
|
|
|
+ ERR_FAIL_COND_V(src_tangents.is_empty(), ERR_PARSE_ERROR);
|
|
|
|
|
|
Vector<float> tangents_v4;
|
|
|
|
|
@@ -4415,7 +4415,7 @@ Error GLTFDocument::_verify_skin(Ref<GLTFState> p_state, Ref<GLTFSkin> p_skin) {
|
|
|
|
|
|
out_roots.sort();
|
|
|
|
|
|
- ERR_FAIL_COND_V(out_roots.size() == 0, FAILED);
|
|
|
+ ERR_FAIL_COND_V(out_roots.is_empty(), FAILED);
|
|
|
|
|
|
// Make sure the roots are the exact same (they better be)
|
|
|
ERR_FAIL_COND_V(out_roots.size() != p_skin->roots.size(), FAILED);
|
|
@@ -6111,7 +6111,7 @@ struct SceneFormatImporterGLTFInterpolate<Quaternion> {
|
|
|
|
|
|
template <class T>
|
|
|
T GLTFDocument::_interpolate_track(const Vector<real_t> &p_times, const Vector<T> &p_values, const float p_time, const GLTFAnimation::Interpolation p_interp) {
|
|
|
- ERR_FAIL_COND_V(!p_values.size(), T());
|
|
|
+ ERR_FAIL_COND_V(p_values.is_empty(), T());
|
|
|
if (p_times.size() != (p_values.size() / (p_interp == GLTFAnimation::INTERP_CUBIC_SPLINE ? 3 : 1))) {
|
|
|
ERR_PRINT_ONCE("The interpolated values are not corresponding to its times.");
|
|
|
return p_values[0];
|