Best practices on updating modified animations from GLB files?

Godot Version

4.5

Question

I’ve got a few character models with their own animations done in Blender: run, attack, damage, and so on.

I then imported those models, created an inherited scene, and used AnimationPlayer to add a few extra things:

  • For walking animations, step sounds on some frames
  • For attacks, function calls that activate collisions on hands, and so on.

The main problem is: when I have to update the model in Blender, how can I preserve my custom work on those animations?

The way it is now, I have to re-import the file and create another inherited scene. But then all my work is lost on the previous one.

What’s the best practice to customize animations and not lose them? Bear in mind that animations might change a bit, so frames might not even be the same.

On my own, I tried doing it in code with a separate component. It works, but feels like a rough draft and dunno if there might be an easier way:

extends Node3D

@onready var animation_player: AnimationPlayer = $AnimationPlayer

var animation_action_ready : bool = true
@onready var action_timer: Timer = $ActionTimer

func _ready() -> void:
	action_timer.timeout.connect(on_action_timer_timeout)

func _process(_delta: float) -> void:
	# Add to animations by animation running time
	# Prevent losing work when reimporting or refining stuff
	if animation_action_ready:

		# Extra stuff for walk animations
		if animation_player.current_animation == 'walk':
			
			# Run action in a small time window, instead of signals
			if animation_player.current_animation_position >= 0.1 and animation_player.current_animation_position <= 0.15:
				$SmashSound.play()
				
				# Avoid playing again, timer resets this
				animation_action_ready = false
				

func step():
	$WalkSound.play()
	if GameManager.camera != null:
		GameManager.camera.shake_camera(0.3)

func start_melee():
	pass
func end_melee():
	pass

func on_action_timer_timeout():
	animation_action_ready = true

Open the advanced import settings window and save the animations to disk enabling Keep Custom Tracks you’ll be able to modify the animations in the blender while keeping the added tracks

You can simply transfer the animation from the new scene to the old one.