mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Subjob Zip Files (#18)
* Transfer any uploaded zip files to subjobs instead of extracted zips * Fix Blender naming scheme
This commit is contained in:
@@ -357,7 +357,8 @@ def add_job_handler():
|
||||
logger.info(f"Import complete for {loaded_project_local_path.split(server.config['UPLOAD_FOLDER'])[-1]}")
|
||||
|
||||
# process uploaded zip files
|
||||
if loaded_project_local_path.lower().endswith('.zip'):
|
||||
zip_path = loaded_project_local_path if loaded_project_local_path.lower().endswith('.zip') else None
|
||||
if zip_path:
|
||||
zip_path = loaded_project_local_path
|
||||
work_path = os.path.dirname(zip_path)
|
||||
try:
|
||||
@@ -387,12 +388,12 @@ def add_job_handler():
|
||||
for job_data in jobs_list:
|
||||
try:
|
||||
# prepare output paths
|
||||
output_dir = os.path.join(job_dir, job_data.get('name', None) or 'output')
|
||||
output_dir = os.path.join(job_dir, job_data.get('name') if len(jobs_list) > 1 else 'output')
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# get new output path in output_dir
|
||||
job_data['output_path'] = os.path.join(output_dir, os.path.basename(
|
||||
job_data.get('name', None) or job_data.get('output_path', None) or loaded_project_local_path
|
||||
job_data.get('output_path', None) or loaded_project_local_path
|
||||
))
|
||||
|
||||
# create & configure jobs
|
||||
@@ -409,7 +410,7 @@ def add_job_handler():
|
||||
|
||||
# determine if we can / should split the job
|
||||
if server.config.get('enable_split_jobs', False) and (worker.total_frames > 1) and not worker.parent:
|
||||
create_subjobs(worker, job_data, loaded_project_local_path)
|
||||
create_subjobs(worker, job_data, zip_path or loaded_project_local_path)
|
||||
|
||||
RenderQueue.add_to_render_queue(worker, force_start=job_data.get('force_start', False))
|
||||
make_job_ready(worker.id)
|
||||
|
||||
@@ -40,7 +40,8 @@ class BlenderRenderWorker(BaseRenderWorker):
|
||||
if self.camera:
|
||||
cmd.extend(['--python-expr', f"import bpy;bpy.context.scene.camera = bpy.data.objects['{self.camera}'];"])
|
||||
|
||||
cmd.extend(['-E', self.blender_engine, '-o', self.output_path, '-F', self.export_format])
|
||||
path_without_ext = os.path.splitext(self.output_path)[0] + "_"
|
||||
cmd.extend(['-E', self.blender_engine, '-o', path_without_ext, '-F', self.export_format])
|
||||
|
||||
# set frame range
|
||||
cmd.extend(['-s', self.start_frame, '-e', self.end_frame, '-a'])
|
||||
@@ -121,10 +122,10 @@ class BlenderRenderWorker(BaseRenderWorker):
|
||||
return most_common_ext
|
||||
|
||||
output_dir_files = os.listdir(os.path.dirname(self.output_path))
|
||||
if self.total_frames > 1 and len(output_dir_files) > 1:
|
||||
if self.total_frames > 1 and len(output_dir_files) > 1 and not self.parent:
|
||||
logger.info("Generating preview for image sequence")
|
||||
try:
|
||||
pattern = self.output_path + "%04d" + most_common_extension(output_dir_files)
|
||||
pattern = os.path.splitext(self.output_path)[0] + "_%04d" + most_common_extension(output_dir_files)
|
||||
image_sequence_to_video(source_glob_pattern=pattern,
|
||||
output_path=self.output_path + '.mov',
|
||||
framerate=self.scene_info['fps'])
|
||||
|
||||
Reference in New Issue
Block a user