summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp7
-rw-r--r--editor/debugger/script_editor_debugger.cpp105
-rw-r--r--editor/debugger/script_editor_debugger.h7
-rw-r--r--editor/icons/Decal.svg1
4 files changed, 91 insertions, 29 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index f10e439f10..b7c8769f64 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -754,14 +754,17 @@ public:
for (Map<int, List<float>>::Element *E = key_ofs_map.front(); E; E = E->next()) {
+ int key = 0;
for (List<float>::Element *F = E->value().front(); F; F = F->next()) {
float key_ofs = F->get();
- if (from != key_ofs)
+ if (from != key_ofs) {
+ key++;
continue;
+ }
int track = E->key();
- key_ofs_map[track][key_ofs] = to;
+ key_ofs_map[track][key] = to;
if (setting)
return;
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 1971abadc4..81a7d85b18 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -149,39 +149,74 @@ void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) {
}
void ScriptEditorDebugger::_file_selected(const String &p_file) {
- Error err;
- FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
- if (err != OK) {
- ERR_PRINT("Failed to open " + p_file);
- return;
- }
- Vector<String> line;
- line.resize(Performance::MONITOR_MAX);
+ switch (file_dialog_purpose) {
+ case SAVE_MONITORS_CSV: {
+ Error err;
+ FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
- // signatures
- for (int i = 0; i < Performance::MONITOR_MAX; i++) {
- line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
- }
- file->store_csv_line(line);
+ if (err != OK) {
+ ERR_PRINT("Failed to open " + p_file);
+ return;
+ }
+ Vector<String> line;
+ line.resize(Performance::MONITOR_MAX);
- // values
- List<Vector<float>>::Element *E = perf_history.back();
- while (E) {
+ // signatures
+ for (int i = 0; i < Performance::MONITOR_MAX; i++) {
+ line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
+ }
+ file->store_csv_line(line);
- Vector<float> &perf_data = E->get();
- for (int i = 0; i < perf_data.size(); i++) {
+ // values
+ List<Vector<float>>::Element *E = perf_history.back();
+ while (E) {
- line.write[i] = String::num_real(perf_data[i]);
- }
- file->store_csv_line(line);
- E = E->prev();
- }
- file->store_string("\n");
+ Vector<float> &perf_data = E->get();
+ for (int i = 0; i < perf_data.size(); i++) {
+
+ line.write[i] = String::num_real(perf_data[i]);
+ }
+ file->store_csv_line(line);
+ E = E->prev();
+ }
+ file->store_string("\n");
+
+ Vector<Vector<String>> profiler_data = profiler->get_data_as_csv();
+ for (int i = 0; i < profiler_data.size(); i++) {
+ file->store_csv_line(profiler_data[i]);
+ }
+ } break;
+ case SAVE_VRAM_CSV: {
+ Error err;
+ FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
- Vector<Vector<String>> profiler_data = profiler->get_data_as_csv();
- for (int i = 0; i < profiler_data.size(); i++) {
- file->store_csv_line(profiler_data[i]);
+ if (err != OK) {
+ ERR_PRINT("Failed to open " + p_file);
+ return;
+ }
+
+ Vector<String> headers;
+ headers.resize(vmem_tree->get_columns());
+ for (int i = 0; i < vmem_tree->get_columns(); ++i) {
+ headers.write[i] = vmem_tree->get_column_title(i);
+ }
+ file->store_csv_line(headers);
+
+ if (vmem_tree->get_root()) {
+ TreeItem *ti = vmem_tree->get_root()->get_children();
+ while (ti) {
+ Vector<String> values;
+ values.resize(vmem_tree->get_columns());
+ for (int i = 0; i < vmem_tree->get_columns(); ++i) {
+ values.write[i] = ti->get_text(i);
+ }
+ file->store_csv_line(values);
+
+ ti = ti->get_next();
+ }
+ }
+ } break;
}
}
@@ -233,6 +268,15 @@ void ScriptEditorDebugger::_video_mem_request() {
_put_msg("core:memory", Array());
}
+void ScriptEditorDebugger::_video_mem_export() {
+
+ file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
+ file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
+ file_dialog->clear_filters();
+ file_dialog_purpose = SAVE_VRAM_CSV;
+ file_dialog->popup_centered_ratio();
+}
+
Size2 ScriptEditorDebugger::get_minimum_size() const {
Size2 ms = MarginContainer::get_minimum_size();
@@ -766,6 +810,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
error_tree->connect("item_selected", callable_mp(this, &ScriptEditorDebugger::_error_selected));
error_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_error_activated));
vmem_refresh->set_icon(get_theme_icon("Reload", "EditorIcons"));
+ vmem_export->set_icon(get_theme_icon("Save", "EditorIcons"));
reason->add_theme_color_override("font_color", get_theme_color("error_color", "Editor"));
@@ -840,6 +885,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
dobreak->set_icon(get_theme_icon("Pause", "EditorIcons"));
docontinue->set_icon(get_theme_icon("DebugContinue", "EditorIcons"));
vmem_refresh->set_icon(get_theme_icon("Reload", "EditorIcons"));
+ vmem_export->set_icon(get_theme_icon("Save", "EditorIcons"));
} break;
}
}
@@ -981,6 +1027,7 @@ void ScriptEditorDebugger::_export_csv() {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
+ file_dialog_purpose = SAVE_MONITORS_CSV;
file_dialog->popup_centered_ratio();
}
@@ -1701,8 +1748,12 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
vmem_hb->add_child(vmem_total);
vmem_refresh = memnew(ToolButton);
vmem_hb->add_child(vmem_refresh);
+ vmem_export = memnew(ToolButton);
+ vmem_export->set_tooltip(TTR("Export list to a CSV file"));
+ vmem_hb->add_child(vmem_export);
vmem_vb->add_child(vmem_hb);
vmem_refresh->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_video_mem_request));
+ vmem_export->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_video_mem_export));
VBoxContainer *vmmc = memnew(VBoxContainer);
vmem_tree = memnew(Tree);
diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h
index 9cb7dc2edf..a08a7c67c2 100644
--- a/editor/debugger/script_editor_debugger.h
+++ b/editor/debugger/script_editor_debugger.h
@@ -88,6 +88,11 @@ private:
PopupMenu *item_menu;
EditorFileDialog *file_dialog;
+ enum FileDialogPurpose {
+ SAVE_MONITORS_CSV,
+ SAVE_VRAM_CSV,
+ };
+ FileDialogPurpose file_dialog_purpose;
int error_count;
int warning_count;
@@ -121,6 +126,7 @@ private:
Tree *vmem_tree;
Button *vmem_refresh;
+ Button *vmem_export;
LineEdit *vmem_total;
Tree *stack_dump;
@@ -160,6 +166,7 @@ private:
void _remote_object_property_updated(ObjectID p_id, const String &p_property);
void _video_mem_request();
+ void _video_mem_export();
int _get_node_path_cache(const NodePath &p_path);
diff --git a/editor/icons/Decal.svg b/editor/icons/Decal.svg
new file mode 100644
index 0000000000..fc7bfb8e2c
--- /dev/null
+++ b/editor/icons/Decal.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 2c-3.3137085 0-6 2.6862915-6 6 0 2.220299 1.2092804 4.153789 3.0019531 5.191406l8.9082029-6.1894529c-.476307-2.8374399-2.937354-5.0019531-5.910156-5.0019531z" fill="#fc9c9c"/><path d="m5.001954 13.191406 8.908202-6.1894529c-.882819-.510985-1.904638-.808594-2.998046-.808594-3.3137079 0-6 2.686292-6 5.9999999 0 .340906.03522.672663.08984.998047z" fill="#ff5d5d"/><path d="m13.910156 7.0019531-8.908202 6.1894529c.882819.510985 1.904638.808594 2.998046.808594 3.313708 0 6-2.686292 6-5.9999999 0-.340906-.03522-.672663-.08984-.998047z" fill="#fc9c9c" fill-opacity=".392157"/></svg> \ No newline at end of file