Skip to content

Commit 270b14d

Browse files
committed
Fix dock opening focus
1 parent 7ed0b61 commit 270b14d

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

doc/classes/EditorDock.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<return type="void" />
7878
<description>
7979
Opens the dock. It will appear in the last used dock slot. If the dock has no default slot, it will be opened floating.
80+
[b]Note:[/b] This does not focus the dock. If you want to open and focus the dock, use [method make_visible].
8081
</description>
8182
</method>
8283
</methods>

editor/docks/editor_dock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ EditorDock::EditorDock() {
105105

106106
void EditorDock::open() {
107107
if (!is_open) {
108-
EditorDockManager::get_singleton()->open_dock(this);
108+
EditorDockManager::get_singleton()->open_dock(this, false);
109109
}
110110
}
111111

editor/gui/editor_bottom_panel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void EditorBottomPanel::remove_item(Control *p_item) {
242242

243243
void EditorBottomPanel::_on_button_visibility_changed(Button *p_button, EditorDock *p_dock) {
244244
if (p_button->is_visible()) {
245-
p_dock->open();
245+
p_dock->make_visible();
246246
} else {
247247
p_dock->close();
248248
}

editor/scene/2d/tiles/tiles_editor_plugin.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ void TileMapEditorPlugin::_update_tile_map() {
374374
Ref<TileSet> tile_set = edited_layer->get_tile_set();
375375
if (tile_set.is_valid() && tile_set_id != tile_set->get_instance_id()) {
376376
tile_set_plugin_singleton->edit(tile_set.ptr());
377-
tile_set_plugin_singleton->make_visible(true);
377+
tile_set_plugin_singleton->make_visible_no_focus();
378378
tile_set_id = tile_set->get_instance_id();
379379
} else if (tile_set.is_null()) {
380380
tile_set_plugin_singleton->edit(nullptr);
@@ -411,7 +411,7 @@ void TileMapEditorPlugin::_edit_tile_map_layer(TileMapLayer *p_tile_map_layer, b
411411
Ref<TileSet> tile_set = p_tile_map_layer->get_tile_set();
412412
if (tile_set.is_valid()) {
413413
tile_set_plugin_singleton->edit(tile_set.ptr());
414-
tile_set_plugin_singleton->make_visible(true);
414+
tile_set_plugin_singleton->make_visible_no_focus();
415415
tile_set_id = tile_set->get_instance_id();
416416
} else {
417417
tile_set_plugin_singleton->edit(nullptr);
@@ -480,7 +480,7 @@ bool TileMapEditorPlugin::handles(Object *p_object) const {
480480

481481
void TileMapEditorPlugin::make_visible(bool p_visible) {
482482
if (p_visible) {
483-
editor->open();
483+
editor->make_visible();
484484
} else {
485485
editor->close();
486486
}
@@ -533,12 +533,16 @@ bool TileSetEditorPlugin::handles(Object *p_object) const {
533533

534534
void TileSetEditorPlugin::make_visible(bool p_visible) {
535535
if (p_visible) {
536-
editor->open();
536+
editor->make_visible();
537537
} else {
538538
editor->close();
539539
}
540540
}
541541

542+
void TileSetEditorPlugin::make_visible_no_focus() {
543+
editor->open();
544+
}
545+
542546
ObjectID TileSetEditorPlugin::get_edited_tileset() const {
543547
return edited_tileset;
544548
}

editor/scene/2d/tiles/tiles_editor_plugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class TileSetEditorPlugin : public EditorPlugin {
165165
virtual bool handles(Object *p_object) const override;
166166
virtual void make_visible(bool p_visible) override;
167167

168+
void make_visible_no_focus();
168169
ObjectID get_edited_tileset() const;
169170

170171
TileSetEditorPlugin();

0 commit comments

Comments
 (0)