Skip to content

Instantly share code, notes, and snippets.

@catprisbrey
Last active January 16, 2025 14:57
Show Gist options
  • Save catprisbrey/bb884a8221d75d915cda79f8dabb79d7 to your computer and use it in GitHub Desktop.
Save catprisbrey/bb884a8221d75d915cda79f8dabb79d7 to your computer and use it in GitHub Desktop.
Blender to Godot - Rename NLA strips to match track names
import bpy
## NLA editor is annoying, that strips and tracks have different names, and in Godot sometimes i see
## my strip names and not track names. Who knows why. This will rename all strips to match their track names.
# Get the current scene
scene = bpy.context.scene
# Iterate through all objects in the scene
for obj in scene.objects:
# Check if the object has NLA tracks
if obj.animation_data and obj.animation_data.nla_tracks:
for track in obj.animation_data.nla_tracks:
# Iterate through each strip in the track
for strip in track.strips:
# Rename the strip to match the track name
strip.name = track.name
# Rename the action to match the track name
if strip.action:
strip.action.name = track.name
print("All NLA strips and actions have been renamed to match their track names.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment