Merge branch master into devel
Conflicts: docs/config.rst overviewer.py overviewer_core/settingsDefinition.py overviewer_core/tileset.py
This commit is contained in:
@@ -115,6 +115,57 @@ individual renders to apply to just those renders.
|
|||||||
See the ``sample_config.py`` file included in the repository for another
|
See the ``sample_config.py`` file included in the repository for another
|
||||||
example.
|
example.
|
||||||
|
|
||||||
|
A dynamic config file
|
||||||
|
=====================
|
||||||
|
|
||||||
|
It might be handy to dynamically retrieve parameters. For instance, if you
|
||||||
|
periodically render your last map backup which is located in a timestamped
|
||||||
|
directory, it is not convenient to edit the config file each time to fit the
|
||||||
|
new directory name.
|
||||||
|
|
||||||
|
Using environment variables, you can easily retrieve a parameter which has
|
||||||
|
been set by, for instance, your map backup script. In this example, Overviewer
|
||||||
|
is called from a *bash* script, but it can be done from other shell scripts
|
||||||
|
and languages.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## Add these lines to your bash script
|
||||||
|
|
||||||
|
# Setting up an environment variable that child processes will inherit.
|
||||||
|
# In this example, the map's path is not static and depends on the
|
||||||
|
# previously set $timestamp var.
|
||||||
|
MYWORLD_DIR=/path/to/map/backup/$timestamp/YourWorld
|
||||||
|
export MYWORLD_DIR
|
||||||
|
|
||||||
|
# Running the Overviewer
|
||||||
|
overviewer.py --config=/path/to/yourConfig.py
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
The environment variable will only be local to the process and its child
|
||||||
|
processes. The Overviewer, when run by the script, will be able to access
|
||||||
|
the variable since it becomes a child process.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
## A config file example
|
||||||
|
|
||||||
|
# Importing the os python module
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Retrieving the environment variable set up by the bash script
|
||||||
|
worlds["My world"] = os.environ['MYWORLD_DIR']
|
||||||
|
|
||||||
|
renders["normalrender"] = {
|
||||||
|
"world": "My world",
|
||||||
|
"title": "Normal Render of My World",
|
||||||
|
}
|
||||||
|
|
||||||
|
outputdir = "/home/username/mcmap"
|
||||||
|
|
||||||
Config File Specifications
|
Config File Specifications
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
@@ -360,6 +411,20 @@ values. The valid configuration keys are listed below.
|
|||||||
|
|
||||||
**Default:** ``95``
|
**Default:** ``95``
|
||||||
|
|
||||||
|
``optimizeimg``
|
||||||
|
This option specifies which additional tools overviewer should use to
|
||||||
|
optimize the filesize of png tiles.
|
||||||
|
The tools used must be placed somewhere, where overviewer can find them, for
|
||||||
|
example the "PATH" environment variable or a directory like /usr/bin.
|
||||||
|
This should be an integer between 0 and 3.
|
||||||
|
* ``1 - Use pngcrush``
|
||||||
|
* ``2 - Use advdef``
|
||||||
|
* ``3 - Use pngcrush and advdef (Not recommended)``
|
||||||
|
Using this option may significantly increase render time, but will make
|
||||||
|
the resulting tiles smaller, with lossless image quality.
|
||||||
|
|
||||||
|
**Default:** ``0``
|
||||||
|
|
||||||
``bgcolor``
|
``bgcolor``
|
||||||
This is the background color to be displayed behind the map. Its value
|
This is the background color to be displayed behind the map. Its value
|
||||||
should be either a string in the standard HTML color syntax or a 4-tuple in
|
should be either a string in the standard HTML color syntax or a 4-tuple in
|
||||||
@@ -492,6 +557,10 @@ values. The valid configuration keys are listed below.
|
|||||||
|
|
||||||
**Default:** ``[]`` (an empty list)
|
**Default:** ``[]`` (an empty list)
|
||||||
|
|
||||||
|
``showspawn``
|
||||||
|
This is a boolean, and defaults to ``True``. If set to ``False``, then the spawn
|
||||||
|
icon will not be displayed on the rendered map.
|
||||||
|
|
||||||
.. _customrendermodes:
|
.. _customrendermodes:
|
||||||
|
|
||||||
Custom Rendermodes and Rendermode Primitives
|
Custom Rendermodes and Rendermode Primitives
|
||||||
@@ -660,7 +729,7 @@ are referencing the previously defined list, not one of the built-in
|
|||||||
rendermodes.
|
rendermodes.
|
||||||
|
|
||||||
Built-in Rendermodes
|
Built-in Rendermodes
|
||||||
--------------------
|
====================
|
||||||
The built-in rendermodes are nothing but pre-defined lists of rendermode
|
The built-in rendermodes are nothing but pre-defined lists of rendermode
|
||||||
primitives for your convenience. Here are their definitions::
|
primitives for your convenience. Here are their definitions::
|
||||||
|
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
|
|||||||
|
|
||||||
# only pass to the TileSet the options it really cares about
|
# only pass to the TileSet the options it really cares about
|
||||||
render['name'] = render_name # perhaps a hack. This is stored here for the asset manager
|
render['name'] = render_name # perhaps a hack. This is stored here for the asset manager
|
||||||
tileSetOpts = util.dict_subset(render, ["name", "imgformat", "renderchecks", "rerenderprob", "bgcolor", "imgquality", "optimizeimg", "rendermode", "worldname_orig", "title", "dimension", "changelist", "overlay"])
|
tileSetOpts = util.dict_subset(render, ["name", "imgformat", "renderchecks", "rerenderprob", "bgcolor", "imgquality", "optimizeimg", "rendermode", "worldname_orig", "title", "dimension", "changelist","showspawn", "overlay"])
|
||||||
tileSetOpts.update({"spawn": w.find_true_spawn()}) # TODO find a better way to do this
|
tileSetOpts.update({"spawn": w.find_true_spawn()}) # TODO find a better way to do this
|
||||||
tset = tileset.TileSet(rset, assetMrg, tex, tileSetOpts, tileset_dir)
|
tset = tileset.TileSet(rset, assetMrg, tex, tileSetOpts, tileset_dir)
|
||||||
tilesets.append(tset)
|
tilesets.append(tset)
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ renders = Setting(required=True, default=util.OrderedDict(),
|
|||||||
"changelist": Setting(required=False, validator=validateStr, default=None),
|
"changelist": Setting(required=False, validator=validateStr, default=None),
|
||||||
"markers": Setting(required=False, validator=validateMarkers, default=[]),
|
"markers": Setting(required=False, validator=validateMarkers, default=[]),
|
||||||
"overlay": Setting(required=False, validator=validateOverlays, default=[]),
|
"overlay": Setting(required=False, validator=validateOverlays, default=[]),
|
||||||
|
"showspawn": Setting(required=False, validator=validateBool, default=True),
|
||||||
|
|
||||||
# Remove this eventually (once people update their configs)
|
# Remove this eventually (once people update their configs)
|
||||||
"worldname": Setting(required=False, default=None,
|
"worldname": Setting(required=False, default=None,
|
||||||
|
|||||||
@@ -527,8 +527,11 @@ class TileSet(object):
|
|||||||
if isOverlay:
|
if isOverlay:
|
||||||
d.update({"tilesets": self.options.get("overlay")})
|
d.update({"tilesets": self.options.get("overlay")})
|
||||||
|
|
||||||
if (self.regionset.get_type() == "overworld"):
|
if (self.regionset.get_type() == "overworld" and self.options.get("showspawn", True)):
|
||||||
d.update({"spawn": self.options.get("spawn")})
|
d.update({"spawn": self.options.get("spawn")})
|
||||||
|
else:
|
||||||
|
d.update({"spawn": "false"});
|
||||||
|
|
||||||
try:
|
try:
|
||||||
d['north_direction'] = self.regionset.north_dir
|
d['north_direction'] = self.regionset.north_dir
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user