Exemplo n.º 1
0
 def loadModel(self, model):
     if self.currentObject!=None:
         self.currentObject.removeNode()
     self.currentObject=loadModel(model)
     self.currentObject.reparentTo(render)
     self.currentObject.setPythonTag('props', '')
     self.currentObject.setHpr(self.currentHPR[0],self.currentHPR[1],self.currentHPR[2])
     self.currentObject.setZ(self.currentZ)
     self.currentObject.setScale(self.currentScale)        
     if self.currentObject.hasPythonTag('hasLight'):
         self.currentLight=self.lightManager.addLight(pos=self.currentObject.getPos(), color=(1.0, 1.0, 1.0), radius=10.0)
         self.currentObject.setPythonTag('hasLight', self.currentLight)
         self.currentHPR=[255.0, 255.0, 255.0]    
Exemplo n.º 2
0
 def loadWall(self, model, change_model=False):
     pos=self.hit_pos   
     if self.currentWall!=None:
         pos=self.currentWall.find('**/next').getPos(render)            
     if change_model:            
         pos=self.currentWall.getPos(render)
         self.currentWall.removeNode()
     self.currentWall=loadModel(model)
     self.currentWall.reparentTo(render)
     #self.currentWall.setCollideMask(BitMask32.allOff())        
     #self.currentWall.setShaderAuto()        
     #self.currentWall.find('**/collision').setCollideMask(BitMask32.bit(2))        
     #self.currentWall.find('**/collision').setPythonTag('object', self.currentWall)
     #self.currentWall.setPythonTag('model_file', model)
     self.currentWall.setPythonTag('props', '')
     self.currentWall.setPos(render,pos)
     self.currentWall.setScale(self.currentScale)
Exemplo n.º 3
0
 def loadActor(self, model):        
     dir_name=Filename(model).getDirname()+'/'
     model_name=Filename(model).getBasename()[3:]
     name_len=len(model_name)        
     anim_dict={}
     dirList=listdir(Filename(dir_name).toOsSpecific())
     for fname in dirList:                        
         if Filename(fname).getExtension() in ('egg', 'bam'): 
             if fname.startswith("_a_"+model_name):
                 anim_dict[fname[4+name_len:-4]]=dir_name+fname[:-4]
     actor=loadModel(model,dir_name+"_c_"+model_name,anim_dict)            
     self.actors.append(actor)
     self.currentObject=self.actors[-1]
     self.currentObject.reparentTo(render)
     self.currentObject.setPythonTag('props', '')
     self.currentObject.setHpr(self.currentHPR[0],self.currentHPR[1],self.currentHPR[2])
     self.currentObject.setZ(self.currentZ)
     self.currentObject.setScale(self.currentScale)  
Exemplo n.º 4
0
 def loadActor(self, model):
     temp=model.split('_m_')
     path=temp[0]
     anim_name='_a_'+temp[1][:-4]
     name_len=len(anim_name)
     anim_dict={}
     dirList=os.listdir(Filename(path).toOsSpecific())
     for fname in dirList:                        
         if Filename(fname).getExtension() in ('egg', 'bam'): 
             if fname.startswith(anim_name):
                 anim_dict[fname[name_len:-4]]=path+fname
     actor=loadModel(model,path+"_c_"+temp[1][:-4],anim_dict)            
     self.actors.append(actor)
     self.currentObject=self.actors[-1]
     self.currentObject.reparentTo(render)
     self.currentObject.setPythonTag('props', '')
     self.currentObject.setHpr(self.currentHPR[0],self.currentHPR[1],self.currentHPR[2])
     self.currentObject.setZ(self.currentZ)
     self.currentObject.setScale(self.currentScale)