Merge pull request #115855 from ryevdokimov/instant-feedback

Show viewport messages and rotation line instantly on instant transforms
This commit is contained in:
Thaddeus Crews 2026-02-09 15:07:00 -06:00
commit 2a5a740bde
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC

View file

@ -3575,8 +3575,7 @@ void Node3DEditorViewport::_notification(int p_what) {
if (!ruler->is_inside_tree()) {
double snap = EDITOR_GET("interface/inspector/default_float_step");
int snap_step_decimals = Math::range_step_decimals(snap);
set_message(TTR("Translating:") + " (" + String::num(selected_node->get_global_position().x, snap_step_decimals) + ", " +
String::num(selected_node->get_global_position().y, snap_step_decimals) + ", " + String::num(selected_node->get_global_position().z, snap_step_decimals) + ")");
set_message(vformat(TTR("Translating: %s"), vformat("%.*v", snap_step_decimals, selected_node->get_global_position())));
}
selected_node->set_global_position(spatial_editor->snap_point(_get_instance_position(_edit.mouse_pos, selected_node)));
@ -3597,8 +3596,7 @@ void Node3DEditorViewport::_notification(int p_what) {
preview_node_pos = spatial_editor->snap_point(_get_instance_position(preview_node_viewport_pos, preview_node));
double snap = EDITOR_GET("interface/inspector/default_float_step");
int snap_step_decimals = Math::range_step_decimals(snap);
set_message(TTR("Instantiating:") + " (" + String::num(preview_node_pos.x, snap_step_decimals) + ", " +
String::num(preview_node_pos.y, snap_step_decimals) + ", " + String::num(preview_node_pos.z, snap_step_decimals) + ")");
set_message(vformat(TTR("Instantiating: %s"), vformat("%.*v", snap_step_decimals, preview_node_pos)));
Transform3D preview_gl_transform = Transform3D(Basis(), preview_node_pos);
preview_node->set_global_transform(preview_gl_transform);
if (!preview_node->is_visible()) {
@ -5654,8 +5652,23 @@ void Node3DEditorViewport::begin_transform(TransformMode p_mode, bool instant) {
_edit.accumulated_rotation_angle = 0.0;
_edit.display_rotation_angle = 0.0;
_edit.gizmo_initiated = false;
switch (p_mode) {
case TRANSFORM_ROTATE:
_edit.show_rotation_line = true;
set_message(vformat(TTR("Rotating %s degrees."), String::num(0, 0)));
break;
case TRANSFORM_TRANSLATE:
set_message(vformat(TTR("Translating: %s"), vformat("%.0v", Vector3())));
break;
case TRANSFORM_SCALE:
set_message(vformat(TTR("Scaling: %s"), vformat("%.0v", Vector3())));
break;
default:
break;
}
update_transform_gizmo_view();
set_process_input(instant);
surface->queue_redraw();
}
}
@ -5831,8 +5844,7 @@ void Node3DEditorViewport::update_transform(bool p_shift) {
motion_snapped.snapf(snap);
// This might not be necessary anymore after issue #288 is solved (in 4.0?).
// TRANSLATORS: Refers to changing the scale of a node in the 3D editor.
set_message(TTR("Scaling:") + " (" + String::num(motion_snapped.x, snap_step_decimals) + ", " +
String::num(motion_snapped.y, snap_step_decimals) + ", " + String::num(motion_snapped.z, snap_step_decimals) + ")");
set_message(vformat(TTR("Scaling: %s"), vformat("%.*v", snap_step_decimals, motion_snapped)));
if (local_coords) {
// TODO: needed?
motion = _edit.original.basis.inverse().xform(motion);
@ -5899,8 +5911,7 @@ void Node3DEditorViewport::update_transform(bool p_shift) {
Vector3 motion_snapped = motion;
motion_snapped.snapf(snap);
// TRANSLATORS: Refers to changing the position of a node in the 3D editor.
set_message(TTR("Translating:") + " (" + String::num(motion_snapped.x, snap_step_decimals) + ", " +
String::num(motion_snapped.y, snap_step_decimals) + ", " + String::num(motion_snapped.z, snap_step_decimals) + ")");
set_message(vformat(TTR("Translating: %s"), vformat("%.*v", snap_step_decimals, motion_snapped)));
if (local_coords) {
motion = spatial_editor->get_gizmo_transform().basis.inverse().xform(motion);
}