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

Code before:

			if (p_local) {
				Vector3 axis = p_original_local.basis.xform(p_motion);
				r.basis = Basis(axis.normalized(), p_extra) * p_original_local.basis;
				r.origin = p_original_local.origin;
			} else {
				Basis local = p_original.basis * p_original_local.basis.inverse();
				Vector3 axis = local.xform_inv(p_motion);
				r.basis = local * Basis(axis.normalized(), p_extra) * p_original_local.basis;
				r.origin = Basis(p_motion, p_extra).xform(p_original.origin - _edit.center) + _edit.center;
			}

			return r;
		}
		default: {
			ERR_FAIL_V_MSG(Transform3D(), "Invalid mode in '_compute_transform'");
		}
	}
}

void Node3DEditorViewport::_reset_transform(TransformType p_type) {
	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Reset Transform"));
	Array selection = editor_selection->get_selected_nodes();

	for (int i = 0; i < selection.size(); i++) {
		Node3D *sp = Object::cast_to<Node3D>(selection[i]);
		if (!sp) {
			continue;
		}

		switch (p_type) {
			case TransformType::POSITION:
				undo_redo->add_undo_method(sp, "set_position", sp->get_position());
				sp->set_position(Vector3(0, 0, 0));
				break;
			case TransformType::ROTATION:
				undo_redo->add_undo_method(sp, "set_rotation", sp->get_rotation());
				sp->set_rotation(Vector3(0, 0, 0));
				break;
			case TransformType::SCALE:
				undo_redo->add_undo_method(sp, "set_scale", sp->get_scale());
				sp->set_scale(Vector3(1, 1, 1));
				break;
		}
	}
	undo_redo->commit_action();
}

void Node3DEditorViewport::_surface_mouse_enter() {
	if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) {

Review comment (suggestion):
```suggestion
	List<Node *> selection = editor_selection->get_full_selected_node_list();

	for (Node *node : selection) {
```
Same in 2D editor.

Code after:

			if (p_local) {
				Vector3 axis = p_original_local.basis.xform(p_motion);
				r.basis = Basis(axis.normalized(), p_extra) * p_original_local.basis;
				r.origin = p_original_local.origin;
			} else {
				Basis local = p_original.basis * p_original_local.basis.inverse();
				Vector3 axis = local.xform_inv(p_motion);
				r.basis = local * Basis(axis.normalized(), p_extra) * p_original_local.basis;
				r.origin = Basis(p_motion, p_extra).xform(p_original.origin - _edit.center) + _edit.center;
			}

			return r;
		}
		default: {
			ERR_FAIL_V_MSG(Transform3D(), "Invalid mode in '_compute_transform'");
		}
	}
}

void Node3DEditorViewport::_reset_transform(TransformType p_type) {
	List<Node *> selection = editor_selection->get_full_selected_node_list();
	if (selection.is_empty()) {
		return;
	}
	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Reset Transform"));
	for (Node *node : selection) {
		Node3D *sp = Object::cast_to<Node3D>(node);
		if (!sp) {
			continue;
		}

		switch (p_type) {
			case TransformType::POSITION:
				undo_redo->add_undo_method(sp, "set_position", sp->get_position());
				undo_redo->add_do_method(sp, "set_position", Vector3());
				break;
			case TransformType::ROTATION:
				undo_redo->add_undo_method(sp, "set_rotation", sp->get_rotation());
				undo_redo->add_do_method(sp, "set_rotation", Vector3());
				break;
			case TransformType::SCALE:
				undo_redo->add_undo_method(sp, "set_scale", sp->get_scale());
				undo_redo->add_do_method(sp, "set_scale", Vector3(1, 1, 1));
				break;
		}
	}
	undo_redo->commit_action();
}