Skip to content

Instantly share code, notes, and snippets.

@tin2tin
Created September 22, 2018 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tin2tin/c28d14b2ad1610c45536238e59561bb1 to your computer and use it in GitHub Desktop.
Save tin2tin/c28d14b2ad1610c45536238e59561bb1 to your computer and use it in GitHub Desktop.
Edit Blender VSE Source in External App.
import bpy
import os
import subprocess
bl_info = {
"name": "Edit Source Externally",
"description": "Open VSE audio/video source with an external program.",
"author": "Joe Button",
"version": (1, 0),
"blender": (2, 73, 0),
"location": "Sequencer > Menu Header > Strip > Edit Externally",
"warning": "Highly sketchy",
"wiki_url": "",
"category": "Sequencer"
}
# Correct the paths. NB. overwrite sourcefile and close external program for source to be updated in VSE
class OpenStripSource(bpy.types.Operator):
"""Open VSE Strip Source"""
bl_idname = "vse.openstripsource"
bl_label = "Edit Externally"
# Change these if you want to use different external programs or if they have different paths on your computer:
openers = {
# Download: http://www.ocenaudio.com/
"SOUND": ("C:\\Users\\User\\AppData\Local\\ocenaudio\\ocenaudio.exe", "{filename}"),
# Download: https://sourceforge.net/projects/vdfiltermod/files/latest/download
"MOVIE": ("C:\\Users\\User\\Downloads\\VirtualDub2_42154\\VirtualDub64.exe", "{filename}"),
# Download: https://www.getpaint.net/
"IMAGE": ("C:\\Program Files\\paint.net\\PaintDotNet.exe", "{filename}"),
}
def execute(self, context):
c = context.scene.sequence_editor.active_strip
#print(c)
try:
opener = self.openers[c.type]
except KeyError:
self.report({'ERROR'}, "No opener for '%s' strip type" % c.type)
return {"CANCELLED"}
if c.type=="IMAGE":
filename = os.path.abspath(
bpy.path.abspath(c.directory+c.name)
)
elif c.type=="SOUND":
filename = os.path.abspath(
bpy.path.abspath(c.sound.filepath)
)
else:
filename = os.path.abspath(
bpy.path.abspath(c.filepath)
)
print(filename)
opener = [s.format(filename=filename) for s in opener]
output=subprocess.run(opener)
return {'FINISHED'}
def menu_func(self, context):
self.layout.operator(OpenStripSource.bl_idname)
def register():
bpy.utils.register_class(OpenStripSource)
bpy.types.SEQUENCER_MT_strip.append(menu_func)
def unregister():
bpy.utils.unregister_class(OpenStripSource)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment