Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import a srt file in bpy API code? #11

Open
cyberpsyche opened this issue Jul 2, 2022 · 1 comment
Open

How to import a srt file in bpy API code? #11

cyberpsyche opened this issue Jul 2, 2022 · 1 comment

Comments

@cyberpsyche
Copy link

I want to use a background style bpy code to handle blender VSE. As Subsimport is a good subtitles process addon in blender. I hope to use import_subtitles() function in my code.

I do it like:

addon_utils.enable("Subsimport")
bpy.ops.sequencerextra.import_subtitles("/Users/sam/Projects/Blender/Study/test.srt")

but I got:

TypeError: Calling operator "bpy.ops.sequencerextra.import_subtitles" error, expected a string enum in ('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS', 'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT', 'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA', 'EXEC_SCREEN')

Can anybody help me to solve this problem ? I don't know how to analog a import file action in the bpy code.
Thanks a lot !

@cyberpsyche
Copy link
Author

After reading the docs of bpy, I found how to do it :)

bpy.ops.sequencerextra.import_subtitles('INVOKE_DEFAULT', filepath="/Users/sam/Projects/Blender/Study/test.srt")

thanks @doakey3 provided such a nice tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant