Godot教程——GraphEdit和GraphNode
上文:
Godot游戏引擎:GraphEdit和GraphNode教程(一)—— GraphNode
Godot游戏引擎:GraphEdit和GraphNode教程(二)——GraphEdit
Godot游戏引擎:GraphEdit和GraphNode教程(三)——GraphEdit事件处理
Godot游戏引擎:GraphEdit和GraphNode教程(四)——应用
这估计是GraphNode和GraphEdit的最后一期吧。
承接上文,我们实现了GraphEdit和GraphNode的功能主体。现在,我们对这个功能进行完善。
首先,我们对GraphEdit的删除连接进行完善。
这是之前的删除信号的处理函数。
func _on_GraphEdit_disconnection_request(from, from_slot, to, to_slot):
disconnect_node(from, from_slot, to, to_slot)
让我们对它稍加修改。
func _on_GraphEdit_disconnection_request(from, from_slot, to, to_slot):
disconnect_node(from, from_slot, to, to_slot)
# print("Disconnection: from: %s, from_slot: %s, to: %s, to_slot: %s" %[from, from_slot, to, to_slot])
if get_node(from) is ScriptableGraphNode and get_node(to) is ScriptableGraphNode:
get_node(to).emit_signal("has_remove_connected", get_node(from)