From dd999e53fb4b7ba05f013872c25987c381be921b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sat, 24 Jan 2026 08:24:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor(TickTool):=20=E5=B0=86=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=A3=B0=E6=98=8E=E7=A7=BB=E5=88=B0=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E4=BB=A5=E6=8F=90=E5=8D=87=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=8F=AF=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将inHandle和outHandle变量的声明移到实际使用的bezier轨道条件块内,减少不必要的变量作用域,使代码更清晰易读 --- scripts/Tools/TickTool.gd | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/Tools/TickTool.gd b/scripts/Tools/TickTool.gd index 063971e..4cc8014 100644 --- a/scripts/Tools/TickTool.gd +++ b/scripts/Tools/TickTool.gd @@ -15,11 +15,9 @@ static func modifyAnimationKey(animator: AnimationPlayer, name: String, track: N var animation = animator.get_animation(name) var trackIdx = animation.find_track(track, trackType) var keyIdx = animation.track_find_key(trackIdx, time) - var inHandle - var outHandle if trackType == Animation.TrackType.TYPE_BEZIER: - inHandle = animation.bezier_track_get_key_in_handle(trackIdx, keyIdx) - outHandle = animation.bezier_track_get_key_out_handle(trackIdx, keyIdx) + var inHandle = animation.bezier_track_get_key_in_handle(trackIdx, keyIdx) + var outHandle = animation.bezier_track_get_key_out_handle(trackIdx, keyIdx) animation.track_set_key_value(trackIdx, keyIdx, [value, inHandle.x, inHandle.y, outHandle.x, outHandle.y]) else: animation.track_set_key_value(trackIdx, keyIdx, [value])