forked from MineClone5/MineClone5
Better log of Texture Converter
This commit is contained in:
parent
d949683cd9
commit
370813d2d1
|
@ -28,6 +28,9 @@ dry_run = False
|
||||||
# If False, textures will be put into MineClone 2 directories.
|
# If False, textures will be put into MineClone 2 directories.
|
||||||
make_texture_pack = True
|
make_texture_pack = True
|
||||||
|
|
||||||
|
# If True, prints all copying actions
|
||||||
|
verbose = False
|
||||||
|
|
||||||
### END OF SETTINGS ###
|
### END OF SETTINGS ###
|
||||||
|
|
||||||
import shutil, csv, os, tempfile
|
import shutil, csv, os, tempfile
|
||||||
|
@ -55,7 +58,8 @@ def target_dir(directory):
|
||||||
|
|
||||||
# Copy texture files
|
# Copy texture files
|
||||||
def convert_textures():
|
def convert_textures():
|
||||||
print("Texture conversion BEGINS HERE!")
|
failed_conversions = 0
|
||||||
|
print("Texture conversion BEGINS NOW!")
|
||||||
with open("Texture_Conversion_Table.csv", newline="") as csvfile:
|
with open("Texture_Conversion_Table.csv", newline="") as csvfile:
|
||||||
reader = csv.reader(csvfile, delimiter=",", quotechar='"')
|
reader = csv.reader(csvfile, delimiter=",", quotechar='"')
|
||||||
first_row = True
|
first_row = True
|
||||||
|
@ -85,6 +89,7 @@ def convert_textures():
|
||||||
|
|
||||||
if src_file_exists == False:
|
if src_file_exists == False:
|
||||||
print("WARNING: Source file does not exist: "+src_file)
|
print("WARNING: Source file does not exist: "+src_file)
|
||||||
|
failed_conversions = failed_conversions + 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if xs != None:
|
if xs != None:
|
||||||
|
@ -94,11 +99,13 @@ def convert_textures():
|
||||||
region = image.crop((xs, ys, xs+xl, ys+yl))
|
region = image.crop((xs, ys, xs+xl, ys+yl))
|
||||||
region.load()
|
region.load()
|
||||||
region.save(dst_file)
|
region.save(dst_file)
|
||||||
|
if verbose:
|
||||||
print(src_file + " → " + dst_file)
|
print(src_file + " → " + dst_file)
|
||||||
else:
|
else:
|
||||||
# Copy image verbatim
|
# Copy image verbatim
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
shutil.copy2(src_file, dst_file)
|
shutil.copy2(src_file, dst_file)
|
||||||
|
if verbose:
|
||||||
print(src_file + " → " + dst_file)
|
print(src_file + " → " + dst_file)
|
||||||
|
|
||||||
# Convert chest textures (requires ImageMagick)
|
# Convert chest textures (requires ImageMagick)
|
||||||
|
@ -160,8 +167,9 @@ def convert_textures():
|
||||||
# os.system("mogrify -clip-mask "+tex_dir+"/entity/banner/base.png"+" -alpha Copy "+filename)
|
# os.system("mogrify -clip-mask "+tex_dir+"/entity/banner/base.png"+" -alpha Copy "+filename)
|
||||||
# os.system("mogrify -fill white -colorize 100 "+filename)
|
# os.system("mogrify -fill white -colorize 100 "+filename)
|
||||||
|
|
||||||
print("")
|
|
||||||
print("Textures conversion COMPLETE!")
|
print("Textures conversion COMPLETE!")
|
||||||
|
if failed_conversions > 0:
|
||||||
|
print("Number of missing files in original resource pack: "+str(failed_conversions))
|
||||||
print("WARNING: Please keep in mind this script does not reliably convert all the textures yet.")
|
print("WARNING: Please keep in mind this script does not reliably convert all the textures yet.")
|
||||||
if make_texture_pack:
|
if make_texture_pack:
|
||||||
print("Retrieve the texture pack in "+working_dir+"/texture_pack/")
|
print("Retrieve the texture pack in "+working_dir+"/texture_pack/")
|
||||||
|
|
Loading…
Reference in New Issue