@@ -121,8 +121,8 @@ public string GameID
121121 /// <param name="location">export directory</param>
122122 public void ExportToLocation ( string location )
123123 {
124- WriteJson ( Path . Combine ( location , GeneratedJsonName + ".json" ) ) ;
125124 WriteImages ( location ) ;
125+ WriteJson ( Path . Combine ( location , GeneratedJsonName + ".json" ) ) ;
126126 WriteGameID ( location ) ;
127127 }
128128
@@ -153,6 +153,7 @@ private void WriteImages(string location)
153153 {
154154 //exports the images for the output_textures
155155 WriteImage ( location , texture ) ;
156+
156157 foreach ( HostDevice device in texture . HostDevices )
157158 {
158159 foreach ( HostKey key in device . HostKeys )
@@ -164,7 +165,7 @@ private void WriteImages(string location)
164165 }
165166 }
166167
167- private void WriteImage ( string location , Interfaces . IImage image )
168+ private void WriteImage ( string location , IImage image )
168169 {
169170 // Unlikely that we get here but skip textures that don't exist
170171 if ( ! File . Exists ( image . TexturePath ) )
@@ -174,13 +175,29 @@ private void WriteImage(string location, Interfaces.IImage image)
174175 image . RelativeTexturePath = CheckRelativeTexturePath ( image ) ;
175176 string output_location = Path . Combine ( location , image . RelativeTexturePath ) ;
176177
178+ //create the directory when it does not exist.
179+ Directory . CreateDirectory ( Path . GetDirectoryName ( output_location ) ) ;
180+
181+ //Use External Scaling if necessary.
182+ if ( image is DynamicInputTexture texture )
183+ {
184+ if ( DynamicInputTextureEvents . DynamicInputTextureExportProcessor != null )
185+ {
186+ DynamicInputTextureEvents . DynamicInputTextureExportProcessor . Invoke ( output_location , texture ) ;
187+ if ( File . Exists ( output_location ) )
188+ {
189+ texture . TexturePath = output_location ;
190+ return ;
191+ }
192+ }
193+ }
194+
177195 // Prevents the file from trying to overwrite itself.
178196 if ( Path . GetFullPath ( output_location ) == Path . GetFullPath ( image . TexturePath ) )
179197 return ;
180198
181199 //write the image
182200 const bool overwrite = true ;
183- Directory . CreateDirectory ( Path . GetDirectoryName ( output_location ) ) ;
184201 File . Copy ( image . TexturePath , output_location , overwrite ) ;
185202 }
186203
0 commit comments