Merge branch 'master' into lighting
Conflicts: chunk.py gmap.py textures.py world.py
This commit is contained in:
19
world.py
19
world.py
@@ -18,9 +18,9 @@ import os
|
||||
import os.path
|
||||
import multiprocessing
|
||||
import sys
|
||||
import logging
|
||||
|
||||
import numpy
|
||||
from PIL import Image
|
||||
|
||||
import chunk
|
||||
import nbt
|
||||
@@ -180,8 +180,9 @@ class WorldRenderer(object):
|
||||
def go(self, procs):
|
||||
"""Starts the render. This returns when it is finished"""
|
||||
|
||||
print "Scanning chunks"
|
||||
logging.info("Scanning chunks")
|
||||
raw_chunks = self._find_chunkfiles()
|
||||
logging.debug("Done scanning chunks")
|
||||
|
||||
# Translate chunks to our diagonal coordinate system
|
||||
mincol, maxcol, minrow, maxrow, chunks = _convert_coords(raw_chunks)
|
||||
@@ -215,9 +216,11 @@ class WorldRenderer(object):
|
||||
p = f.split(".")
|
||||
all_chunks.append((base36decode(p[1]), base36decode(p[2]),
|
||||
os.path.join(dirpath, f)))
|
||||
logging.debug((base36decode(p[1]), base36decode(p[2]),
|
||||
os.path.join(dirpath, f)))
|
||||
|
||||
if not all_chunks:
|
||||
print "Error: No chunks found!"
|
||||
logging.error("Error: No chunks found!")
|
||||
sys.exit(1)
|
||||
return all_chunks
|
||||
|
||||
@@ -238,7 +241,7 @@ class WorldRenderer(object):
|
||||
results = {}
|
||||
if processes == 1:
|
||||
# Skip the multiprocessing stuff
|
||||
print "Rendering chunks synchronously since you requested 1 process"
|
||||
logging.debug("Rendering chunks synchronously since you requested 1 process")
|
||||
for i, (col, row, chunkfile) in enumerate(chunks):
|
||||
if inclusion_set and (col, row) not in inclusion_set:
|
||||
# Skip rendering, just find where the existing image is
|
||||
@@ -252,9 +255,9 @@ class WorldRenderer(object):
|
||||
results[(col, row)] = result
|
||||
if i > 0:
|
||||
if 1000 % i == 0 or i % 1000 == 0:
|
||||
print "{0}/{1} chunks rendered".format(i, len(chunks))
|
||||
logging.info("{0}/{1} chunks rendered".format(i, len(chunks)))
|
||||
else:
|
||||
print "Rendering chunks in {0} processes".format(processes)
|
||||
logging.debug("Rendering chunks in {0} processes".format(processes))
|
||||
pool = multiprocessing.Pool(processes=processes)
|
||||
asyncresults = []
|
||||
for col, row, chunkfile in chunks:
|
||||
@@ -277,10 +280,10 @@ class WorldRenderer(object):
|
||||
results[(col, row)] = result.get()
|
||||
if i > 0:
|
||||
if 1000 % i == 0 or i % 1000 == 0:
|
||||
print "{0}/{1} chunks rendered".format(i, len(asyncresults))
|
||||
logging.info("{0}/{1} chunks rendered".format(i, len(asyncresults)))
|
||||
|
||||
pool.join()
|
||||
print "Done!"
|
||||
logging.info("Done!")
|
||||
|
||||
return results
|
||||
|
||||
|
||||
Reference in New Issue
Block a user