Godot游戏引擎:GraphEdit和GraphNode教程(五)——应用收尾

本文是Godot游戏引擎GraphEdit和GraphNode教程的最后一期,主要介绍如何完善GraphEdit的删除连接功能,修正Slot的处理,确保连接断开后槽值清空,并调整添加、删除事件,防止输入槽重复连接,同时确保输出槽值在删除时被覆盖,保证每次运行的输入输出一致性。
摘要由CSDN通过智能技术生成

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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值