def find_track_directory(gdb_filename): rest, ext = os.path.splitext(gdb_filename) scn_filename = rest + ".scn" scn_filename = rfactortools.lookup_path_icase(scn_filename) if not scn_filename: raise Exception("couldn't locate .scn file matching %s" % gdb_filename) else: info = rfactortools.InfoScnParser() rfactortools.process_scnfile(scn_filename, info) result = find_track_directory_from_searchpath( os.path.dirname(gdb_filename), info.search_path) return result
def find_track_directory(gdb_filename): rest, ext = os.path.splitext(gdb_filename) scn_filename = rest + ".scn" scn_filename = rfactortools.lookup_path_icase(scn_filename) if not scn_filename: raise Exception("couldn't locate .scn file matching %s" % gdb_filename) else: info = rfactortools.InfoScnParser() rfactortools.process_scnfile(scn_filename, info) result = find_track_directory_from_searchpath(os.path.dirname(gdb_filename), info.search_path) return result
def convert_aiw(self, source_file, target_file): shutil.copy(source_file, target_file) # generate the thumbnail if there isn't somebody already rest, ext = os.path.splitext(source_file) trest, text = os.path.splitext(target_file) source_mini_file = os.path.join(rest + "mini.tga") target_mini_file = os.path.join(trest + "mini.tga") logging.info("generating track thumbnail: %s", target_mini_file) if not rfactortools.lookup_path_icase(source_mini_file) or self.cfg.force_track_thumbnails: aiw = rfactortools.parse_aiwfile(source_file) img = rfactortools.render_aiw(aiw, 252, 249) img.save(target_mini_file)
def convert_aiw(self, source_file, target_file): shutil.copy(source_file, target_file) # generate the thumbnail if there isn't somebody already rest, ext = os.path.splitext(source_file) trest, text = os.path.splitext(target_file) source_mini_file = os.path.join(rest + "mini.tga") target_mini_file = os.path.join(trest + "mini.tga") logging.info("generating track thumbnail: %s", target_mini_file) if not rfactortools.lookup_path_icase( source_mini_file) or self.cfg.force_track_thumbnails: aiw = rfactortools.parse_aiwfile(source_file) img = rfactortools.render_aiw(aiw, 252, 249) img.save(target_mini_file)
def process_veh_file(veh_filename, fix, errors, fout): teamdir = os.path.dirname(veh_filename) modname = find_modname(os.path.dirname(veh_filename)) vehdir = find_vehdir(os.path.dirname(veh_filename)) veh_obj = parse_vehfile(rfactortools.lookup_path_icase(veh_filename)) fout.write("[Vehicle]\n") fout.write("veh: %s\n" % veh_filename) fout.write(" <VEHDIR>: %s\n" % vehdir) fout.write(" <TEAMDIR>: %s\n" % teamdir) fout.write(" graphics: %s\n" % veh_obj.graphics_file) fout.write(" spinner: %s\n" % veh_obj.spinner_file) if veh_obj.graphics_file is not None: process_scn_veh_file(modname, veh_filename, veh_obj.graphics_file, vehdir, teamdir, fix, errors, fout) if veh_obj.spinner_file is not None: process_scn_veh_file(modname, veh_filename, veh_obj.spinner_file, vehdir, teamdir, fix, errors, fout)