Browse Source

working on fixing decachunk generation

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
51e0e2b456
  1. 23
      chunkymap-regen.py
  2. 15
      install-chunkymap-on-windows.py

23
chunkymap-regen.py

@ -60,7 +60,7 @@ class InstalledFile:
self.source_dir_path=source_dir_path
self.dest_dir_path=dest_dir_path
def get_dict_deepcopy(old_dict):
new_dict = None
if type(old_dict) is dict:
@ -391,6 +391,7 @@ class MTChunks:
chunks = None
decachunks = None
rendered_this_session_count = None
#force_rerender_decachunks_enable = None
#region values for subprocess arguments:
pixelspernode = 1
@ -434,6 +435,7 @@ class MTChunks:
min_indent = None
def __init__(self): #formerly checkpaths() in global scope
#self.force_rerender_decachunks_enable = True
self.min_indent = " "
self.decachunks = {}
self.rendered_this_session_count = 0
@ -904,7 +906,7 @@ class MTChunks:
decachunk_image_path = self.get_decachunk_image_path_from_decachunk(decachunky_x, decachunky_z)
combined_count = 0
contains_chunk_luids = list()
for coord in chunk16_coord_list:
chunky_x, chunky_z = coord
chunky_offset_x = chunky_x - chunk16x_min
@ -1563,8 +1565,9 @@ class MTChunks:
prev_len = len(self.todo_positions)
self._check_map_pseudorecursion_branchfrom(chunky_x, chunky_z)
#must check_decachunk_containing_chunk AFTER _check_map_pseudorecursion_branchfrom so check_decachunk_containing_chunk can see if there are more to do before rendering superchunk
if self.rendered_this_session_count>prev_rendered_this_session_count:
self.check_decachunk_containing_chunk(chunky_x, chunky_z)
#always check since already checks queue and doesn't render decachunk on last rendered chunk, but instead on last queued chunk in decachunk
#if self.rendered_this_session_count>prev_rendered_this_session_count or self.force_rerender_decachunks_enable:
self.check_decachunk_containing_chunk(chunky_x, chunky_z)
if self.verbose_enable:
print(min_indent+"["+str(self.todo_index)+"] branching from "+str((chunky_x, chunky_z))+" (added "+str(len(self.todo_positions)-prev_len)+")")
else:
@ -1596,7 +1599,7 @@ class MTChunks:
except:
pass
return result
def apply_auto_tags_by_worldgen_mods(self, chunky_x, chunky_z):
worldgen_mod_list = list()
worldgen_mod_list.append("technic_worldgen")
@ -1608,7 +1611,7 @@ class MTChunks:
worldgen_mod_list.append("caverealms")
#worldgen_mod_list.append("nature_classic") # NOTE: plantlife_modpack has this and other stuff, but just mention this one in tags since it is unique to the modpack
worldgen_mod_list.append("plantlife_modpack") #ok if installed as modpack instead of putting individual mods in mods folder
chunk_luid = self.get_chunk_luid(chunky_x, chunky_z)
if chunk_luid not in self.chunks.keys():
self.prepare_chunk_meta(chunky_x, chunky_z)
@ -1625,10 +1628,10 @@ class MTChunks:
#TODO: finish this
#for mod_name in worldgen_mod_list:
#mod_path = self.asdf
#if os.path.isdir(
#if os.path.isdir(
#if is_changed:
# self.save_chunk_meta(chunky_x, chunky_z)
def correct_genresults_paths(self):
count = 0
folder_path = self.get_chunk_genresults_base_path()
@ -1670,7 +1673,7 @@ class MTChunks:
print("MOVED "+str(count)+" genresult file(s)")
print("")
print("")
def check_map_pseudorecursion_start(self):
if self.todo_index<0:
@ -1717,7 +1720,7 @@ class MTChunks:
break
print("Checking chunk "+str(coords)+" *"+str(self.mapvars["chunk_size"])+"")
self.prepare_chunk_meta(chunky_x, chunky_z)
#if ("tags" not in self.chunks[chunk_luid].metadata):
#self.chunks[chunk_luid].metadata["tags"] = "moreores,caverealms"
#self.save_chunk_meta(chunky_x, chunky_z)

15
install-chunkymap-on-windows.py

@ -12,7 +12,7 @@ def view_traceback():
traceback.print_tb(tb)
del tb
#as per Pedro Lobito on http://stackoverflow.com/questions/802134/changing-user-agent-on-urllib2-urlopen
#as per Pedro Lobito on http://stackoverflow.com/questions/802134/changing-user-agent-on-urllib2-urlopen
from urllib import FancyURLopener
class MyOpener(FancyURLopener, object):
version = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'
@ -21,16 +21,17 @@ def web_get(url, file_name):
myopener = MyOpener()
print("Downloading "+url+"...")
myopener.retrieve(url, file_name)
#as per http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python
#as per http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python but FAILS (404 Error) since user agent is not recognized, and setting user agent string does not fix it. use web_get above instead.
def web_get_BADUSERAGENT(url, file_name):
print("This function probably will not work since settings user agent doesn't work with urllib2 request object (user agent is not recognized, and 404 error is usually the result). Try web_get instead.")
file_name = None
try:
#url = "http://download.thinkbroadband.com/10MB.zip"
#file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
@ -148,7 +149,7 @@ if python_folder_name.lower()[:7]!="python3":
python_Lib_path = os.path.join(python_folder_path,"Lib")
python_Lib_site_packages_path = os.path.join(python_Lib_path, "site-packages")
if os.path.isdir(python_Lib_site_packages_path):
installed_numpy_path = os.path.join(python_Lib_site_packages_path, "numpy")
if not os.path.isdir(installed_numpy_path):
#downloaded_numpy_path = os.path.join(downloads_path, downloaded_numpy_name)
@ -161,7 +162,7 @@ if python_folder_name.lower()[:7]!="python3":
if os.path.isfile(downloaded_numpy_path):
subprocess.call(install_numpy_cmd_string)
if os.path.isdir(installed_numpy_path):
print("Numpy was detected at '"+installed_numpy_path+"'")
installed_pillow_path = os.path.join(python_Lib_site_packages_path, "PIL")
@ -207,4 +208,4 @@ if python_folder_name.lower()[:7]!="python3":
else:
raw_input("Cannot detect a site-packages folder in python installation of current python executable "+sys.executable+" so installation cannot continue. Press enter to exit.")
else:
raw_input("This installer does not know the correct wheels for python 3 (detected at "+python_folder_path+"). Please run this script with python 2 instead. Please see README.md for manual installation, but download python 3 wheels instead of the example wheels listed in README.md. Press enter to exit.")
raw_input("This installer does not know the correct wheels for python 3 (detected at "+python_folder_path+"). Please run this script with python 2 instead. Please see README.md for manual installation, but download and install Python 3 wheels instead of the example wheels listed in README.md. Press enter to exit.")

Loading…
Cancel
Save