Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parseBone(self, name):
bone=MotionData(name)
self.pose.append(bone)
bone.pos=Vector3(*[float(token) for token in self.readline().split(';')[0].split(',')])
bone.q=Quaternion(*[float(token) for token in self.readline().split(';')[0].split(',')])
return self.readline()=="}"
def __init__(self, x=0, y=0, z=0, nx=0, ny=0, nz=0, u=0, v=0,
bone0=0, bone1=0, weight0=0, edge_flag=0):
self.pos=Vector3(x, y, z)
self.normal=Vector3(nx, ny, nz)
self.uv=Vector2(u, v)
self.bone0=bone0
self.bone1=bone1
self.weight0=weight0
self.edge_flag=edge_flag
def _loadBone(self):
size = struct.unpack("H", self.io.read(2))[0]
for i in xrange(size):
name=truncate_zero(struct.unpack("20s", self.io.read(20))[0])
parent_index, tail_index = struct.unpack("HH", self.io.read(4))
type = struct.unpack("B", self.io.read(1))[0]
bone=createBone(name, type)
bone.parent_index=parent_index
bone.tail_index=tail_index
bone.ik_index = struct.unpack("H", self.io.read(2))[0]
bone.pos = Vector3(*struct.unpack("3f", self.io.read(12)))
bone.english_name="bone%03d" % len(self.bones)
self.bones.append(bone)
return True
def __init__(self, name):
self.name=name
self.frame=-1
self.pos=Vector3()
self.q=Quaternion()
def __init__(self, name='bone', type=0):
self.name=name
self.index=0
self.type=type
self.parent_index=0xFFFF
self.tail_index=0
self.tail=Vector3(0, 0, 0)
self.parent=None
self.ik_index=0xFFFF
self.pos=Vector3(0, 0, 0)
self.children=[]
self.english_name=''
def __init__(self, name='bone', type=0):
self.name=name
self.index=0
self.type=type
self.parent_index=0xFFFF
self.tail_index=0
self.tail=Vector3(0, 0, 0)
self.parent=None
self.ik_index=0xFFFF
self.pos=Vector3(0, 0, 0)
self.children=[]
self.english_name=''
def _loadSkin(self):
size = struct.unpack("H", self.io.read(2))[0]
for i in xrange(size):
skin=Skin(truncate_zero(struct.unpack("20s", self.io.read(20))[0]))
skin_size = struct.unpack("I", self.io.read(4))[0]
skin.type = struct.unpack("B", self.io.read(1))[0]
for j in xrange(skin_size):
skin.indices.append(struct.unpack("I", self.io.read(4))[0])
skin.pos_list.append(
Vector3(*struct.unpack("3f", self.io.read(12))))
skin.english_name="skin%03d" % len(self.morph_list)
self.morph_list.append(skin)
return True