Fix 6: don't kill shader tweens on rebuild — fixes stuck materialize effect
Fix 3 killed all shader tweens at the top of every rebuild_units() call. This interrupted materialize/ascend-arrival tweens mid-animation for units that were staying on the board. Because tween.kill() skips the completion callback, the mi.material_override was never restored, leaving every model permanently frozen in the reveal=0..1 shader state with no actual mesh visible. Tweens run to completion naturally. The WeakRef + is_instance_valid guards inside each tween callback already handle pooled/freed nodes safely, so there is no leak when a unit is removed while its tween is still running. _exit_tree() still kills all tweens on scene teardown. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -101,14 +101,6 @@ func _acquire_from_pool(card_type: String) -> StaticBody3D:
|
||||
## Recreating a unit body interrupts its running animation (idle/move/attack),
|
||||
## causing a one-frame bind-pose flash on every state echo.
|
||||
func rebuild_units(state: Dictionary) -> void:
|
||||
# Kill all in-flight shader tweens so ShaderMaterial refs are released now.
|
||||
for t: Tween in _active_tweens:
|
||||
if is_instance_valid(t):
|
||||
t.kill()
|
||||
_active_tweens.clear()
|
||||
if OS.is_debug_build():
|
||||
print("UnitMeshBuilder: rebuild - killed %d shader tweens" % _active_tweens.size())
|
||||
|
||||
# Kill any in-flight movement tweens.
|
||||
for iid: String in move_anims:
|
||||
var t: Tween = move_anims[iid] as Tween
|
||||
|
||||
Reference in New Issue
Block a user