[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3807] contrib/py/scripts/addons: initial commit of extra sequencer tools

carlos padial palidoestudio2 at gmail.com
Wed Oct 3 14:10:47 CEST 2012


Revision: 3807
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3807
Author:   carlospadial
Date:     2012-10-03 12:10:47 +0000 (Wed, 03 Oct 2012)
Log Message:
-----------
initial commit of extra sequencer tools

Added Paths:
-----------
    contrib/py/scripts/addons/sequencer_extra_actions/
    contrib/py/scripts/addons/sequencer_extra_actions/__init__.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/operators_recursive.py
    contrib/py/scripts/addons/sequencer_extra_actions/ui.py

Added: contrib/py/scripts/addons/sequencer_extra_actions/__init__.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/__init__.py	                        (rev 0)
+++ contrib/py/scripts/addons/sequencer_extra_actions/__init__.py	2012-10-03 12:10:47 UTC (rev 3807)
@@ -0,0 +1,94 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+bl_info = {
+    'name': 'Extra Sequencer Actions',
+    'author': 'Turi Scandurra, Carlos Padial',
+    'version': (3, 3),
+    'blender': (2, 6, 3, 17),
+    'api': 49500,
+    'category': 'Sequencer',
+    'location': 'Sequencer',
+    'description': 'Collection of extra operators to manipulate VSE strips',
+    'wiki_url': 'http://wiki.blender.org/index.php/'
+    'Extensions:2.6/Py/Scripts/Sequencer/Extra_Sequencer_Actions',
+    'tracker_url': 'http://projects.blender.org/tracker/index.php?func=detail'\
+        '&aid=30474',
+    'support': 'COMMUNITY'}
+
+if "bpy" in locals():
+    import imp
+    imp.reload(operators_extra_actions)
+    imp.reload(ui)
+    imp.reload(operators_recursive)
+else:
+    from . import operators_extra_actions
+    from . import ui
+    from . import operators_recursive
+
+import bpy
+import os.path
+from bpy.types import Menu
+from bpy.types import Header
+
+
+# Registration
+def register():
+    bpy.utils.register_module(__name__)
+
+    # Append menu entries
+    bpy.types.SEQUENCER_MT_select.prepend(ui.sequencer_select_menu_func)
+    bpy.types.SEQUENCER_MT_strip.prepend(ui.sequencer_strip_menu_func)
+    bpy.types.SEQUENCER_HT_header.append(ui.sequencer_header_func)
+    bpy.types.CLIP_HT_header.append(ui.clip_header_func)
+    bpy.types.CLIP_MT_clip.prepend(ui.clip_clip_menu_func)
+    bpy.types.TIME_MT_frame.prepend(ui.time_frame_menu_func)
+    bpy.types.TIME_HT_header.append(ui.time_header_func)
+
+    # Add keyboard shortcut configuration
+    kc = bpy.context.window_manager.keyconfigs.addon
+    km = kc.keymaps.new(name='Frames')
+    kmi = km.keymap_items.new('screenextra.frame_skip',
+    'RIGHT_ARROW', 'PRESS', ctrl=True, shift=True)
+    kmi.properties.back = False
+    kmi = km.keymap_items.new('screenextra.frame_skip',
+    'LEFT_ARROW', 'PRESS', ctrl=True, shift=True)
+    kmi.properties.back = True
+
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+    #  Remove menu entries
+    bpy.types.SEQUENCER_MT_select.remove(ui.sequencer_select_menu_func)
+    bpy.types.SEQUENCER_MT_strip.remove(ui.sequencer_strip_menu_func)
+    bpy.types.SEQUENCER_HT_header.remove(ui.sequencer_header_func)
+    bpy.types.CLIP_HT_header.remove(ui.clip_header_func)
+    bpy.types.CLIP_MT_clip.remove(ui.clip_clip_menu_func)
+    bpy.types.TIME_MT_frame.remove(ui.time_frame_menu_func)
+    bpy.types.TIME_HT_header.remove(ui.time_header_func)
+
+    #  Remove keyboard shortcut configuration
+    kc = bpy.context.window_manager.keyconfigs.addon
+    km = kc.keymaps['Frames']
+    km.keymap_items.remove(km.keymap_items['screenextra.frame_skip'])
+    km.keymap_items.remove(km.keymap_items['screenextra.frame_skip'])
+
+
+if __name__ == '__main__':
+    register()

