fixes object path

This commit is contained in:
buttle 2021-06-18 20:44:14 +02:00
parent 3970792599
commit 7c803e468a
1 changed files with 9 additions and 9 deletions

View File

@ -72,12 +72,12 @@ def get_object(file_path, result={}):
if extension == "gltf": if extension == "gltf":
result['type']="gltf" result['type']="gltf"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
if extension == "obj": if extension == "obj":
result['type']="obj" result['type']="obj"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
mtl_file = find_file_with_extension(file_dir, 'mtl') mtl_file = find_file_with_extension(file_dir, 'mtl')
if mtl_file: if mtl_file:
result = get_object(mtl_file.replace(OBJECT_DIR, ""), result) result = get_object(mtl_file.replace(OBJECT_DIR, ""), result)
@ -86,36 +86,36 @@ def get_object(file_path, result={}):
if extension == 'stl': if extension == 'stl':
result['type'] = "stl" result['type'] = "stl"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
if extension == 'mtl': if extension == 'mtl':
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
if extension == 'fbx': if extension == 'fbx':
result['type'] = "fbx" result['type'] = "fbx"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
if extension == 'dae': if extension == 'dae':
result['type'] = "dae" result['type'] = "dae"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
if extension == 'glb': if extension == 'glb':
result['type'] = "glb" result['type'] = "glb"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
if extension == 'json': if extension == 'json':
result['type'] = "json" result['type'] = "json"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
if extension == 'ply': if extension == 'ply':
result['type'] = "ply" result['type'] = "ply"
object_path = str(file_path).replace(OBJECT_DIR, "") object_path = str(file_path).replace(OBJECT_DIR, "")
result['urls'].append(f"/objects{object_path}") result['urls'].append(f"/objects/{object_path}")
return result return result
return None return None