Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undoredo handling in some dialogs #93898

Merged
merged 1 commit into from
Jul 4, 2024
Merged

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Jul 3, 2024

Looks like dialogs are blocking input from passing to the editor, so undo/redo shortcut has to be handled manually when relevant. I improved handling in some dialogs and fixed animation dialog, but there might be more dialogs that need fixing.

Fixes godotengine/godot-proposals#10062

7Z38LZN1ha.mp4

Fixes #88412

@JekSun97
Copy link
Contributor

JekSun97 commented Jul 4, 2024

@KoBeWi Also fixes #88412 ?

@akien-mga
Copy link
Member

@KoBeWi Also fixes #88412 ?

Judging by the code, I don't think so, but this would be another case of a dialog that needs to be handled like done here for the AnimationLibrary editor.

@KoBeWi KoBeWi requested a review from a team as a code owner July 4, 2024 09:51
@KoBeWi
Copy link
Member Author

KoBeWi commented Jul 4, 2024

Added fix for UV edit.

Comment on lines 55 to 78
class UVEditDialog : public AcceptDialog {
GDCLASS(UVEditDialog, AcceptDialog);

void UVEditDialog::shortcut_input(const Ref<InputEvent> &p_event) override {
const Ref<InputEventKey> k = p_event;
if (k.is_valid() && k->is_pressed()) {
bool handled = false;

if (ED_IS_SHORTCUT("ui_undo", p_event)) {
EditorNode::get_singleton()->undo();
handled = true;
}

if (ED_IS_SHORTCUT("ui_redo", p_event)) {
EditorNode::get_singleton()->redo();
handled = true;
}

if (handled) {
set_input_as_handled();
}
}
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make this an editor class like AcceptDialogWithUndoRedo in editor/gui/?

For now doing it ad hoc is fine but if we find more similar occurrences we might want to consider using this in place of AcceptDialog for editor dialogs which need UndoRedo.

@KoBeWi KoBeWi force-pushed the rundo_edo branch 2 times, most recently from 30c7cfd to 67bbd4d Compare July 4, 2024 12:08
@akien-mga akien-mga merged commit f986a80 into godotengine:master Jul 4, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Undo / Redo support to Animation Library Editing Undo/Redo does not work in the UV editor
3 participants