|
|
|
@ -4,28 +4,28 @@ import toml, os
|
|
|
|
|
|
|
|
|
|
CONFIG["svg.file_path"] = "../assets/"
|
|
|
|
|
|
|
|
|
|
with open("../definitions.toml", "r") as def_file:
|
|
|
|
|
with open("../definitions.toml", "r") as def_file: #Load the part definitions
|
|
|
|
|
definitions = toml.loads(def_file.read())
|
|
|
|
|
with open("../designs.toml", "r") as design_file:
|
|
|
|
|
with open("../designs.toml", "r") as design_file: #Load the user designs
|
|
|
|
|
designs = toml.loads(design_file.read())
|
|
|
|
|
with open("../config.toml", "r") as config_file:
|
|
|
|
|
with open("../config.toml", "r") as config_file: #Load the user config
|
|
|
|
|
config = toml.loads(config_file.read())
|
|
|
|
|
|
|
|
|
|
os.makedirs("../output/vector/", exist_ok=True)
|
|
|
|
|
os.makedirs("../output/" + str(config["raster_size"]) + "/", exist_ok=True)
|
|
|
|
|
|
|
|
|
|
for key in designs:
|
|
|
|
|
currentDesign = designs[key]
|
|
|
|
|
currentDesign = designs[key] #Select the current design which is a list of parts
|
|
|
|
|
partsList = []
|
|
|
|
|
for part in currentDesign:
|
|
|
|
|
for url in definitions[part]:
|
|
|
|
|
partsList.append(url)
|
|
|
|
|
svg_parts = []
|
|
|
|
|
partsList.append(url) #For each part add each element to the list
|
|
|
|
|
svg_parts = []
|
|
|
|
|
for part in partsList:
|
|
|
|
|
svg_parts.append(SVG(part))
|
|
|
|
|
Figure("128","128", *svg_parts, SVG("credits.svg")).save("../output/vector/" + key + ".svg")
|
|
|
|
|
svg_parts.append(SVG(part)) #Add each element of the list of paths to a new list as a SVG element
|
|
|
|
|
Figure("128","128", *svg_parts, SVG("credits.svg")).save("../output/vector/" + key + ".svg") #Compile all parts into an SVG
|
|
|
|
|
|
|
|
|
|
if config["raster_images"]:
|
|
|
|
|
if config["raster_images"]: #Create png of designated size
|
|
|
|
|
svg2png(
|
|
|
|
|
url="../output/vector/" + key + ".svg",
|
|
|
|
|
write_to="../output/" + str(config["raster_size"]) + "/" + key + ".png", output_width=config["raster_size"]
|
|
|
|
|