summaryrefslogtreecommitdiff
path: root/editor/editor_run_native.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_run_native.cpp')
-rw-r--r--editor/editor_run_native.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index 06cadca1c0..585ea0ec69 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -56,7 +56,7 @@ void EditorRunNative::_notification(int p_what) {
small_icon->create_from_image(im, 0);
MenuButton *mb = memnew(MenuButton);
mb->get_popup()->connect("id_pressed", this, "_run_native", varray(i));
- //mb->connect("pressed", this, "_run_native", varray(-1, i));
+ mb->connect("pressed", this, "_run_native", varray(-1, i));
mb->set_icon(small_icon);
add_child(mb);
menus[i] = mb;
@@ -82,10 +82,14 @@ void EditorRunNative::_notification(int p_what) {
} else {
mb->get_popup()->clear();
mb->show();
- mb->set_tooltip(TTR("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());
+ 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());
+ }
}
}
}
@@ -97,16 +101,23 @@ void EditorRunNative::_notification(int p_what) {
void EditorRunNative::_run_native(int p_idx, int p_platform) {
+ if (!EditorNode::get_singleton()->ensure_main_scene(true)) {
+ resume_idx = p_idx;
+ resume_platform = p_platform;
+ return;
+ }
+
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(p_platform);
ERR_FAIL_COND(eep.is_null());
- /*if (p_idx == -1) {
+
+ if (p_idx == -1) {
if (eep->get_device_count() == 1) {
menus[p_platform]->get_popup()->hide();
p_idx = 0;
} else {
return;
}
- }*/
+ }
Ref<EditorExportPreset> preset;
@@ -139,6 +150,10 @@ void EditorRunNative::_run_native(int p_idx, int p_platform) {
eep->run(preset, p_idx, flags);
}
+void EditorRunNative::resume_run_native() {
+ _run_native(resume_idx, resume_platform);
+}
+
void EditorRunNative::_bind_methods() {
ClassDB::bind_method("_run_native", &EditorRunNative::_run_native);
@@ -193,4 +208,6 @@ EditorRunNative::EditorRunNative() {
deploy_debug_remote = false;
debug_collisions = false;
debug_navigation = false;
+ resume_idx = 0;
+ resume_platform = 0;
}