Exemplo n.º 1
0
        def write(self, stream, resource=None):
            """
            """
            s = StreamWriter(stream)
            s.chars(self.MAGIC)
            s.u32(self.major_version)
            s.u32(self.minor_version)
            s.u32(self.unknown1)
            s.u32(self.unknown2)
            s.u32(self.unknown3)
            s.u32(self.date_created)
            s.u32(self.date_modified)

            s.u32(self.index_major_version)
            s.u32(self.index_entry_count)
            s.u32(self.index_entry_offset)
            s.u32(self.index_size)
            s.u32(self.hole_count)
            s.u32(self.hole_offset)
            s.u32(self.hole_size)
            s.u32(self.index_minor_version)

            s.u32(self.index_offset)
            s.u32(self.unknown4)
            for i in range(24): s.u32(self.reserved[i])
Exemplo n.º 2
0
        def write(self, stream, resource=None):
            """
            """
            s = StreamWriter(stream)
            s.chars(self.MAGIC)
            s.u32(self.major_version)
            s.u32(self.minor_version)
            s.u32(self.unknown1)
            s.u32(self.unknown2)
            s.u32(self.unknown3)
            s.u32(self.date_created)
            s.u32(self.date_modified)

            s.u32(self.index_major_version)
            s.u32(self.index_entry_count)
            s.u32(self.index_entry_offset)
            s.u32(self.index_size)
            s.u32(self.hole_count)
            s.u32(self.hole_offset)
            s.u32(self.hole_size)
            s.u32(self.index_minor_version)

            s.u32(self.index_offset)
            s.u32(self.unknown4)
            for i in range(24):
                s.u32(self.reserved[i])
Exemplo n.º 3
0
 def write(self, stream, resource=None):
     s = StreamWriter(stream)
     s.chars(self.TAG)
     s.u32(self.version)
     cBlends = len(self.blends)
     cLods = 0
     if cBlends:
         len(self.blends[0].lods)
Exemplo n.º 4
0
 def write(self, stream, resource=None):
     s = StreamWriter(stream)
     s.chars(self.TAG)
     s.u32(self.version)
     cBlends = len(self.blends)
     cLods = 0
     if cBlends:
         len(self.blends[0].lods)
Exemplo n.º 5
0
    def write(self, stream, resources=None):
        s = StreamWriter(stream)
        indexedFloats = []
        curves = []
        curveMap = {}
        for t in self.tracks:
            assert isinstance(t, Track)
            for curve in t:
                assert isinstance(curve, Curve)
                if len(curve.frames) > self.max_frame_count:
                    self.max_frame_count = len(curve.frames) + 1
                cdi = CurveDataInfo()
                curve.flags.static = len(curve.frames) == 0
                cdi.frame_count = len(curve.frames)
                cdi.process_frames(curve.frames)
                cdi.flags = curve.flags
                cdi.type = curve.type
                cdi.track_key = t.track_key
                curveMap[cdi] = curve.frames
                curves.append(cdi)

        cCurves = len(curves)
        cFloats = len(indexedFloats)

        #Begin writing...
        s.chars('_pilC3S_')
        s.u32(self.version)
        s.u32(self.unknown1)
        s.f32(self.frame_duration)
        s.u16(self.max_frame_count)
        s.u16(self.unknown2)

        s.u32(cCurves)
        s.u32(cFloats)
        curveOffset = StreamPtr.begin_write(s)
        frameOffset = StreamPtr.begin_write(s)
        nameOffset = StreamPtr.begin_write(s)
        srcNameOffset = StreamPtr.begin_write(s)

        curveOffset.end()
        for curve in curves:
            curve.write(stream)
        nameOffset.end()
        s.zs(self.name)
        srcNameOffset.end()
        s.zs(self.source_file_name)

        frameOffset.end()
        for curve in curves:
            curve.frame_data_ptr.end()
            frames = curveMap[curve]
            for f in frames:
                f.write(stream, curve, indexedFloats)
        return self
