@@ -72,9 +72,9 @@ def _calculate_area(image_rect_list, inner_padding):
7272 area = 0
7373 for image_rect in image_rect_list :
7474 area += image_rect .area + \
75- image_rect .width * inner_padding + \
76- image_rect .height * inner_padding + \
77- inner_padding ** 2
75+ image_rect .width * inner_padding + \
76+ image_rect .height * inner_padding + \
77+ inner_padding ** 2
7878 return area
7979
8080 @staticmethod
@@ -131,23 +131,25 @@ def _init_atlas_list(self, image_rect_list):
131131
132132 if self .enable_rotated :
133133 if min (min_width , min_height ) > min (self .max_width , self .max_height ) or \
134- max (min_width , min_height ) > max (self .max_width , self .max_height ):
134+ max (min_width , min_height ) > max (self .max_width , self .max_height ):
135135 raise ValueError ("size of image is larger than max size." )
136136 else :
137137 if min_height > self .max_height or min_width > self .max_width :
138138 raise ValueError ("size of image is larger than max size." )
139139
140140 atlas_list = []
141141 area = self ._calculate_area (image_rect_list , self .inner_padding )
142- w , h = self ._cal_init_size (area , min_width , min_height , self .max_width , self .max_height )
142+ w , h = self ._cal_init_size (
143+ area , min_width , min_height , self .max_width , self .max_height )
143144
144145 atlas_list .append (self .ATLAS_TYPE (w , h , self .max_width , self .max_height ,
145146 force_square = self .force_square , border_padding = self .border_padding ,
146147 shape_padding = self .shape_padding , inner_padding = self .inner_padding ))
147148
148149 area = area - w * h
149150 while area > 0 :
150- w , h = self ._cal_init_size (area , 0 , 0 , self .max_width , self .max_height )
151+ w , h = self ._cal_init_size (
152+ area , 0 , 0 , self .max_width , self .max_height )
151153 area = area - w * h
152154 atlas_list .append (self .ATLAS_TYPE (w , h , self .max_width , self .max_height ,
153155 force_square = self .force_square , border_padding = self .border_padding ,
@@ -176,14 +178,15 @@ def pack(self, input_images, output_name, output_path="", input_base_path=None):
176178 if self .trim_mode :
177179 for image_rect in image_rects :
178180 image_rect .trim (self .trim_mode )
179-
181+
180182 if self .extrude :
181183 for image_rect in image_rects :
182184 image_rect .extrude (self .extrude )
183185
184186 atlas_list = self ._pack (image_rects )
185187
186- assert "%d" in output_name or len (atlas_list ) == 1 , 'more than one output image, but no "%d" in output_name'
188+ assert "%d" in output_name or len (
189+ atlas_list ) == 1 , 'more than one output image, but no "%d" in output_name'
187190
188191 for i , atlas in enumerate (atlas_list ):
189192 texture_file_name = output_name if "%d" not in output_name else output_name % i
@@ -195,10 +198,12 @@ def pack(self, input_images, output_name, output_path="", input_base_path=None):
195198 if self .reduce_border_artifacts :
196199 packed_image = Utils .alpha_bleeding (packed_image )
197200
198- atlas_data_ext = self .atlas_ext or Utils .get_atlas_data_ext (self .atlas_format )
199- Utils .save_atlas_data (packed_plist , os .path .join (output_path , "%s%s" % (texture_file_name , atlas_data_ext )),
201+ atlas_data_ext = self .atlas_ext or Utils .get_atlas_data_ext (
200202 self .atlas_format )
201- Utils .save_image (packed_image , os .path .join (output_path , "%s%s" % (texture_file_name , self .texture_format )))
203+ Utils .save_atlas_data (packed_plist , os .path .join (output_path , "%s%s" % (texture_file_name , atlas_data_ext )),
204+ self .atlas_format )
205+ Utils .save_image (packed_image , os .path .join (
206+ output_path , "%s%s" % (texture_file_name , self .texture_format )))
202207
203208 def multi_pack (self , pack_args_list ):
204209 """
@@ -212,6 +217,7 @@ def multi_pack(self, pack_args_list):
212217 pool_size = multiprocessing .cpu_count () * 2
213218 pool = multiprocessing .Pool (processes = pool_size )
214219
215- pool .map (multi_pack_handler , zip ([self ] * len (pack_args_list ), pack_args_list ))
220+ pool .map (multi_pack_handler , zip (
221+ [self ] * len (pack_args_list ), pack_args_list ))
216222 pool .close ()
217223 pool .join ()
0 commit comments