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:
authorCampbell Barton <ideasman42@gmail.com>2013-01-06 14:15:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-06 14:15:19 +0400
commit2e29310724e00291e1138bebccb0965a676f626f (patch)
tree48a57f7366330100e760127d1bb932578b904917 /io_sequencer_edl
parent8a83ea85304be70b0445d32c0f511f7169e136f4 (diff)
fixes to EDL import
- allow editmode 'a1', 'a2', 'a3'... etc - allow editmode 'none' - accept black as 'bl', 'bw', 'blk', 'black' - black was being imported as grey - add global frame offset option for importing - fix error naming strips - if a reel has an extension, match with the extension stripped as well --- so foobar.mov will find foobar.avi file.
Diffstat (limited to 'io_sequencer_edl')
-rw-r--r--io_sequencer_edl/__init__.py26
-rw-r--r--io_sequencer_edl/import_edl.py22
-rw-r--r--io_sequencer_edl/parse_edl.py16
3 files changed, 49 insertions, 15 deletions
diff --git a/io_sequencer_edl/__init__.py b/io_sequencer_edl/__init__.py
index 89b0132d..09ee806d 100644
--- a/io_sequencer_edl/__init__.py
+++ b/io_sequencer_edl/__init__.py
@@ -79,7 +79,7 @@ class ReloadEDL(Operator):
for reel in edl_import_info.reels}
reels = elist.reels_as_dict()
- reels = [k for k in reels.keys() if k != "bw"]
+ reels = [k for k in reels.keys() if k not in parse_edl.BLACK_ID]
# re-create reels collection, keeping old values
bl_reels.clear()
@@ -116,6 +116,7 @@ class FindReelsEDL(Operator):
# walk over .avi, .mov, .wav etc.
def media_file_walker(path):
+ ext_check = bpy.path.extensions_movie | bpy.path.extensions_audio
for dirpath, dirnames, filenames in os.walk(path):
# skip '.svn'
if dirpath.startswith("."):
@@ -123,9 +124,7 @@ class FindReelsEDL(Operator):
for filename in filenames:
fileonly, ext = os.path.splitext(filename)
ext_lower = ext.lower()
- if ext_lower in bpy.path.extensions_movie:
- yield os.path.join(dirpath, filename), fileonly
- elif ext_lower in bpy.path.extensions_audio:
+ if ext_lower in ext_check:
yield os.path.join(dirpath, filename), fileonly
scene = context.scene
@@ -143,6 +142,11 @@ class FindReelsEDL(Operator):
for reel_names, reel_files_found, reel in bl_reels_search:
reel_names_list = []
reel_names_list.append(reel.name.lower())
+
+ # add non-extension version of the reel name
+ if "." in reel_names_list[-1]:
+ reel_names_list.append(os.path.splitext(reel_names_list[-1])[0])
+
# use the filepath if set
reel_filepath = reel.filepath
if reel_filepath:
@@ -156,6 +160,12 @@ class FindReelsEDL(Operator):
if "_" in reel_filepath]
reel_names.update(reel_names_list)
+ # debug info
+ print("Searching or %d reels" % len(bl_reels_search))
+ for reel_names, reel_files_found, reel in bl_reels_search:
+ print("Reel: %r --> (%s)" % (reel.name, " ".join(sorted(reel_names))))
+ print()
+
for filename, fileonly in media_file_walker(self.directory):
for reel_names, reel_files_found, reel in bl_reels_search:
if fileonly.lower() in reel_names:
@@ -227,7 +237,8 @@ class ImportEDL(Operator):
msg = import_edl.load_edl(
scene, filepath,
- reel_filepaths, reel_offsets)
+ reel_filepaths, reel_offsets,
+ edl_import_info.frame_offset)
if msg:
self.report({'WARNING'}, msg)
@@ -258,7 +269,9 @@ class EDLImportInfo(bpy.types.PropertyGroup):
reels = bpy.props.CollectionProperty(
type=EDLReelInfo,
)
-
+ frame_offset = IntProperty(
+ name="Global Frame Offset",
+ )
# ----------------------------------------------------------------------------
# Panel to show EDL Import UI
@@ -278,6 +291,7 @@ class SEQUENCER_PT_import_edl(bpy.types.Panel):
layout.operator(ImportEDL.bl_idname)
col = layout.column(align=True)
+ col.prop(edl_import_info, "frame_offset")
col.prop(edl_import_info, "filepath", text="")
col.operator(ReloadEDL.bl_idname, icon='FILE_REFRESH')
diff --git a/io_sequencer_edl/import_edl.py b/io_sequencer_edl/import_edl.py
index 65e4db4a..24faaef7 100644
--- a/io_sequencer_edl/import_edl.py
+++ b/io_sequencer_edl/import_edl.py
@@ -89,7 +89,7 @@ def replace_ext(path, ext):
return path[:path.rfind(".") + 1] + ext
-def load_edl(scene, filename, reel_files, reel_offsets):
+def load_edl(scene, filename, reel_files, reel_offsets, global_offset):
"""
reel_files - key:reel <--> reel:filename
"""
@@ -123,7 +123,10 @@ def load_edl(scene, filename, reel_files, reel_offsets):
prev_edit = None
for edit in edits:
print(edit)
- frame_offset = reel_offsets[edit.reel]
+ if edit.reel.lower() in parse_edl.BLACK_ID:
+ frame_offset = 0
+ else:
+ frame_offset = reel_offsets[edit.reel]
src_start = int(edit.srcIn) + frame_offset
src_end = int(edit.srcOut) + frame_offset
@@ -133,6 +136,10 @@ def load_edl(scene, filename, reel_files, reel_offsets):
rec_end = int(edit.recOut) + 1
rec_length = rec_end - rec_start
+ # apply global offset
+ rec_start += global_offset
+ rec_end += global_offset
+
# print src_length, rec_length, src_start
if edit.m2 is not None:
@@ -148,16 +155,17 @@ def load_edl(scene, filename, reel_files, reel_offsets):
strip = None
final_strips = []
- if edit.reel.lower() == "bw":
+ if edit.reel.lower() in parse_edl.BLACK_ID:
strip = sequence_editor.sequences.new_effect(
- name="Wipe",
+ name="Color",
type='COLOR',
start_frame=rec_start,
+ end_frame=rec_start + max(1, rec_length),
channel=track + 1)
strip_list.append(strip)
-
- strip.frame_duration = rec_length # for color its simple
final_strips.append(strip)
+ strip.color = 0.0, 0.0, 0.0
+
else:
path_full = reel_files[edit.reel]
path_dironly, path_fileonly = os.path.split(path_full)
@@ -272,7 +280,7 @@ def load_edl(scene, filename, reel_files, reel_offsets):
if final_strips:
for strip in final_strips:
# strip.frame_duration = length
- final_strip.name = edit.as_name()
+ strip.name = edit.as_name()
edit.custom_data[:] = final_strips
# track = not track
prev_edit = edit
diff --git a/io_sequencer_edl/parse_edl.py b/io_sequencer_edl/parse_edl.py
index 909b1ecc..683e67bc 100644
--- a/io_sequencer_edl/parse_edl.py
+++ b/io_sequencer_edl/parse_edl.py
@@ -223,9 +223,9 @@ EDIT_VIDEO_AUDIO = 1 << enum
enum += 1
EDIT_DICT = {
+ "none": 0, # TODO, investigate this more.
"v": EDIT_VIDEO,
"a": EDIT_AUDIO,
- "a2": EDIT_AUDIO, # TODO, what is this really?, FCP uses.
"aa": EDIT_AUDIO_STEREO,
"va": EDIT_VIDEO_AUDIO,
"b": EDIT_VIDEO_AUDIO,
@@ -248,6 +248,13 @@ enum += 1
KEY_OUT = enum # K O
enum += 1
+BLACK_ID = {
+ "bw",
+ "bl",
+ "blk",
+ "black",
+ }
+
"""
Most sytems:
@@ -290,6 +297,10 @@ class EditDecision:
def edit_flags_to_text(flag):
return "/".join([item for item, val in EDIT_DICT.items() if val & flag])
+ @staticmethod
+ def strip_digits(text):
+ return "".join(filter(lambda x: not x.isdigit(), text))
+
def __init__(self, text=None, fps=25):
# print text
self.number = -1
@@ -351,7 +362,8 @@ class EditDecision:
# AA/V can be an edit type
self.edit_type = 0
for edit_type in line[index].lower().split("/"):
- self.edit_type |= EDIT_DICT[edit_type]
+ # stripping digits is done because we don't do 'a1, a2...'
+ self.edit_type |= EDIT_DICT[EditDecision.strip_digits(edit_type)]
index += 1
tx_name = "".join([c for c in line[index].lower() if not c.isdigit()])