Added: contrib/py/scripts/addons/sequencer_extra_actions/functions.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/functions.py	                        (rev 0)
+++ contrib/py/scripts/addons/sequencer_extra_actions/functions.py	2012-10-03 12:10:47 UTC (rev 3807)
@@ -0,0 +1,150 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+import os.path
+import operator
+
+from bpy.props import IntProperty
+from bpy.props import FloatProperty
+from bpy.props import EnumProperty
+from bpy.props import BoolProperty
+from bpy.props import StringProperty
+
+
+# Functions
+
+def add_marker(text):
+    scene = bpy.context.scene
+    markers = scene.timeline_markers
+    mark = markers.new(name=text)
+    mark.frame = scene.frame_current
+
+
+def act_strip(context):
+    try:
+        return context.scene.sequence_editor.active_strip
+    except AttributeError:
+        return None
+
+
+def detect_strip_type(filepath):
+    imb_ext_image = [
+    # IMG
+    ".png", ".tga", ".bmp", ".jpg", ".jpeg", ".sgi", ".rgb",
+    ".rgba", ".tif", ".tiff", ".tx", ".jp2", ".hdr", ".dds",
+    ".dpx", ".cin", ".exr",
+    # IMG QT
+    ".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",
+    ]
+
+    imb_ext_audio = [
+    ".wav", ".ogg", ".oga", ".mp3", ".mp2", ".ac3", ".aac",
+    ".flac", ".wma", ".eac3", ".aif", ".aiff", ".m4a"]
+
+    extension = os.path.splitext(filepath)[1]
+    extension = extension.lower()
+    if extension in imb_ext_image:
+        type = 'IMAGE'
+    elif extension in imb_ext_movie:
+        type = 'MOVIE'
+    elif extension in imb_ext_audio:
+        type = 'SOUND'
+    else:
+        type = None
+
+    return type
+
+
+def getpathfrombrowser():
+    '''
+    returns path from filebrowser
+    '''
+    scn = bpy.context.scene
+    for a in bpy.context.window.screen.areas:
+        if a.type == 'FILE_BROWSER':
+            params = a.spaces[0].params
+            break
+    try:
+        params
+    except UnboundLocalError:
+        print("no browser")
+        #self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
+        return {'CANCELLED'}
+    path = params.directory
+    return path
+
+
+def getfilepathfrombrowser():
+    '''
+    returns path and file from filebrowser
+    '''
+    scn = bpy.context.scene
+    for a in bpy.context.window.screen.areas:
+        if a.type == 'FILE_BROWSER':
+            params = a.spaces[0].params
+            break
+    try:
+        params
+    except UnboundLocalError:
+        print("no browser")
+        #self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
+        return {'CANCELLED'}
+
+    if params.filename == '':
+        print("no file selected")
+        #self.report({'ERROR_INVALID_INPUT'}, 'No file selected')
+        return {'CANCELLED'}
+    path = params.directory
+    filename = params.filename
+    return path, filename
+
+
+def setpathinbrowser(path, file):
+    '''
+    set path and file in the filebrowser
+    '''
+    scn = bpy.context.scene
+    for a in bpy.context.window.screen.areas:
+        if a.type == 'FILE_BROWSER':
+            params = a.spaces[0].params
+            break
+    try:
+        params
+    except UnboundLocalError:
+        print("no browser")
+        #self.report({'ERROR_INVALID_INPUT'}, 'No visible File Browser')
+        return {'CANCELLED'}
+
+    params.directory = path
+    params.filename = file
+    return path, params
+
+
+def sortlist(filelist):
+    '''
+    given a list of tuplas (path, filename) returns a list sorted by filename
+    '''
+    filelist_sorted = sorted(filelist, key=operator.itemgetter(1))
+    return filelist_sorted

Added: contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py	                        (rev 0)
+++ contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py	2012-10-03 12:10:47 UTC (rev 3807)
@@ -0,0 +1,1497 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+import os.path
+from bpy.props import IntProperty
+from bpy.props import FloatProperty
+from bpy.props import EnumProperty
+from bpy.props import BoolProperty
+from bpy.props import StringProperty
+
+from . import functions
+
+
+# Initialization
+def initSceneProperties(scn):
+    try:
+        if bpy.context.scene.scene_initialized == True:
+            return False
+    except AttributeError:
+        pass
+
+    bpy.types.Scene.default_slide_offset = IntProperty(
+    name='Offset',
+    description='Number of frames to slide',
+    min=-250, max=250,
+    default=0)
+    scn.default_slide_offset = 0
+
+    bpy.types.Scene.default_fade_duration = IntProperty(

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list