Merge pull request #96530 from ev13bird/issue-96527

Fix instant transformations not being committed when used in succession
This commit is contained in:
Rémi Verschelde 2024-09-05 17:44:15 +02:00
commit f5aac22b10
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 23 additions and 8 deletions

View File

@ -1975,7 +1975,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
} }
} }
if (_edit.mode != TRANSFORM_NONE) { if (!_edit.instant && _edit.mode != TRANSFORM_NONE) {
Node3D *selected = spatial_editor->get_single_selected_node(); Node3D *selected = spatial_editor->get_single_selected_node();
Node3DEditorSelectedItem *se = selected ? editor_selection->get_node_editor_data<Node3DEditorSelectedItem>(selected) : nullptr; Node3DEditorSelectedItem *se = selected ? editor_selection->get_node_editor_data<Node3DEditorSelectedItem>(selected) : nullptr;
@ -2399,15 +2399,30 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (ED_IS_SHORTCUT("spatial_editor/cancel_transform", p_event) && _edit.mode != TRANSFORM_NONE) { if (ED_IS_SHORTCUT("spatial_editor/cancel_transform", p_event) && _edit.mode != TRANSFORM_NONE) {
cancel_transform(); cancel_transform();
} }
if (!is_freelook_active()) { if (!is_freelook_active() && !k->is_echo()) {
if (ED_IS_SHORTCUT("spatial_editor/instant_translate", p_event)) { if (ED_IS_SHORTCUT("spatial_editor/instant_translate", p_event) && _edit.mode != TRANSFORM_TRANSLATE) {
begin_transform(TRANSFORM_TRANSLATE, true); if (_edit.mode == TRANSFORM_NONE) {
begin_transform(TRANSFORM_TRANSLATE, true);
} else if (_edit.instant) {
commit_transform();
begin_transform(TRANSFORM_TRANSLATE, true);
}
} }
if (ED_IS_SHORTCUT("spatial_editor/instant_rotate", p_event)) { if (ED_IS_SHORTCUT("spatial_editor/instant_rotate", p_event) && _edit.mode != TRANSFORM_ROTATE) {
begin_transform(TRANSFORM_ROTATE, true); if (_edit.mode == TRANSFORM_NONE) {
begin_transform(TRANSFORM_ROTATE, true);
} else if (_edit.instant) {
commit_transform();
begin_transform(TRANSFORM_ROTATE, true);
}
} }
if (ED_IS_SHORTCUT("spatial_editor/instant_scale", p_event)) { if (ED_IS_SHORTCUT("spatial_editor/instant_scale", p_event) && _edit.mode != TRANSFORM_SCALE) {
begin_transform(TRANSFORM_SCALE, true); if (_edit.mode == TRANSFORM_NONE) {
begin_transform(TRANSFORM_SCALE, true);
} else if (_edit.instant) {
commit_transform();
begin_transform(TRANSFORM_SCALE, true);
}
} }
} }