|
|
@@ -1291,6 +1291,8 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|
|
|
|
|
Vector3 ray_pos = _get_ray_pos(m->get_position());
|
|
|
Vector3 ray = _get_ray(m->get_position());
|
|
|
+ float snap = EDITOR_GET("interface/inspector/default_float_step");
|
|
|
+ int snap_step_decimals = Math::range_step_decimals(snap);
|
|
|
|
|
|
switch (_edit.mode) {
|
|
|
|
|
|
@@ -1372,18 +1374,14 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|
|
// Disable local transformation for TRANSFORM_VIEW
|
|
|
bool local_coords = (spatial_editor->are_local_coords_enabled() && _edit.plane != TRANSFORM_VIEW);
|
|
|
|
|
|
- float snap = 0;
|
|
|
if (_edit.snap || spatial_editor->is_snap_enabled()) {
|
|
|
-
|
|
|
snap = spatial_editor->get_scale_snap() / 100;
|
|
|
-
|
|
|
- Vector3 motion_snapped = motion;
|
|
|
- motion_snapped.snap(Vector3(snap, snap, snap));
|
|
|
- set_message(TTR("Scaling: ") + motion_snapped);
|
|
|
-
|
|
|
- } else {
|
|
|
- set_message(TTR("Scaling: ") + motion);
|
|
|
}
|
|
|
+ Vector3 motion_snapped = motion;
|
|
|
+ motion_snapped.snap(Vector3(snap, snap, snap));
|
|
|
+ // This might not be necessary anymore after issue #288 is solved (in 4.0?).
|
|
|
+ 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) + ")");
|
|
|
|
|
|
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
|
|
|
|
|
@@ -1502,17 +1500,13 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|
|
// Disable local transformation for TRANSFORM_VIEW
|
|
|
bool local_coords = (spatial_editor->are_local_coords_enabled() && _edit.plane != TRANSFORM_VIEW);
|
|
|
|
|
|
- float snap = 0;
|
|
|
if (_edit.snap || spatial_editor->is_snap_enabled()) {
|
|
|
-
|
|
|
snap = spatial_editor->get_translate_snap();
|
|
|
-
|
|
|
- Vector3 motion_snapped = motion;
|
|
|
- motion_snapped.snap(Vector3(snap, snap, snap));
|
|
|
- set_message(TTR("Translating: ") + motion_snapped);
|
|
|
- } else {
|
|
|
- set_message(TTR("Translating: ") + motion);
|
|
|
}
|
|
|
+ Vector3 motion_snapped = motion;
|
|
|
+ motion_snapped.snap(Vector3(snap, snap, snap));
|
|
|
+ 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) + ")");
|
|
|
|
|
|
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
|
|
|
|
|
@@ -1601,20 +1595,12 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|
|
float angle = Math::atan2(x_axis.dot(intersection - _edit.center), y_axis.dot(intersection - _edit.center));
|
|
|
|
|
|
if (_edit.snap || spatial_editor->is_snap_enabled()) {
|
|
|
-
|
|
|
- float snap = spatial_editor->get_rotate_snap();
|
|
|
-
|
|
|
- if (snap) {
|
|
|
- angle = Math::rad2deg(angle) + snap * 0.5; //else it won't reach +180
|
|
|
- angle -= Math::fmod(angle, snap);
|
|
|
- set_message(vformat(TTR("Rotating %s degrees."), rtos(angle)));
|
|
|
- angle = Math::deg2rad(angle);
|
|
|
- } else
|
|
|
- set_message(vformat(TTR("Rotating %s degrees."), rtos(Math::rad2deg(angle))));
|
|
|
-
|
|
|
- } else {
|
|
|
- set_message(vformat(TTR("Rotating %s degrees."), rtos(Math::rad2deg(angle))));
|
|
|
+ snap = spatial_editor->get_rotate_snap();
|
|
|
}
|
|
|
+ angle = Math::rad2deg(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);
|
|
|
|
|
|
List<Node *> &selection = editor_selection->get_selected_node_list();
|
|
|
|