Skip to content

Commit 0277672

Browse files
committed
Fix (MAT): Fix bug in max num of cel mipmaps to load
1 parent a99e7e7 commit 0277672

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

file-mat/mat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def load_from_file(self, file_path, max_cells = -1, parse_lod = False):
3535
r = self._read_records(f, h)
3636

3737
mat_name = file_path #os.path.basename(file_path)
38-
max_cells = h.cel_count if max_cells < 0 else max_cells
38+
max_cells = h.cel_count if max_cells < 0 else min(max_cells, h.cel_count)
3939
for cel_idx in range(0, max_cells):
4040
mm = self._read_mipmap(f, h.color_info)
4141
for lod_num, pixdata in enumerate(mm.pixel_data_array):

file-mat/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from gimpfu import *
22

3-
43
def is_image_mipmap(img):
54
para = img.parasite_find("mipmap")
65
if para:
@@ -10,7 +9,6 @@ def is_image_mipmap(img):
109
def set_image_as_mipmap(img, is_mipmap):
1110
img.attach_new_parasite("mipmap", is_mipmap, "")
1211

13-
1412
def make_mipmaps(img, min_size = 1, max_level = -1):
1513
if min_size < 1 or max_level == 0: return []
1614
mipmaps = []

0 commit comments

Comments
 (0)