diff options
| author | Pawel Kowal | 2016-11-08 20:08:07 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2016-11-15 08:35:01 +0100 |
| commit | f1c2d70f1a6edd77c575b4817b73823fdb79384f (patch) | |
| tree | 645f14f3cbccfb6f95930902cf375272e218cb3f | |
| parent | 3e127ce3fdd181bdd85a112bc22f45aa3ad571f5 (diff) | |
| download | godot-f1c2d70f1a6edd77c575b4817b73823fdb79384f.tar.gz godot-f1c2d70f1a6edd77c575b4817b73823fdb79384f.tar.zst godot-f1c2d70f1a6edd77c575b4817b73823fdb79384f.zip | |
| -rw-r--r-- | tools/editor/editor_run_native.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/editor/editor_run_native.cpp b/tools/editor/editor_run_native.cpp index edbcc7128..330103923 100644 --- a/tools/editor/editor_run_native.cpp +++ b/tools/editor/editor_run_native.cpp @@ -55,6 +55,7 @@ void EditorRunNative::_notification(int p_what) { small_icon->create_from_image(im); MenuButton *mb = memnew( MenuButton ); mb->get_popup()->connect("item_pressed",this,"_run_native",varray(E->get())); + mb->connect("pressed",this,"_run_native",varray(-1, E->get())); mb->set_icon(small_icon); add_child(mb); menus[E->get()]=mb; @@ -79,13 +80,16 @@ void EditorRunNative::_notification(int p_what) { if (dc==0) { mb->hide(); } else { - mb->get_popup()->clear(); mb->show(); - for(int i=0;i<dc;i++) { - - mb->get_popup()->add_icon_item(get_icon("Play","EditorIcons"),eep->get_device_name(i)); - mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() -1,eep->get_device_info(i)); + if (dc == 1) { + mb->set_tooltip(eep->get_device_name(0) + "\n\n" + eep->get_device_info(0).strip_edges()); + } else { + mb->set_tooltip("Select device from the list"); + for(int i=0;i<dc;i++) { + mb->get_popup()->add_icon_item(get_icon("Play","EditorIcons"),eep->get_device_name(i)); + mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() -1,eep->get_device_info(i).strip_edges()); + } } } } @@ -96,11 +100,18 @@ void EditorRunNative::_notification(int p_what) { } - void EditorRunNative::_run_native(int p_idx,const String& p_platform) { Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform); ERR_FAIL_COND(eep.is_null()); + if (p_idx == -1) { + if (eep->get_device_count() == 1) { + menus[p_platform]->get_popup()->hide(); + p_idx = 0; + } else { + return; + } + } emit_signal("native_run"); int flags=0; |
