netrender

Downloading results for jobs from blender now uses the current output settings, it doesn't just download the multilayer exr as it used to.

Render output panel now visible under the jobs panel in client mode.
This commit is contained in:
2011-01-08 19:42:26 +00:00
parent 17e733a4fc
commit c0bae16dad
5 changed files with 126 additions and 27 deletions

View File

@@ -410,26 +410,71 @@ class netclientdownload(bpy.types.Operator):
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
if conn:
job = netrender.jobs[netsettings.active_job_index]
job_id = netrender.jobs[netsettings.active_job_index].id
conn.request("GET", "/status", headers={"job-id":job_id})
response = conn.getresponse()
if response.status != http.client.OK:
self.report('ERROR', "Job ID %i not defined on master" % job_id)
return {'ERROR'}
content = response.read()
job = netrender.model.RenderJob.materialize(json.loads(str(content, encoding='utf8')))
conn.close()
finished_frames = []
nb_error = 0
nb_missing = 0
for frame in job.frames:
client.requestResult(conn, job.id, frame.number)
response = conn.getresponse()
buf = response.read()
if response.status != http.client.OK:
print("missing", frame.number)
continue
print("got back", frame.number)
f = open(os.path.join(bpy.path.abspath(netsettings.path), "%06d.exr" % frame.number), "wb")
f.write(buf)
f.close()
conn.close()
if frame.status == DONE:
finished_frames.append(frame.number)
elif frame.status == ERROR:
nb_error += 1
else:
nb_missing += 1
if not finished_frames:
return
frame_ranges = []
first = None
last = None
for i in range(len(finished_frames)):
current = finished_frames[i]
if not first:
first = current
last = current
elif last + 1 == current:
last = current
if last + 1 < current or i + 1 == len(finished_frames):
if first < last:
frame_ranges.append((first, last))
else:
frame_ranges.append((first,))
first = current
last = current
getResults(netsettings.server_address, netsettings.server_port, job_id, job.resolution[0], job.resolution[1], job.resolution[2], frame_ranges)
if nb_error and nb_missing:
self.report('ERROR', "Results downloaded but skipped %i frames with errors and %i unfinished frames" % (nb_error, nb_missing))
elif nb_error:
self.report('ERROR', "Results downloaded but skipped %i frames with errors" % nb_error)
elif nb_missing:
self.report('WARNING', "Results downloaded but skipped %i unfinished frames" % nb_missing)
else:
self.report('INFO', "All results downloaded")
return {'FINISHED'}