forked from wangyida/model-render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shatrans.py
80 lines (70 loc) · 2.81 KB
/
shatrans.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import os
import bpy
root = '/Volumes/wangyida/train'
files = os.listdir(root)
log = '_'
for file in files:
if os.path.isdir(root+'/'+file) and file!='.DS_Store' and file!='..DS_Store':
objlist = os.listdir(root+'/'+file)
for object in objlist:
name_obj = root+'/'+file+'/'+object
override = {'selected_bases': list(bpy.context.scene.object_bases)}
bpy.ops.object.delete(override)
bpy.ops.import_scene.obj(filepath=name_obj,filter_glob=object)
bpy.ops.export_scene.obj(filepath=name_obj,filter_glob=object)
root = '/Volumes/wangyida/train_perturbed'
files = os.listdir(root)
log = '_'
for file in files:
if os.path.isdir(root+'/'+file) and file!='.DS_Store' and file!='..DS_Store':
objlist = os.listdir(root+'/'+file)
for object in objlist:
name_obj = root+'/'+file+'/'+object
override = {'selected_bases': list(bpy.context.scene.object_bases)}
bpy.ops.object.delete(override)
bpy.ops.import_scene.obj(filepath=name_obj,filter_glob=object)
bpy.ops.export_scene.obj(filepath=name_obj,filter_glob=object)
root = '/Volumes/wangyida/val'
files = os.listdir(root)
log = '_'
for file in files:
if os.path.isdir(root+'/'+file) and file!='.DS_Store' and file!='..DS_Store':
objlist = os.listdir(root+'/'+file)
for object in objlist:
name_obj = root+'/'+file+'/'+object
override = {'selected_bases': list(bpy.context.scene.object_bases)}
bpy.ops.object.delete(override)
bpy.ops.import_scene.obj(filepath=name_obj,filter_glob=object)
bpy.ops.export_scene.obj(filepath=name_obj,filter_glob=object)
root = '/Volumes/wangyida/val_perturbed'
files = os.listdir(root)
log = '_'
for file in files:
if os.path.isdir(root+'/'+file) and file!='.DS_Store' and file!='..DS_Store':
objlist = os.listdir(root+'/'+file)
for object in objlist:
name_obj = root+'/'+file+'/'+object
override = {'selected_bases': list(bpy.context.scene.object_bases)}
bpy.ops.object.delete(override)
bpy.ops.import_scene.obj(filepath=name_obj,filter_glob=object)
bpy.ops.export_scene.obj(filepath=name_obj,filter_glob=object)
root = '/Volumes/wangyida/test_allinone'
files = os.listdir(root)
log = '_'
for file in files:
if file!='.DS_Store' and file!='..DS_Store':
name_obj = root+'/'+file
override = {'selected_bases': list(bpy.context.scene.object_bases)}
bpy.ops.object.delete(override)
bpy.ops.import_scene.obj(filepath=name_obj,filter_glob=file)
bpy.ops.export_scene.obj(filepath=name_obj,filter_glob=file)
root = '/Volumes/wangyida/test_allinone_perturbed'
files = os.listdir(root)
log = '_'
for file in files:
if file!='.DS_Store' and file!='..DS_Store':
name_obj = root+'/'+file
override = {'selected_bases': list(bpy.context.scene.object_bases)}
bpy.ops.object.delete(override)
bpy.ops.import_scene.obj(filepath=name_obj,filter_glob=file)
bpy.ops.export_scene.obj(filepath=name_obj,filter_glob=file)