diff options
| author | Juan Linietsky | 2017-03-23 20:14:12 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-03-23 20:14:12 -0300 |
| commit | efaeebab4d83e5657288b7b20db6ce4ccf987a01 (patch) | |
| tree | 2c748755605fe2e1bc065519df35f57b49dbf7b4 /editor | |
| parent | c37fad650f92845a6f59740fea2fea1b46f56db1 (diff) | |
| download | godot-efaeebab4d83e5657288b7b20db6ce4ccf987a01.tar.gz godot-efaeebab4d83e5657288b7b20db6ce4ccf987a01.tar.zst godot-efaeebab4d83e5657288b7b20db6ce4ccf987a01.zip | |
Several fixes to Android exporter and port.
Android seems to be working again!
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/editor_export.cpp | 64 | ||||
| -rw-r--r-- | editor/editor_export.h | 5 | ||||
| -rw-r--r-- | editor/editor_run_native.cpp | 91 | ||||
| -rw-r--r-- | editor/editor_run_native.h | 4 |
4 files changed, 118 insertions, 46 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index e2a7011cc..d2976808f 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -601,6 +601,58 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co return OK; } +void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) { + + String host = EditorSettings::get_singleton()->get("network/debug_host"); + + if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) + host = "localhost"; + + if (p_flags & DEBUG_FLAG_DUMB_CLIENT) { + int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); + String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); + r_flags.push_back("-rfs"); + r_flags.push_back(host + ":" + itos(port)); + if (passwd != "") { + r_flags.push_back("-rfs_pass"); + r_flags.push_back(passwd); + } + } + + if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) { + + r_flags.push_back("-rdebug"); + + r_flags.push_back(host + ":" + String::num(GLOBAL_DEF("network/debug/remote_port", 6007))); + + List<String> breakpoints; + ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); + + if (breakpoints.size()) { + + r_flags.push_back("-bp"); + String bpoints; + for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) { + + bpoints += E->get().replace(" ", "%20"); + if (E->next()) + bpoints += ","; + } + + r_flags.push_back(bpoints); + } + } + + if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) { + + r_flags.push_back("-debugcol"); + } + + if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) { + + r_flags.push_back("-debugnav"); + } +} EditorExportPlatform::EditorExportPlatform() { } @@ -804,6 +856,18 @@ void EditorExport::load_config() { block_save = false; } +bool EditorExport::poll_export_platforms() { + + bool changed = false; + for (int i = 0; i < export_platforms.size(); i++) { + if (export_platforms[i]->poll_devices()) { + changed = true; + } + } + + return changed; +} + EditorExport::EditorExport() { save_timer = memnew(Timer); diff --git a/editor/editor_export.h b/editor/editor_export.h index fcd671e03..1c9f5b335 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -153,6 +153,7 @@ private: protected: virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) = 0; String find_export_template(String template_file_name) const; + void gen_export_flags(Vector<String> &r_flags, int p_flags); public: struct ExportOption { @@ -190,7 +191,7 @@ public: DEBUG_FLAG_VIEW_NAVIGATION = 16, }; - virtual Error run(int p_device, int p_debug_flags) { return OK; } + virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { return OK; } virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0; @@ -234,6 +235,8 @@ public: void load_config(); + bool poll_export_platforms(); + EditorExport(); ~EditorExport(); }; diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index 5e2759830..fa835ef76 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -29,18 +29,15 @@ #include "editor_run_native.h" #include "editor_export.h" +#include "editor_node.h" void EditorRunNative::_notification(int p_what) { -#if 0 - if (p_what==NOTIFICATION_ENTER_TREE) { + if (p_what == NOTIFICATION_ENTER_TREE) { - List<StringName> ep; - EditorImportExport::get_singleton()->get_export_platforms(&ep); - ep.sort_custom<StringName::AlphCompare>(); - for(List<StringName>::Element *E=ep.front();E;E=E->next()) { + for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) { - Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(E->get()); + Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i); if (eep.is_null()) continue; Ref<ImageTexture> icon = eep->get_logo(); @@ -49,85 +46,93 @@ void EditorRunNative::_notification(int p_what) { im.clear_mipmaps(); if (!im.empty()) { - im.resize(16,16); - - Ref<ImageTexture> small_icon = memnew( ImageTexture); - small_icon->create_from_image(im); - MenuButton *mb = memnew( MenuButton ); - mb->get_popup()->connect("id_pressed",this,"_run_native",varray(E->get())); - mb->connect("pressed",this,"_run_native",varray(-1, E->get())); + im.resize(16, 16); + Ref<ImageTexture> small_icon; + small_icon.instance(); + 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->set_icon(small_icon); add_child(mb); - menus[E->get()]=mb; + menus[i] = mb; } } } } - if (p_what==NOTIFICATION_PROCESS) { - + if (p_what == NOTIFICATION_PROCESS) { - bool changed = EditorImportExport::get_singleton()->poll_export_platforms() || first; + bool changed = EditorExport::get_singleton()->poll_export_platforms() || first; if (changed) { - for(Map<StringName,MenuButton*>::Element *E=menus.front();E;E=E->next()) { + for (Map<int, MenuButton *>::Element *E = menus.front(); E; E = E->next()) { - Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(E->key()); + Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(E->key()); MenuButton *mb = E->get(); int dc = eep->get_device_count(); - if (dc==0) { + if (dc == 0) { mb->hide(); } else { mb->get_popup()->clear(); mb->show(); - 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()); - } + 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()); } } } - first=false; + first = false; } } -#endif } -void EditorRunNative::_run_native(int p_idx, const String &p_platform) { +void EditorRunNative::_run_native(int p_idx, int p_platform) { -#if 0 - Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform); + 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; + + for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) { + + Ref<EditorExportPreset> ep = EditorExport::get_singleton()->get_export_preset(i); + if (ep->is_runnable() && ep->get_platform() == eep) { + preset = ep; + break; + } + } + + if (preset.is_null()) { + EditorNode::get_singleton()->show_warning("No runnable export preset found for this platform.\nPlease add a runnable preset in the export menu."); + return; } + emit_signal("native_run"); - int flags=0; + int flags = 0; if (deploy_debug_remote) - flags|=EditorExportPlatform::EXPORT_REMOTE_DEBUG; + flags |= EditorExportPlatform::DEBUG_FLAG_REMOTE_DEBUG; if (deploy_dumb) - flags|=EditorExportPlatform::EXPORT_DUMB_CLIENT; + flags |= EditorExportPlatform::DEBUG_FLAG_DUMB_CLIENT; if (debug_collisions) - flags|=EditorExportPlatform::EXPORT_VIEW_COLLISONS; + flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_COLLISONS; if (debug_navigation) - flags|=EditorExportPlatform::EXPORT_VIEW_NAVIGATION; - - eep->run(p_idx,flags); + flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_NAVIGATION; -#endif + eep->run(preset, p_idx, flags); } void EditorRunNative::_bind_methods() { diff --git a/editor/editor_run_native.h b/editor/editor_run_native.h index 92eaa8516..63c3f0271 100644 --- a/editor/editor_run_native.h +++ b/editor/editor_run_native.h @@ -36,14 +36,14 @@ class EditorRunNative : public HBoxContainer { GDCLASS(EditorRunNative, BoxContainer); - Map<StringName, MenuButton *> menus; + Map<int, MenuButton *> menus; bool first; bool deploy_dumb; bool deploy_debug_remote; bool debug_collisions; bool debug_navigation; - void _run_native(int p_idx, const String &p_platform); + void _run_native(int p_idx, int p_platform); protected: static void _bind_methods(); |
