#genqc.py # # generates a QC file for creating a sprite/tile model for the videogames plugin # #---------------------------------------------------------------------------------------- import sys, getopt #---------------------------------------------------------------------------------------- usage = 'genqc.py -g -m -s -o ' #---------------------------------------------------------------------------------------- def main(argv): game = '' outputfile = '' smd = '' model = '' try: opts, args = getopt.getopt(argv,"hg:m:s:o:",["help","game=","model=","smd=","output="]) except getopt.GetoptError: print "error!" print usage sys.exit(2) for opt, arg in opts: if opt in ("-h","--help"): print usage sys.exit() elif opt in ("-g", "--game"): game = arg elif opt in ("-o", "--output"): outputfile = arg elif opt in ("-s", "--smd"): smd = arg elif opt in ("-m", "--model"): model = arg # quit if an argument is missing if game == '' or outputfile == '' or smd == '' or model == '': print 'bad arguments' sys.exit(2) # poop out stuff print 'writing ' + outputfile + '...' output = open(outputfile,"w") output.write( '// this file generated by genqc.py\n\n' ) output.write( '$modelname "videogames/' + game + '/' + model + '.mdl"\n' ) output.write( '$cdmaterials "videogames/' + game + '"\n' ) output.write( '\n' ) output.write( '$model "body" "' + smd + '"\n' ) output.write( '$staticprop\n' ) output.write( '$sequence idle "' + smd + '"\n' ) output.close() print 'done.' #---------------------------------------------------------------------------------------- if __name__ == "__main__": main(sys.argv[1:])