[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4088] contrib/py/scripts/addons/ sequencer_extra_actions: Added Operator 'Extend to Fill'. \nAdded minimal error handling for Carlos' ReadExifData. \nRestored pep-80 compliance.

Turi Scandurra salvatore.scandurra at gmail.com
Fri Dec 21 16:21:11 CET 2012


Revision: 4088
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4088
Author:   turi
Date:     2012-12-21 15:21:08 +0000 (Fri, 21 Dec 2012)
Log Message:
-----------
Added Operator 'Extend to Fill'.\nAdded minimal error handling for Carlos' ReadExifData.\nRestored pep-80 compliance.

Modified Paths:
--------------
    contrib/py/scripts/addons/sequencer_extra_actions/__init__.py
    contrib/py/scripts/addons/sequencer_extra_actions/exiftool.py
    contrib/py/scripts/addons/sequencer_extra_actions/functions.py
    contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py
    contrib/py/scripts/addons/sequencer_extra_actions/ui.py

Modified: contrib/py/scripts/addons/sequencer_extra_actions/__init__.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/__init__.py	2012-12-21 02:57:40 UTC (rev 4087)
+++ contrib/py/scripts/addons/sequencer_extra_actions/__init__.py	2012-12-21 15:21:08 UTC (rev 4088)
@@ -19,7 +19,7 @@
 bl_info = {
     "name": "Extra Sequencer Actions",
     "author": "Turi Scandurra, Carlos Padial",
-    "version": (3, 4),
+    "version": (3, 5),
     "blender": (2, 63, 0),
     "api": 49500,
     "category": "Sequencer",

Modified: contrib/py/scripts/addons/sequencer_extra_actions/exiftool.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/exiftool.py	2012-12-21 02:57:40 UTC (rev 4087)
+++ contrib/py/scripts/addons/sequencer_extra_actions/exiftool.py	2012-12-21 15:21:08 UTC (rev 4088)
@@ -87,6 +87,8 @@
 
 # This code has been adapted from Lib/os.py in the Python source tree
 # (sha1 265e36e277f3)
+
+
 def _fscodec():
     encoding = sys.getfilesystemencoding()
     errors = "strict"
@@ -101,8 +103,8 @@
     def fsencode(filename):
         """
         Encode filename to the filesystem encoding with 'surrogateescape' error
-        handler, return bytes unchanged. On Windows, use 'strict' error handler if
-        the file system encoding is 'mbcs' (which is the default encoding).
+        handler, return bytes unchanged. On Windows, use 'strict' error handler
+        if the file system encoding is 'mbcs' (which is the default encoding).
         """
         if isinstance(filename, bytes):
             return filename
@@ -114,6 +116,7 @@
 fsencode = _fscodec()
 del _fscodec
 
+
 class ExifTool(object):
     """Run the `exiftool` command-line tool and communicate to it.
 

Modified: contrib/py/scripts/addons/sequencer_extra_actions/functions.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/functions.py	2012-12-21 02:57:40 UTC (rev 4087)
+++ contrib/py/scripts/addons/sequencer_extra_actions/functions.py	2012-12-21 15:21:08 UTC (rev 4088)
@@ -33,17 +33,16 @@
     ".rgba", ".tif", ".tiff", ".tx", ".jp2", ".hdr", ".dds",
     ".dpx", ".cin", ".exr", ".rw2",
     # IMG QT
-    ".gif", ".psd", ".pct", ".pict", ".pntg", ".qtif"]  
+    ".gif", ".psd", ".pct", ".pict", ".pntg", ".qtif"]
 
 
 imb_ext_movie = [
     ".avi", ".flc", ".mov", ".movie", ".mp4", ".m4v", ".m2v",
     ".m2t", ".m2ts", ".mts", ".mv", ".avs", ".wmv", ".ogv",
     ".dv", ".mpeg", ".mpg", ".mpg2", ".vob", ".mkv", ".flv",
-    ".divx", ".xvid", ".mxf",
-    ]    
-  
+    ".divx", ".xvid", ".mxf"]
 
+
 # Functions
 
 def add_marker(text):
@@ -73,8 +72,7 @@
     ".avi", ".flc", ".mov", ".movie", ".mp4", ".m4v", ".m2v",
     ".m2t", ".m2ts", ".mts", ".mv", ".avs", ".wmv", ".ogv",
     ".dv", ".mpeg", ".mpg", ".mpg2", ".vob", ".mkv", ".flv",
-    ".divx", ".xvid", ".mxf",
-    ]
+    ".divx", ".xvid", ".mxf"]
 
     imb_ext_audio = [
     ".wav", ".ogg", ".oga", ".mp3", ".mp2", ".ac3", ".aac",
@@ -167,26 +165,20 @@
     return filelist_sorted
 
 
-#------------ jump to cut functions...
-
-
-def triminout(strip,sin,sout):
-    start = strip.frame_start+strip.frame_offset_start 
-    end = start+strip.frame_final_duration
+# jump to cut functions
+def triminout(strip, sin, sout):
+    start = strip.frame_start + strip.frame_offset_start
+    end = start + strip.frame_final_duration
     if end > sin:
         if start < sin:
-            strip.select_right_handle = False            
+            strip.select_right_handle = False
             strip.select_left_handle = True
             bpy.ops.sequencer.snap(frame=sin)
             strip.select_left_handle = False
     if start < sout:
         if end > sout:
-            strip.select_left_handle = False            
+            strip.select_left_handle = False
             strip.select_right_handle = True
             bpy.ops.sequencer.snap(frame=sout)
-            strip.select_right_handle = False    
+            strip.select_right_handle = False
     return {'FINISHED'}
-
-
-
-

Modified: contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py	2012-12-21 02:57:40 UTC (rev 4087)
+++ contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py	2012-12-21 15:21:08 UTC (rev 4088)
@@ -22,7 +22,8 @@
 
 '''
 
-import random, math
+import random
+import math
 
 
 import bpy
@@ -424,7 +425,7 @@
         if meta_level > 0:
             seq = seq.meta_stack[meta_level - 1]
         #strip = functions.act_strip(context)
-        for strip in context.selected_editable_sequences:       
+        for strip in context.selected_editable_sequences:
             cut_frame = strip.frame_final_start
             next_edit = 300000
             bpy.ops.sequencer.select_all(action='DESELECT')
@@ -1129,6 +1130,50 @@
         return context.window_manager.invoke_props_dialog(self)
 
 
+# EXTEND TO FILL
+class Sequencer_Extra_ExtendToFill(bpy.types.Operator):
+    bl_idname = 'sequencerextra.extendtofill'
+    bl_label = 'Extend to Fill'
+    bl_description = 'Extend active strip forward to fill adjacent space'
+    bl_options = {'REGISTER', 'UNDO'}
+
+    @classmethod
+    def poll(cls, context):
+        scn = context.scene
+        if scn and scn.sequence_editor and scn.sequence_editor.active_strip:
+            return True
+        else:
+            return False
+
+    def execute(self, context):
+        scn = context.scene
+        seq = scn.sequence_editor
+        meta_level = len(seq.meta_stack)
+        if meta_level > 0:
+            seq = seq.meta_stack[meta_level - 1]
+        strip = functions.act_strip(context)
+        chn = strip.channel
+        stf = strip.frame_final_end
+        enf = 300000
+
+        for i in seq.sequences:
+            ffs = i.frame_final_start
+            if (i.channel == chn and ffs > stf):
+                if ffs < enf:
+                    enf = ffs
+        if enf == 300000 and stf < scn.frame_end:
+            enf = scn.frame_end
+
+        if enf == 300000 or enf == stf:
+            self.report({'ERROR_INVALID_INPUT'}, 'Unable to extend')
+            return {'CANCELLED'}
+        else:
+            strip.frame_final_end = enf
+
+        bpy.ops.sequencer.reload()
+        return {'FINISHED'}
+
+
 # DISTRIBUTE
 class Sequencer_Extra_Distribute(bpy.types.Operator):
     bl_idname = 'sequencerextra.distribute'
@@ -1467,9 +1512,9 @@
     bl_description = 'Create a Movieclip strip from a MOVIE or IMAGE strip'
 
     """
-    When a movie or image strip is selected, this operator creates a movieclip 
-    or find the correspondent movieclip that already exists for this footage, 
-    and add a VSE clip strip with same cuts the original strip has. 
+    When a movie or image strip is selected, this operator creates a movieclip
+    or find the correspondent movieclip that already exists for this footage,
+    and add a VSE clip strip with same cuts the original strip has.
     It can convert movie strips and image sequences, both with hard cuts or
     soft cuts.
     """
@@ -1486,7 +1531,6 @@
     def execute(self, context):
         strip = functions.act_strip(context)
         scn = context.scene
-        
 
         if strip.type == 'MOVIE':
             #print("movie", strip.frame_start)
@@ -1502,7 +1546,7 @@
                 try:
                     data = bpy.data.movieclips.load(filepath=path)
                     newstrip = bpy.ops.sequencer.movieclip_strip_add(\
-                        replace_sel = True, overlap=False, clip=data.name)
+                        replace_sel=True, overlap=False, clip=data.name)
                     newstrip = functions.act_strip(context)
                     newstrip.frame_start = strip.frame_start\
                         - strip.animation_offset_start
@@ -1513,21 +1557,23 @@
                 except:
                     self.report({'ERROR_INVALID_INPUT'}, 'Error loading file')
                     return {'CANCELLED'}
-                
+
             else:
                 try:
                     newstrip = bpy.ops.sequencer.movieclip_strip_add(\
-                        replace_sel = True, overlap=False, clip=data.name)
+                        replace_sel=True, overlap=False, clip=data.name)
                     newstrip = functions.act_strip(context)
                     newstrip.frame_start = strip.frame_start\
                         - strip.animation_offset_start
-                    #i need to declare the strip this way in order to get triminout() working
-                    clip = bpy.context.scene.sequence_editor.sequences[newstrip.name]
-                    # i cannot change this movie clip atributes via scripts... 
+                    # i need to declare the strip this way in order
+                    # to get triminout() working
+                    clip = bpy.context.scene.sequence_editor.sequences[\
+                        newstrip.name]
+                    # i cannot change these movie clip attributes via scripts
                     # but it works in the python console...
                     #clip.animation_offset_start = strip.animation.offset_start
                     #clip.animation_offset_end = strip.animation.offset_end
-                    #clip.frame_final_duration = strip.frame_final_duration 
+                    #clip.frame_final_duration = strip.frame_final_duration
                     tin = strip.frame_offset_start + strip.frame_start
                     tout = tin + strip.frame_final_duration
                     #print(newstrip.frame_start, strip.frame_start, tin, tout)
@@ -1535,16 +1581,17 @@
                 except:
                     self.report({'ERROR_INVALID_INPUT'}, 'Error loading file')
                     return {'CANCELLED'}
-                 
+
         elif strip.type == 'IMAGE':
             #print("image")
             base_dir = bpy.path.abspath(strip.directory)
-            scn.frame_current = strip.frame_start - strip.animation_offset_start
-            # searching for the first frame of the sequencer. This is mandatory 
-            # for hard cutted sequence strips to be correctly converted, 
+            scn.frame_current = strip.frame_start -\

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list