mirror of https://github.com/godotengine/godot
Merge 5fd5744b38 into 15ff450680
This commit is contained in:
commit
a7a183294a
|
|
@ -199,7 +199,6 @@ void EditorSettingsDialog::popup_edit_settings() {
|
|||
inspector->get_inspector()->update_tree();
|
||||
|
||||
_update_shortcuts();
|
||||
set_process_shortcut_input(true);
|
||||
|
||||
// Restore valid window bounds or pop up at default size.
|
||||
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "editor_settings", Rect2());
|
||||
|
|
@ -231,7 +230,6 @@ void EditorSettingsDialog::_notification(int p_what) {
|
|||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (!is_visible()) {
|
||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", Rect2(get_position(), get_size()));
|
||||
set_process_shortcut_input(false);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
@ -272,21 +270,16 @@ void EditorSettingsDialog::_notification(int p_what) {
|
|||
}
|
||||
|
||||
void EditorSettingsDialog::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
EditorAcceptDialog::shortcut_input(p_event);
|
||||
if (is_input_handled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 (k->is_match(InputEventKey::create_reference(KeyModifierMask::CMD_OR_CTRL | Key::F))) {
|
||||
if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
|
||||
_focus_current_search_box();
|
||||
handled = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef EDITOR_SETTINGS_DIALOG_H
|
||||
#define EDITOR_SETTINGS_DIALOG_H
|
||||
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "editor/gui/editor_accept_dialog.h"
|
||||
|
||||
class CheckButton;
|
||||
class EventListenerLineEdit;
|
||||
|
|
@ -43,8 +43,8 @@ class TextureRect;
|
|||
class Tree;
|
||||
class TreeItem;
|
||||
|
||||
class EditorSettingsDialog : public AcceptDialog {
|
||||
GDCLASS(EditorSettingsDialog, AcceptDialog);
|
||||
class EditorSettingsDialog : public EditorAcceptDialog {
|
||||
GDCLASS(EditorSettingsDialog, EditorAcceptDialog);
|
||||
|
||||
bool updating = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
/**************************************************************************/
|
||||
/* editor_accept_dialog.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "editor_accept_dialog.h"
|
||||
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
|
||||
void EditorAcceptDialog::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorAcceptDialog::EditorAcceptDialog() {
|
||||
set_process_shortcut_input(true);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/**************************************************************************/
|
||||
/* editor_accept_dialog.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef EDITOR_ACCEPT_DIALOG_H
|
||||
#define EDITOR_ACCEPT_DIALOG_H
|
||||
|
||||
#include "scene/gui/dialogs.h"
|
||||
|
||||
class EditorAcceptDialog : public AcceptDialog {
|
||||
GDCLASS(EditorAcceptDialog, AcceptDialog);
|
||||
|
||||
protected:
|
||||
virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
|
||||
|
||||
public:
|
||||
EditorAcceptDialog();
|
||||
};
|
||||
|
||||
#endif // EDITOR_ACCEPT_DIALOG_H
|
||||
|
|
@ -983,27 +983,6 @@ void AnimationLibraryEditor::_update_editor(Object *p_mixer) {
|
|||
emit_signal("update_editor", p_mixer);
|
||||
}
|
||||
|
||||
void AnimationLibraryEditor::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationLibraryEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_update_editor", "mixer"), &AnimationLibraryEditor::_update_editor);
|
||||
ADD_SIGNAL(MethodInfo("update_editor"));
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
|
||||
#include "core/io/config_file.h"
|
||||
#include "core/templates/vector.h"
|
||||
#include "editor/gui/editor_accept_dialog.h"
|
||||
#include "editor/plugins/editor_plugin.h"
|
||||
#include "scene/animation/animation_mixer.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class AnimationMixer;
|
||||
class EditorFileDialog;
|
||||
|
||||
class AnimationLibraryEditor : public AcceptDialog {
|
||||
GDCLASS(AnimationLibraryEditor, AcceptDialog)
|
||||
class AnimationLibraryEditor : public EditorAcceptDialog {
|
||||
GDCLASS(AnimationLibraryEditor, EditorAcceptDialog)
|
||||
|
||||
enum {
|
||||
LIB_BUTTON_ADD,
|
||||
|
|
@ -119,7 +119,6 @@ class AnimationLibraryEditor : public AcceptDialog {
|
|||
protected:
|
||||
void _notification(int p_what);
|
||||
void _update_editor(Object *p_mixer);
|
||||
virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "editor/gui/editor_bottom_panel.h"
|
||||
#include "editor/gui/editor_file_dialog.h"
|
||||
#include "editor/inspector_dock.h"
|
||||
#include "editor/plugins/theme_editor_preview.h"
|
||||
#include "editor/progress_dialog.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "scene/gui/check_button.h"
|
||||
|
|
@ -54,7 +55,9 @@
|
|||
#include "scene/gui/tab_bar.h"
|
||||
#include "scene/gui/tab_container.h"
|
||||
#include "scene/gui/texture_rect.h"
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "scene/resources/theme.h"
|
||||
#include "scene/theme/theme_db.h"
|
||||
|
||||
void ThemeItemImportTree::_update_items_tree() {
|
||||
|
|
|
|||
|
|
@ -31,12 +31,10 @@
|
|||
#ifndef THEME_EDITOR_PLUGIN_H
|
||||
#define THEME_EDITOR_PLUGIN_H
|
||||
|
||||
#include "editor/gui/editor_accept_dialog.h"
|
||||
#include "editor/plugins/editor_plugin.h"
|
||||
#include "editor/plugins/theme_editor_preview.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/margin_container.h"
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/resources/theme.h"
|
||||
|
||||
class Button;
|
||||
class CheckButton;
|
||||
|
|
@ -47,8 +45,12 @@ class OptionButton;
|
|||
class PanelContainer;
|
||||
class TabBar;
|
||||
class TabContainer;
|
||||
class ThemeEditorPlugin;
|
||||
class TextureRect;
|
||||
class Theme;
|
||||
class ThemeEditorPlugin;
|
||||
class ThemeEditorPreview;
|
||||
class Tree;
|
||||
class TreeItem;
|
||||
|
||||
class ThemeItemImportTree : public VBoxContainer {
|
||||
GDCLASS(ThemeItemImportTree, VBoxContainer);
|
||||
|
|
@ -187,8 +189,8 @@ public:
|
|||
|
||||
class ThemeTypeEditor;
|
||||
|
||||
class ThemeItemEditorDialog : public AcceptDialog {
|
||||
GDCLASS(ThemeItemEditorDialog, AcceptDialog);
|
||||
class ThemeItemEditorDialog : public EditorAcceptDialog {
|
||||
GDCLASS(ThemeItemEditorDialog, EditorAcceptDialog);
|
||||
|
||||
ThemeTypeEditor *theme_type_editor = nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ void ProjectSettingsEditor::popup_project_settings(bool p_clear_filter) {
|
|||
|
||||
_add_feature_overrides();
|
||||
general_settings_inspector->update_category_list();
|
||||
set_process_shortcut_input(true);
|
||||
|
||||
localization_editor->update_translations();
|
||||
autoload_settings->update_autoload();
|
||||
|
|
@ -236,20 +235,15 @@ void ProjectSettingsEditor::_select_type(Variant::Type p_type) {
|
|||
}
|
||||
|
||||
void ProjectSettingsEditor::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
EditorAcceptDialog::shortcut_input(p_event);
|
||||
if (is_input_handled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 (ED_IS_SHORTCUT("editor/open_search", p_event)) {
|
||||
_focus_current_search_box();
|
||||
handled = true;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include "editor/editor_data.h"
|
||||
#include "editor/editor_sectioned_inspector.h"
|
||||
#include "editor/group_settings_editor.h"
|
||||
#include "editor/gui/editor_accept_dialog.h"
|
||||
#include "editor/import_defaults_editor.h"
|
||||
#include "editor/localization_editor.h"
|
||||
#include "editor/plugins/editor_plugin_settings.h"
|
||||
|
|
@ -47,8 +48,8 @@
|
|||
|
||||
class FileSystemDock;
|
||||
|
||||
class ProjectSettingsEditor : public AcceptDialog {
|
||||
GDCLASS(ProjectSettingsEditor, AcceptDialog);
|
||||
class ProjectSettingsEditor : public EditorAcceptDialog {
|
||||
GDCLASS(ProjectSettingsEditor, EditorAcceptDialog);
|
||||
|
||||
static ProjectSettingsEditor *singleton;
|
||||
ProjectSettings *ps = nullptr;
|
||||
|
|
|
|||
Loading…
Reference in New Issue