From 755c70b871c659df2d7c3a003593f38775dd7b5d Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Sun, 14 Mar 2021 07:21:32 +0000 Subject: [PATCH] Rename Array.invert() to Array.reverse() Does the same internally for List and Vector<>, which includes all PackedArray types. --- core/string/ustring.cpp | 2 +- core/templates/list.h | 2 +- core/templates/vector.h | 4 ++-- core/variant/array.cpp | 4 ++-- core/variant/array.h | 2 +- core/variant/variant_call.cpp | 20 +++++++++---------- doc/classes/Array.xml | 2 +- doc/classes/PackedByteArray.xml | 2 +- doc/classes/PackedColorArray.xml | 2 +- doc/classes/PackedFloat32Array.xml | 2 +- doc/classes/PackedFloat64Array.xml | 2 +- doc/classes/PackedInt32Array.xml | 2 +- doc/classes/PackedInt64Array.xml | 2 +- doc/classes/PackedStringArray.xml | 2 +- doc/classes/PackedVector2Array.xml | 2 +- doc/classes/PackedVector3Array.xml | 2 +- editor/dependency_editor.cpp | 6 +++--- editor/filesystem_dock.cpp | 6 +++--- editor/plugins/tile_set_editor_plugin.cpp | 2 +- editor/scene_tree_dock.cpp | 8 ++++---- modules/csg/csg.cpp | 2 +- modules/csg/csg_shape.cpp | 2 +- modules/gdnative/gdnative_api.json | 2 +- modules/gdnative/include/text/godot_text.h | 2 +- .../gdnative/text/text_server_gdnative.cpp | 4 ++-- modules/gdnavigation/nav_map.cpp | 4 ++-- modules/gdscript/gdscript.cpp | 4 ++-- modules/gdscript/gdscript_byte_codegen.cpp | 2 +- .../gdscript/gdscript_utility_functions.cpp | 2 +- .../animation_node_state_machine.cpp | 2 +- scene/main/node.cpp | 4 ++-- scene/resources/convex_polygon_shape_2d.cpp | 2 +- scene/resources/polygon_path_finder.cpp | 2 +- tests/test_geometry_2d.h | 2 +- tests/test_list.h | 2 +- 35 files changed, 57 insertions(+), 57 deletions(-) diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 28228e4a83a..05c80296c29 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -1138,7 +1138,7 @@ Vector String::rsplit(const String &p_splitter, bool p_allow_empty, int remaining_len = left_edge; } - ret.invert(); + ret.reverse(); return ret; } diff --git a/core/templates/list.h b/core/templates/list.h index eaf1dbb4a00..010e35eed85 100644 --- a/core/templates/list.h +++ b/core/templates/list.h @@ -492,7 +492,7 @@ public: _data->last = p_I; } - void invert() { + void reverse() { int s = size() / 2; Element *F = front(); Element *B = back(); diff --git a/core/templates/vector.h b/core/templates/vector.h index 6a8902707c3..a56a941dbce 100644 --- a/core/templates/vector.h +++ b/core/templates/vector.h @@ -74,7 +74,7 @@ public: remove(idx); } } - void invert(); + void reverse(); _FORCE_INLINE_ T *ptrw() { return _cowdata.ptrw(); } _FORCE_INLINE_ const T *ptr() const { return _cowdata.ptr(); } @@ -194,7 +194,7 @@ public: }; template -void Vector::invert() { +void Vector::reverse() { for (int i = 0; i < size() / 2; i++) { T *p = ptrw(); SWAP(p[i], p[size() - i - 1]); diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 347c6cd82e0..beb3bdb7090 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -445,8 +445,8 @@ int Array::bsearch_custom(const Variant &p_value, Callable p_callable, bool p_be return bisect(_p->array, p_value, p_before, less); } -void Array::invert() { - _p->array.invert(); +void Array::reverse() { + _p->array.reverse(); } void Array::push_front(const Variant &p_value) { diff --git a/core/variant/array.h b/core/variant/array.h index d8f2402330f..9fa77513498 100644 --- a/core/variant/array.h +++ b/core/variant/array.h @@ -83,7 +83,7 @@ public: void shuffle(); int bsearch(const Variant &p_value, bool p_before = true); int bsearch_custom(const Variant &p_value, Callable p_callable, bool p_before = true); - void invert(); + void reverse(); int find(const Variant &p_value, int p_from = 0) const; int rfind(const Variant &p_value, int p_from = -1) const; diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 8c1d8066d6e..8f2d252810c 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1460,7 +1460,7 @@ static void _register_variant_builtin_methods() { bind_method(Array, shuffle, sarray(), varray()); bind_method(Array, bsearch, sarray("value", "before"), varray(true)); bind_method(Array, bsearch_custom, sarray("value", "func", "before"), varray(true)); - bind_method(Array, invert, sarray(), varray()); + bind_method(Array, reverse, sarray(), varray()); bind_method(Array, duplicate, sarray("deep"), varray(false)); bind_method(Array, slice, sarray("begin", "end", "step", "deep"), varray(1, false)); bind_method(Array, max, sarray(), varray()); @@ -1477,7 +1477,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedByteArray, insert, sarray("at_index", "value"), varray()); bind_method(PackedByteArray, resize, sarray("new_size"), varray()); bind_method(PackedByteArray, has, sarray("value"), varray()); - bind_method(PackedByteArray, invert, sarray(), varray()); + bind_method(PackedByteArray, reverse, sarray(), varray()); bind_method(PackedByteArray, subarray, sarray("from", "to"), varray()); bind_method(PackedByteArray, sort, sarray(), varray()); bind_method(PackedByteArray, duplicate, sarray(), varray()); @@ -1503,7 +1503,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedInt32Array, insert, sarray("at_index", "value"), varray()); bind_method(PackedInt32Array, resize, sarray("new_size"), varray()); bind_method(PackedInt32Array, has, sarray("value"), varray()); - bind_method(PackedInt32Array, invert, sarray(), varray()); + bind_method(PackedInt32Array, reverse, sarray(), varray()); bind_method(PackedInt32Array, subarray, sarray("from", "to"), varray()); bind_method(PackedInt32Array, to_byte_array, sarray(), varray()); bind_method(PackedInt32Array, sort, sarray(), varray()); @@ -1521,7 +1521,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedInt64Array, insert, sarray("at_index", "value"), varray()); bind_method(PackedInt64Array, resize, sarray("new_size"), varray()); bind_method(PackedInt64Array, has, sarray("value"), varray()); - bind_method(PackedInt64Array, invert, sarray(), varray()); + bind_method(PackedInt64Array, reverse, sarray(), varray()); bind_method(PackedInt64Array, subarray, sarray("from", "to"), varray()); bind_method(PackedInt64Array, to_byte_array, sarray(), varray()); bind_method(PackedInt64Array, sort, sarray(), varray()); @@ -1539,7 +1539,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedFloat32Array, insert, sarray("at_index", "value"), varray()); bind_method(PackedFloat32Array, resize, sarray("new_size"), varray()); bind_method(PackedFloat32Array, has, sarray("value"), varray()); - bind_method(PackedFloat32Array, invert, sarray(), varray()); + bind_method(PackedFloat32Array, reverse, sarray(), varray()); bind_method(PackedFloat32Array, subarray, sarray("from", "to"), varray()); bind_method(PackedFloat32Array, to_byte_array, sarray(), varray()); bind_method(PackedFloat32Array, sort, sarray(), varray()); @@ -1557,7 +1557,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedFloat64Array, insert, sarray("at_index", "value"), varray()); bind_method(PackedFloat64Array, resize, sarray("new_size"), varray()); bind_method(PackedFloat64Array, has, sarray("value"), varray()); - bind_method(PackedFloat64Array, invert, sarray(), varray()); + bind_method(PackedFloat64Array, reverse, sarray(), varray()); bind_method(PackedFloat64Array, subarray, sarray("from", "to"), varray()); bind_method(PackedFloat64Array, to_byte_array, sarray(), varray()); bind_method(PackedFloat64Array, sort, sarray(), varray()); @@ -1575,7 +1575,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedStringArray, insert, sarray("at_index", "value"), varray()); bind_method(PackedStringArray, resize, sarray("new_size"), varray()); bind_method(PackedStringArray, has, sarray("value"), varray()); - bind_method(PackedStringArray, invert, sarray(), varray()); + bind_method(PackedStringArray, reverse, sarray(), varray()); bind_method(PackedStringArray, subarray, sarray("from", "to"), varray()); bind_method(PackedStringArray, to_byte_array, sarray(), varray()); bind_method(PackedStringArray, sort, sarray(), varray()); @@ -1593,7 +1593,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedVector2Array, insert, sarray("at_index", "value"), varray()); bind_method(PackedVector2Array, resize, sarray("new_size"), varray()); bind_method(PackedVector2Array, has, sarray("value"), varray()); - bind_method(PackedVector2Array, invert, sarray(), varray()); + bind_method(PackedVector2Array, reverse, sarray(), varray()); bind_method(PackedVector2Array, subarray, sarray("from", "to"), varray()); bind_method(PackedVector2Array, to_byte_array, sarray(), varray()); bind_method(PackedVector2Array, sort, sarray(), varray()); @@ -1611,7 +1611,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedVector3Array, insert, sarray("at_index", "value"), varray()); bind_method(PackedVector3Array, resize, sarray("new_size"), varray()); bind_method(PackedVector3Array, has, sarray("value"), varray()); - bind_method(PackedVector3Array, invert, sarray(), varray()); + bind_method(PackedVector3Array, reverse, sarray(), varray()); bind_method(PackedVector3Array, subarray, sarray("from", "to"), varray()); bind_method(PackedVector3Array, to_byte_array, sarray(), varray()); bind_method(PackedVector3Array, sort, sarray(), varray()); @@ -1629,7 +1629,7 @@ static void _register_variant_builtin_methods() { bind_method(PackedColorArray, insert, sarray("at_index", "value"), varray()); bind_method(PackedColorArray, resize, sarray("new_size"), varray()); bind_method(PackedColorArray, has, sarray("value"), varray()); - bind_method(PackedColorArray, invert, sarray(), varray()); + bind_method(PackedColorArray, reverse, sarray(), varray()); bind_method(PackedColorArray, subarray, sarray("from", "to"), varray()); bind_method(PackedColorArray, to_byte_array, sarray(), varray()); bind_method(PackedColorArray, sort, sarray(), varray()); diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index dcfb91eb612..f3cecc081a9 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -328,7 +328,7 @@ [b]Note:[/b] On large arrays, this method will be slower if the inserted element is close to the beginning of the array (index 0). This is because all elements placed after the newly inserted element have to be reindexed. - + diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index 3c7f0f4fad2..a668c09fdaf 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -157,7 +157,7 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml index abfedc84cc9..99b0f0486a8 100644 --- a/doc/classes/PackedColorArray.xml +++ b/doc/classes/PackedColorArray.xml @@ -79,7 +79,7 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml index 8918312dc72..99c2d3cf7ef 100644 --- a/doc/classes/PackedFloat32Array.xml +++ b/doc/classes/PackedFloat32Array.xml @@ -80,7 +80,7 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml index fbb832299ee..5a6d4a48c42 100644 --- a/doc/classes/PackedFloat64Array.xml +++ b/doc/classes/PackedFloat64Array.xml @@ -80,7 +80,7 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml index ecef2d508b4..a6cf311bc27 100644 --- a/doc/classes/PackedInt32Array.xml +++ b/doc/classes/PackedInt32Array.xml @@ -80,7 +80,7 @@ Inserts a new integer at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml index 19619d60cf6..05c7c0e0720 100644 --- a/doc/classes/PackedInt64Array.xml +++ b/doc/classes/PackedInt64Array.xml @@ -80,7 +80,7 @@ Inserts a new integer at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml index c241573b938..9a2ea216241 100644 --- a/doc/classes/PackedStringArray.xml +++ b/doc/classes/PackedStringArray.xml @@ -80,7 +80,7 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml index 9138dc68e10..7549d4a0293 100644 --- a/doc/classes/PackedVector2Array.xml +++ b/doc/classes/PackedVector2Array.xml @@ -80,7 +80,7 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index 0a3b0cf2c00..a55d2eeaede 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -79,7 +79,7 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). - + diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 25e155aafea..57d44ca56cf 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -86,11 +86,11 @@ void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Mapkey().replace_first("res://", ""); Vector existingv = existing.split("/"); - existingv.invert(); + existingv.reverse(); Vector currentv = current.split("/"); - currentv.invert(); + currentv.reverse(); Vector lostv = lost.split("/"); - lostv.invert(); + lostv.reverse(); int existing_score = 0; int current_score = 0; diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 43bfccc6562..99d36cfe8d8 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -680,17 +680,17 @@ void FileSystemDock::_sort_file_info_list(List &r_file break; case FILE_SORT_TYPE_REVERSE: r_file_list.sort_custom(); - r_file_list.invert(); + r_file_list.reverse(); break; case FILE_SORT_MODIFIED_TIME: r_file_list.sort_custom(); break; case FILE_SORT_MODIFIED_TIME_REVERSE: r_file_list.sort_custom(); - r_file_list.invert(); + r_file_list.reverse(); break; case FILE_SORT_NAME_REVERSE: - r_file_list.invert(); + r_file_list.reverse(); break; default: // FILE_SORT_NAME break; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index b97ee107433..66d7d3dbaaf 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -2928,7 +2928,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { } if (p_total < 0) { - points.invert(); + points.reverse(); } shape->set_points(points); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 2cdab83d900..53edee0181f 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -608,7 +608,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { List selection = editor_selection->get_selected_node_list(); selection.sort_custom(); // sort by index if (MOVING_DOWN) { - selection.invert(); + selection.reverse(); } int lowest_id = common_parent->get_child_count() - 1; @@ -1384,7 +1384,7 @@ void SceneTreeDock::fill_path_renames(Node *p_node, Node *p_new_parent, Listget_name()); n = n->get_parent(); } - base_path.invert(); + base_path.reverse(); Vector new_base_path; if (p_new_parent) { @@ -1394,7 +1394,7 @@ void SceneTreeDock::fill_path_renames(Node *p_node, Node *p_new_parent, Listget_parent(); } - new_base_path.invert(); + new_base_path.reverse(); } _fill_path_renames(base_path, new_base_path, p_node, p_renames); @@ -1580,7 +1580,7 @@ void SceneTreeDock::_node_prerenamed(Node *p_node, const String &p_new_name) { base_path.push_back(n->get_name()); n = n->get_parent(); } - base_path.invert(); + base_path.reverse(); Vector new_base_path = base_path; base_path.push_back(p_node->get_name()); diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index 8b46447f046..73878422599 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -931,7 +931,7 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector &p_segment_ // Delete the old faces in reverse index order. merge_faces_idx.sort(); - merge_faces_idx.invert(); + merge_faces_idx.reverse(); for (int i = 0; i < merge_faces_idx.size(); ++i) { faces.remove(merge_faces_idx[i]); } diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index b97ee6ce4c6..77be493be9f 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -1679,7 +1679,7 @@ CSGBrush *CSGPolygon3D::_build_brush() { Vector final_polygon = polygon; if (Triangulate::get_area(final_polygon) > 0) { - final_polygon.invert(); + final_polygon.reverse(); } Vector triangles = Geometry2D::triangulate_polygon(final_polygon); diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 59b078f2b69..489083e7951 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -5716,7 +5716,7 @@ ] }, { - "name": "godot_packed_glyph_array_invert", + "name": "godot_packed_glyph_array_reverse", "return_type": "void", "arguments": [ [ diff --git a/modules/gdnative/include/text/godot_text.h b/modules/gdnative/include/text/godot_text.h index 86fc7451344..b49beab5181 100644 --- a/modules/gdnative/include/text/godot_text.h +++ b/modules/gdnative/include/text/godot_text.h @@ -213,7 +213,7 @@ godot_bool GDAPI godot_packed_glyph_array_has(godot_packed_glyph_array *p_self, void GDAPI godot_packed_glyph_array_sort(godot_packed_glyph_array *p_self); -void GDAPI godot_packed_glyph_array_invert(godot_packed_glyph_array *p_self); +void GDAPI godot_packed_glyph_array_reverse(godot_packed_glyph_array *p_self); void GDAPI godot_packed_glyph_array_push_back(godot_packed_glyph_array *p_self, const godot_glyph *p_data); diff --git a/modules/gdnative/text/text_server_gdnative.cpp b/modules/gdnative/text/text_server_gdnative.cpp index 7cd8de5f2e6..e4c61c4d956 100644 --- a/modules/gdnative/text/text_server_gdnative.cpp +++ b/modules/gdnative/text/text_server_gdnative.cpp @@ -841,9 +841,9 @@ void GDAPI godot_packed_glyph_array_sort(godot_packed_glyph_array *p_self) { self->sort(); } -void GDAPI godot_packed_glyph_array_invert(godot_packed_glyph_array *p_self) { +void GDAPI godot_packed_glyph_array_reverse(godot_packed_glyph_array *p_self) { Vector *self = (Vector *)p_self; - self->invert(); + self->reverse(); } void GDAPI godot_packed_glyph_array_push_back(godot_packed_glyph_array *p_self, const godot_glyph *p_data) { diff --git a/modules/gdnavigation/nav_map.cpp b/modules/gdnavigation/nav_map.cpp index 80f367f3a6a..464082221f5 100644 --- a/modules/gdnavigation/nav_map.cpp +++ b/modules/gdnavigation/nav_map.cpp @@ -351,7 +351,7 @@ Vector NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p path.push_back(begin_point); } - path.invert(); + path.reverse(); } else { path.push_back(end_point); @@ -363,7 +363,7 @@ Vector NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p np_id = navigation_polys[np_id].back_navigation_poly_id; } - path.invert(); + path.reverse(); } return path; diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index a129b73c1ac..09634bb5e09 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -276,7 +276,7 @@ void GDScript::_get_script_property_list(List *r_list, bool p_incl } msort.sort(); - msort.invert(); + msort.reverse(); for (int i = 0; i < msort.size(); i++) { props.push_front(sptr->member_info[msort[i].name]); } @@ -1494,7 +1494,7 @@ void GDScriptInstance::get_property_list(List *p_properties) const } msort.sort(); - msort.invert(); + msort.reverse(); for (int i = 0; i < msort.size(); i++) { props.push_front(sptr->member_info[msort[i].name]); } diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index 58c6b31a77e..0b5448bd07f 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -100,7 +100,7 @@ void GDScriptByteCodeGenerator::start_parameters() { } void GDScriptByteCodeGenerator::end_parameters() { - function->default_arguments.invert(); + function->default_arguments.reverse(); } void GDScriptByteCodeGenerator::write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, MultiplayerAPI::RPCMode p_rpc_mode, const GDScriptDataType &p_return_type) { diff --git a/modules/gdscript/gdscript_utility_functions.cpp b/modules/gdscript/gdscript_utility_functions.cpp index 348d2213521..64c629662c0 100644 --- a/modules/gdscript/gdscript_utility_functions.cpp +++ b/modules/gdscript/gdscript_utility_functions.cpp @@ -298,7 +298,7 @@ struct GDScriptUtilityFunctionsDefinitions { sname.push_back(p->name); p = p->_owner; } - sname.invert(); + sname.reverse(); if (!p->path.is_resource_file()) { r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index d46f24752e8..246fff6d579 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -281,7 +281,7 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta at = cost_map[at].prev; } - path.invert(); + path.reverse(); return true; } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 933f67db68d..b406d800dce 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1690,7 +1690,7 @@ NodePath Node::get_path_to(const Node *p_node) const { n = n->data.parent; } - path.invert(); + path.reverse(); return NodePath(path, false); } @@ -1711,7 +1711,7 @@ NodePath Node::get_path() const { n = n->data.parent; } - path.invert(); + path.reverse(); data.path_cache = memnew(NodePath(path, true)); diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index 6e56f6e7fc9..ac31315858c 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -41,7 +41,7 @@ bool ConvexPolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, dou void ConvexPolygonShape2D::_update_shape() { Vector final_points = points; if (Geometry2D::is_polygon_clockwise(final_points)) { //needs to be counter clockwise - final_points.invert(); + final_points.reverse(); } PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), final_points); emit_changed(); diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index 536318ed16d..a08684a506a 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -368,7 +368,7 @@ Vector PolygonPathFinder::find_path(const Vector2 &p_from, const Vector path.push_back(points[at].pos); } while (at != aidx); - path.invert(); + path.reverse(); } for (int i = 0; i < points.size() - 2; i++) { diff --git a/tests/test_geometry_2d.h b/tests/test_geometry_2d.h index ea02d1114ff..c9313f36251 100644 --- a/tests/test_geometry_2d.h +++ b/tests/test_geometry_2d.h @@ -113,7 +113,7 @@ TEST_CASE("[Geometry2D] Polygon clockwise") { p.push_back(Vector2(1, 5)); CHECK(Geometry2D::is_polygon_clockwise(p)); - p.invert(); + p.reverse(); CHECK_FALSE(Geometry2D::is_polygon_clockwise(p)); } diff --git a/tests/test_list.h b/tests/test_list.h index 1c70b6e961f..52d5edff709 100644 --- a/tests/test_list.h +++ b/tests/test_list.h @@ -260,7 +260,7 @@ TEST_CASE("[List] Invert") { List::Element *n[4]; populate_integers(list, n, 4); - list.invert(); + list.reverse(); CHECK(list.front()->get() == 3); CHECK(list.front()->next()->get() == 2);