1
2
3
4
6 """
7 行指向の汎用ローダ
8 """
9 __slots__=['path', 'io', 'end']
11 return "<%s current:%d, end:%d>" % (
12 self.__class__, self.getPos(), self.getEnd())
13
16
19
22
24 return self.io.tell()>=self.end
25
26 - def load(self, path, io, end):
31
33 """
34 dummy. read to end.
35 """
36 while not self.isEnd():
37 self.io.readline()
38 return True
39
40
42 __slots__=['pose']
46
48 return "<VPD poses:%d>" % len(self.pose)
49
51 if self.readline()!="Vocaloid Pose Data file":
52 return
53
54 RE_OPEN=re.compile('^(\w+){(.*)')
55 RE_OSM=re.compile('^\w+\.osm;')
56 RE_COUNT=re.compile('^(\d+);')
57
58 bone_count=-1
59 while not self.isEnd():
60 line=self.readline()
61 if line=='':
62 continue
63 m=RE_OPEN.match(line)
64 if m:
65 if not self.parseBone(m.group(2)):
66 raise Exception("invalid bone")
67 continue
68
69 m=RE_OSM.match(line)
70 if m:
71 continue
72
73 m=RE_COUNT.match(line)
74 if m:
75 bone_count=int(m.group(1))
76 continue
77
78 return len(self.pose)==bone_count
79
86