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