You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Update GraphEdit when GraphNode's slot is updated
(cherry picked from commit fe6c8d48e6)
This commit is contained in:
committed by
Rémi Verschelde
parent
08d556f677
commit
adb93d7120
@@ -226,6 +226,13 @@
|
|||||||
Emitted when the GraphNode is moved.
|
Emitted when the GraphNode is moved.
|
||||||
</description>
|
</description>
|
||||||
</signal>
|
</signal>
|
||||||
|
<signal name="slot_updated">
|
||||||
|
<argument index="0" name="idx" type="int">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Emitted when any GraphNode's slot is updated.
|
||||||
|
</description>
|
||||||
|
</signal>
|
||||||
<signal name="raise_request">
|
<signal name="raise_request">
|
||||||
<description>
|
<description>
|
||||||
Emitted when the GraphNode is requested to be displayed over other ones. Happens on focusing (clicking into) the GraphNode.
|
Emitted when the GraphNode is requested to be displayed over other ones. Happens on focusing (clicking into) the GraphNode.
|
||||||
|
|||||||
@@ -396,6 +396,15 @@ void GraphEdit::_graph_node_moved(Node *p_gn) {
|
|||||||
connections_layer->update();
|
connections_layer->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphEdit::_graph_node_slot_updated(int p_index, Node *p_gn) {
|
||||||
|
GraphNode *gn = Object::cast_to<GraphNode>(p_gn);
|
||||||
|
ERR_FAIL_COND(!gn);
|
||||||
|
top_layer->update();
|
||||||
|
minimap->update();
|
||||||
|
update();
|
||||||
|
connections_layer->update();
|
||||||
|
}
|
||||||
|
|
||||||
void GraphEdit::add_child_notify(Node *p_child) {
|
void GraphEdit::add_child_notify(Node *p_child) {
|
||||||
|
|
||||||
Control::add_child_notify(p_child);
|
Control::add_child_notify(p_child);
|
||||||
@@ -406,6 +415,7 @@ void GraphEdit::add_child_notify(Node *p_child) {
|
|||||||
if (gn) {
|
if (gn) {
|
||||||
gn->set_scale(Vector2(zoom, zoom));
|
gn->set_scale(Vector2(zoom, zoom));
|
||||||
gn->connect("offset_changed", this, "_graph_node_moved", varray(gn));
|
gn->connect("offset_changed", this, "_graph_node_moved", varray(gn));
|
||||||
|
gn->connect("slot_updated", this, "_graph_node_slot_updated", varray(gn));
|
||||||
gn->connect("raise_request", this, "_graph_node_raised", varray(gn));
|
gn->connect("raise_request", this, "_graph_node_raised", varray(gn));
|
||||||
gn->connect("item_rect_changed", connections_layer, "update");
|
gn->connect("item_rect_changed", connections_layer, "update");
|
||||||
gn->connect("item_rect_changed", minimap, "update");
|
gn->connect("item_rect_changed", minimap, "update");
|
||||||
@@ -432,6 +442,7 @@ void GraphEdit::remove_child_notify(Node *p_child) {
|
|||||||
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
|
GraphNode *gn = Object::cast_to<GraphNode>(p_child);
|
||||||
if (gn) {
|
if (gn) {
|
||||||
gn->disconnect("offset_changed", this, "_graph_node_moved");
|
gn->disconnect("offset_changed", this, "_graph_node_moved");
|
||||||
|
gn->disconnect("slot_updated", this, "_graph_node_slot_updated");
|
||||||
gn->disconnect("raise_request", this, "_graph_node_raised");
|
gn->disconnect("raise_request", this, "_graph_node_raised");
|
||||||
|
|
||||||
// In case of the whole GraphEdit being destroyed these references can already be freed.
|
// In case of the whole GraphEdit being destroyed these references can already be freed.
|
||||||
@@ -1659,6 +1670,7 @@ void GraphEdit::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("_graph_node_moved"), &GraphEdit::_graph_node_moved);
|
ClassDB::bind_method(D_METHOD("_graph_node_moved"), &GraphEdit::_graph_node_moved);
|
||||||
ClassDB::bind_method(D_METHOD("_graph_node_raised"), &GraphEdit::_graph_node_raised);
|
ClassDB::bind_method(D_METHOD("_graph_node_raised"), &GraphEdit::_graph_node_raised);
|
||||||
|
ClassDB::bind_method(D_METHOD("_graph_node_slot_updated"), &GraphEdit::_graph_node_slot_updated);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("_top_layer_input"), &GraphEdit::_top_layer_input);
|
ClassDB::bind_method(D_METHOD("_top_layer_input"), &GraphEdit::_top_layer_input);
|
||||||
ClassDB::bind_method(D_METHOD("_top_layer_draw"), &GraphEdit::_top_layer_draw);
|
ClassDB::bind_method(D_METHOD("_top_layer_draw"), &GraphEdit::_top_layer_draw);
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ private:
|
|||||||
|
|
||||||
void _graph_node_raised(Node *p_gn);
|
void _graph_node_raised(Node *p_gn);
|
||||||
void _graph_node_moved(Node *p_gn);
|
void _graph_node_moved(Node *p_gn);
|
||||||
|
void _graph_node_slot_updated(int p_index, Node *p_gn);
|
||||||
|
|
||||||
void _update_scroll();
|
void _update_scroll();
|
||||||
void _scroll_moved(double);
|
void _scroll_moved(double);
|
||||||
|
|||||||
@@ -312,6 +312,8 @@ void GraphNode::set_slot(int p_idx, bool p_enable_left, int p_type_left, const C
|
|||||||
slot_info[p_idx] = s;
|
slot_info[p_idx] = s;
|
||||||
update();
|
update();
|
||||||
connpos_dirty = true;
|
connpos_dirty = true;
|
||||||
|
|
||||||
|
emit_signal("slot_updated", p_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphNode::clear_slot(int p_idx) {
|
void GraphNode::clear_slot(int p_idx) {
|
||||||
@@ -720,6 +722,7 @@ void GraphNode::_bind_methods() {
|
|||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "overlay", PROPERTY_HINT_ENUM, "Disabled,Breakpoint,Position"), "set_overlay", "get_overlay");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "overlay", PROPERTY_HINT_ENUM, "Disabled,Breakpoint,Position"), "set_overlay", "get_overlay");
|
||||||
|
|
||||||
ADD_SIGNAL(MethodInfo("offset_changed"));
|
ADD_SIGNAL(MethodInfo("offset_changed"));
|
||||||
|
ADD_SIGNAL(MethodInfo("slot_updated", PropertyInfo(Variant::INT, "idx")));
|
||||||
ADD_SIGNAL(MethodInfo("dragged", PropertyInfo(Variant::VECTOR2, "from"), PropertyInfo(Variant::VECTOR2, "to")));
|
ADD_SIGNAL(MethodInfo("dragged", PropertyInfo(Variant::VECTOR2, "from"), PropertyInfo(Variant::VECTOR2, "to")));
|
||||||
ADD_SIGNAL(MethodInfo("raise_request"));
|
ADD_SIGNAL(MethodInfo("raise_request"));
|
||||||
ADD_SIGNAL(MethodInfo("close_request"));
|
ADD_SIGNAL(MethodInfo("close_request"));
|
||||||
|
|||||||
Reference in New Issue
Block a user