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

Method _file_selected

editor/debugger/script_editor_debugger.cpp:180–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void ScriptEditorDebugger::_file_selected(const String &p_file) {
181 switch (file_dialog_purpose) {
182 case SAVE_MONITORS_CSV: {
183 Error err;
184 Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
185
186 if (err != OK) {
187 ERR_PRINT("Failed to open " + p_file);
188 return;
189 }
190 Vector<String> line;
191 line.resize(Performance::MONITOR_MAX);
192
193 // signatures
194 for (int i = 0; i < Performance::MONITOR_MAX; i++) {
195 line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
196 }
197 file->store_csv_line(line);
198
199 // values
200 Vector<List<float>::Element *> iterators;
201 iterators.resize(Performance::MONITOR_MAX);
202 bool continue_iteration = false;
203 for (int i = 0; i < Performance::MONITOR_MAX; i++) {
204 iterators.write[i] = performance_profiler->get_monitor_data(Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)))->back();
205 continue_iteration = continue_iteration || iterators[i];
206 }
207 while (continue_iteration) {
208 continue_iteration = false;
209 for (int i = 0; i < Performance::MONITOR_MAX; i++) {
210 if (iterators[i]) {
211 line.write[i] = String::num_real(iterators[i]->get());
212 iterators.write[i] = iterators[i]->prev();
213 } else {
214 line.write[i] = "";
215 }
216 continue_iteration = continue_iteration || iterators[i];
217 }
218 file->store_csv_line(line);
219 }
220 file->store_string("\n");
221
222 Vector<Vector<String>> profiler_data = profiler->get_data_as_csv();
223 for (int i = 0; i < profiler_data.size(); i++) {
224 file->store_csv_line(profiler_data[i]);
225 }
226 } break;
227 case SAVE_VRAM_CSV: {
228 Error err;
229 Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
230
231 if (err != OK) {
232 ERR_PRINT("Failed to open " + p_file);
233 return;
234 }
235
236 Vector<String> headers;
237 headers.resize(vmem_tree->get_columns());

Callers

nothing calls this directly

Calls 15

get_monitor_nameMethod · 0.80
store_csv_lineMethod · 0.80
get_monitor_dataMethod · 0.80
store_stringMethod · 0.80
get_column_titleMethod · 0.80
get_first_childMethod · 0.80
MonitorClass · 0.70
sizeMethod · 0.65
resizeMethod · 0.45
backMethod · 0.45
getMethod · 0.45
prevMethod · 0.45

Tested by

no test coverage detected