diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_run_native.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/animation_library_editor.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 6 |
3 files changed, 20 insertions, 11 deletions
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index 49723aa169..0628dc7116 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -44,7 +44,8 @@ void EditorRunNative::_notification(int p_what) { bool changed = EditorExport::get_singleton()->poll_export_platforms() || first; if (changed) { - remote_debug->get_popup()->clear(); + PopupMenu *popup = remote_debug->get_popup(); + popup->clear(); for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) { Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i); if (eep.is_null()) { @@ -52,15 +53,22 @@ void EditorRunNative::_notification(int p_what) { } int dc = MIN(eep->get_options_count(), 9000); if (dc > 0) { - remote_debug->get_popup()->add_icon_item(eep->get_run_icon(), eep->get_name(), -1); - remote_debug->get_popup()->set_item_disabled(-1, true); + popup->add_icon_item(eep->get_run_icon(), eep->get_name(), -1); + popup->set_item_disabled(-1, true); for (int j = 0; j < dc; j++) { - remote_debug->get_popup()->add_icon_item(eep->get_option_icon(j), eep->get_option_label(j), 10000 * i + j); - remote_debug->get_popup()->set_item_tooltip(-1, eep->get_option_tooltip(j)); - remote_debug->get_popup()->set_item_indent(-1, 2); + popup->add_icon_item(eep->get_option_icon(j), eep->get_option_label(j), 10000 * i + j); + popup->set_item_tooltip(-1, eep->get_option_tooltip(j)); + popup->set_item_indent(-1, 2); } } } + if (popup->get_item_count() == 0) { + remote_debug->set_disabled(true); + remote_debug->set_tooltip_text(TTR("No Remote Debug export presets configured.")); + } else { + remote_debug->set_disabled(false); + remote_debug->set_tooltip_text(TTR("Remote Debug")); + } first = false; } @@ -149,6 +157,7 @@ EditorRunNative::EditorRunNative() { remote_debug->get_popup()->connect("id_pressed", callable_mp(this, &EditorRunNative::run_native)); remote_debug->set_icon(get_theme_icon(SNAME("PlayRemote"), SNAME("EditorIcons"))); remote_debug->set_tooltip_text(TTR("Remote Debug")); + remote_debug->set_disabled(true); add_child(remote_debug); diff --git a/editor/plugins/animation_library_editor.cpp b/editor/plugins/animation_library_editor.cpp index d66982f31b..bf7e419fe4 100644 --- a/editor/plugins/animation_library_editor.cpp +++ b/editor/plugins/animation_library_editor.cpp @@ -554,7 +554,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int file_popup->add_separator(); file_popup->add_item(TTR("Open in Inspector"), FILE_MENU_EDIT_LIBRARY); Rect2 pos = tree->get_item_rect(p_item, 1, 0); - Vector2 popup_pos = tree->get_screen_position() + pos.position + Vector2(0, pos.size.height); + Vector2 popup_pos = tree->get_screen_transform().xform(pos.position + Vector2(0, pos.size.height)); file_popup->popup(Rect2(popup_pos, Size2())); file_dialog_animation = StringName(); @@ -594,7 +594,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int file_popup->add_separator(); file_popup->add_item(TTR("Open in Inspector"), FILE_MENU_EDIT_ANIMATION); Rect2 pos = tree->get_item_rect(p_item, 1, 0); - Vector2 popup_pos = tree->get_screen_position() + pos.position + Vector2(0, pos.size.height); + Vector2 popup_pos = tree->get_screen_transform().xform(pos.position + Vector2(0, pos.size.height)); file_popup->popup(Rect2(popup_pos, Size2())); file_dialog_animation = anim_name; diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 9e2cb47c23..cfe7c9c344 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -1472,12 +1472,12 @@ void TileSetAtlasSourceEditor::_end_dragging() { // We have a tile. menu_option_coords = selected.tile; menu_option_alternative = 0; - base_tile_popup_menu->popup(Rect2i(get_global_mouse_position(), Size2i())); + base_tile_popup_menu->popup(Rect2i(get_screen_transform().xform(get_local_mouse_position()), Size2i())); } else if (hovered_base_tile_coords != TileSetSource::INVALID_ATLAS_COORDS) { // We don't have a tile, but can create one. menu_option_coords = hovered_base_tile_coords; menu_option_alternative = TileSetSource::INVALID_TILE_ALTERNATIVE; - empty_base_tile_popup_menu->popup(Rect2i(get_global_mouse_position(), Size2i())); + empty_base_tile_popup_menu->popup(Rect2i(get_screen_transform().xform(get_local_mouse_position()), Size2i())); } } break; case DRAG_TYPE_RESIZE_TOP_LEFT: @@ -1973,7 +1973,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In selected = selection.front()->get(); menu_option_coords = selected.tile; menu_option_alternative = selected.alternative; - alternative_tile_popup_menu->popup(Rect2i(get_global_mouse_position(), Size2i())); + alternative_tile_popup_menu->popup(Rect2i(get_screen_transform().xform(get_local_mouse_position()), Size2i())); } } |