netrender

- Temporary fix for linked libs repathing (didn't work correctly when using relative links).

- autorefresh only for main page (on job page, it's really annoying because it keeps reseting results preview, so until that's fixed, off it is).
This commit is contained in:
Martin Poirier 2010-07-17 18:40:00 +00:00
parent fd31436897
commit 84b291462f
4 changed files with 13 additions and 7 deletions

@ -27,8 +27,9 @@ def get(handler):
def output(text):
handler.wfile.write(bytes(text, encoding='utf8'))
def head(title):
def head(title, refresh = False):
output("<html><head>")
if refresh:
output("<meta http-equiv='refresh' content=5>")
output("<script src='/html/netrender.js' type='text/javascript'></script>")
# output("<script src='/html/json2.js' type='text/javascript'></script>")
@ -104,7 +105,7 @@ def get(handler):
f.close()
elif handler.path == "/html" or handler.path == "/":
handler.send_head(content = "text/html")
head("NetRender")
head("NetRender", refresh = True)
output("<h2>Jobs</h2>")

@ -83,14 +83,17 @@ def process(paths):
elif paths[i].endswith(".bobj.gz"):
path_map[os.path.split(paths[i])[0]] = os.path.split(paths[i+1])[0]
else:
path_map[paths[i]] = paths[i+1]
path_map[os.path.split(paths[i])[1]] = paths[i+1]
# TODO original paths aren't really the orignal path (they are the normalized path
# so we repath using the filenames only.
###########################
# LIBRARIES
###########################
for lib in bpy.data.libraries:
file_path = bpy.utils.expandpath(lib.filepath)
new_path = path_map.get(file_path, None)
new_path = path_map.get(os.path.split(file_path)[1], None)
if new_path:
lib.filepath = new_path
@ -100,7 +103,7 @@ def process(paths):
for image in bpy.data.images:
if image.source == "FILE" and not image.packed_file:
file_path = bpy.utils.expandpath(image.filepath)
new_path = path_map.get(file_path, None)
new_path = path_map.get(os.path.split(file_path)[1], None)
if new_path:
image.filepath = new_path

@ -79,6 +79,8 @@ def testFile(conn, job_id, slave_id, rfile, JOB_PREFIX, main_path = None):
job_full_path = prefixPath(JOB_PREFIX, rfile.filepath, main_path, force = True)
if not found:
# Force prefix path if not found
job_full_path = prefixPath(JOB_PREFIX, rfile.filepath, main_path, force = True)
temp_path = JOB_PREFIX + "slave.temp"
conn.request("GET", fileURL(job_id, rfile.index), headers={"slave-id":slave_id})
response = conn.getresponse()

@ -171,7 +171,7 @@ def prefixPath(prefix_directory, file_path, prefix_path, force = False):
# if an absolute path, make sure path exists, if it doesn't, use relative local path
full_path = file_path
if force or not os.path.exists(full_path):
p, n = os.path.split(full_path)
p, n = os.path.split(os.path.normpath(full_path))
if prefix_path and p.startswith(prefix_path):
if len(prefix_path) < len(p):