forked from bartvdbraak/blender
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:
parent
fd31436897
commit
84b291462f
@ -27,8 +27,9 @@ def get(handler):
|
|||||||
def output(text):
|
def output(text):
|
||||||
handler.wfile.write(bytes(text, encoding='utf8'))
|
handler.wfile.write(bytes(text, encoding='utf8'))
|
||||||
|
|
||||||
def head(title):
|
def head(title, refresh = False):
|
||||||
output("<html><head>")
|
output("<html><head>")
|
||||||
|
if refresh:
|
||||||
output("<meta http-equiv='refresh' content=5>")
|
output("<meta http-equiv='refresh' content=5>")
|
||||||
output("<script src='/html/netrender.js' type='text/javascript'></script>")
|
output("<script src='/html/netrender.js' type='text/javascript'></script>")
|
||||||
# output("<script src='/html/json2.js' type='text/javascript'></script>")
|
# output("<script src='/html/json2.js' type='text/javascript'></script>")
|
||||||
@ -104,7 +105,7 @@ def get(handler):
|
|||||||
f.close()
|
f.close()
|
||||||
elif handler.path == "/html" or handler.path == "/":
|
elif handler.path == "/html" or handler.path == "/":
|
||||||
handler.send_head(content = "text/html")
|
handler.send_head(content = "text/html")
|
||||||
head("NetRender")
|
head("NetRender", refresh = True)
|
||||||
|
|
||||||
output("<h2>Jobs</h2>")
|
output("<h2>Jobs</h2>")
|
||||||
|
|
||||||
|
@ -83,14 +83,17 @@ def process(paths):
|
|||||||
elif paths[i].endswith(".bobj.gz"):
|
elif paths[i].endswith(".bobj.gz"):
|
||||||
path_map[os.path.split(paths[i])[0]] = os.path.split(paths[i+1])[0]
|
path_map[os.path.split(paths[i])[0]] = os.path.split(paths[i+1])[0]
|
||||||
else:
|
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
|
# LIBRARIES
|
||||||
###########################
|
###########################
|
||||||
for lib in bpy.data.libraries:
|
for lib in bpy.data.libraries:
|
||||||
file_path = bpy.utils.expandpath(lib.filepath)
|
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:
|
if new_path:
|
||||||
lib.filepath = new_path
|
lib.filepath = new_path
|
||||||
|
|
||||||
@ -100,7 +103,7 @@ def process(paths):
|
|||||||
for image in bpy.data.images:
|
for image in bpy.data.images:
|
||||||
if image.source == "FILE" and not image.packed_file:
|
if image.source == "FILE" and not image.packed_file:
|
||||||
file_path = bpy.utils.expandpath(image.filepath)
|
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:
|
if new_path:
|
||||||
image.filepath = 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)
|
job_full_path = prefixPath(JOB_PREFIX, rfile.filepath, main_path, force = True)
|
||||||
|
|
||||||
if not found:
|
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"
|
temp_path = JOB_PREFIX + "slave.temp"
|
||||||
conn.request("GET", fileURL(job_id, rfile.index), headers={"slave-id":slave_id})
|
conn.request("GET", fileURL(job_id, rfile.index), headers={"slave-id":slave_id})
|
||||||
response = conn.getresponse()
|
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
|
# if an absolute path, make sure path exists, if it doesn't, use relative local path
|
||||||
full_path = file_path
|
full_path = file_path
|
||||||
if force or not os.path.exists(full_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 prefix_path and p.startswith(prefix_path):
|
||||||
if len(prefix_path) < len(p):
|
if len(prefix_path) < len(p):
|
||||||
|
Loading…
Reference in New Issue
Block a user