[Durian-svn] [6601] use 'final' dir when available.
campbell
institute at blender.org
Thu Jul 8 17:17:39 CEST 2010
Revision: 6601
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=6601
Author: campbell
Date: 2010-07-08 17:17:39 +0200 (Thu, 08 Jul 2010)
Log Message:
-----------
use 'final' dir when available.
Modified Paths:
--------------
pro/scripts/utilities/sequencer_switch_finals.py
Modified: pro/scripts/utilities/sequencer_switch_finals.py
===================================================================
--- pro/scripts/utilities/sequencer_switch_finals.py 2010-07-08 15:14:31 UTC (rev 6600)
+++ pro/scripts/utilities/sequencer_switch_finals.py 2010-07-08 15:17:39 UTC (rev 6601)
@@ -5,6 +5,17 @@
DEBUG = False
+# CONSTANTS
+CONTEXT = 'SEL' # SEL or ALL
+AVI_DIR = "//render/"
+EXR_DIR = "/shared/render"
+SVN_DIR = "/d/pro/scenes"
+
+# LOG ERRORS
+MISSING_BLENDS = [] # avis that have no blends
+MISSING_EXRS = [] # avis that have no exrs
+BAD_AVI_LENGTHS = [] # blends that are not the same length as the avis
+
def blend_path_list(path):
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
@@ -12,11 +23,6 @@
yield os.path.join(dirpath, filename)
-
-AVI_DIR = "//render/"
-EXR_DIR = "/shared/render"
-SVN_DIR = "/d/pro/scenes"
-
blend_lookup = {}
for blend in blend_path_list(SVN_DIR):
basename = os.path.splitext(os.path.basename(blend))[0]
@@ -30,44 +36,48 @@
base_name = os.path.splitext(filepath)[0]
base_name = os.path.basename(base_name)
-
+
if DEBUG:
print(filepath)
-
- if base_name == "05.3b_comp": return "", []
- if base_name == "05.3a_comp": return "", []
-
- blend_name = blend_lookup[base_name]
-
- if blend_name:
+
+ blend_name = blend_lookup.get(base_name, "")
+
+ if not blend_name:
+ MISSING_BLENDS.append(base_name)
+ else:
frame_start, frame_end, scene = blend_render_info.read_blend_rend_chunk(blend_name)[0]
- exr_path = os.path.join(EXR_DIR, base_name)
+ exr_path_current = os.path.join(EXR_DIR, base_name)
+ exr_path_final = os.path.join(EXR_DIR, base_name, "final")
+
# print(base_name)
- if os.path.exists(exr_path):
- # print(exr_path)
- exrs = []
+ for exr_path in (exr_path_final, exr_path_current):
+ if os.path.exists(exr_path):
+ # print(exr_path)
+ exrs = []
- for f in os.listdir(exr_path):
- if f.startswith(base_name) and f.endswith(".exr"):
- f_num = f.split("_")[-1].split(".")[0]
- val = int(f_num)
- if val >= frame_start and val <= frame_end:
- exrs.append(f)
- else:
+ for f in os.listdir(exr_path):
+ if f.startswith(base_name) and f.endswith(".exr"):
+ f_num = f.split("_")[-1].split(".")[0]
+ val = int(f_num)
+ if val >= frame_start and val <= frame_end:
+ exrs.append(f)
+ else:
+ if DEBUG:
+ print("remove_me", f)
+
+ if exrs:
+ exrs.sort()
+ tot = frame_end - frame_start
+ if(tot > len(exrs)):
if DEBUG:
- print("remove_me", f)
+ print("%s missing %d frames" % (base_name, tot - len(exrs)))
+ return "", []
+ # print("PATH:", exr_path)
+ return exr_path, exrs
+ else:
+ print("\texr path missing: %s" % exr_path)
- if exrs:
- exrs.sort()
- tot = frame_end - frame_start
- if(tot > len(exrs)):
- if DEBUG:
- print("%s missing %d frames" % (base_name, tot - len(exrs)))
- return "", []
- print("PATH:", exr_path)
- return exr_path, exrs
-
return "", []
@@ -103,18 +113,19 @@
bpy.ops.sequencer.image_strip_add( \
directory=image_dir, \
- frame_start=-200, \
+ frame_start=-1000, \
channel=1, \
replace_sel=True, \
files=[{"name": image} for image in images])
return bpy.context.scene.sequence_editor.active_strip
- #for seq in bpy.context.scene.sequence_editor.sequences_all[:]:
- for seq in bpy.context.scene.sequence_editor.sequences[:]:
-
- if not seq.selected:
- continue
+ if CONTEXT == 'SEL':
+ seq_ls = bpy.context.selected_sequences[:]
+ else:
+ seq_ls = bpy.context.scene.sequence_editor.sequences_all[:]
+
+ for seq in seq_ls:
if seq.type != 'MOVIE':
continue
@@ -122,11 +133,39 @@
image_dir, image_files = convert_avi_to_exr(filepath)
- if image_dir:
+ if not image_dir:
+ MISSING_EXRS.append(filepath)
+ else:
if len(image_files) == seq.frame_length:
seq.selected = True
- print(filepath, len(image_files), seq.frame_length)
+ print("swapping:", filepath, len(image_files), seq.frame_length)
seq_new = add_strip(image_dir, image_files)
seq_new.swap(seq)
-
\ No newline at end of file
+
+ # XXX, context only
+ for s in bpy.context.sequences:
+ s.selected = False
+ seq_new.selected = True
+ bpy.ops.sequencer.delete()
+ else:
+ BAD_AVI_LENGTHS.append((filepath, "images:", str(len(image_files)), "movie:", str(seq.frame_length)))
+
+ # report errors
+ print("\n")
+
+ print("Missing Blends")
+ for blend in MISSING_BLENDS:
+ print("\t" + blend)
+ print("\n")
+
+ print("Missing EXRS for AVIS")
+ for avi in MISSING_EXRS:
+ # filter out crap
+ if "/render/" in avi:
+ print("\t" + avi)
+ print("\n")
+
+ print("Length mismatch")
+ for blend in BAD_AVI_LENGTHS:
+ print("\t" + " ".join(blend))
More information about the Durian-svn
mailing list