0

Bring docs and code in sync

This commit is contained in:
Andrew Chin
2012-02-12 13:45:43 -05:00
parent 6cf38d08b6
commit 14306f7e8a
3 changed files with 35 additions and 30 deletions

View File

@@ -22,7 +22,7 @@ A Simple Example
worlds["My world"] = "/home/username/server/world" worlds["My world"] = "/home/username/server/world"
render["normalrender"] = { render["normalrender"] = {
"world": "My world", "worldname": "My world",
"title": "Normal Render of My World", "title": "Normal Render of My World",
} }
@@ -38,7 +38,7 @@ The ``worlds`` dictionary
dictionary. If you want to render more than one world, you would put more dictionary. If you want to render more than one world, you would put more
lines like this one. Otherwise, one is sufficient. lines like this one. Otherwise, one is sufficient.
The ``render`` dictionary The ``renders`` dictionary
Each item here declares a "render" which is a map of a world rendered with a Each item here declares a "render" which is a map of a world rendered with a
set of options. If you have more than one, when viewing the maps, you will set of options. If you have more than one, when viewing the maps, you will
get a dropdown box to choose which map you want to look at. get a dropdown box to choose which map you want to look at.
@@ -59,37 +59,37 @@ A more complicated example
worlds["survival"] = "/home/username/server/survivalworld" worlds["survival"] = "/home/username/server/survivalworld"
worlds["creative"] = "/home/username/server/creativeworld" worlds["creative"] = "/home/username/server/creativeworld"
render["survivalday"] = { renders["survivalday"] = {
"world": "survival", "worldname": "survival",
"title": "Survival Daytime", "title": "Survival Daytime",
"rendermode": smooth_lighting, "rendermode": smooth_lighting,
"dimension": "overworld", "dimension": "overworld",
} }
render["survivalnight"] = { renders["survivalnight"] = {
"world": "survival", "worldname": "survival",
"title": "Survival Daytime", "title": "Survival Daytime",
"rendermode": smooth_night, "rendermode": smooth_night,
"dimension": "overworld", "dimension": "overworld",
} }
render["survivalnether"] = { renders["survivalnether"] = {
"world": "survival", "worldname": "survival",
"title": "Survival Nether", "title": "Survival Nether",
"rendermode": nether_smooth_lighting, "rendermode": nether_smooth_lighting,
"dimension": "nether", "dimension": "nether",
} }
render["survivalspawnoverlay"] = { renders["survivalspawnoverlay"] = {
"world": "survival", "worldname": "survival",
"title": "Spawn Overlay", "title": "Spawn Overlay",
"rendermode": spawn_overlay, "rendermode": spawn_overlay,
"dimension": "overworld", "dimension": "overworld",
"overlay": ["survivalday", "survivalnight"], "overlay": ["survivalday", "survivalnight"],
} }
render["creative"] = { renders["creative"] = {
"world": "creative", "worldname": "creative",
"title": "Creative", "title": "Creative",
"rendermode": smooth_lighting, "rendermode": smooth_lighting,
"dimension": "overworld", "dimension": "overworld",
@@ -123,7 +123,7 @@ This means you can put arbitrary logic in this file. The Overviewer gives the
execution of the file a local dict with a few pre-defined items (everything in execution of the file a local dict with a few pre-defined items (everything in
the overviewer_core.rendermodes module). the overviewer_core.rendermodes module).
After the config file is evaluated, the ``worlds`` and ``render`` dictionaries, After the config file is evaluated, the ``worlds`` and ``renders`` dictionaries,
along with other global level configuration options, are used to configure The along with other global level configuration options, are used to configure The
Overviewer's rendering. Overviewer's rendering.
@@ -131,12 +131,12 @@ Overviewer's rendering.
This is pre-defined as an empty dictionary. The config file is expected to This is pre-defined as an empty dictionary. The config file is expected to
add at least one item to it. add at least one item to it.
Keys are arbitrary strings used to identify the worlds in the ``render`` Keys are arbitrary strings used to identify the worlds in the ``renders``
dictionary. dictionary.
Values are paths to worlds (directories with a level.dat) Values are paths to worlds (directories with a level.dat)
``render`` ``renders``
This is also pre-defined as an empty dictionary. The config file is expected This is also pre-defined as an empty dictionary. The config file is expected
to add at least one item to it. to add at least one item to it.
@@ -152,7 +152,7 @@ Overviewer's rendering.
Render Dictonary Keys Render Dictonary Keys
--------------------- ---------------------
``world`` ``worldname``
Specifies which world this render corresponds to. Its value should be a Specifies which world this render corresponds to. Its value should be a
string from the appropriate key in the worlds dictionary. string from the appropriate key in the worlds dictionary.
@@ -172,9 +172,8 @@ Render Dictonary Keys
``title`` ``title``
This is the display name used in the user interface. Set this to whatever This is the display name used in the user interface. Set this to whatever
you want to see under the dropdown box for map selection. you want to see displayed in the Map Type control (the buttons in the upper-
right).
**Deafult: Worldname - Dimension**
``rendermode`` ``rendermode``
This is which rendermode to use for this render. There are many rendermodes This is which rendermode to use for this render. There are many rendermodes
@@ -242,6 +241,12 @@ These values are set directly in the config file. Example::
This can also be specified with :option:`--processes <-p>` This can also be specified with :option:`--processes <-p>`
.. _outputdir:
``outputdir = "<output directory path>"``
This is the path to the output directory where the rendered tiles will
be saved.
TODO: More to come here TODO: More to come here
.. _customrendermodes: .. _customrendermodes:

View File

@@ -223,10 +223,10 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
logging.debug("Using %r as the world directory", worldpath) logging.debug("Using %r as the world directory", worldpath)
logging.debug("Using %r as the output directory", destdir) logging.debug("Using %r as the output directory", destdir)
mw_parser.set_config_item("world", {'world': worldpath}) mw_parser.set_config_item("worlds", {'world': worldpath})
mw_parser.set_config_item("outputdir", destdir) mw_parser.set_config_item("outputdir", destdir)
# Now for some good defaults # Now for some good defaults
mw_parser.set_config_item("render", {'world': { mw_parser.set_config_item("renders", {'world': {
'worldname': 'world', 'worldname': 'world',
'title': 'Overviewer Render', 'title': 'Overviewer Render',
'rendermode': 'normal', 'rendermode': 'normal',
@@ -252,15 +252,15 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
############################################################ ############################################################
# Final validation steps and creation of the destination directory # Final validation steps and creation of the destination directory
if not config['render']: if not config['renders']:
logging.error("You must specify at least one render in your config file. See the docs if you're having trouble") logging.error("You must specify at least one render in your config file. See the docs if you're having trouble")
return 1 return 1
for rname, render in config['render'].iteritems(): for rname, render in config['renders'].iteritems():
# Convert render['worldname'] to the world path, and store the original # Convert render['worldname'] to the world path, and store the original
# in render['worldname_orig'] # in render['worldname_orig']
try: try:
worldpath = config['world'][render['worldname']] worldpath = config['worlds'][render['worldname']]
except KeyError: except KeyError:
logging.error("Render %s's world is '%s', but I could not find a corresponding entry in the worlds dictionary.", logging.error("Render %s's world is '%s', but I could not find a corresponding entry in the worlds dictionary.",
rname, render['worldname']) rname, render['worldname'])
@@ -297,7 +297,7 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
# same for textures # same for textures
texcache = {} texcache = {}
renders = config['render'] renders = config['renders']
for render_name, render in renders.iteritems(): for render_name, render in renders.iteritems():
logging.debug("Found the following render thing: %r", render) logging.debug("Found the following render thing: %r", render)

View File

@@ -45,8 +45,8 @@
from settingsValidators import * from settingsValidators import *
# render is a dictionary mapping strings to dicts. These dicts describe the # renders is a dictionary mapping strings to dicts. These dicts describe the
# configuration for that render. Therefore, the validator for 'render' is set # configuration for that render. Therefore, the validator for 'renders' is set
# to a dict validator configured to validate keys as strings and values as... # to a dict validator configured to validate keys as strings and values as...
# values are set to validate as a "configdict", which is a dict mapping a set # values are set to validate as a "configdict", which is a dict mapping a set
@@ -55,7 +55,7 @@ from settingsValidators import *
# objects with their respective validators. # objects with their respective validators.
# config file. # config file.
render = Setting(required=True, default={}, renders = Setting(required=True, default={},
validator=make_dictValidator(validateStr, make_configDictValidator( validator=make_dictValidator(validateStr, make_configDictValidator(
{ {
"worldname": Setting(required=True, validator=validateStr, default=None), "worldname": Setting(required=True, validator=validateStr, default=None),
@@ -77,8 +77,8 @@ render = Setting(required=True, default={},
} }
))) )))
# The world dict, mapping world names to world paths # The worlds dict, mapping world names to world paths
world = Setting(required=True, validator=make_dictValidator(validateStr, validateWorldPath), default={}) worlds = Setting(required=True, validator=make_dictValidator(validateStr, validateWorldPath), default={})
outputdir = Setting(required=True, validator=validateOutputDir, default=None) outputdir = Setting(required=True, validator=validateOutputDir, default=None)