From 15d057c5211270605d4344165930bba9c5d7e2aa Mon Sep 17 00:00:00 2001 From: Jonathan Nicholl Date: Thu, 1 Sep 2022 20:32:33 -0400 Subject: Add `is_zero_approx` methods to `Vector2`, `3`, and `4` --- editor/plugins/bone_map_editor_plugin.cpp | 2 +- editor/plugins/skeleton_3d_editor_plugin.cpp | 2 +- editor/plugins/tiles/tile_atlas_view.cpp | 2 +- editor/plugins/tiles/tile_data_editors.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'editor') diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 988f9cc394..46e2fe41af 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -681,7 +681,7 @@ void BoneMapper::auto_mapping_process(Ref &p_bone_map) { } if (!found) { for (int i = 0; i < search_path.size(); i++) { - if (Vector3(0, 0, 0).is_equal_approx(skeleton->get_bone_global_rest(search_path[i]).origin)) { + if (skeleton->get_bone_global_rest(search_path[i]).origin.is_zero_approx()) { bone_idx = search_path[i]; // The bone existing at the origin is appropriate as a root. found = true; break; diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index b85e44e106..8836799c87 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -433,7 +433,7 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi /// Get an up vector not collinear with child rest origin Vector3 up = Vector3(0, 1, 0); - if (up.cross(child_rest.origin).is_equal_approx(Vector3())) { + if (up.cross(child_rest.origin).is_zero_approx()) { up = Vector3(0, 0, 1); } diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 5f0576a675..d9291503cb 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -139,7 +139,7 @@ void TileAtlasView::_update_zoom_and_panning(bool p_zoom_on_mouse_pos) { // Center of panel. panning = panning * zoom / previous_zoom; } - button_center_view->set_disabled(panning.is_equal_approx(Vector2())); + button_center_view->set_disabled(panning.is_zero_approx()); previous_zoom = zoom; diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 1bfbd342c2..1dce41e4c7 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -448,7 +448,7 @@ void GenericTilePolygonEditor::_base_control_gui_input(Ref p_event) } else if (drag_type == DRAG_TYPE_PAN) { panning += mm->get_position() - drag_last_pos; drag_last_pos = mm->get_position(); - button_center_view->set_disabled(panning.is_equal_approx(Vector2())); + button_center_view->set_disabled(panning.is_zero_approx()); } else { // Update hovered point. _grab_polygon_point(mm->get_position(), xform, hovered_polygon_index, hovered_point_index); -- cgit v1.2.3