MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / start_run_native

Method start_run_native

editor/run/editor_run_native.cpp:109–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109Error EditorRunNative::start_run_native(int p_id) {
110 if (p_id < 0) {
111 return OK;
112 }
113
114 int platform = p_id / 10000;
115 int idx = p_id % 10000;
116 resume_id = p_id;
117
118 if (!EditorNode::get_singleton()->ensure_main_scene(true)) {
119 return OK;
120 }
121
122 Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(platform);
123 ERR_FAIL_COND_V(eep.is_null(), ERR_UNAVAILABLE);
124
125 Ref<EditorExportPreset> preset;
126
127 for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
128 Ref<EditorExportPreset> ep = EditorExport::get_singleton()->get_export_preset(i);
129 if (ep->is_runnable() && ep->get_platform() == eep) {
130 preset = ep;
131 break;
132 }
133 }
134
135 if (preset.is_null()) {
136 EditorNode::get_singleton()->show_warning(TTR("No runnable export preset found for this platform.\nPlease add a runnable preset in the Export menu or define an existing preset as runnable."));
137 return ERR_UNAVAILABLE;
138 }
139
140 String architecture = eep->get_device_architecture(idx);
141 if (!run_confirmed && !architecture.is_empty()) {
142 String preset_arch = "architectures/" + architecture;
143 bool is_arch_enabled = preset->get(preset_arch);
144
145 if (!is_arch_enabled) {
146 run_native_confirm->set_text(vformat(TTR("Warning: The CPU architecture \"%s\" is not active in your export preset.\n\nRun \"Remote Deploy\" anyway?"), architecture));
147 run_native_confirm->popup_centered();
148 return OK;
149 }
150 }
151 run_confirmed = false;
152
153 preset->update_value_overrides();
154
155 emit_signal(SNAME("native_run"), preset);
156
157 BitField<EditorExportPlatform::DebugFlags> flags = 0;
158
159 bool deploy_debug_remote = is_deploy_debug_remote_enabled();
160 bool deploy_dumb = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_file_server", false);
161 bool debug_collisions = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisions", false);
162 bool debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
163
164 if (deploy_debug_remote) {
165 flags.set_flag(EditorExportPlatform::DEBUG_FLAG_REMOTE_DEBUG);
166 }

Callers 1

start_native_deviceMethod · 0.80

Calls 15

TTRFunction · 0.85
vformatFunction · 0.85
ensure_main_sceneMethod · 0.80
is_runnableMethod · 0.80
get_platformMethod · 0.80
show_warningMethod · 0.80
popup_centeredMethod · 0.80
get_project_metadataMethod · 0.80
clear_messagesMethod · 0.80
fill_log_messagesMethod · 0.80

Tested by

no test coverage detected