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:
@@ -28,7 +28,7 @@ try:
|
||||
except:
|
||||
bpy = None
|
||||
|
||||
VERSION = bytes("1.0", encoding='utf8')
|
||||
VERSION = bytes("1.2", encoding='utf8')
|
||||
|
||||
# Jobs status
|
||||
JOB_WAITING = 0 # before all data has been entered
|
||||
@@ -223,8 +223,43 @@ def prefixPath(prefix_directory, file_path, prefix_path, force = False):
|
||||
|
||||
return full_path
|
||||
|
||||
def getResults(server_address, server_port, job_id, resolution_x, resolution_y, resolution_percentage, frame_ranges):
|
||||
frame_arguments = []
|
||||
for r in frame_ranges:
|
||||
if len(r) == 2:
|
||||
frame_arguments.extend(["-s", str(r[0]), "-e", str(r[1]), "-a"])
|
||||
else:
|
||||
frame_arguments.extend(["-f", str(r[0])])
|
||||
|
||||
filepath = os.path.join(bpy.app.tempdir, "netrender_temp.blend")
|
||||
bpy.ops.wm.save_as_mainfile(filepath=filepath, copy=True, check_existing=False)
|
||||
|
||||
process = subprocess.Popen([sys.argv[0], "-b", "-noaudio", filepath, "-P", __file__] + frame_arguments + ["--", "GetResults", server_address, str(server_port), job_id, str(resolution_x), str(resolution_y), str(resolution_percentage)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
while process.poll() is None:
|
||||
process.stdout.read(1024) # empty buffer to be sure
|
||||
process.stdout.read()
|
||||
|
||||
os.remove(filepath)
|
||||
|
||||
return
|
||||
|
||||
def _getResults(server_address, server_port, job_id, resolution_x, resolution_y, resolution_percentage):
|
||||
render = bpy.context.scene.render
|
||||
|
||||
netsettings = bpy.context.scene.network_render
|
||||
|
||||
netsettings.server_address = server_address
|
||||
netsettings.server_port = int(server_port)
|
||||
netsettings.job_id = job_id
|
||||
|
||||
render.engine = 'NET_RENDER'
|
||||
render.resolution_x = int(resolution_x)
|
||||
render.resolution_y = int(resolution_y)
|
||||
render.resolution_percentage = int(resolution_percentage)
|
||||
|
||||
|
||||
def getFileInfo(filepath, infos):
|
||||
process = subprocess.Popen([sys.argv[0], "-b", "-noaudio", filepath, "-P", __file__, "--"] + infos, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
process = subprocess.Popen([sys.argv[0], "-b", "-noaudio", filepath, "-P", __file__, "--", "FileInfo"] + infos, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
stdout = bytes()
|
||||
while process.poll() is None:
|
||||
stdout += process.stdout.read(1024)
|
||||
@@ -237,12 +272,17 @@ def getFileInfo(filepath, infos):
|
||||
values = [eval(v[1:].strip()) for v in stdout.split("\n") if v.startswith("$")]
|
||||
|
||||
return values
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import bpy
|
||||
try:
|
||||
start = sys.argv.index("--") + 1
|
||||
except ValueError:
|
||||
start = 0
|
||||
for info in sys.argv[start:]:
|
||||
print("$", eval(info))
|
||||
action, *args = sys.argv[start:]
|
||||
|
||||
if action == "FileInfo":
|
||||
for info in args:
|
||||
print("$", eval(info))
|
||||
elif action == "GetResults":
|
||||
_getResults(args[0], args[1], args[2], args[3], args[4], args[5])
|
||||
|
||||
Reference in New Issue
Block a user