0

Only pass to TileSet the options it required

This commit is contained in:
Andrew Chin
2012-01-16 20:35:13 -05:00
parent 728351f9a3
commit aa34853664
2 changed files with 15 additions and 1 deletions

View File

@@ -294,7 +294,10 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
print "tileset_dir: %r" % tileset_dir print "tileset_dir: %r" % tileset_dir
if not os.path.exists(tileset_dir): if not os.path.exists(tileset_dir):
os.mkdir(tileset_dir) os.mkdir(tileset_dir)
tset = tileset.TileSet(rset, assetMrg, tex, render, tileset_dir)
# only pass to the TileSet the options it really cares about
tileSetOpts = util.dict_subset(render, ["name", "imgformat", "renderchecks", "rerenderprob", "bgcolor", "imgquality", "optimizeimg", "rendermode"])
tset = tileset.TileSet(rset, assetMrg, tex, tileSetOpts, tileset_dir)
tilesets.append(tset) tilesets.append(tset)

View File

@@ -447,3 +447,14 @@ def mirror_dir(src, dst, entities=None):
pass pass
shutil.copy(os.path.join(src, entry), os.path.join(dst, entry)) shutil.copy(os.path.join(src, entry), os.path.join(dst, entry))
# if this stills throws an error, let it propagate up # if this stills throws an error, let it propagate up
def dict_subset(d, keys):
"Return a new dictionary that is built from copying select keys from d"
n = dict()
for key in keys:
if key in d:
n[key] = d[key]
return n