Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'kinoraw_tools/datamosh.py')
-rw-r--r--kinoraw_tools/datamosh.py123
1 files changed, 59 insertions, 64 deletions
diff --git a/kinoraw_tools/datamosh.py b/kinoraw_tools/datamosh.py
index 0dc9d015..be6ea89d 100644
--- a/kinoraw_tools/datamosh.py
+++ b/kinoraw_tools/datamosh.py
@@ -1,23 +1,29 @@
-import bpy, os
-from bpy.props import IntProperty, StringProperty, BoolProperty
-import subprocess
-
+# gpl: authors Carlos Padial, Turi Scandurra
+
+import bpy
+import os
+from bpy.props import IntProperty
+from bpy.types import (
+ Operator,
+ Panel,
+ )
from . import functions
-proxy_qualities = [ ( "1", "25%", "" ), ( "2", "50%", "" ),
- ( "3", "75%", "" ), ( "4", "100%", "" ),
- ( "5", "none", "" )]
+proxy_qualities = [
+ ("1", "25%", ""), ("2", "50%", ""),
+ ("3", "75%", ""), ("4", "100%", ""),
+ ("5", "none", "")
+ ]
# functions
-
def createdatamosh(context, strip):
preferences = context.user_preferences
prefs = preferences.addons[__package__].preferences
fileinput = bpy.path.abspath(strip.filepath)
- fileoutput = fileinput.rpartition(".")[0]+"_datamosh.avi"
+ fileoutput = fileinput.rpartition(".")[0] + "_datamosh.avi"
if prefs.all_keyframes:
command = "datamosh '{}' -a -o '{}'".format(fileinput, fileoutput)
@@ -27,41 +33,42 @@ def createdatamosh(context, strip):
os.system(command)
return fileoutput
-def createavi(context, strip):
- preferences = context.user_preferences
- prefs = preferences.addons[__package__].preferences
+def createavi(context, strip):
fileinput = bpy.path.abspath(strip.filepath)
- fileoutput = fileinput.rpartition(".")[0]+"_.avi"
+ fileoutput = fileinput.rpartition(".")[0] + "_.avi"
command = "ffmpeg -i '{}' -vcodec copy '{}'".format(fileinput, fileoutput)
print(command)
os.system(command)
+
return fileoutput
-def createavimjpeg(context, strip):
- preferences = context.user_preferences
- prefs = preferences.addons[__package__].preferences
+def createavimjpeg(context, strip):
fileinput = bpy.path.abspath(strip.filepath)
- fileoutput = fileinput.rpartition(".")[0]+"_mjpeg.avi"
+ fileoutput = fileinput.rpartition(".")[0] + "_mjpeg.avi"
command = "ffmpeg -i '{}' -vcodec mjpeg -q:v 1 '{}'".format(fileinput, fileoutput)
print(command)
os.system(command)
- return fileoutput
-
+ return fileoutput
# classes
-
-class CreateAvi(bpy.types.Operator):
- """ """
+class CreateAvi(Operator):
bl_idname = "sequencer.createavi"
- bl_label = "create avi file"
+ bl_label = "Create avi file"
+ bl_description = "Create an avi output file"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ size = IntProperty(
+ name="proxysize",
+ default=1
+ )
@classmethod
def poll(self, context):
@@ -72,20 +79,14 @@ class CreateAvi(bpy.types.Operator):
else:
return False
- size = IntProperty(
- name='proxysize',
- default=1)
- bl_options = {'REGISTER', 'UNDO'}
-
def execute(self, context):
-
- preferences = context.user_preferences
strips = functions.get_selected_strips(context)
for strip in strips:
- #deselect all other strips
- for i in strips: i.select = False
- #select current strip
+ # deselect all other strips
+ for i in strips:
+ i.select = False
+ # select current strip
strip.select = True
if strip.type == "MOVIE":
if self.size == 1:
@@ -93,20 +94,23 @@ class CreateAvi(bpy.types.Operator):
elif self.size == 2:
fileoutput = createavimjpeg(context, strip)
strip.filepath = fileoutput
- #select all strips again
+
+ # select all strips again
for strip in strips:
- try:
- strip.select=True
+ try:
+ strip.select = True
except ReferenceError:
pass
+
bpy.ops.sequencer.reload()
+
return {'FINISHED'}
-class CreateDatamosh(bpy.types.Operator):
- """ """
+class CreateDatamosh(Operator):
bl_idname = "sequencer.createdatamosh"
- bl_label = "create datamosh"
+ bl_label = "Create Datamosh"
+ bl_description = "Create Datamosh"
@classmethod
def poll(self, context):
@@ -118,42 +122,43 @@ class CreateDatamosh(bpy.types.Operator):
return False
def execute(self, context):
-
preferences = context.user_preferences
prefs = preferences.addons[__package__].preferences
strips = functions.get_selected_strips(context)
for strip in strips:
- #deselect all other strips
- for i in strips: i.select = False
- #select current strip
+ # deselect all other strips
+ for i in strips:
+ i.select = False
+ # select current strip
strip.select = True
if strip.type == "MOVIE":
fileoutput = createdatamosh(context, strip)
if prefs.load_glitch:
strip.filepath = fileoutput
- #select all strips again
+
+ # select all strips again
for strip in strips:
- try:
- strip.select=True
+ try:
+ strip.select = True
except ReferenceError:
pass
+
bpy.ops.sequencer.reload()
+
return {'FINISHED'}
-class CreateGlitchToolPanel(bpy.types.Panel):
- """ """
+class CreateGlitchToolPanel(Panel):
bl_label = "Glitch Tools"
bl_idname = "OBJECT_PT_GlitchTool"
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
-
@classmethod
def poll(self, context):
if context.space_data.view_type in {'SEQUENCER',
- 'SEQUENCER_PREVIEW'}:
+ 'SEQUENCER_PREVIEW'}:
strip = functions.act_strip(context)
scn = context.scene
preferences = context.user_preferences
@@ -175,20 +180,10 @@ class CreateGlitchToolPanel(bpy.types.Panel):
layout = self.layout
- layout.operator("sequencer.createavi", text="create avi (same codec)")
- layout.operator("sequencer.createavi", text="create avi (mjpeg)").size=2
-
- strip = functions.act_strip(context)
+ layout.operator("sequencer.createavi", text="Create avi (same codec)")
+ layout.operator("sequencer.createavi", text="Create avi (mjpeg)").size = 2
- layout.prop(prefs,"all_keyframes")
- layout.prop(prefs,"load_glitch")
+ layout.prop(prefs, "all_keyframes")
+ layout.prop(prefs, "load_glitch")
layout.operator("sequencer.createdatamosh")
-
-
-
-
-
-
-
-