/
test.py
executable file
·90 lines (66 loc) · 2.57 KB
/
test.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
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/python
import sys
import PySlo
PySlo.setPath(".:&")
PySlo.setShader(sys.argv[1])
print "\n%s \"%s\"" % (PySlo.typetoStr(PySlo.getType()),
PySlo.getName())
for x in xrange(1, PySlo.getNArgs()+1):
param = PySlo.getArgById(x)
s_storage = PySlo.stortoStr(param['storage'])
s_detail = PySlo.detailtoStr(param['detail'])
s_type = PySlo.typetoStr(param['type'])
sys.stdout.write(" \"%s\" \"%s %s %s" % (param['name'], s_storage, s_detail, s_type))
if PySlo.isArray(x):
if param['arraylen'] == 0:
sys.stdout.write("[]");
else:
sys.stdout.write("[%d]" % param['arraylen']);
sys.stdout.write("\"\n")
sys.stdout.write("\t\tDefault value: ")
if param['type'] == PySlo.TYPE.COLOR:
sys.stdout.write("\"rgb\" ")
printspace = False
if param['type'] == PySlo.TYPE.POINT:
printspace = True
if param['type'] == PySlo.TYPE.VECTOR:
printspace = True
if param['type'] == PySlo.TYPE.NORMAL:
printspace = True
if param['type'] == PySlo.TYPE.MATRIX:
printspace = True
if param['spacename'] != '' and printspace:
sys.stdout.write("\"%s\" " % param['spacename'])
if PySlo.isArray(x):
sys.stdout.write("{")
for i in xrange(0, len(param['default'])):
value = param['default'][i]
if param['type'] == PySlo.TYPE.SCALAR:
sys.stdout.write("%g" % value)
vectortype = False
if param['type'] == PySlo.TYPE.POINT:
vectortype = True
if param['type'] == PySlo.TYPE.VECTOR:
vectortype = True
if param['type'] == PySlo.TYPE.NORMAL:
vectortype = True
if param['type'] == PySlo.TYPE.COLOR:
vectortype = True
if vectortype:
sys.stdout.write("[%g %g %g]" % (value[0], value[1], value[2]))
if param['type'] == PySlo.TYPE.MATRIX:
sys.stdout.write("[%g " % value[0])
for ii in xrange(1, 15):
sys.stdout.write("%g " % value[ii])
sys.stdout.write("%g]" % value[15])
if param['type'] == PySlo.TYPE.STRING:
sys.stdout.write("\"%s\"" % value)
if param['type'] == PySlo.TYPE.SHADER:
sys.stdout.write("\"(nil)\"")
if i != len(param['default']) - 1:
sys.stdout.write(", ")
if PySlo.isArray(x):
sys.stdout.write("}")
sys.stdout.write("\n")
sys.stdout.write("\n")
PySlo.endShader()