Skip to content

Commit

Permalink
Merge pull request #76052 from TokageItLab/fix-viewport-axis
Browse files Browse the repository at this point in the history
Fix 3D Viewport Front/Rear axis and Focus button
  • Loading branch information
akien-mga committed May 24, 2023
2 parents 7bdc458 + 4e4259b commit 299f0ae
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ void ViewportRotationControl::_notification(int p_what) {
axis_menu_options.clear();
axis_menu_options.push_back(Node3DEditorViewport::VIEW_RIGHT);
axis_menu_options.push_back(Node3DEditorViewport::VIEW_TOP);
axis_menu_options.push_back(Node3DEditorViewport::VIEW_REAR);
axis_menu_options.push_back(Node3DEditorViewport::VIEW_FRONT);
axis_menu_options.push_back(Node3DEditorViewport::VIEW_LEFT);
axis_menu_options.push_back(Node3DEditorViewport::VIEW_BOTTOM);
axis_menu_options.push_back(Node3DEditorViewport::VIEW_FRONT);
axis_menu_options.push_back(Node3DEditorViewport::VIEW_REAR);

axis_colors.clear();
axis_colors.push_back(get_theme_color(SNAME("axis_x_color"), SNAME("Editor")));
Expand Down Expand Up @@ -370,7 +370,7 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) {
Vector3 axis_3d = camera_basis.get_column(i);
Vector2i axis_vector = Vector2(axis_3d.x, -axis_3d.y) * radius;

if (Math::abs(axis_3d.z) < 1.0) {
if (Math::abs(axis_3d.z) <= 1.0) {
Axis2D pos_axis;
pos_axis.axis = i;
pos_axis.screen_point = center + axis_vector;
Expand All @@ -385,7 +385,7 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) {
} else {
// Special case when the camera is aligned with one axis
Axis2D axis;
axis.axis = i + (axis_3d.z < 0 ? 0 : 3);
axis.axis = i + (axis_3d.z <= 0 ? 0 : 3);
axis.screen_point = center;
axis.z_axis = 1.0;
r_axis.push_back(axis);
Expand Down Expand Up @@ -3176,7 +3176,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
} break;
case VIEW_FRONT: {
cursor.x_rot = 0;
cursor.y_rot = Math_PI;
cursor.y_rot = 0;
set_message(TTR("Front View."), 2);
view_type = VIEW_TYPE_FRONT;
_set_auto_orthogonal();
Expand All @@ -3185,7 +3185,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
} break;
case VIEW_REAR: {
cursor.x_rot = 0;
cursor.y_rot = 0;
cursor.y_rot = Math_PI;
set_message(TTR("Rear View."), 2);
view_type = VIEW_TYPE_REAR;
_set_auto_orthogonal();
Expand Down

0 comments on commit 299f0ae

Please sign in to comment.