• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python io.StreamReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中s3py.io.StreamReader的典型用法代码示例。如果您正苦于以下问题:Python StreamReader类的具体用法?Python StreamReader怎么用?Python StreamReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了StreamReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: read

 def read(self, stream, resources=None):
     s = StreamReader(stream)
     flags = s.u8()
     self.type = (flags & 0x07) >> 0
     self.static = ((flags & 0x08) >> 3) == 1
     self.unknown = (flags & 0xF0) >> 4
     return self
开发者ID:markmanching,项目名称:s3py,代码行数:7,代码来源:__init__.py


示例2: read

 def read(self, stream, resources):
     s = StreamReader(stream)
     self.age_gender = s.u32()
     self.edge_color = s.u32()
     self.specular_color = s.u32()
     self.specular_power = s.f32()
     self.is_genetic = bool(s.u8())
开发者ID:markmanching,项目名称:s3py,代码行数:7,代码来源:catalog.py


示例3: read

 def read(self, stream, resource=None):
     s = StreamReader(stream)
     self.name = s.u32()
     self.start_index = s.i32()
     self.start_vertex = s.i32()
     self.vertex_count = s.i32()
     self.index_count = s.i32()
开发者ID:markmanching,项目名称:s3py,代码行数:7,代码来源:geometry.py


示例4: read_rcol

 def read_rcol(self, stream, rcol):
     s = StreamReader(stream)
     self.read_tag(stream)
     self.version = s.u32()
     self.outcomes = [self.Outcome(stream, rcol) for i in range(s.i32())]
     assert s.u32() == DEADBEEF
     self.flags = s.u32()
     DecisionGraphNode.read(self, stream, rcol)
开发者ID:markmanching,项目名称:s3py,代码行数:8,代码来源:jazz.py


示例5: read

 def read(self, stream, resource=None):
     s = StreamReader(stream)
     self.version = s.u32()
     cNames = s.u32()
     for i in range(cNames):
         iid = s.u64()
         name = s.p32()
         self.names[iid] = name
开发者ID:markmanching,项目名称:s3py,代码行数:8,代码来源:package.py


示例6: read

 def read(self, stream, resource=None):
     s = StreamReader(stream)
     self.type = s.u32()
     self.origin = [s.f32() for i in range(3)]
     self.normal = [s.f32() for i in range(3)]
     self.x_axis = [s.f32() for i in range(3)]
     self.y_axis = [s.f32() for i in range(3)]
     self.pair_offset = s.f32()
开发者ID:markmanching,项目名称:s3py,代码行数:8,代码来源:lights.py


示例7: read_rcol

 def read_rcol(self, stream, rcol):
     self.read_tag(stream)
     s = StreamReader(stream)
     self.version = s.u32()
     cBones = s.i32()
     names = [s.u32() for i in range(cBones)]
     poses = [s.m43() for pose_index in range(cBones)]
     self.bones = [self.Bone(names[i], poses[i]) for i in range(cBones)]
开发者ID:markmanching,项目名称:s3py,代码行数:8,代码来源:geometry.py


示例8: read_rcol

 def read_rcol(self, stream, rcol):
     s = StreamReader(stream)
     self.version = s.u32()
     self.deltas = {}
     c = s.i32()
     for i in range(c):
         hsh = s.hash()
         self.deltas[hsh] = self.Delta(stream)
     pass
开发者ID:markmanching,项目名称:s3py,代码行数:9,代码来源:rig.py


示例9: read_rcol

    def read_rcol(self, stream, rcol):
        s = StreamReader(stream)
        self.read_tag(stream)
        self.version = s.u32()

        self.routing_slots = [RoutingSlot() for i in range(s.i32())]
        self.container_slots = [ContainerSlot() for i in range(s.i32())]
        self.effect_slots = [EffectSlot() for i in range(s.i32())]
        self.target_slots = [TargetSlot() for i in range(s.i32())]
        self.cone_slots = [ConeSlot() for i in range(s.i32())]

        def read_names(slots):
            for slot in slots: slot.name = s.hash(Slot.NAMES)

        def read_bones(slots):
            for slot in slots: slot.bone_name = s.u32()

        def read_transforms(slots):
            for slot in slots: slot.transform = s.m43()

        def read_offsets(slots):
            if any(slots):
                for i in range(s.i32()):
                    slots[i].offset = SlotOffset([s.f32(), s.f32(), s.f32()], [s.f32(), s.f32(), s.f32()])
                    pass
                pass

        read_names(self.routing_slots)
        read_bones(self.routing_slots)
        read_transforms(self.routing_slots)
        read_offsets(self.routing_slots)

        read_names(self.container_slots)
        read_bones(self.container_slots)
        for slot in self.container_slots:
            slot.flags = s.u32()
        read_transforms(self.container_slots)
        read_offsets(self.container_slots)

        read_names(self.effect_slots)
        read_bones(self.effect_slots)
        read_transforms(self.effect_slots)
        read_offsets(self.effect_slots)

        read_names(self.target_slots)
        read_bones(self.target_slots)
        read_transforms(self.target_slots)
        read_offsets(self.target_slots)

        read_names(self.cone_slots)
        read_bones(self.cone_slots)
        read_transforms(self.cone_slots)
        for cone_slot in self.cone_slots:
            cone_slot.radius = s.f32()
            cone_slot.angle = s.f32()
        read_offsets(self.cone_slots)
        pass
