You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Reworked signal connection system, added support for Callable and Signal objects and made them default.
This commit is contained in:
committed by
Juan Linietsky
parent
1a4be2cd8f
commit
69c95f4b4c
@@ -257,9 +257,9 @@ void GraphEdit::add_child_notify(Node *p_child) {
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
|
||||
if (gn) {
|
||||
gn->set_scale(Vector2(zoom, zoom));
|
||||
gn->connect("offset_changed", this, "_graph_node_moved", varray(gn));
|
||||
gn->connect("raise_request", this, "_graph_node_raised", varray(gn));
|
||||
gn->connect("item_rect_changed", connections_layer, "update");
|
||||
gn->connect_compat("offset_changed", this, "_graph_node_moved", varray(gn));
|
||||
gn->connect_compat("raise_request", this, "_graph_node_raised", varray(gn));
|
||||
gn->connect_compat("item_rect_changed", connections_layer, "update");
|
||||
_graph_node_moved(gn);
|
||||
gn->set_mouse_filter(MOUSE_FILTER_PASS);
|
||||
}
|
||||
@@ -273,8 +273,8 @@ void GraphEdit::remove_child_notify(Node *p_child) {
|
||||
}
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
|
||||
if (gn) {
|
||||
gn->disconnect("offset_changed", this, "_graph_node_moved");
|
||||
gn->disconnect("raise_request", this, "_graph_node_raised");
|
||||
gn->disconnect_compat("offset_changed", this, "_graph_node_moved");
|
||||
gn->disconnect_compat("raise_request", this, "_graph_node_raised");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1341,12 +1341,12 @@ GraphEdit::GraphEdit() {
|
||||
add_child(top_layer);
|
||||
top_layer->set_mouse_filter(MOUSE_FILTER_PASS);
|
||||
top_layer->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
top_layer->connect("draw", this, "_top_layer_draw");
|
||||
top_layer->connect("gui_input", this, "_top_layer_input");
|
||||
top_layer->connect_compat("draw", this, "_top_layer_draw");
|
||||
top_layer->connect_compat("gui_input", this, "_top_layer_input");
|
||||
|
||||
connections_layer = memnew(Control);
|
||||
add_child(connections_layer);
|
||||
connections_layer->connect("draw", this, "_connections_layer_draw");
|
||||
connections_layer->connect_compat("draw", this, "_connections_layer_draw");
|
||||
connections_layer->set_name("CLAYER");
|
||||
connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offset
|
||||
connections_layer->set_mouse_filter(MOUSE_FILTER_IGNORE);
|
||||
@@ -1373,8 +1373,8 @@ GraphEdit::GraphEdit() {
|
||||
v_scroll->set_min(-10000);
|
||||
v_scroll->set_max(10000);
|
||||
|
||||
h_scroll->connect("value_changed", this, "_scroll_moved");
|
||||
v_scroll->connect("value_changed", this, "_scroll_moved");
|
||||
h_scroll->connect_compat("value_changed", this, "_scroll_moved");
|
||||
v_scroll->connect_compat("value_changed", this, "_scroll_moved");
|
||||
|
||||
zoom = 1;
|
||||
|
||||
@@ -1385,25 +1385,25 @@ GraphEdit::GraphEdit() {
|
||||
zoom_minus = memnew(ToolButton);
|
||||
zoom_hb->add_child(zoom_minus);
|
||||
zoom_minus->set_tooltip(RTR("Zoom Out"));
|
||||
zoom_minus->connect("pressed", this, "_zoom_minus");
|
||||
zoom_minus->connect_compat("pressed", this, "_zoom_minus");
|
||||
zoom_minus->set_focus_mode(FOCUS_NONE);
|
||||
|
||||
zoom_reset = memnew(ToolButton);
|
||||
zoom_hb->add_child(zoom_reset);
|
||||
zoom_reset->set_tooltip(RTR("Zoom Reset"));
|
||||
zoom_reset->connect("pressed", this, "_zoom_reset");
|
||||
zoom_reset->connect_compat("pressed", this, "_zoom_reset");
|
||||
zoom_reset->set_focus_mode(FOCUS_NONE);
|
||||
|
||||
zoom_plus = memnew(ToolButton);
|
||||
zoom_hb->add_child(zoom_plus);
|
||||
zoom_plus->set_tooltip(RTR("Zoom In"));
|
||||
zoom_plus->connect("pressed", this, "_zoom_plus");
|
||||
zoom_plus->connect_compat("pressed", this, "_zoom_plus");
|
||||
zoom_plus->set_focus_mode(FOCUS_NONE);
|
||||
|
||||
snap_button = memnew(ToolButton);
|
||||
snap_button->set_toggle_mode(true);
|
||||
snap_button->set_tooltip(RTR("Enable snap and show grid."));
|
||||
snap_button->connect("pressed", this, "_snap_toggled");
|
||||
snap_button->connect_compat("pressed", this, "_snap_toggled");
|
||||
snap_button->set_pressed(true);
|
||||
snap_button->set_focus_mode(FOCUS_NONE);
|
||||
zoom_hb->add_child(snap_button);
|
||||
@@ -1413,7 +1413,7 @@ GraphEdit::GraphEdit() {
|
||||
snap_amount->set_max(100);
|
||||
snap_amount->set_step(1);
|
||||
snap_amount->set_value(20);
|
||||
snap_amount->connect("value_changed", this, "_snap_value_changed");
|
||||
snap_amount->connect_compat("value_changed", this, "_snap_value_changed");
|
||||
zoom_hb->add_child(snap_amount);
|
||||
|
||||
setting_scroll_ofs = false;
|
||||
|
||||
Reference in New Issue
Block a user