def importRoad(self): model = Model() model.open(os.path.join(self.tempath, 'model_0.db'), 'w') importer = RoadImporter(model, self.mesh) for name in os.listdir(self.roadpath): if name.endswith('.txd'): importer.process(os.path.join(self.roadpath, name)) model.close()
def exportAll(self): builder = AllDataBuilder(self.grid, self.rect) builder.open(os.path.join(self.dstpath, 'alldata')) for i in range(0, self.MAX_LEVEL_NUM): model = Model() model.open(os.path.join(self.tempath, 'model_%d.db' % (i+1)), 'r') builder.build(model, i) model.close() builder.save() builder.close()
def buildRoad(self): for i in range(self.MAX_LEVEL_NUM): src = Model() dst = Model() src.open(os.path.join(self.tempath, 'model_%d.db' % i), 'r') dst.open(os.path.join(self.tempath, 'model_%d.db' % (i+1)), 'w') builder = RoadBuilder(src, dst, self.mesh) builder.process(i) src.close() dst.close()
def importBack(self): modelist = [] for i in range(self.MAX_LEVEL_NUM): model = Model() model.open(os.path.join(self.tempath, 'model_%d.db' % (i+1)), 'a') modelist.append(model) importer = BackImporter(modelist, self.grid) # back_0 for name in os.listdir(self.backpath_0): if name.endswith('.txd'): importer.process(os.path.join(self.backpath_0, name), 0, 2) for name in os.listdir(self.backpath_2): if name.endswith('.txd'): importer.process(os.path.join(self.backpath_2, name), 2, 4) for name in os.listdir(self.backpath_4): if name.endswith('.txd'): importer.process(os.path.join(self.backpath_4, name), 4, 6) for model in modelist: model.close()