Skip to content

Commit

Permalink
Fixed archived mcmeta
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Jul 13, 2024
1 parent 49b0955 commit e3bcb95
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions Mcblend Source/Materials/Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,28 +425,17 @@ def zip_unpacker(root_folder, image_name, file=None):

for zip_info in filter(lambda x: ".png" in x.filename, zip_ref.infolist()):
texture = os.path.basename(zip_info.filename)
base_texture = texture.replace(".mcmeta", "")

if ".mcmeta" in texture:
if texture.replace(".mcmeta", "") == image_name and r_props.animate_textures:
extracted_file_path = os.path.join(extract_path, zip_info.filename)
if not os.path.isfile(extracted_file_path):
zip_ref.extract(zip_info, extract_path)
extracted_file_path = os.path.join(extract_path, zip_info.filename)

else:
debugger(f"{texture.replace('.mcmeta', '')} - {image_name}")

if texture == image_name:
extracted_file_path = os.path.join(extract_path, zip_info.filename)
if not os.path.isfile(extracted_file_path):
extracted_file_path = zip_ref.extract(zip_info, extract_path)
if not os.path.isfile(extracted_file_path):
zip_ref.extract(zip_info, extract_path)

if base_texture == image_name and texture.endswith(".png"):
return extracted_file_path

if "grass" in image_name and (texture == f"short_{image_name}" or texture == image_name.replace("short_", "")):
extracted_file_path = os.path.join(extract_path, zip_info.filename)
if not os.path.isfile(extracted_file_path):
extracted_file_path = zip_ref.extract(zip_info, extract_path)

if "grass" in image_name and (base_texture == f"short_{image_name}" or base_texture == image_name.replace("short_", "")) and texture.endswith(".png"):
return extracted_file_path
return None

Expand Down

0 comments on commit e3bcb95

Please sign in to comment.