Exemplo n.º 1
0
    def read_rcol(self, stream, rcol):
        s = StreamReader(stream)
        self.read_tag(stream)
        self.version = s.u32()
        self.clip = ExternalResource(s.tgi('ITG'))
        self.track_mask = ExternalResource(s.tgi('ITG'))

        cActorSlots = s.i32()
        assert s.u32() == 0
        assert s.u32() == 0
        assert s.u32() == 0
        self.actor_slots = [
            self.SlotAssignment(stream) for i in range(cActorSlots)
        ]
        self.actor_iks = [
            self.NamespaceSlotSuffix(stream) for i in range(s.i32())
        ]

        assert s.u32() == DEADBEEF
        self.additive_clip = ExternalResource(s.tgi('ITG'))

        self.clip_pattern = s.p32(size=16)
        s.align()
        self.additive_clip_pattern = s.p32(size=16)
        s.align()
        assert s.u32() == DEADBEEF
        AnimationNode.read_rcol(self, stream, rcol)
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
Arquivo: rig.py Projeto: garthand/s3py
 def read(self, stream, resource=None):
     s = StreamReader(stream)
     self.version_major = s.u32()
     self.version_minor = s.u32()
     cBones = s.i32()
     self.bones = []
     opposites = []
     parents = []
     self.__hashes = {}
     for i in range(cBones):
         bone = Bone(self)
         bone.position = [s.f32() for i in range(3)]
         bone.orientation = [s.f32() for i in range(4)]
         bone.scale = [s.f32() for i in range(3)]
         bone.name = s.p32()
         opposites.append(s.i32())
         parents.append(s.i32())
         hash_name = s.u32()
         if not hash_name == FNV32.hash(bone.name):
             print(
                 "WARNING: Bone %s should have matching hash 0x%08X, but has 0x%08X",
                 bone.name, FNV32.hash(bone.name), hash_name)
         self.__hashes[hash] = bone
         bone.flags = s.u32()
         self.bones.append(bone)
     for bone_index, opposite_index in enumerate(opposites):
         if opposite_index >= 0:
             self.bones[bone_index].opposite = self.bones[opposite_index]
     for bone_index, parent_index in enumerate(parents):
         if parent_index >= 0:
             self.bones[bone_index].parent = self.bones[parent_index]
     if self.version_major >= 4: self.name = s.p32()
     self.ik_chains = []
     cChains = s.i32()
     for i in range(cChains):
         chain = IKChain(self)
         chain.read(stream)
         self.ik_chains.append(chain)
Exemplo n.º 5
0
    def read_rcol(self, stream, rcol):
        s = StreamReader(stream)
        self.read_tag(stream)
        self.version = s.u32()
        self.clip = ExternalResource(s.tgi('ITG'))
        self.track_mask = ExternalResource(s.tgi('ITG'))

        cActorSlots = s.i32()
        assert s.u32() == 0
        assert s.u32() == 0
        assert s.u32() == 0
        self.actor_slots = [self.SlotAssignment(stream) for i in range(cActorSlots)]
        self.actor_iks = [self.NamespaceSlotSuffix(stream) for i in range(s.i32())]

        assert s.u32() == DEADBEEF
        self.additive_clip = ExternalResource(s.tgi('ITG'))

        self.clip_pattern = s.p32(size=16)
        s.align()
        self.additive_clip_pattern = s.p32(size=16)
        s.align()
        assert s.u32() == DEADBEEF
        AnimationNode.read_rcol(self, stream, rcol)
Exemplo n.º 6
0
 def read(self, stream, resource=None):
     s = StreamReader(stream)
     self.version_major = s.u32()
     self.version_minor = s.u32()
     cBones = s.i32()
     self.bones = []
     opposites = []
     parents = []
     self.__hashes = {}
     for i in range(cBones):
         bone = Bone(self)
         bone.position = [s.f32() for i in range(3)]
         bone.orientation = [s.f32() for i in range(4)]
         bone.scale = [s.f32() for i in range(3)]
         bone.name = s.p32()
         opposites.append(s.i32())
         parents.append(s.i32())
         hash_name = s.u32()
         if not hash_name == FNV32.hash(bone.name):
             print("WARNING: Bone %s should have matching hash 0x%08X, but has 0x%08X",bone.name, FNV32.hash(bone.name),hash_name)
         self.__hashes[hash] = bone
         bone.flags = s.u32()
         self.bones.append(bone)
     for bone_index, opposite_index in enumerate(opposites):
         if opposite_index >= 0:
             self.bones[bone_index].opposite = self.bones[opposite_index]
     for bone_index, parent_index in enumerate(parents):
         if parent_index >= 0:
             self.bones[bone_index].parent = self.bones[parent_index]
     if self.version_major >= 4: self.name = s.p32()
     self.ik_chains = []
     cChains = s.i32()
     for i in range(cChains):
         chain = IKChain(self)
         chain.read(stream)
         self.ik_chains.append(chain)