diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_properties.cpp | 34 | ||||
-rw-r--r-- | editor/import/collada.cpp | 2 | ||||
-rw-r--r-- | editor/import/post_import_plugin_skeleton_rest_fixer.cpp | 2 | ||||
-rw-r--r-- | editor/import/resource_importer_wav.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/mesh_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_gizmos.cpp | 60 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 32 | ||||
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 32 |
11 files changed, 107 insertions, 79 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index e5d64c41bb..c70dc6bc51 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1462,7 +1462,7 @@ void EditorPropertyFloat::_value_changed(double val) { } if (angle_in_radians) { - val = Math::deg2rad(val); + val = Math::deg_to_rad(val); } emit_changed(get_edited_property(), val); } @@ -1470,7 +1470,7 @@ void EditorPropertyFloat::_value_changed(double val) { void EditorPropertyFloat::update_property() { double val = get_edited_object()->get(get_edited_property()); if (angle_in_radians) { - val = Math::rad2deg(val); + val = Math::rad_to_deg(val); } setting = true; spin->set_value(val); @@ -1992,9 +1992,9 @@ void EditorPropertyVector3::_value_changed(double val, const String &p_name) { v3.y = spin[1]->get_value(); v3.z = spin[2]->get_value(); if (angle_in_radians) { - v3.x = Math::deg2rad(v3.x); - v3.y = Math::deg2rad(v3.y); - v3.z = Math::deg2rad(v3.z); + v3.x = Math::deg_to_rad(v3.x); + v3.y = Math::deg_to_rad(v3.y); + v3.z = Math::deg_to_rad(v3.z); } emit_changed(get_edited_property(), v3, p_name); } @@ -2026,9 +2026,9 @@ void EditorPropertyVector3::_update_ratio() { void EditorPropertyVector3::update_using_vector(Vector3 p_vector) { if (angle_in_radians) { - p_vector.x = Math::rad2deg(p_vector.x); - p_vector.y = Math::rad2deg(p_vector.y); - p_vector.z = Math::rad2deg(p_vector.z); + p_vector.x = Math::rad_to_deg(p_vector.x); + p_vector.y = Math::rad_to_deg(p_vector.y); + p_vector.z = Math::rad_to_deg(p_vector.z); } setting = true; spin[0]->set_value(p_vector.x); @@ -2043,9 +2043,9 @@ Vector3 EditorPropertyVector3::get_vector() { v3.y = spin[1]->get_value(); v3.z = spin[2]->get_value(); if (angle_in_radians) { - v3.x = Math::deg2rad(v3.x); - v3.y = Math::deg2rad(v3.y); - v3.z = Math::deg2rad(v3.z); + v3.x = Math::deg_to_rad(v3.x); + v3.y = Math::deg_to_rad(v3.y); + v3.z = Math::deg_to_rad(v3.z); } return v3; @@ -2647,9 +2647,9 @@ void EditorPropertyQuaternion::_custom_value_changed(double val) { edit_euler.z = euler[2]->get_value(); Vector3 v; - v.x = Math::deg2rad(edit_euler.x); - v.y = Math::deg2rad(edit_euler.y); - v.z = Math::deg2rad(edit_euler.z); + v.x = Math::deg_to_rad(edit_euler.x); + v.y = Math::deg_to_rad(edit_euler.y); + v.z = Math::deg_to_rad(edit_euler.z); Quaternion temp_q = Quaternion(v); spin[0]->set_value(temp_q.x); @@ -2689,9 +2689,9 @@ void EditorPropertyQuaternion::update_property() { spin[3]->set_value(val.w); if (!is_grabbing_euler()) { Vector3 v = val.normalized().get_euler_yxz(); - edit_euler.x = Math::rad2deg(v.x); - edit_euler.y = Math::rad2deg(v.y); - edit_euler.z = Math::rad2deg(v.z); + edit_euler.x = Math::rad_to_deg(v.x); + edit_euler.y = Math::rad_to_deg(v.y); + edit_euler.z = Math::rad_to_deg(v.z); euler[0]->set_value(edit_euler.x); euler[1]->set_value(edit_euler.y); euler[2]->set_value(edit_euler.z); diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp index f4d19fe8b6..5b9ed2c1d2 100644 --- a/editor/import/collada.cpp +++ b/editor/import/collada.cpp @@ -131,7 +131,7 @@ Transform3D Collada::Node::compute_transform(const Collada &state) const { switch (xf.op) { case XForm::OP_ROTATE: { if (xf.data.size() >= 4) { - xform_step.rotate(Vector3(xf.data[0], xf.data[1], xf.data[2]), Math::deg2rad(xf.data[3])); + xform_step.rotate(Vector3(xf.data[0], xf.data[1], xf.data[2]), Math::deg_to_rad(xf.data[3])); } } break; case XForm::OP_SCALE: { diff --git a/editor/import/post_import_plugin_skeleton_rest_fixer.cpp b/editor/import/post_import_plugin_skeleton_rest_fixer.cpp index 685cb16eb1..6f775c7ea8 100644 --- a/editor/import/post_import_plugin_skeleton_rest_fixer.cpp +++ b/editor/import/post_import_plugin_skeleton_rest_fixer.cpp @@ -324,7 +324,7 @@ void PostImportPluginSkeletonRestFixer::internal_process(InternalImportCategory Vector3 src_dir = src_tail - src_head; // Rotate rest. - if (Math::abs(Math::rad2deg(src_dir.angle_to(prof_dir))) > float(p_options["retarget/rest_fixer/fix_silhouette/threshold"])) { + if (Math::abs(Math::rad_to_deg(src_dir.angle_to(prof_dir))) > float(p_options["retarget/rest_fixer/fix_silhouette/threshold"])) { // Get rotation difference. Vector3 up_vec; // Need to rotate other than roll axis. switch (Vector3(abs(src_dir.x), abs(src_dir.y), abs(src_dir.z)).min_axis_index()) { diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index a1e00f7d30..1dcae2841b 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -390,7 +390,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s int first = 0; int last = (frames / format_channels) - 1; bool found = false; - float limit = Math::db2linear(TRIM_DB_LIMIT); + float limit = Math::db_to_linear(TRIM_DB_LIMIT); for (int i = 0; i < data.size() / format_channels; i++) { float ampChannelSum = 0; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 17c2d26dc2..3505d7fedf 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -223,8 +223,8 @@ public: grid_step_x->set_value(p_grid_step.x); grid_step_y->set_value(p_grid_step.y); primary_grid_steps->set_value(p_primary_grid_steps); - rotation_offset->set_value(Math::rad2deg(p_rotation_offset)); - rotation_step->set_value(Math::rad2deg(p_rotation_step)); + rotation_offset->set_value(Math::rad_to_deg(p_rotation_offset)); + rotation_step->set_value(Math::rad_to_deg(p_rotation_step)); scale_step->set_value(p_scale_step); } @@ -232,8 +232,8 @@ public: p_grid_offset = Point2(grid_offset_x->get_value(), grid_offset_y->get_value()); p_grid_step = Point2(grid_step_x->get_value(), grid_step_y->get_value()); p_primary_grid_steps = int(primary_grid_steps->get_value()); - p_rotation_offset = Math::deg2rad(rotation_offset->get_value()); - p_rotation_step = Math::deg2rad(rotation_step->get_value()); + p_rotation_offset = Math::deg_to_rad(rotation_offset->get_value()); + p_rotation_step = Math::deg_to_rad(rotation_step->get_value()); p_scale_step = scale_step->get_value(); } }; @@ -1447,7 +1447,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) { drag_selection, vformat(TTR("Rotate CanvasItem \"%s\" to %d degrees"), drag_selection[0]->get_name(), - Math::rad2deg(drag_selection[0]->_edit_get_rotation())), + Math::rad_to_deg(drag_selection[0]->_edit_get_rotation())), true); } @@ -3676,7 +3676,7 @@ void CanvasItemEditor::_draw_transform_message() { } break; case DRAG_ROTATE: { - real_t delta = Math::rad2deg(current_transform.get_rotation() - original_transform.get_rotation()); + real_t delta = Math::rad_to_deg(current_transform.get_rotation() - original_transform.get_rotation()); transform_message = TTR("Rotating:") + " " + FORMAT(delta) + String::utf8(" °"); } break; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 2ca495e5d6..0a840d6fd6 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -215,7 +215,7 @@ private: int primary_grid_steps = 8; int grid_step_multiplier = 0; - real_t snap_rotation_step = Math::deg2rad(15.0); + real_t snap_rotation_step = Math::deg_to_rad(15.0); real_t snap_rotation_offset = 0.0; real_t snap_scale_step = 0.1f; bool smart_snap_active = false; diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 9fcb6619c0..74a6e90a6d 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -179,8 +179,8 @@ MaterialEditor::MaterialEditor() { viewport->add_child(box_instance); Transform3D box_xform; - box_xform.basis.rotate(Vector3(1, 0, 0), Math::deg2rad(25.0)); - box_xform.basis = box_xform.basis * Basis().rotated(Vector3(0, 1, 0), Math::deg2rad(-25.0)); + box_xform.basis.rotate(Vector3(1, 0, 0), Math::deg_to_rad(25.0)); + box_xform.basis = box_xform.basis * Basis().rotated(Vector3(0, 1, 0), Math::deg_to_rad(-25.0)); box_xform.basis.scale(Vector3(0.7, 0.7, 0.7)); box_xform.origin.y = 0.05; box_instance->set_transform(box_xform); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 31c9f1e387..980d2974a0 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -77,8 +77,8 @@ void MeshEditor::edit(Ref<Mesh> p_mesh) { mesh = p_mesh; mesh_instance->set_mesh(mesh); - rot_x = Math::deg2rad(-15.0); - rot_y = Math::deg2rad(30.0); + rot_x = Math::deg_to_rad(-15.0); + rot_y = Math::deg_to_rad(30.0); _update_rotation(); AABB aabb = mesh->get_aabb(); diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 3eec19ba06..878f8c9a95 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -1295,7 +1295,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 = (Math_PI * 0.5) - Vector2(min_p.x, -min_p.z).angle(); - return Math::rad2deg(a); + return Math::rad_to_deg(a); } void Light3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_id, bool p_secondary, Camera3D *p_camera, const Point2 &p_point) { @@ -1421,8 +1421,8 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 120; i++) { // Create a circle - const float ra = Math::deg2rad((float)(i * 3)); - const float rb = Math::deg2rad((float)((i + 1) * 3)); + const float ra = Math::deg_to_rad((float)(i * 3)); + const float rb = Math::deg_to_rad((float)((i + 1) * 3)); const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; @@ -1458,13 +1458,13 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { SpotLight3D *sl = Object::cast_to<SpotLight3D>(light); float r = sl->get_param(Light3D::PARAM_RANGE); - float w = r * Math::sin(Math::deg2rad(sl->get_param(Light3D::PARAM_SPOT_ANGLE))); - float d = r * Math::cos(Math::deg2rad(sl->get_param(Light3D::PARAM_SPOT_ANGLE))); + float w = r * Math::sin(Math::deg_to_rad(sl->get_param(Light3D::PARAM_SPOT_ANGLE))); + float d = r * Math::cos(Math::deg_to_rad(sl->get_param(Light3D::PARAM_SPOT_ANGLE))); for (int i = 0; i < 120; i++) { // Draw a circle - const float ra = Math::deg2rad((float)(i * 3)); - const float rb = Math::deg2rad((float)((i + 1) * 3)); + const float ra = Math::deg_to_rad((float)(i * 3)); + const float rb = Math::deg_to_rad((float)((i + 1) * 3)); const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w; const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * w; @@ -1545,8 +1545,8 @@ void AudioStreamPlayer3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo float closest_angle = 1e20; for (int i = 0; i < 180; i++) { - float a = Math::deg2rad((float)i); - float an = Math::deg2rad((float)(i + 1)); + float a = Math::deg_to_rad((float)i); + float an = Math::deg_to_rad((float)(i + 1)); Vector3 from(Math::sin(a), 0, -Math::cos(a)); Vector3 to(Math::sin(an), 0, -Math::cos(an)); @@ -1628,8 +1628,8 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 120; i++) { // Create a circle. - const float ra = Math::deg2rad((float)(i * 3)); - const float rb = Math::deg2rad((float)((i + 1) * 3)); + const float ra = Math::deg_to_rad((float)(i * 3)); + const float rb = Math::deg_to_rad((float)((i + 1) * 3)); const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; @@ -1671,8 +1671,8 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { if (player->is_emission_angle_enabled()) { const float pc = player->get_emission_angle(); - const float ofs = -Math::cos(Math::deg2rad(pc)); - const float radius = Math::sin(Math::deg2rad(pc)); + const float ofs = -Math::cos(Math::deg_to_rad(pc)); + const float radius = Math::sin(Math::deg_to_rad(pc)); Vector<Vector3> points_primary; points_primary.resize(200); @@ -1707,7 +1707,7 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_lines(points_secondary, material_secondary); Vector<Vector3> handles; - const float ha = Math::deg2rad(player->get_emission_angle()); + const float ha = Math::deg_to_rad(player->get_emission_angle()); handles.push_back(Vector3(Math::sin(ha), 0, -Math::cos(ha))); p_gizmo->add_handles(handles, get_material("handles")); } @@ -1872,7 +1872,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { // The real FOV is halved for accurate representation float fov = camera->get_fov() / 2.0; - Vector3 side = Vector3(Math::sin(Math::deg2rad(fov)), 0, -Math::cos(Math::deg2rad(fov))); + Vector3 side = Vector3(Math::sin(Math::deg_to_rad(fov)), 0, -Math::cos(Math::deg_to_rad(fov))); Vector3 nside = side; nside.x = -nside.x; Vector3 up = Vector3(0, side.x, 0); @@ -2643,8 +2643,8 @@ void VehicleWheel3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { float r = car_wheel->get_radius(); const int skip = 10; for (int i = 0; i <= 360; i += skip) { - float ra = Math::deg2rad((float)i); - float rb = Math::deg2rad((float)i + skip); + float ra = Math::deg_to_rad((float)i); + float rb = Math::deg_to_rad((float)i + skip); Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; @@ -3272,8 +3272,8 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector<Vector3> points; for (int i = 0; i <= 360; i++) { - float ra = Math::deg2rad((float)i); - float rb = Math::deg2rad((float)i + 1); + float ra = Math::deg_to_rad((float)i); + float rb = Math::deg_to_rad((float)i + 1); Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; @@ -4517,8 +4517,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector<Vector3> points; for (int i = 0; i <= 360; i++) { - float ra = Math::deg2rad((float)i); - float rb = Math::deg2rad((float)i + 1); + float ra = Math::deg_to_rad((float)i); + float rb = Math::deg_to_rad((float)i + 1); Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; @@ -4589,8 +4589,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector3 d(0, height * 0.5 - radius, 0); for (int i = 0; i < 360; i++) { - float ra = Math::deg2rad((float)i); - float rb = Math::deg2rad((float)i + 1); + float ra = Math::deg_to_rad((float)i); + float rb = Math::deg_to_rad((float)i + 1); Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius; Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius; @@ -4660,8 +4660,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Vector3 d(0, height * 0.5, 0); for (int i = 0; i < 360; i++) { - float ra = Math::deg2rad((float)i); - float rb = Math::deg2rad((float)i + 1); + float ra = Math::deg_to_rad((float)i); + float rb = Math::deg_to_rad((float)i + 1); Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius; Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius; @@ -5203,8 +5203,8 @@ void JointGizmosDrawer::draw_cone(const Transform3D &p_offset, const Basis &p_ba //swing for (int i = 0; i < 360; i += 10) { - float ra = Math::deg2rad((float)i); - float rb = Math::deg2rad((float)i + 10); + float ra = Math::deg_to_rad((float)i); + float rb = Math::deg_to_rad((float)i + 10); Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w; Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * w; @@ -5221,12 +5221,12 @@ void JointGizmosDrawer::draw_cone(const Transform3D &p_offset, const Basis &p_ba r_points.push_back(p_offset.translated_local(p_base.xform(Vector3(1, 0, 0))).origin); /// Twist - float ts = Math::rad2deg(p_twist); + float ts = Math::rad_to_deg(p_twist); ts = MIN(ts, 720); for (int i = 0; i < int(ts); i += 5) { - float ra = Math::deg2rad((float)i); - float rb = Math::deg2rad((float)i + 5); + float ra = Math::deg_to_rad((float)i); + float rb = Math::deg_to_rad((float)i + 5); float c = i / 720.0; float cn = (i + 5) / 720.0; Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w * c; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index c7ddd4d7a5..0fdb62c56c 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -342,7 +342,7 @@ void Node3DEditorViewport::_update_camera(real_t p_interp_delta) { camera->set_global_transform(to_camera_transform(camera_cursor)); if (orthogonal) { - float half_fov = Math::deg2rad(get_fov()) / 2.0; + float half_fov = Math::deg_to_rad(get_fov()) / 2.0; float height = 2.0 * cursor.distance * Math::tan(half_fov); camera->set_orthogonal(height, get_znear(), get_zfar()); } else { @@ -2144,7 +2144,7 @@ void Node3DEditorViewport::_nav_orbit(Ref<InputEventWithModifiers> p_event, cons } const real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity"); - const real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel); + const real_t radians_per_pixel = Math::deg_to_rad(degrees_per_pixel); const bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y_axis"); const bool invert_x_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_x_axis"); @@ -2177,7 +2177,7 @@ void Node3DEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const // Scale mouse sensitivity with camera FOV scale when zoomed in to make it easier to point at things. const real_t degrees_per_pixel = real_t(EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_sensitivity")) * MIN(1.0, cursor.fov_scale); - const real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel); + const real_t radians_per_pixel = Math::deg_to_rad(degrees_per_pixel); const bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y_axis"); // Note: do NOT assume the camera has the "current" transform, because it is interpolated and may have "lag". @@ -4534,7 +4534,7 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) { break; } - static const float orthogonal_threshold = Math::cos(Math::deg2rad(87.0f)); + static const float orthogonal_threshold = Math::cos(Math::deg_to_rad(87.0f)); bool axis_is_orthogonal = ABS(plane.normal.dot(global_axis)) < orthogonal_threshold; double angle = 0.0f; @@ -4554,10 +4554,10 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) { if (_edit.snap || spatial_editor->is_snap_enabled()) { snap = spatial_editor->get_rotate_snap(); } - angle = Math::rad2deg(angle) + snap * 0.5; //else it won't reach +180 + angle = Math::rad_to_deg(angle) + snap * 0.5; //else it won't reach +180 angle -= Math::fmod(angle, snap); set_message(vformat(TTR("Rotating %s degrees."), String::num(angle, snap_step_decimals))); - angle = Math::deg2rad(angle); + angle = Math::deg_to_rad(angle); bool local_coords = (spatial_editor->are_local_coords_enabled() && _edit.plane != TRANSFORM_VIEW); // Disable local transformation for TRANSFORM_VIEW @@ -5725,7 +5725,7 @@ void Node3DEditor::_xform_dialog_action() { for (int i = 0; i < 3; i++) { translate[i] = xform_translate[i]->get_text().to_float(); - rotate[i] = Math::deg2rad(xform_rotate[i]->get_text().to_float()); + rotate[i] = Math::deg_to_rad(xform_rotate[i]->get_text().to_float()); scale[i] = xform_scale[i]->get_text().to_float(); } @@ -7611,10 +7611,10 @@ void Node3DEditor::_load_default_preview_settings() { // On any not-tidally-locked planet, a sun would have an angular altitude // of 60 degrees as the average of all points on the sphere at noon. // The azimuth choice is arbitrary, but ideally shouldn't be on an axis. - sun_rotation = Vector2(-Math::deg2rad(60.0), Math::deg2rad(150.0)); + sun_rotation = Vector2(-Math::deg_to_rad(60.0), Math::deg_to_rad(150.0)); - sun_angle_altitude->set_value(-Math::rad2deg(sun_rotation.x)); - sun_angle_azimuth->set_value(180.0 - Math::rad2deg(sun_rotation.y)); + sun_angle_altitude->set_value(-Math::rad_to_deg(sun_rotation.x)); + sun_angle_azimuth->set_value(180.0 - Math::rad_to_deg(sun_rotation.y)); sun_direction->update(); environ_sky_color->set_pick_color(Color(0.385, 0.454, 0.55)); environ_ground_color->set_pick_color(Color(0.2, 0.169, 0.133)); @@ -7657,8 +7657,8 @@ void Node3DEditor::_update_preview_environment() { } } - sun_angle_altitude->set_value(-Math::rad2deg(sun_rotation.x)); - sun_angle_azimuth->set_value(180.0 - Math::rad2deg(sun_rotation.y)); + sun_angle_altitude->set_value(-Math::rad_to_deg(sun_rotation.x)); + sun_angle_azimuth->set_value(180.0 - Math::rad_to_deg(sun_rotation.y)); bool disable_env = world_env_count > 0 || environ_button->is_pressed(); @@ -7691,15 +7691,15 @@ void Node3DEditor::_sun_direction_input(const Ref<InputEvent> &p_event) { sun_rotation.x += mm->get_relative().y * (0.02 * EDSCALE); sun_rotation.y -= mm->get_relative().x * (0.02 * EDSCALE); sun_rotation.x = CLAMP(sun_rotation.x, -Math_TAU / 4, Math_TAU / 4); - sun_angle_altitude->set_value(-Math::rad2deg(sun_rotation.x)); - sun_angle_azimuth->set_value(180.0 - Math::rad2deg(sun_rotation.y)); + sun_angle_altitude->set_value(-Math::rad_to_deg(sun_rotation.x)); + sun_angle_azimuth->set_value(180.0 - Math::rad_to_deg(sun_rotation.y)); _preview_settings_changed(); } } void Node3DEditor::_sun_direction_angle_set() { - sun_rotation.x = Math::deg2rad(-sun_angle_altitude->get_value()); - sun_rotation.y = Math::deg2rad(180.0 - sun_angle_azimuth->get_value()); + sun_rotation.x = Math::deg_to_rad(-sun_angle_altitude->get_value()); + sun_rotation.y = Math::deg_to_rad(180.0 - sun_angle_azimuth->get_value()); _preview_settings_changed(); } diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index dea69a8b2a..04c73e16ab 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -566,9 +566,23 @@ static const char *gdscript_function_renames[][2] = { { "to_utf8", "to_utf8_buffer" }, // String { "to_wchar", "to_utf32_buffer" }, // String // TODO - utf32 or utf16? - // Globals + // @GlobalScope + { "bytes2var", "bytes_to_var" }, + { "bytes2var_with_objects", "bytes_to_var_with_objects" }, + { "db2linear", "db_to_linear" }, + { "deg2rad", "deg_to_rad" }, + { "linear2db", "linear_to_db" }, + { "rad2deg", "rad_to_deg" }, { "rand_range", "randf_range" }, { "stepify", "snapped" }, + { "str2var", "str_to_var" }, + { "var2str", "var_to_str" }, + { "var2bytes", "var_to_bytes" }, + { "var2bytes_with_objects", "var_to_bytes_with_objects" }, + + // @GDScript + { "dict2inst", "dict_to_inst" }, + { "inst2dict", "inst_to_dict" }, { nullptr, nullptr }, }; @@ -955,9 +969,23 @@ static const char *csharp_function_renames[][2] = { { "ToUtf8", "ToUtf8Buffer" }, // String { "ToWchar", "ToUtf32Buffer" }, // String // TODO - utf32 or utf16? - // Globals + // @GlobalScope + { "Bytes2Var", "BytesToVar" }, + { "Bytes2VarWithObjects", "BytesToVarWithObjects" }, + { "Db2Linear", "DbToLinear" }, + { "Deg2Rad", "DegToRad" }, + { "Linear2Db", "LinearToDb" }, + { "Rad2Deg", "RadToDeg" }, { "RandRange", "RandfRange" }, { "Stepify", "Snapped" }, + { "Str2Var", "StrToVar" }, + { "Var2Str", "VarToStr" }, + { "Var2Bytes", "VarToBytes" }, + { "Var2BytesWithObjects", "VarToBytesWithObjects" }, + + // @GDScript + { "Dict2Inst", "DictToInst" }, + { "Inst2Dict", "InstToDict" }, { nullptr, nullptr }, }; |