From 7e37380b0e49252bc749bca6dec81b75b4c9a365 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Fri, 28 Apr 2023 15:31:30 -0500 Subject: [PATCH] Use human-readable unique names for GraphEdit's internal nodes --- scene/gui/graph_edit.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 9b762f7b3c4d..e3c6b7a6f20f 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -2786,6 +2786,7 @@ GraphEdit::GraphEdit() { panner->set_callbacks(callable_mp(this, &GraphEdit::_pan_callback), callable_mp(this, &GraphEdit::_zoom_callback)); top_layer = memnew(Control); + top_layer->set_name("_top_layer"); add_child(top_layer, false, INTERNAL_MODE_BACK); top_layer->set_mouse_filter(MOUSE_FILTER_IGNORE); top_layer->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT); @@ -2838,11 +2839,13 @@ GraphEdit::GraphEdit() { menu_panel->set_position(Vector2(10, 10)); menu_hbox = memnew(HBoxContainer); + menu_hbox->set_name("_menu_hbox"); menu_panel->add_child(menu_hbox); // Zoom label and controls. zoom_label = memnew(Label); + zoom_label->set_name("_zoom_label"); zoom_label->set_visible(show_zoom_label); zoom_label->set_v_size_flags(Control::SIZE_SHRINK_CENTER); zoom_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); @@ -2851,6 +2854,7 @@ GraphEdit::GraphEdit() { _update_zoom_label(); zoom_minus_button = memnew(Button); + zoom_minus_button->set_name("_zoom_minus_button"); zoom_minus_button->set_theme_type_variation("FlatButton"); zoom_minus_button->set_visible(show_zoom_buttons); zoom_minus_button->set_tooltip_text(ETR("Zoom Out")); @@ -2859,6 +2863,7 @@ GraphEdit::GraphEdit() { zoom_minus_button->connect(SceneStringName(pressed), callable_mp(this, &GraphEdit::_zoom_minus)); zoom_reset_button = memnew(Button); + zoom_reset_button->set_name("_zoom_reset_button"); zoom_reset_button->set_theme_type_variation("FlatButton"); zoom_reset_button->set_visible(show_zoom_buttons); zoom_reset_button->set_tooltip_text(ETR("Zoom Reset")); @@ -2867,6 +2872,7 @@ GraphEdit::GraphEdit() { zoom_reset_button->connect(SceneStringName(pressed), callable_mp(this, &GraphEdit::_zoom_reset)); zoom_plus_button = memnew(Button); + zoom_plus_button->set_name("_zoom_plus_button"); zoom_plus_button->set_theme_type_variation("FlatButton"); zoom_plus_button->set_visible(show_zoom_buttons); zoom_plus_button->set_tooltip_text(ETR("Zoom In")); @@ -2877,6 +2883,7 @@ GraphEdit::GraphEdit() { // Grid controls. toggle_grid_button = memnew(Button); + toggle_grid_button->set_name("_toggle_grid_button"); toggle_grid_button->set_theme_type_variation("FlatButton"); toggle_grid_button->set_visible(show_grid_buttons); toggle_grid_button->set_toggle_mode(true); @@ -2887,6 +2894,7 @@ GraphEdit::GraphEdit() { toggle_grid_button->connect(SceneStringName(pressed), callable_mp(this, &GraphEdit::_show_grid_toggled)); toggle_snapping_button = memnew(Button); + toggle_snapping_button->set_name("_toggle_snapping_button"); toggle_snapping_button->set_theme_type_variation("FlatButton"); toggle_snapping_button->set_visible(show_grid_buttons); toggle_snapping_button->set_toggle_mode(true); @@ -2897,6 +2905,7 @@ GraphEdit::GraphEdit() { toggle_snapping_button->connect(SceneStringName(pressed), callable_mp(this, &GraphEdit::_snapping_toggled)); snapping_distance_spinbox = memnew(SpinBox); + snapping_distance_spinbox->set_name("_snapping_distance_spinbox"); snapping_distance_spinbox->set_visible(show_grid_buttons); snapping_distance_spinbox->set_min(GRID_MIN_SNAPPING_DISTANCE); snapping_distance_spinbox->set_max(GRID_MAX_SNAPPING_DISTANCE); @@ -2909,6 +2918,7 @@ GraphEdit::GraphEdit() { // Extra controls. minimap_button = memnew(Button); + minimap_button->set_name("_minimap_button"); minimap_button->set_theme_type_variation("FlatButton"); minimap_button->set_visible(show_minimap_button); minimap_button->set_toggle_mode(true); @@ -2919,6 +2929,7 @@ GraphEdit::GraphEdit() { minimap_button->connect(SceneStringName(pressed), callable_mp(this, &GraphEdit::_minimap_toggled)); arrange_button = memnew(Button); + arrange_button->set_name("_arrange_button"); arrange_button->set_theme_type_variation("FlatButton"); arrange_button->set_visible(show_arrange_button); arrange_button->connect(SceneStringName(pressed), callable_mp(this, &GraphEdit::arrange_nodes)); @@ -2932,8 +2943,8 @@ GraphEdit::GraphEdit() { const float minimap_opacity = 0.65; minimap = memnew(GraphEditMinimap(this)); - top_layer->add_child(minimap); minimap->set_name("_minimap"); + top_layer->add_child(minimap); minimap->set_modulate(Color(1, 1, 1, minimap_opacity)); minimap->set_mouse_filter(MOUSE_FILTER_PASS); minimap->set_custom_minimum_size(Vector2(50, 50));