From d3eb9e8c54d4a93b2bed90a5988f9814377d409f Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 19 Nov 2015 10:41:20 -0300 Subject: [PATCH] -remove Vector2.atan2() replaced by Vector2.angle(), fixes #2260 --- core/math/math_2d.cpp | 4 ++-- core/math/math_2d.h | 2 +- core/variant_call.cpp | 4 ++-- platform/windows/export/export.cpp | 4 ++-- platform/windows/export/export.h | 2 +- scene/2d/node_2d.cpp | 2 +- scene/2d/path_2d.cpp | 2 +- scene/2d/ray_cast_2d.cpp | 2 +- servers/physics_2d/body_2d_sw.cpp | 2 +- tools/editor/io_plugins/editor_scene_import_plugin.cpp | 4 ++-- tools/editor/plugins/canvas_item_editor_plugin.cpp | 2 +- tools/editor/spatial_editor_gizmos.cpp | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index 88717723ce1..ce03f089e5f 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -29,7 +29,7 @@ #include "math_2d.h" -real_t Vector2::atan2() const { +real_t Vector2::angle() const { return Math::atan2(x,y); } @@ -165,7 +165,7 @@ Vector2 Vector2::floor() const { Vector2 Vector2::rotated(float p_by) const { Vector2 v; - v.set_rotation(atan2()+p_by); + v.set_rotation(angle()+p_by); v*=length(); return v; } diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 5e6cefd114d..3d40e240914 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -133,7 +133,7 @@ struct Vector2 { bool operator<(const Vector2& p_vec2) const { return (x==p_vec2.x)?(y *p_list } -Error EditorExportPlatformWindows::export_project(const String& p_path, bool p_debug, bool p_dumb,bool p_remote_debug) { +Error EditorExportPlatformWindows::export_project(const String& p_path, bool p_debug, int p_flags) { - Error err = EditorExportPlatformPC::export_project(p_path, p_debug, p_dumb, p_remote_debug); + Error err = EditorExportPlatformPC::export_project(p_path, p_debug, p_flags); if(err != OK) { return err; diff --git a/platform/windows/export/export.h b/platform/windows/export/export.h index 702acc04b2d..2424efc8618 100644 --- a/platform/windows/export/export.h +++ b/platform/windows/export/export.h @@ -29,7 +29,7 @@ protected: void _get_property_list( List *p_list) const; public: - Error export_project(const String& p_path, bool p_debug, bool p_dumb=false, bool p_remote_debug=false); + Error export_project(const String& p_path, bool p_debug,int p_flags=0); EditorExportPlatformWindows(); }; diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 6141b6a09e2..52b112f0906 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -354,7 +354,7 @@ void Node2D::look_at(const Vector2& p_pos) { float Node2D::get_angle_to(const Vector2& p_pos) const { - return (get_global_transform().affine_inverse().xform(p_pos)).atan2(); + return (get_global_transform().affine_inverse().xform(p_pos)).angle(); } void Node2D::_bind_methods() { diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 7ba1bb28b69..8f110b39311 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -118,7 +118,7 @@ void PathFollow2D::_update_transform() { pos+=n*h_offset; pos+=t*v_offset; - set_rot(t.atan2()); + set_rot(t.angle()); } else { diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index acc4c620e67..4a199e3418b 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -131,7 +131,7 @@ void RayCast2D::_notification(int p_what) { if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) break; Matrix32 xf; - xf.rotate(cast_to.atan2()); + xf.rotate(cast_to.angle()); xf.translate(Vector2(0,cast_to.length())); //Vector2 tip = Vector2(0,s->get_length()); diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index 38835c9a82e..3afbbe5455b 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -442,7 +442,7 @@ void Body2DSW::integrate_forces(real_t p_step) { //compute motion, angular and etc. velocities from prev transform linear_velocity = (new_transform.elements[2] - get_transform().elements[2])/p_step; - real_t rot = new_transform.affine_inverse().basis_xform(get_transform().elements[1]).atan2(); + real_t rot = new_transform.affine_inverse().basis_xform(get_transform().elements[1]).angle(); angular_velocity = rot / p_step; motion = new_transform.elements[2] - get_transform().elements[2]; diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 99dcf4ed289..ca44df269b4 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1814,8 +1814,8 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map for(int i=0;ib) { SWAP( portal_points[i], portal_points[i+1] ); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 90bfe0bfdf5..fbc41a72692 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -1488,7 +1488,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { Matrix32 rot; rot.elements[1] = (dfrom - center).normalized(); rot.elements[0] = rot.elements[1].tangent(); - node->set_rot(snap_angle(rot.xform_inv(dto-center).atan2(), node->get_rot())); + node->set_rot(snap_angle(rot.xform_inv(dto-center).angle(), node->get_rot())); display_rotate_to = dto; display_rotate_from = center; viewport->update(); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 4dc9c4f43e7..5efca44c7db 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -745,7 +745,7 @@ static float _find_closest_angle_to_half_pi_arc(const Vector3& p_from, const Vec } //min_p = p_arc_xform.affine_inverse().xform(min_p); - float a = Vector2(min_p.x,-min_p.z).atan2(); + float a = Vector2(min_p.x,-min_p.z).angle(); return a*180.0/Math_PI; }