本文整理汇总了Python中s3py.io.StreamWriter.p32方法的典型用法代码示例。如果您正苦于以下问题:Python StreamWriter.p32方法的具体用法?Python StreamWriter.p32怎么用?Python StreamWriter.p32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类s3py.io.StreamWriter
的用法示例。
在下文中一共展示了StreamWriter.p32方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from s3py.io import StreamWriter [as 别名]
# 或者: from s3py.io.StreamWriter import p32 [as 别名]
def write(self, stream, resources=None):
s = StreamWriter(stream)
s.u32(self.version)
tgi = TGIList(package=resources)
tgi.begin_write(stream)
s.i8(len(self.components))
for component in self.components:
s.hash(component)
def write_component_data(data):
s.i8(data[0])
val = data[1]
if isinstance(val, str):
s.p32(val)
elif isinstance(val, Resource):
s.i32(tgi.get_resource_index(val))
elif isinstance(val, int):
s.u32(val)
else:
raise Exception("Unable to handle data type %" % type(val))
k = self.component_data.keys()
s.i8(len(k))
for key in k:
s.p32(key)
write_component_data(self.component_data[key])
s.i8(self.visible)
tgi.end_write(stream)
示例2: write
# 需要导入模块: from s3py.io import StreamWriter [as 别名]
# 或者: from s3py.io.StreamWriter import p32 [as 别名]
def write(self, stream, resource=None):
s = StreamWriter(stream)
keys = self.names.keys()
s.u32(len(keys))
for key in keys:
s.u64(key)
s.p32(self.names[key])
示例3: write
# 需要导入模块: from s3py.io import StreamWriter [as 别名]
# 或者: from s3py.io.StreamWriter import p32 [as 别名]
def write(self, stream, resource=None):
s = StreamWriter(stream)
s.u32(self.version_major)
s.u32(self.version_minor)
s.i32(len(self.bones))
for bone in self.bones:
for i in range(3): s.f32(bone.position[i])
for i in range(4): s.f32(bone.orientation[i])
for i in range(3): s.f32(bone.scale[i])
assert bone.name != None, "Bone %s must have a name"
s.p32(bone.name)
s.i32(-1 if not bone.opposite in self.bones else self.bones.index(bone.opposite))
s.i32(-1 if not bone.parent in self.bones else self.bones.index(bone.parent))
s.u32(FNV32.hash(bone.name))
s.u32(bone.flags)
if self.version_major >= 4: s.p32(self.name)
s.i32(len(self.ik_chains))
for chain in self.ik_chains:
chain.write(stream)
示例4: write_rcol
# 需要导入模块: from s3py.io import StreamWriter [as 别名]
# 或者: from s3py.io.StreamWriter import p32 [as 别名]
def write_rcol(self, stream, rcol):
s = StreamWriter(stream)
self.write_tag(stream)
s.u32(self.version)
s.tgi(self.clip, 'ITG')
s.tgi(self.track_mask, 'ITG')
s.i32(len(self.actor_slots))
s.u32(0)
s.u32(0)
s.u32(0)
for actor_slot in self.actor_slots: actor_slot.write(stream)
s.i32(len(self.actor_iks))
for actor_ik in self.actor_iks: actor_ik.write(stream)
s.u32(DEADBEEF)
s.tgi(self.additive_clip)
s.p32(self.clip_pattern, size=16)
s.align()
s.p32(self.additive_clip_pattern, size=16)
s.align()
s.u32(DEADBEEF)
AnimationNode.write_rcol(self, stream, rcol)