Last active
January 16, 2025 14:57
-
-
Save catprisbrey/bb884a8221d75d915cda79f8dabb79d7 to your computer and use it in GitHub Desktop.
Blender to Godot - Rename NLA strips to match track names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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