Clean up/refactor GraphEdit

This commit is contained in:
Hendrik Brucker 2023-07-10 17:26:02 +02:00 committed by Yuri Sizov
parent 91258e52be
commit a38fd09669
12 changed files with 1274 additions and 1059 deletions

View file

@ -126,7 +126,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
visible_properties.clear();
graph->set_scroll_ofs(blend_tree->get_graph_offset() * EDSCALE);
graph->set_scroll_offset(blend_tree->get_graph_offset() * EDSCALE);
graph->clear_connections();
//erase all nodes
@ -348,7 +348,7 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
return;
}
Point2 instance_pos = graph->get_scroll_ofs();
Point2 instance_pos = graph->get_scroll_offset();
if (use_position_from_popup_menu) {
instance_pos += position_from_popup_menu;
} else {
@ -1092,13 +1092,13 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
graph->set_connection_lines_curvature(graph_lines_curvature);
VSeparator *vs = memnew(VSeparator);
graph->get_zoom_hbox()->add_child(vs);
graph->get_zoom_hbox()->move_child(vs, 0);
graph->get_menu_hbox()->add_child(vs);
graph->get_menu_hbox()->move_child(vs, 0);
add_node = memnew(MenuButton);
graph->get_zoom_hbox()->add_child(add_node);
graph->get_menu_hbox()->add_child(add_node);
add_node->set_text(TTR("Add Node..."));
graph->get_zoom_hbox()->move_child(add_node, 0);
graph->get_menu_hbox()->move_child(add_node, 0);
add_node->get_popup()->connect("id_pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_add_node));
add_node->get_popup()->connect("popup_hide", callable_mp(this, &AnimationNodeBlendTreeEditor::_popup_hide), CONNECT_DEFERRED);
add_node->connect("about_to_popup", callable_mp(this, &AnimationNodeBlendTreeEditor::_update_options_menu).bind(false));