Created
March 11, 2021 06:20
-
-
Save tin2tin/9b24dff1ab4294e9562724614e450599 to your computer and use it in GitHub Desktop.
Import and select a sound strip in the sequencer
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 | |
# Import and select a sound strip in the sequencer, then run scipt. | |
# A speaker object and a sound data-block will be created and linked. | |
active = bpy.context.scene.sequence_editor.active_strip | |
if active and active.type == "SOUND": | |
path = bpy.path.abspath(active.sound.filepath) | |
bpy.ops.object.speaker_add() | |
speaker = bpy.context.object | |
speaker.data.sound = bpy.data.sounds.load(path) | |
speaker.data.update_tag() | |
bpy.context.collection.objects.unlink(speaker) | |
bpy.context.collection.objects.link(speaker) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment