diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_properties.cpp | 2 | ||||
-rw-r--r-- | editor/editor_run_native.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 25 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/shader_globals_editor.cpp | 4 |
5 files changed, 34 insertions, 4 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 4c8af615b4..9e68ef2f35 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -614,7 +614,7 @@ public: const Ref<InputEventMouseButton> mb = p_ev; - if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed() && hovered_index > 0) { // Toggle the flag. // We base our choice on the hovered flag, so that it always matches the hovered flag. if (value & (1 << hovered_index)) { diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index 422534a2e1..639da371bd 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -76,8 +76,10 @@ void EditorRunNative::_notification(int p_what) { } else { mb->get_popup()->clear(); mb->show(); - mb->set_tooltip(eep->get_options_tooltip()); - if (dc > 1) { + if (dc == 1) { + mb->set_tooltip(eep->get_option_tooltip(0)); + } else { + mb->set_tooltip(eep->get_options_tooltip()); for (int i = 0; i < dc; i++) { mb->get_popup()->add_icon_item(eep->get_option_icon(i), eep->get_option_label(i)); mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() - 1, eep->get_option_tooltip(i)); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 8cd8aaf277..9261113706 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -89,6 +89,25 @@ void TileMapEditor::_notification(int p_what) { case NOTIFICATION_EXIT_TREE: { get_tree()->disconnect("node_removed", callable_mp(this, &TileMapEditor::_node_removed)); } break; + + case NOTIFICATION_APPLICATION_FOCUS_OUT: { + if (tool == TOOL_PAINTING) { + Vector<int> ids = get_selected_tiles(); + + if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) { + _set_cell(over_tile, ids, flip_h, flip_v, transpose); + _finish_undo(); + + paint_undo.clear(); + } + + tool = TOOL_NONE; + _update_button_tool(); + } + + // set flag to ignore over_tile on refocus + refocus_over_tile = true; + } break; } } @@ -1299,6 +1318,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { CanvasItemEditor::get_singleton()->update_viewport(); } + if (refocus_over_tile) { + // editor lost focus; forget last tile position + old_over_tile = new_over_tile; + refocus_over_tile = false; + } + int tile_under = node->get_cell(over_tile.x, over_tile.y); String tile_name = "none"; diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 996e904853..f57616db1f 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -119,6 +119,7 @@ class TileMapEditor : public VBoxContainer { Rect2i rectangle; Point2i over_tile; + bool refocus_over_tile = false; bool *bucket_cache_visited; Rect2i bucket_cache_rect; diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp index aa88b0ef39..04fbac3463 100644 --- a/editor/shader_globals_editor.cpp +++ b/editor/shader_globals_editor.cpp @@ -437,6 +437,9 @@ void ShaderGlobalsEditor::_notification(int p_what) { inspector->edit(interface); } } + if (p_what == NOTIFICATION_PREDELETE) { + inspector->edit(nullptr); + } } ShaderGlobalsEditor::ShaderGlobalsEditor() { @@ -474,6 +477,5 @@ ShaderGlobalsEditor::ShaderGlobalsEditor() { } ShaderGlobalsEditor::~ShaderGlobalsEditor() { - inspector->edit(nullptr); memdelete(interface); } |