-
Notifications
You must be signed in to change notification settings - Fork 0
/
lwo_repickle.py
55 lines (40 loc) · 1.26 KB
/
lwo_repickle.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
#!/usr/bin/env python
import os
import re
from lwo_strut.lwoObject import lwoObject
from scripts.lwo_helper import LwoFile
def main():
infiles = [
"tests/basic/src/LWO2/box/box0.lwo",
"tests/basic/src/LWO2/box/box6-hidden.lwo",
"tests/basic/src/LWO/box/box3-uv-layers.lwo",
"tests/lwo_interceptor/src/LWO2/Federation - Interceptor/objects/interceptor_hull.lwo",
]
for infile in infiles:
f = LwoFile(infile, create_pickle=True)
f.check_file()
x = lwoObject(infile)
x.search_paths = ["/../images"]
x.absfilepath = False
x.read()
#print(f.picklefile)
if os.path.isfile(f.picklefile):
os.unlink(f.picklefile)
f.setup_pickle(x)
b = f.load_pickle()
print(x == b)
infile = "tests/basic/src/LWO2/box/box0.lwo"
f = LwoFile(infile, create_pickle=True)
f.check_file()
x = lwoObject(infile)
x.read()
#print(f.picklefile)
f.picklefile = re.sub(".lwo.pickle", ".lwo.error0.pickle", f.picklefile)
#print(f.picklefile)
x.layers[0].name = "Layer 2"
os.unlink(f.picklefile)
f.setup_pickle(x)
b = f.load_pickle()
#print(x == b)
if __name__ == "__main__":
main()