Exemplo n.º 6
0
    def write(self, stream, resources=None):
        s = StreamWriter(stream)
        indexedFloats = []
        curves = []
        curveMap = {}
        for t in self.tracks:
            assert isinstance(t,Track)
            for curve in t:
                assert isinstance(curve,Curve)
                if len(curve.frames) > self.max_frame_count: self.max_frame_count = len(curve.frames) + 1
                cdi = CurveDataInfo()
                curve.flags.static = len(curve.frames) == 0
                cdi.frame_count = len(curve.frames)
                cdi.process_frames(curve.frames)
                cdi.flags = curve.flags
                cdi.type = curve.type
                cdi.track_key = t.track_key
                curveMap[cdi] = curve.frames
                curves.append(cdi)

        cCurves = len(curves)
        cFloats = len(indexedFloats)

        #Begin writing...
        s.chars('_pilC3S_')
        s.u32(self.version)
        s.u32(self.unknown1)
        s.f32(self.frame_duration)
        s.u16(self.max_frame_count)
        s.u16(self.unknown2)

        s.u32(cCurves)
        s.u32(cFloats)
        curveOffset = StreamPtr.begin_write(s)
        frameOffset = StreamPtr.begin_write(s)
        nameOffset = StreamPtr.begin_write(s)
        srcNameOffset = StreamPtr.begin_write(s)

        curveOffset.end()
        for curve in curves:
            curve.write(stream)
        nameOffset.end()
        s.zs(self.name)
        srcNameOffset.end()
        s.zs(self.source_file_name)

        frameOffset.end()
        for curve in curves:
            curve.frame_data_ptr.end()
            frames = curveMap[curve]
            for f in frames: f.write(stream, curve, indexedFloats)
        return self
Exemplo n.º 7
0
 def write(self, stream, resource=None):
     s = StreamWriter(stream)
     s.chars(self.TAG)
     s.u32(self.version)
     s.i32(len(self.events))
     size_offset = stream.tell()
     s.u32(0)
     s.u32(0 if not len(self.events) else 4)
     start_pos = stream.tell()
     for event in self.events:
         s.u16(event.TYPE)
         event.write(stream)
     end_pos = stream.tell()
     stream.seek(size_offset, SEEK_SET)
     s.u32(end_pos - start_pos)
     stream.seek(end_pos, SEEK_SET)
Exemplo n.º 8
0
 def write(self, stream, resource=None):
     s = StreamWriter(stream)
     s.chars(self.TAG)
     s.u32(self.version)
     s.i32(len(self.events))
     size_offset = stream.tell()
     s.u32(0)
     s.u32(0 if not len(self.events) else 4)
     start_pos = stream.tell()
     for event in self.events:
         s.u16(event.TYPE)
         event.write(stream)
     end_pos = stream.tell()
     stream.seek(size_offset, SEEK_SET)
     s.u32(end_pos - start_pos)
     stream.seek(end_pos, SEEK_SET)
Exemplo n.º 9
0
    def write(self, stream, keys):
        items = []
        for key in self.__parameters.keys():
            val = self.__parameters[key]
            item = self.Item(key, val)
            items.append(item)

        s = StreamWriter(stream)
        s.chars(self.TAG_TEXTURES)
        s.u32(0)
        data_len_ptr = stream.tell()
        s.u32(0)
        s.u32(len(items))

        for item in items: item.write_pointer(stream)
        start = stream.tell()
        for item in items: item.write_data(stream, keys)
        end = stream.tell()
        stream.seek(data_len_ptr, SEEK_SET)
        s.u32(end - start)
        stream.seek(end, SEEK_SET)
Exemplo n.º 10
0
    def write(self, stream, keys):
        items = []
        for key in self.__parameters.keys():
            val = self.__parameters[key]
            item = self.Item(key, val)
            items.append(item)

        s = StreamWriter(stream)
        s.chars(self.TAG_TEXTURES)
        s.u32(0)
        data_len_ptr = stream.tell()
        s.u32(0)
        s.u32(len(items))

        for item in items:
            item.write_pointer(stream)
        start = stream.tell()
        for item in items:
            item.write_data(stream, keys)
        end = stream.tell()
        stream.seek(data_len_ptr, SEEK_SET)
        s.u32(end - start)
        stream.seek(end, SEEK_SET)