7
7
from Python import regex_rules
8
8
from Python import zips as zips_py
9
9
from Python import update_progress
10
+ from Python import palette
10
11
11
12
12
13
warnings_file_name = "Warnings.json"
@@ -26,7 +27,7 @@ def resource_path(relative_path):
26
27
27
28
28
29
# If an exe executes this program then sys is frozen.
29
- output_folder = ".." if getattr (sys , 'frozen' , False ) else "Output"
30
+ output_folder_path = ".." if getattr (sys , 'frozen' , False ) else "Output"
30
31
31
32
32
33
def load_conversion_and_warning_rules ():
@@ -57,7 +58,7 @@ def check_github_button_clicked_and_exit(clicked_github_button):
57
58
58
59
59
60
def convert ():
60
- global output_folder , warnings
61
+ global output_folder_path , warnings
61
62
62
63
print ("" ) # Only prints a newline.
63
64
@@ -76,12 +77,12 @@ def convert():
76
77
77
78
if len (mod_subfolder_parts ) > 0 and mod_subfolder_parts [0 ].endswith (".rte" ):
78
79
try_print_mod_name (mod_subfolder_parts , mod_subfolder )
79
- output_subfolder = os .path .join (output_folder , mod_subfolder )
80
+ output_subfolder = os .path .join (output_folder_path , mod_subfolder )
80
81
create_folder (input_subfolder_path , output_subfolder )
81
- process_files (input_subfiles , input_subfolder_path , output_subfolder , input_folder_path )
82
+ process_files (input_subfiles , input_subfolder_path , output_subfolder , input_folder_path , output_folder_path )
82
83
83
84
if cfg .sg .user_settings_get_entry ("output_zips" ):
84
- zips_py .create_zips (input_folder_path , output_folder )
85
+ zips_py .create_zips (input_folder_path , output_folder_path )
85
86
86
87
if len (warnings ) > 0 :
87
88
warnings_popup ()
@@ -115,20 +116,25 @@ def create_folder(input_subfolder_path, output_subfolder):
115
116
pass
116
117
117
118
118
- def process_files (input_subfiles , input_subfolder_path , output_subfolder , input_folder_path ):
119
+ def process_files (input_subfiles , input_subfolder_path , output_subfolder , input_folder_path , output_folder_path ):
119
120
for full_filename in input_subfiles :
120
121
filename , file_extension = os .path .splitext (full_filename )
121
122
122
- input_file_path = os .path .join (input_subfolder_path , full_filename )
123
+ input_file_path = os .path .join (input_subfolder_path , full_filename )
124
+
123
125
output_file_path = os .path .join (output_subfolder , full_filename )
124
126
127
+ if palette .is_input_image (full_filename ):
128
+ palette .process_image (full_filename , input_file_path , output_file_path )
129
+
125
130
if full_filename == "desktop.ini" :
126
131
continue
127
132
128
133
if file_extension in (".ini" , ".lua" ):
129
134
create_converted_file (input_file_path , output_file_path , input_folder_path )
130
135
else :
131
- shutil .copyfile (input_file_path , output_file_path )
136
+ if not palette .is_input_image (full_filename ):
137
+ shutil .copyfile (input_file_path , output_file_path )
132
138
133
139
update_progress .increment_progress ()
134
140
0 commit comments