summaryrefslogtreecommitdiff
path: root/editor/editor_visual_profiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_visual_profiler.cpp')
-rw-r--r--editor/editor_visual_profiler.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/editor/editor_visual_profiler.cpp b/editor/editor_visual_profiler.cpp
index 1b68a89181..e9638148e2 100644
--- a/editor/editor_visual_profiler.cpp
+++ b/editor/editor_visual_profiler.cpp
@@ -161,7 +161,7 @@ void EditorVisualProfiler::_update_plot() {
graph_image.resize(desired_len);
}
- PoolVector<uint8_t>::Write wr = graph_image.write();
+ uint8_t *wr = graph_image.ptrw();
//clear
for (int i = 0; i < desired_len; i += 4) {
@@ -305,8 +305,6 @@ void EditorVisualProfiler::_update_plot() {
}
}
- wr.release();
-
Ref<Image> img;
img.instance();
img->create(w, h, 0, Image::FORMAT_RGBA8, graph_image);
@@ -590,8 +588,7 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
if (activate->is_pressed()) {
if (!seeking) {
- //probably not need to break request, can just stop profiling
- //emit_signal("break_request");
+ // Break request is not required, just stop profiling
}
}
@@ -669,19 +666,7 @@ void EditorVisualProfiler::_combo_changed(int) {
void EditorVisualProfiler::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_update_frame"), &EditorVisualProfiler::_update_frame, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("_update_plot"), &EditorVisualProfiler::_update_plot);
- ClassDB::bind_method(D_METHOD("_activate_pressed"), &EditorVisualProfiler::_activate_pressed);
- ClassDB::bind_method(D_METHOD("_clear_pressed"), &EditorVisualProfiler::_clear_pressed);
- ClassDB::bind_method(D_METHOD("_graph_tex_draw"), &EditorVisualProfiler::_graph_tex_draw);
- ClassDB::bind_method(D_METHOD("_graph_tex_input"), &EditorVisualProfiler::_graph_tex_input);
- ClassDB::bind_method(D_METHOD("_graph_tex_mouse_exit"), &EditorVisualProfiler::_graph_tex_mouse_exit);
- ClassDB::bind_method(D_METHOD("_cursor_metric_changed"), &EditorVisualProfiler::_cursor_metric_changed);
- ClassDB::bind_method(D_METHOD("_combo_changed"), &EditorVisualProfiler::_combo_changed);
-
- ClassDB::bind_method(D_METHOD("_item_selected"), &EditorVisualProfiler::_item_selected);
ADD_SIGNAL(MethodInfo("enable_profiling", PropertyInfo(Variant::BOOL, "enable")));
- ADD_SIGNAL(MethodInfo("break_request"));
}
void EditorVisualProfiler::set_enabled(bool p_enable) {
@@ -757,12 +742,12 @@ EditorVisualProfiler::EditorVisualProfiler() {
activate = memnew(Button);
activate->set_toggle_mode(true);
activate->set_text(TTR("Start"));
- activate->connect("pressed", this, "_activate_pressed");
+ activate->connect("pressed", callable_mp(this, &EditorVisualProfiler::_activate_pressed));
hb->add_child(activate);
clear_button = memnew(Button);
clear_button->set_text(TTR("Clear"));
- clear_button->connect("pressed", this, "_clear_pressed");
+ clear_button->connect("pressed", callable_mp(this, &EditorVisualProfiler::_clear_pressed));
hb->add_child(clear_button);
hb->add_child(memnew(Label(TTR("Measure:"))));
@@ -770,18 +755,18 @@ EditorVisualProfiler::EditorVisualProfiler() {
display_mode = memnew(OptionButton);
display_mode->add_item(TTR("Frame Time (msec)"));
display_mode->add_item(TTR("Frame %"));
- display_mode->connect("item_selected", this, "_combo_changed");
+ display_mode->connect("item_selected", callable_mp(this, &EditorVisualProfiler::_combo_changed));
hb->add_child(display_mode);
frame_relative = memnew(CheckBox(TTR("Fit to Frame")));
frame_relative->set_pressed(true);
hb->add_child(frame_relative);
- frame_relative->connect("pressed", this, "_update_plot");
+ frame_relative->connect("pressed", callable_mp(this, &EditorVisualProfiler::_update_plot));
linked = memnew(CheckBox(TTR("Linked")));
linked->set_pressed(true);
hb->add_child(linked);
- linked->connect("pressed", this, "_update_plot");
+ linked->connect("pressed", callable_mp(this, &EditorVisualProfiler::_update_plot));
hb->add_spacer();
@@ -790,7 +775,7 @@ EditorVisualProfiler::EditorVisualProfiler() {
cursor_metric_edit = memnew(SpinBox);
cursor_metric_edit->set_h_size_flags(SIZE_FILL);
hb->add_child(cursor_metric_edit);
- cursor_metric_edit->connect("value_changed", this, "_cursor_metric_changed");
+ cursor_metric_edit->connect("value_changed", callable_mp(this, &EditorVisualProfiler::_cursor_metric_changed));
hb->add_constant_override("separation", 8 * EDSCALE);
@@ -814,15 +799,15 @@ EditorVisualProfiler::EditorVisualProfiler() {
variables->set_column_title(2, TTR("GPU"));
variables->set_column_expand(2, false);
variables->set_column_min_width(2, 60 * EDSCALE);
- variables->connect("cell_selected", this, "_item_selected");
+ variables->connect("cell_selected", callable_mp(this, &EditorVisualProfiler::_item_selected));
graph = memnew(TextureRect);
graph->set_expand(true);
graph->set_mouse_filter(MOUSE_FILTER_STOP);
//graph->set_ignore_mouse(false);
- graph->connect("draw", this, "_graph_tex_draw");
- graph->connect("gui_input", this, "_graph_tex_input");
- graph->connect("mouse_exited", this, "_graph_tex_mouse_exit");
+ graph->connect("draw", callable_mp(this, &EditorVisualProfiler::_graph_tex_draw));
+ graph->connect("gui_input", callable_mp(this, &EditorVisualProfiler::_graph_tex_input));
+ graph->connect("mouse_exited", callable_mp(this, &EditorVisualProfiler::_graph_tex_mouse_exit));
h_split->add_child(graph);
graph->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -839,13 +824,13 @@ EditorVisualProfiler::EditorVisualProfiler() {
frame_delay->set_wait_time(0.1);
frame_delay->set_one_shot(true);
add_child(frame_delay);
- frame_delay->connect("timeout", this, "_update_frame");
+ frame_delay->connect("timeout", callable_mp(this, &EditorVisualProfiler::_update_frame), make_binds(false));
plot_delay = memnew(Timer);
plot_delay->set_wait_time(0.1);
plot_delay->set_one_shot(true);
add_child(plot_delay);
- plot_delay->connect("timeout", this, "_update_plot");
+ plot_delay->connect("timeout", callable_mp(this, &EditorVisualProfiler::_update_plot));
seeking = false;
graph_height_cpu = 1;