[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4120] contrib/py/scripts/addons/ sequencer_extra_actions: merged recursive loader operator into main operator file
carlos padial
palidoestudio2 at gmail.com
Wed Jan 2 14:06:52 CET 2013
Revision: 4120
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4120
Author: carlospadial
Date: 2013-01-02 13:06:47 +0000 (Wed, 02 Jan 2013)
Log Message:
-----------
merged recursive loader operator into main operator file
removed operator_recursive.py file
fixed blender version
Modified Paths:
--------------
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
Removed Paths:
-------------
contrib/py/scripts/addons/sequencer_extra_actions/operators_recursive.py
Modified: contrib/py/scripts/addons/sequencer_extra_actions/__init__.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/__init__.py 2013-01-02 10:15:15 UTC (rev 4119)
+++ contrib/py/scripts/addons/sequencer_extra_actions/__init__.py 2013-01-02 13:06:47 UTC (rev 4120)
@@ -19,9 +19,9 @@
bl_info = {
"name": "Extra Sequencer Actions",
"author": "Turi Scandurra, Carlos Padial",
- "version": (3, 5),
- "blender": (2, 63, 0),
- "api": 49500,
+ "version": (3, 6),
+ "blender": (2, 65, 0),
+ "api": 53177,
"category": "Sequencer",
"location": "Sequencer",
"description": "Collection of extra operators to manipulate VSE strips",
@@ -35,11 +35,11 @@
import imp
imp.reload(operators_extra_actions)
imp.reload(ui)
- imp.reload(operators_recursive)
+ #imp.reload(operators_recursive)
else:
from . import operators_extra_actions
from . import ui
- from . import operators_recursive
+ #from . import operators_recursive
import bpy
import os.path
Modified: contrib/py/scripts/addons/sequencer_extra_actions/functions.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/functions.py 2013-01-02 10:15:15 UTC (rev 4119)
+++ contrib/py/scripts/addons/sequencer_extra_actions/functions.py 2013-01-02 13:06:47 UTC (rev 4120)
@@ -41,6 +41,31 @@
".m2t", ".m2ts", ".mts", ".mv", ".avs", ".wmv", ".ogv",
".dv", ".mpeg", ".mpg", ".mpg2", ".vob", ".mkv", ".flv",
".divx", ".xvid", ".mxf"]
+
+movieextdict = [("1", ".avi", ""),
+ ("2", ".flc", ""),
+ ("3", ".mov", ""),
+ ("4", ".movie", ""),
+ ("5", ".mp4", ""),
+ ("6", ".m4v", ""),
+ ("7", ".m2v", ""),
+ ("8", ".m2t", ""),
+ ("9", ".m2ts", ""),
+ ("10", ".mts", ""),
+ ("11", ".mv", ""),
+ ("12", ".avs", ""),
+ ("13", ".wmv", ""),
+ ("14", ".ogv", ""),
+ ("15", ".dv", ""),
+ ("16", ".mpeg", ""),
+ ("17", ".mpg", ""),
+ ("18", ".mpg2", ""),
+ ("19", ".vob", ""),
+ ("20", ".mkv", ""),
+ ("21", ".flv", ""),
+ ("22", ".divx", ""),
+ ("23", ".xvid", ""),
+ ("24", ".mxf", "")]
# Functions
@@ -70,7 +95,7 @@
imb_ext_movie = [
".avi", ".flc", ".mov", ".movie", ".mp4", ".m4v", ".m2v",
- ".m2t", ".m2ts", ".mts", ".mv", ".avs", ".wmv", ".ogv",
+ ".m2t", ".m2ts", ".mts", ".mv", ".avs", ".wmv", ".ogv", ".ogg",
".dv", ".mpeg", ".mpg", ".mpg2", ".vob", ".mkv", ".flv",
".divx", ".xvid", ".mxf"]
@@ -163,8 +188,75 @@
'''
filelist_sorted = sorted(filelist, key=operator.itemgetter(1))
return filelist_sorted
+
+# recursive load functions
+def loader(filelist):
+ scn = bpy.context.scene
+ if filelist:
+ for i in filelist:
+ setpathinbrowser(i[0], i[1])
+ try:
+ if scn.default_recursive_proxies:
+ bpy.ops.sequencerextra.placefromfilebrowserproxy(
+ proxy_suffix=scn.default_proxy_suffix,
+ proxy_extension=scn.default_proxy_extension,
+ proxy_path=scn.default_proxy_path,
+ build_25=scn.default_build_25,
+ build_50=scn.default_build_50,
+ build_75=scn.default_build_75,
+ build_100=scn.default_build_100)
+ else:
+ bpy.ops.sequencerextra.placefromfilebrowser()
+ except:
+ print("Error loading file (recursive loader error): ", i[1])
+ add_marker(i[1])
+ #self.report({'ERROR_INVALID_INPUT'}, 'Error loading file ')
+ #return {'CANCELLED'}
+ pass
+def onefolder():
+ '''
+ returns a list of MOVIE type files from folder selected in file browser
+ '''
+ filelist = []
+ path, filename = getfilepathfrombrowser()
+ extension = filename.rpartition(".")[2]
+ #extension = scn.default_ext
+ scn = bpy.context.scene
+
+ if detect_strip_type(path + filename) == 'MOVIE':
+ if scn.default_recursive_ext == True:
+ for file in os.listdir(path):
+ if file.rpartition(".")[2] == extension:
+ filelist.append((path, file))
+ else:
+ for file in os.listdir(path):
+ filelist.append((path, file))
+ return (filelist)
+
+def recursive():
+ '''
+ returns a list of MOVIE type files recursively from file browser
+ '''
+ filelist = []
+ path = getpathfrombrowser()
+ scn = bpy.context.scene
+ for i in movieextlist:
+ if i[0] == scn.default_ext:
+ extension = i[1].rpartition(".")[2]
+ #pythonic way to magic:
+ for root, dirs, files in os.walk(path):
+ for f in files:
+ if scn.default_recursive_ext == True:
+ if f.rpartition(".")[2] == extension:
+ filelist.append((root, f))
+ else:
+ filelist.append((root, f))
+ return filelist
+
+
+
# jump to cut functions
def triminout(strip, sin, sout):
start = strip.frame_start + strip.frame_offset_start
@@ -182,3 +274,28 @@
bpy.ops.sequencer.snap(frame=sout)
strip.select_right_handle = False
return {'FINISHED'}
+
+
+#------------ random edit functions...
+
+def randompartition(lst,n,rand):
+ division = len(lst) / float(n)
+ lista = []
+ for i in range(n): lista.append(division)
+ var=0
+ for i in range(n-1):
+ lista[i]+= random.randint(-int(rand*division),int(rand*division))
+ var+=lista[i]
+ if lista[n-1] != len(lst)-var:
+ lista[n-1] = len(lst)-var
+ random.shuffle(lista)
+ division = len(lst) / float(n)
+ count = 0
+ newlist=[]
+ for i in range(n):
+ print(lst[count : int(lista[i]-1)+count])
+ newlist.append([lst[count : int(lista[i]-1)+count]])
+ count += int(lista[i])
+ return newlist
+
+
Modified: contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py 2013-01-02 10:15:15 UTC (rev 4119)
+++ contrib/py/scripts/addons/sequencer_extra_actions/operators_extra_actions.py 2013-01-02 13:06:47 UTC (rev 4120)
@@ -22,12 +22,12 @@
'''
+import bpy
+
import random
import math
+import os, sys
-
-import bpy
-import os.path
from bpy.props import IntProperty
from bpy.props import FloatProperty
from bpy.props import EnumProperty
@@ -35,7 +35,6 @@
from bpy.props import StringProperty
from . import functions
-from . import functions
from . import exiftool
@@ -48,17 +47,17 @@
pass
bpy.types.Scene.default_slide_offset = IntProperty(
- name='Offset',
- description='Number of frames to slide',
- min=-250, max=250,
- default=0)
+ 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(
- name='Duration',
- description='Number of frames to fade',
- min=1, max=250,
- default=scn.render.fps)
+ name='Duration',
+ description='Number of frames to fade',
+ min=1, max=250,
+ default=scn.render.fps)
scn.default_fade_duration = scn.render.fps
bpy.types.Scene.default_fade_amount = FloatProperty(
@@ -124,11 +123,37 @@
description='default build_100',
default=False)
scn.default_build_100 = False
+
+ bpy.types.Scene.default_recursive = BoolProperty(
+ name='Recursive',
+ description='Load in recursive folders',
+ default=False)
+ scn.default_recursive = False
+ bpy.types.Scene.default_recursive_ext = BoolProperty(
+ name='Recursive ext',
+ description='Load only clips with selected extension',
+ default=False)
+ scn.default_recursive_ext = False
+
+ bpy.types.Scene.default_recursive_proxies = BoolProperty(
+ name='Recursive proxies',
+ description='Load in recursive folders + proxies',
+ default=False)
+ scn.default_recursive_proxies = False
+
+ bpy.types.Scene.default_ext = EnumProperty(
+ items=functions.movieextdict,
+ name="ext enum",
+ default="3")
+ scn.default_ext = "3"
+
bpy.types.Scene.scene_initialized = BoolProperty(
name='Init',
default=False)
scn.scene_initialized = True
+
+
return True
@@ -1650,8 +1675,24 @@
a.spaces[0].clip = data
return {'FINISHED'}
+
+
+# RECURSIVE LOADER
+class Sequencer_Extra_RecursiveLoader(bpy.types.Operator):
+ bl_idname = "sequencerextra.recursiveload"
+ bl_label = "recursive load"
+ bl_options = {'REGISTER', 'UNDO'}
+ def execute(self, context):
+ scn = bpy.context.scene
+ if scn["default_recursive"] == True:
+ functions.loader(functions.sortlist(functions.recursive()))
+ else:
+ functions.loader(functions.sortlist(functions.onefolder()))
+ return {'FINISHED'}
+
+
# READ EXIF DATA
class Sequencer_Extra_ReadExifData(bpy.types.Operator):
# load exifdata from strip to scene['metadata'] property
Deleted: contrib/py/scripts/addons/sequencer_extra_actions/operators_recursive.py
===================================================================
--- contrib/py/scripts/addons/sequencer_extra_actions/operators_recursive.py 2013-01-02 10:15:15 UTC (rev 4119)
+++ contrib/py/scripts/addons/sequencer_extra_actions/operators_recursive.py 2013-01-02 13:06:47 UTC (rev 4120)
@@ -1,162 +0,0 @@
-# ##### 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
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list