Don't block input after cancelling transform.
After starting an instant transform and cancelling it, the mouse was blocked because cancel_transform did not set _edit.instant back to false. This refactors all the cleanup into a separate function that both cancel_transform and commit_transform can call. Fixes #57868.
This commit is contained in:
parent
f21a62b620
commit
628219c922
@ -385,8 +385,6 @@ int Node3DEditorViewport::get_selected_count() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Node3DEditorViewport::cancel_transform() {
|
void Node3DEditorViewport::cancel_transform() {
|
||||||
_edit.mode = TRANSFORM_NONE;
|
|
||||||
|
|
||||||
List<Node *> &selection = editor_selection->get_selected_node_list();
|
List<Node *> &selection = editor_selection->get_selected_node_list();
|
||||||
|
|
||||||
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
||||||
@ -402,7 +400,8 @@ void Node3DEditorViewport::cancel_transform() {
|
|||||||
|
|
||||||
sp->set_global_transform(se->original);
|
sp->set_global_transform(se->original);
|
||||||
}
|
}
|
||||||
surface->update();
|
|
||||||
|
finish_transform();
|
||||||
set_message(TTR("Transform Aborted."), 3);
|
set_message(TTR("Transform Aborted."), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4063,12 +4062,9 @@ void Node3DEditorViewport::commit_transform() {
|
|||||||
undo_redo->add_undo_method(sp, "set_global_transform", se->original);
|
undo_redo->add_undo_method(sp, "set_global_transform", se->original);
|
||||||
}
|
}
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
_edit.mode = TRANSFORM_NONE;
|
|
||||||
_edit.instant = false;
|
finish_transform();
|
||||||
spatial_editor->set_local_coords_enabled(_edit.original_local);
|
|
||||||
set_message("");
|
set_message("");
|
||||||
spatial_editor->update_transform_gizmo();
|
|
||||||
surface->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
|
void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
|
||||||
@ -4407,6 +4403,14 @@ void Node3DEditorViewport::update_transform(Point2 p_mousepos, bool p_shift) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node3DEditorViewport::finish_transform() {
|
||||||
|
spatial_editor->set_local_coords_enabled(_edit.original_local);
|
||||||
|
spatial_editor->update_transform_gizmo();
|
||||||
|
_edit.mode = TRANSFORM_NONE;
|
||||||
|
_edit.instant = false;
|
||||||
|
surface->update();
|
||||||
|
}
|
||||||
|
|
||||||
Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, EditorNode *p_editor, int p_index) {
|
Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, EditorNode *p_editor, int p_index) {
|
||||||
cpu_time_history_index = 0;
|
cpu_time_history_index = 0;
|
||||||
gpu_time_history_index = 0;
|
gpu_time_history_index = 0;
|
||||||
|
@ -409,6 +409,7 @@ private:
|
|||||||
void begin_transform(TransformMode p_mode, bool instant);
|
void begin_transform(TransformMode p_mode, bool instant);
|
||||||
void commit_transform();
|
void commit_transform();
|
||||||
void update_transform(Point2 p_mousepos, bool p_shift);
|
void update_transform(Point2 p_mousepos, bool p_shift);
|
||||||
|
void finish_transform();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
Loading…
Reference in New Issue
Block a user