From fc27636999a15f88b1f3b1d7101d84a67968ba06 Mon Sep 17 00:00:00 2001 From: Anilforextra Date: Wed, 2 Feb 2022 00:04:13 +0545 Subject: Vectors: Use clear() and has(). Use clear() instead of resize(0). Use has() instead of "find(p_val) != -1". --- editor/plugins/animation_blend_space_2d_editor.cpp | 2 +- editor/plugins/animation_state_machine_editor.cpp | 2 +- editor/plugins/polygon_2d_editor_plugin.cpp | 4 ++-- editor/plugins/script_editor_plugin.cpp | 2 +- editor/plugins/visual_shader_editor_plugin.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'editor/plugins') diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index c0029312a7..f9df8db419 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -180,7 +180,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refdraw_style_box(sb, nr.node); - if (playing && (blend_from == name || current == name || travel_path.find(name) != -1)) { + if (playing && (blend_from == name || current == name || travel_path.has(name))) { state_machine_draw->draw_style_box(playing_overlay, nr.node); } diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 7a96e6eced..b116f8ff6d 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -473,7 +473,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { uv_move_current = uv_mode; if (uv_move_current == UV_MODE_CREATE) { if (!uv_create) { - points_prev.resize(0); + points_prev.clear(); Vector2 tuv = mtx.affine_inverse().xform(snap_point(mb->get_position())); points_prev.push_back(tuv); uv_create_to = tuv; @@ -682,7 +682,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { } polygon_create.clear(); - } else if (polygon_create.find(closest) == -1) { + } else if (!polygon_create.has(closest)) { //add temporarily if not exists polygon_create.push_back(closest); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 2a8882bbd1..9e46150813 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3486,7 +3486,7 @@ void ScriptEditor::_open_script_request(const String &p_path) { void ScriptEditor::register_syntax_highlighter(const Ref &p_syntax_highlighter) { ERR_FAIL_COND(p_syntax_highlighter.is_null()); - if (syntax_highlighters.find(p_syntax_highlighter) == -1) { + if (!syntax_highlighters.has(p_syntax_highlighter)) { syntax_highlighters.push_back(p_syntax_highlighter); } } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index ef6d7b3462..61657397f1 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1030,7 +1030,7 @@ void VisualShaderEditor::edit(VisualShader *p_visual_shader) { } void VisualShaderEditor::add_plugin(const Ref &p_plugin) { - if (plugins.find(p_plugin) != -1) { + if (plugins.has(p_plugin)) { return; } plugins.push_back(p_plugin); -- cgit v1.2.3