Repository: godotengine/godot
File: editor/scene/3d/node_3d_editor_plugin.cpp (C++)

Code before:
	return !t.is_equal_approx(last_camera_transform);
}

void Node3DEditorViewport::_apply_camera_transform_to_cursor() {
	// Effectively the reverse of to_camera_transform, use camera transform to set cursor position and rotation.
	const Transform3D camera_transform = camera->get_camera_transform();
	const Basis basis = camera_transform.basis;

	real_t distance;
	if (orthogonal) {
		distance = (get_zfar() - get_znear()) / 2.0;
	} else {
		distance = cursor.distance;
	}

	cursor.pos = camera_transform.origin - basis.get_column(2) * distance;

	cursor.x_rot = cursor.unsnapped_x_rot = -camera_transform.basis.get_euler().x;
	cursor.y_rot = cursor.unsnapped_y_rot = -camera_transform.basis.get_euler().y;
}

void Node3DEditorViewport::_menu_option(int p_option) {
	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	switch (p_option) {
		case VIEW_TOP: {
			cursor.y_rot = cursor.unsnapped_y_rot = 0;
			cursor.x_rot = cursor.unsnapped_x_rot = Math::PI / 2.0;
			set_message(TTR("Top View."), 2);
			view_type = VIEW_TYPE_TOP;
			_set_auto_orthogonal();
			_update_name();

		} break;
		case VIEW_BOTTOM: {
			cursor.y_rot = cursor.unsnapped_y_rot = 0;
			cursor.x_rot = cursor.unsnapped_x_rot = -Math::PI / 2.0;
			set_message(TTR("Bottom View."), 2);
			view_type = VIEW_TYPE_BOTTOM;
			_set_auto_orthogonal();
			_update_name();

		} break;
		case VIEW_LEFT: {
			cursor.x_rot = cursor.unsnapped_x_rot = 0;
			cursor.y_rot = cursor.unsnapped_y_rot = Math::PI / 2.0;
			set_message(TTR("Left View."), 2);
			view_type = VIEW_TYPE_LEFT;
			_set_auto_orthogonal();
			_update_name();

		} break;

Review comment (suggestion):
```suggestion
			cursor.y_rot = 0;
			cursor.unsnapped_y_rot = 0;
```
For all these assignments by constant, we avoid chained assignments when possible 

Code after:
	return !t.is_equal_approx(last_camera_transform);
}

void Node3DEditorViewport::_apply_camera_transform_to_cursor() {
	// Effectively the reverse of to_camera_transform, use camera transform to set cursor position and rotation.
	const Transform3D camera_transform = camera->get_camera_transform();
	const Basis basis = camera_transform.basis;

	real_t distance;
	if (orthogonal) {
		distance = (get_zfar() - get_znear()) / 2.0;
	} else {
		distance = cursor.distance;
	}

	cursor.pos = camera_transform.origin - basis.get_column(2) * distance;

	cursor.x_rot = -camera_transform.basis.get_euler().x;
	cursor.y_rot = -camera_transform.basis.get_euler().y;
	cursor.unsnapped_x_rot = cursor.x_rot;
	cursor.unsnapped_y_rot = cursor.y_rot;
}

void Node3DEditorViewport::_menu_option(int p_option) {
	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	switch (p_option) {
		case VIEW_TOP: {
			cursor.y_rot = 0;
			cursor.x_rot = Math::PI / 2.0;
			cursor.unsnapped_y_rot = cursor.y_rot;
			cursor.unsnapped_x_rot = cursor.x_rot;
			set_message(TTR("Top View."), 2);
			view_type = VIEW_TYPE_TOP;
			_set_auto_orthogonal();
			_update_name();

		} break;
		case VIEW_BOTTOM: {
			cursor.y_rot = 0;
			cursor.x_rot = -Math::PI / 2.0;
			cursor.unsnapped_y_rot = cursor.y_rot;
			cursor.unsnapped_x_rot = cursor.x_rot;
			set_message(TTR("Bottom View."), 2);
			view_type = VIEW_TYPE_BOTTOM;
			_set_auto_orthogonal();
			_update_name();

		} break;
		case VIEW_LEFT: {
			cursor.x_rot = 0;
			cursor.y_rot = Math::PI / 2.0;