added rendercheck mode 3, the identity function of rendercheck modes!
This commit is contained in:
@@ -704,6 +704,14 @@ values. The valid configuration keys are listed below.
|
|||||||
'forcerender': True,
|
'forcerender': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
``renderchecks``
|
||||||
|
This is an integer, and functions as a more complex form of
|
||||||
|
``forcerender``. Setting it to 1 enables :option:`--check-tiles`
|
||||||
|
mode, setting it to 2 enables :option:`--forcerender`, and 3 tells
|
||||||
|
Overviewer to keep this particular render in the output, but
|
||||||
|
otherwise don't update it. It defaults to 0, which is the usual
|
||||||
|
update checking mode.
|
||||||
|
|
||||||
``changelist``
|
``changelist``
|
||||||
This is a string. It names a file where it will write out, one per line, the
|
This is a string. It names a file where it will write out, one per line, the
|
||||||
path to tiles that have been updated. You can specify the same file for
|
path to tiles that have been updated. You can specify the same file for
|
||||||
|
|||||||
@@ -318,19 +318,24 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
|
|||||||
"--check-tiles, and --no-tile-checks. These options conflict.")
|
"--check-tiles, and --no-tile-checks. These options conflict.")
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
def set_renderchecks(checkname, num):
|
||||||
|
for name, render in config['renders'].iteritems():
|
||||||
|
if render.get('renderchecks', 0) == 3:
|
||||||
|
logging.warning(checkname + " ignoring render " + repr(name) + " since it's marked as \"don't render\".")
|
||||||
|
else:
|
||||||
|
render['renderchecks'] = num
|
||||||
|
|
||||||
if options.forcerender:
|
if options.forcerender:
|
||||||
logging.info("Forcerender mode activated. ALL tiles will be rendered")
|
logging.info("Forcerender mode activated. ALL tiles will be rendered")
|
||||||
for render in config['renders'].itervalues():
|
set_renderchecks("forcerender", 2)
|
||||||
render['renderchecks'] = 2
|
|
||||||
elif options.checktiles:
|
elif options.checktiles:
|
||||||
logging.info("Checking all tiles for updates manually.")
|
logging.info("Checking all tiles for updates manually.")
|
||||||
for render in config['renders'].itervalues():
|
set_renderchecks("checktiles", 1)
|
||||||
render['renderchecks'] = 1
|
|
||||||
elif options.notilechecks:
|
elif options.notilechecks:
|
||||||
logging.info("Disabling all tile mtime checks. Only rendering tiles "+
|
logging.info("Disabling all tile mtime checks. Only rendering tiles "+
|
||||||
"that need updating since last render")
|
"that need updating since last render")
|
||||||
for render in config['renders'].itervalues():
|
set_renderchecks("notilechecks", 0)
|
||||||
render['renderchecks'] = 0
|
|
||||||
|
|
||||||
if not config['renders']:
|
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")
|
||||||
|
|||||||
@@ -130,6 +130,14 @@ Bounds = namedtuple("Bounds", ("mincol", "maxcol", "minrow", "maxrow"))
|
|||||||
# slowest, but SHOULD be specified if this is the first render because
|
# slowest, but SHOULD be specified if this is the first render because
|
||||||
# the scan will forgo tile stat calls. It's also useful for changing
|
# the scan will forgo tile stat calls. It's also useful for changing
|
||||||
# texture packs or other options that effect the output.
|
# texture packs or other options that effect the output.
|
||||||
|
|
||||||
|
# 3
|
||||||
|
# A very special mode. Using this will not actually render
|
||||||
|
# anything, but will leave this tileset in the resulting
|
||||||
|
# map. Useful for renders that you want to keep, but not
|
||||||
|
# update. Since this mode is so simple, it's left out of the
|
||||||
|
# rest of this discussion.
|
||||||
|
|
||||||
#
|
#
|
||||||
# For 0 our caller has explicitly requested not to check mtimes on disk to
|
# For 0 our caller has explicitly requested not to check mtimes on disk to
|
||||||
# speed things up. So the mode 0 chunk scan only looks at chunk mtimes and the
|
# speed things up. So the mode 0 chunk scan only looks at chunk mtimes and the
|
||||||
@@ -238,6 +246,13 @@ class TileSet(object):
|
|||||||
useful for changing texture packs or other options that effect
|
useful for changing texture packs or other options that effect
|
||||||
the output.
|
the output.
|
||||||
|
|
||||||
|
3
|
||||||
|
A very special mode. Using this will not actually render
|
||||||
|
anything, but will leave this tileset in the resulting
|
||||||
|
map. Useful for renders that you want to keep, but not
|
||||||
|
update. Since this mode is so simple, it's left out of the
|
||||||
|
rest of this discussion.
|
||||||
|
|
||||||
imgformat
|
imgformat
|
||||||
A string indicating the output format. Must be one of 'png' or
|
A string indicating the output format. Must be one of 'png' or
|
||||||
'jpeg'
|
'jpeg'
|
||||||
@@ -390,6 +405,11 @@ class TileSet(object):
|
|||||||
attribute for later use in iterate_work_items()
|
attribute for later use in iterate_work_items()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# skip if we're told to
|
||||||
|
if self.options['renderchecks'] == 3:
|
||||||
|
return
|
||||||
|
|
||||||
# REMEMBER THAT ATTRIBUTES ASSIGNED IN THIS METHOD ARE NOT AVAILABLE IN
|
# REMEMBER THAT ATTRIBUTES ASSIGNED IN THIS METHOD ARE NOT AVAILABLE IN
|
||||||
# THE do_work() METHOD (because this is only called in the main process
|
# THE do_work() METHOD (because this is only called in the main process
|
||||||
# not the workers)
|
# not the workers)
|
||||||
@@ -416,15 +436,16 @@ class TileSet(object):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def get_phase_length(self, phase):
|
def get_phase_length(self, phase):
|
||||||
"""Returns the number of work items in a given phase, or None if there
|
"""Returns the number of work items in a given phase.
|
||||||
is no good estimate.
|
|
||||||
"""
|
"""
|
||||||
# Yeah functional programming!
|
# Yeah functional programming!
|
||||||
|
# and by functional we mean a bastardized python switch statement
|
||||||
return {
|
return {
|
||||||
0: lambda: self.dirtytree.count_all(),
|
0: lambda: self.dirtytree.count_all(),
|
||||||
#there is no good way to guess this so just give total count
|
#there is no good way to guess this so just give total count
|
||||||
1: lambda: (4**(self.treedepth+1)-1)/3,
|
1: lambda: (4**(self.treedepth+1)-1)/3,
|
||||||
2: lambda: self.dirtytree.count_all(),
|
2: lambda: self.dirtytree.count_all(),
|
||||||
|
3: lambda: 0,
|
||||||
}[self.options['renderchecks']]()
|
}[self.options['renderchecks']]()
|
||||||
|
|
||||||
def iterate_work_items(self, phase):
|
def iterate_work_items(self, phase):
|
||||||
@@ -434,6 +455,10 @@ class TileSet(object):
|
|||||||
This method returns an iterator over (obj, [dependencies, ...])
|
This method returns an iterator over (obj, [dependencies, ...])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# skip if asked to
|
||||||
|
if self.options['renderchecks'] == 3:
|
||||||
|
return
|
||||||
|
|
||||||
# The following block of code implementes the changelist functionality.
|
# The following block of code implementes the changelist functionality.
|
||||||
fd = self.options.get("changelist", None)
|
fd = self.options.get("changelist", None)
|
||||||
if fd:
|
if fd:
|
||||||
@@ -537,6 +562,11 @@ class TileSet(object):
|
|||||||
return "#%02x%02x%02x" % color[0:3]
|
return "#%02x%02x%02x" % color[0:3]
|
||||||
isOverlay = self.options.get("overlay") or (not any(isinstance(x, rendermodes.Base) for x in self.options.get("rendermode")))
|
isOverlay = self.options.get("overlay") or (not any(isinstance(x, rendermodes.Base) for x in self.options.get("rendermode")))
|
||||||
|
|
||||||
|
# don't update last render time if we're leaving this alone
|
||||||
|
last_rendertime = self.last_rendertime
|
||||||
|
if self.options['renderchecks'] != 3:
|
||||||
|
last_rendertime = self.max_chunk_mtime
|
||||||
|
|
||||||
d = dict(name = self.options.get('title'),
|
d = dict(name = self.options.get('title'),
|
||||||
zoomLevels = self.treedepth,
|
zoomLevels = self.treedepth,
|
||||||
defaultZoom = self.options.get('defaultzoom'),
|
defaultZoom = self.options.get('defaultzoom'),
|
||||||
@@ -546,7 +576,7 @@ class TileSet(object):
|
|||||||
bgcolor = bgcolorformat(self.options.get('bgcolor')),
|
bgcolor = bgcolorformat(self.options.get('bgcolor')),
|
||||||
world = self.options.get('worldname_orig') +
|
world = self.options.get('worldname_orig') +
|
||||||
(" - " + self.options.get('dimension')[0] if self.options.get('dimension')[1] != 0 else ''),
|
(" - " + self.options.get('dimension')[0] if self.options.get('dimension')[1] != 0 else ''),
|
||||||
last_rendertime = self.max_chunk_mtime,
|
last_rendertime = last_rendertime,
|
||||||
imgextension = self.imgextension,
|
imgextension = self.imgextension,
|
||||||
isOverlay = isOverlay,
|
isOverlay = isOverlay,
|
||||||
poititle = self.options.get("poititle"),
|
poititle = self.options.get("poititle"),
|
||||||
|
|||||||
Reference in New Issue
Block a user