diff options
author | Anilforextra <anilforextra@gmail.com> | 2022-02-02 00:04:13 +0545 |
---|---|---|
committer | Anilforextra <anilforextra@gmail.com> | 2022-02-02 00:11:09 +0545 |
commit | fc27636999a15f88b1f3b1d7101d84a67968ba06 (patch) | |
tree | e3b66fce3dfd70ef1e7d5a4d1543446af2deae47 /scene/resources | |
parent | ea12094f19b028c1dcf6d402b8cbb3296b2065a8 (diff) |
Vectors: Use clear() and has().
Use clear() instead of resize(0).
Use has() instead of "find(p_val) != -1".
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/curve.cpp | 14 | ||||
-rw-r--r-- | scene/resources/mesh.cpp | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index d2cd76b796..6485c1ac77 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -661,8 +661,8 @@ void Curve2D::_bake() const { baked_cache_dirty = false; if (points.size() == 0) { - baked_point_cache.resize(0); - baked_dist_cache.resize(0); + baked_point_cache.clear(); + baked_dist_cache.clear(); return; } @@ -1164,10 +1164,10 @@ void Curve3D::_bake() const { baked_cache_dirty = false; if (points.size() == 0) { - baked_point_cache.resize(0); - baked_tilt_cache.resize(0); - baked_up_vector_cache.resize(0); - baked_dist_cache.resize(0); + baked_point_cache.clear(); + baked_tilt_cache.clear(); + baked_up_vector_cache.clear(); + baked_dist_cache.clear(); return; } @@ -1183,7 +1183,7 @@ void Curve3D::_bake() const { baked_up_vector_cache.resize(1); baked_up_vector_cache.set(0, Vector3(0, 1, 0)); } else { - baked_up_vector_cache.resize(0); + baked_up_vector_cache.clear(); } return; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index d2d96b1f06..441e84eccc 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -1475,12 +1475,12 @@ void ArrayMesh::add_blend_shape(const StringName &p_name) { StringName name = p_name; - if (blend_shapes.find(name) != -1) { + if (blend_shapes.has(name)) { int count = 2; do { name = String(p_name) + " " + itos(count); count++; - } while (blend_shapes.find(name) != -1); + } while (blend_shapes.has(name)); } blend_shapes.push_back(name); |