def createAnimatedModel(self, f11): wld = self.wld_container.wld_file_obj f10 = wld.getFragment(f11.fragRef) if f10.type != 0x10: print 'Model::createAnimatedModel() ERROR expected 0x10 fragment but got:', f10.type return # Lets initially try to only read all the mesh pieces and assemble the basic # model. Once that is working we can start looking into animation # Loop over the parts of the model/skeleton: the entries list in the f10 fragment # define these root_mesh = None for i in range(0, f10.size1): if i > 0: f2d = wld.getFragment( f10.entries[i][3]) # entry[3] -> fragRef2 # f2d.dump() f36 = wld.getFragment(f2d.fragRef) # f36.dump() m = Mesh(self.name + '_mesh_' + str(i)) m.buildFromFragment(f36, self.wld_container, False) m.root.reparentTo(root_mesh.root) else: # the root node (index 0) does not have a mesh m = Mesh(self.name + '_mesh_' + str(i)) # empty dummy mesh root_mesh = m self.meshes.append(m) # get model part orientation data from 0x10->0x13->0x12 ref chain f13 = wld.getFragment(f10.entries[i][2]) # entry[2] -> fragRef1 f12 = wld.getFragment(f13.fragRef) denom = float(f12.rotDenom) if denom != 0.0: rotx = f12.rotx / denom roty = f12.roty / denom rotz = f12.rotz / denom m.root.setHpr(rotx / 512.0 * 360.0, roty / 512.0 * 360.0, rotz / 512.0 * 360.0) denom = float(f12.shiftDenom) if denom != 0.0: shiftx = float(f12.shiftx) / denom shifty = float(f12.shifty) / denom shiftz = float(f12.shiftz) / denom # print shiftx, shifty, shiftz m.root.setPos(shiftx, shifty, shiftz) self.loaded = 1
def createAnimatedModel(self, f11): wld = self.wld_container.wld_file_obj f10 = wld.getFragment(f11.fragRef) if f10.type != 0x10: print 'Model::createAnimatedModel() ERROR expected 0x10 fragment but got:', f10.type return # Lets initially try to only read all the mesh pieces and assemble the basic # model. Once that is working we can start looking into animation # Loop over the parts of the model/skeleton: the entries list in the f10 fragment # define these root_mesh = None for i in range(0, f10.size1): if i > 0: f2d = wld.getFragment(f10.entries[i][3]) # entry[3] -> fragRef2 # f2d.dump() f36 = wld.getFragment(f2d.fragRef) # f36.dump() m = Mesh(self.name+'_mesh_'+str(i)) m.buildFromFragment(f36, self.wld_container, False) m.root.reparentTo(root_mesh.root) else: # the root node (index 0) does not have a mesh m = Mesh(self.name+'_mesh_'+str(i)) # empty dummy mesh root_mesh = m self.meshes.append(m) # get model part orientation data from 0x10->0x13->0x12 ref chain f13 = wld.getFragment(f10.entries[i][2]) # entry[2] -> fragRef1 f12 = wld.getFragment(f13.fragRef) denom = float(f12.rotDenom) if denom != 0.0: rotx = f12.rotx/denom roty = f12.roty/denom rotz = f12.rotz/denom m.root.setHpr(rotx / 512.0 * 360.0, roty / 512.0 * 360.0, rotz / 512.0 * 360.0) denom = float(f12.shiftDenom) if denom != 0.0: shiftx = float(f12.shiftx)/denom shifty = float(f12.shifty)/denom shiftz = float(f12.shiftz)/denom # print shiftx, shifty, shiftz m.root.setPos(shiftx, shifty, shiftz) self.loaded = 1
def createStaticModel(self, f36): m = Mesh(self.name + '_mesh') m.buildFromFragment(f36, self.wld_container, False) self.meshes.append(m) self.loaded = 1
def createStaticModel(self, f36): m = Mesh(self.name+'_mesh') m.buildFromFragment(f36, self.wld_container,False) self.meshes.append(m) self.loaded = 1