File tree 3 files changed +12
-12
lines changed
3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def load(self):
24
24
data ,
25
25
)
26
26
27
- if self .mipmap :
27
+ if self .meta . mipmap :
28
28
self .build_mipmaps ()
29
29
30
30
self ._close_image ()
Original file line number Diff line number Diff line change @@ -11,21 +11,22 @@ class PillowLoader(BaseLoader):
11
11
12
12
def __init__ (self , meta ):
13
13
super ().__init__ (meta )
14
- self .image = getattr (meta , 'image' , None )
15
- self .flip = getattr (meta , 'flip' , True )
16
- self .mipmap = getattr (meta , 'mipmap' , False )
14
+ self .image = None
17
15
18
16
def load (self ) -> Any :
19
17
raise NotImplementedError ()
20
18
21
19
def _open_image (self ):
22
- self .meta .resolved_path = self .find_texture (self .meta .path )
23
- if not self .meta .resolved_path :
24
- raise ValueError ("Cannot find texture: {}" .format (self .meta .path ))
20
+ if self .meta .image :
21
+ self .image = self .meta .image
22
+ else :
23
+ self .meta .resolved_path = self .find_texture (self .meta .path )
24
+ if not self .meta .resolved_path :
25
+ raise ValueError ("Cannot find texture: {}" .format (self .meta .path ))
25
26
26
- self .image = Image .open (self .meta .resolved_path )
27
+ self .image = Image .open (self .meta .resolved_path )
27
28
28
- if self .flip :
29
+ if self .meta . flip :
29
30
self .image = self .image .transpose (Image .FLIP_TOP_BOTTOM )
30
31
31
32
def _close_image (self ):
Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ class Loader(PillowLoader):
6
6
7
7
def load (self ):
8
8
"""Load a 2d texture"""
9
- if not self .image :
10
- self ._open_image ()
9
+ self ._open_image ()
11
10
12
11
components , data = image_data (self .image )
13
12
@@ -17,7 +16,7 @@ def load(self):
17
16
data ,
18
17
)
19
18
20
- if self .mipmap :
19
+ if self .meta . mipmap :
21
20
texture .build_mipmaps ()
22
21
23
22
self ._close_image ()
You can’t perform that action at this time.
0 commit comments