开发者ID:markmanching,项目名称:s3py,代码行数:57,代码来源:__init__.py


示例10: read_rcol

 def read_rcol(self, stream, rcol):
     s = StreamReader(stream)
     self.read_tag(stream)
     self.version = s.u32()
     self.framerate = s.f32()
     cFrames = s.i32()
     offsets = [s.u32() for i in range(cFrames)]
     offsets.append(-1)
     for frame_index in range(cFrames):
         offset = offsets[frame_index]
         next = offsets[frame_index + 1]
         cBytes = next - offset if next > 0 else -1
         data = stream.read(cBytes)
         self.frames.append(data)
开发者ID:markmanching,项目名称:s3py,代码行数:14,代码来源:material.py


示例11: fix_read_offset

 def fix_read_offset(self, stream):
     s = StreamReader(stream)
     pos = stream.tell()
     fix_bytes = 0
     if pos % 2 == 0:
         fix_bytes = pos % 4
     else:
         fix_bytes = pos % 2
         if (pos + fix_bytes) % 2 == 0:
             fix_bytes += 2
     assert fix_bytes <= 3
     for i in range(fix_bytes):
         b = s.i8()
         assert b == i
开发者ID:markmanching,项目名称:s3py,代码行数:14,代码来源:__init__.py


示例12: read_presets

 def read_presets(cls,stream,resources=None):
     s = StreamReader(stream)
     c = s.i32()
     ce = ComplateEncoder()
     presets = []
     for i in range(c):
         preset = cls.BuildBuyPreset()
         preset.unk1 = s.i8()
         if preset.unk1 != 1:
             preset.unk2 = s.i32()
         preset_ptr = StreamPtr.begin_read(s,relative=True,offset_start=True)
         preset.complate = ce.deserialize(stream,resources)
         preset_ptr.end()
         preset.id = s.u32()
         presets.append(preset)
     return presets
开发者ID:markmanching,项目名称:s3py,代码行数:16,代码来源:catalog.py


示例13: read

    def read(self, stream, keys):
        s = StreamReader(stream)
        tag = s.chars(4)
        if not tag == self.TAG_TEXTURES or tag == self.TAG_NO_TEXTURES:
            raise IOError(
                "Invalid data, expected %s or %s, but got %s" % (self.TAG_TEXTURES, self.TAG_NO_TEXTURES, tag))
        zero = s.u32()
        assert zero == 0

        param_len = s.u32()
        cParams = s.i32()
        items = []
        for i in range(cParams):
            item = self.Item()
            item.read_pointer(stream)
            items.append(item)
        start = stream.tell()
        for item in items:
            self.__parameters[item.name] = item.read_data(stream, keys)
        end = stream.tell()
        assert (end - start) == param_len
开发者ID:markmanching,项目名称:s3py,代码行数:21,代码来源:material.py


示例14: read

 def read(self, stream, resource=None):
     s = StreamReader(stream)
     self.bones = []
     bone_count=s.i32()
     for i in range(bone_count):
         bone=self.parent.get_bone(s.i32())
         self.bones.append(bone)
     if self.parent.version_major >= 4:
         self.info_nodes = [self.parent.get_bone(s.i32()) for i in range(11)]
     self.pole = self.parent.get_bone(s.i32())
     if self.parent.version_major >= 4:
         self.slot_info = self.parent.get_bone(s.i32())
     self.slot_offset = self.parent.get_bone(s.i32())
     self.root = self.parent.get_bone(s.i32())
开发者ID:markmanching,项目名称:s3py,代码行数:14,代码来源:rig.py


示例15: deserialize

    def deserialize(self,stream,parent_tgi):
        def read_element(s,tgi_list):
            def read_complate_string(s):
                a = s.i8()
                if not a: return None
                if a & 0x80: return s.chars(s.i8() if a & 0x40 else a &0x3F)
                if a & 0x40: a = (a & 0x3F) + s.i8()
                return self.complate_string_lookup[a]
            def read_typecode(s,tgi_list):
                tc = s.u8()
                if   tc == 1: return read_complate_string(s)
                elif tc == 0x02: return [s.u8() for i in range(4)]
                elif tc == 0x03: return tgi_list.get_resource(s.i8())
                elif tc == 0x04: return s.f32()
                elif tc == 0x05: return [s.f32() for i in range(2)]
                elif tc == 0x06: return [s.f32() for i in range(3)]
                elif tc == 0x07: return bool(s.i8())
                else: raise Exception("Unknown typecode %02X"%tc)
            element = Preset.Element()
            element.resource = tgi_list.get_resource(s.u8())
            element.name = read_complate_string(s)
            element.variable = read_complate_string(s)

            for i in range(s.i32()):
                name = read_complate_string(s)
                value = read_typecode(s,tgi_list)
                element.values[name] =value
            element.patterns = [read_element(s,tgi_list) for i in range(s.i32())]
            return element
        s = StreamReader(stream)
        unk = s.i16()
        preset_tgi = TGIList(use_length=True)
        preset_tgi.begin_read(stream)
        element = read_element(s,preset_tgi)
        preset_tgi.end_read(stream)
        complate = ComplateElement()
        complate.preset = element
        complate.priority = unk
        return complate
开发者ID:markmanching,项目名称:s3py,代码行数:39,代码来源:catalog.py



注:本文中的s3py.io.StreamReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python io.StreamWriter类代码示例发布时间:2022-05-27
下一篇:
Python s3crud.S3CRUD类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap