-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDownloadBakedSDFSamples.py
64 lines (42 loc) · 2.07 KB
/
DownloadBakedSDFSamples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
import wget
import argparse
scene_list = {
"gardenvase" : "7srlfofbiryehn6/gardenvase.glb",
"bicycle" : "3ss5rc56bg0s9k5/bicycle.glb",
"kitchenlego" : "jbjhvht3s6vvir2/kitchenlego.glb",
"stump" : "1hqrcw1ax59b34z/stump.glb",
"officebonsai" : "6bghm2gdmgzg32n/officebonsai.glb",
"fulllivingroom" : "8r83yv14c0d2wxe/fulllivingroom.glb",
"kitchencounter" : "zw6trrwjnh56pyp/kitchencounter.glb"
}
baseurl = "https://dl.dropboxusercontent.com/s/"
def download_scenes(scene_names, base_dir):
for scene in scene_names:
print("\n\n")
print("*********************************************")
print("Downloading BakedSDF sample scene: " + scene)
scene_dir = os.path.abspath(base_dir)
if(not os.path.exists(scene_dir)):
os.makedirs(scene_dir)
scene_url = baseurl + scene_list[scene]
print("Downloading files...")
print("From URL: " + scene_url)
print("To directory: "+ scene_dir)
response = wget.download(scene_url, scene_dir)
print(response)
parser = argparse.ArgumentParser(
prog = 'DownloadBakedSDFDemoSamples',
description = 'A helper script to download BakedSDF demo samples',
)
parser.add_argument('downloadPath', help="The path where the sample scenes will be downloaded.")
parser.add_argument('-n', '--name', required=False, help="The name of a specific sample scene.", choices= scene_list.keys())
parser.add_argument('-a', '--all', required=False, help="Download all the sample scenes. Ignores --name if this is used",
action='store_true') # on/off flag
args = parser.parse_args()
if args.all or args.name is None:
print("Downloading all BakedSDF demo samples.")
download_scenes(scene_list.keys, os.path.join(args.downloadPath, "BakedSDF_Samples"))
else:
print("Downloading {0} BakedSDF demo sample .".format(args.name))
download_scenes(([args.name]), os.path.join(args.downloadPath))