Skip to content

Commit

Permalink
GFX editor: Fix palette being exported multiple successive times
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jan 27, 2018
1 parent 6de0dff commit 623307c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dsvedit/gfx_editor_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def export_file
return if @palettes.nil? || @palette_index.nil?

palette = @palettes[@palette_index]
palette_name = "palette_%08X-%02X" % [@palette_pointer, @palette_index]

@gfx_pages.each do |gfx|
if gfx.file
Expand All @@ -268,13 +269,13 @@ def export_file
chunky_image = @renderer.render_gfx_page(gfx.file, palette, gfx.canvas_width)
end
file_basename = File.basename(gfx_name, ".*")
palette_name = "palette_%08X-%02X" % [@palette_pointer, @palette_index]
gfx_file_path = "#{@output_folder}/#{file_basename}_#{palette_name}.png"
chunky_image.save(gfx_file_path)
palette_file_path = "#{@output_folder}/#{palette_name}.png"
@renderer.export_palette_to_palette_swatches_file(palette, palette_file_path)
end

palette_file_path = "#{@output_folder}/#{palette_name}.png"
@renderer.export_palette_to_palette_swatches_file(palette, palette_file_path)

@ui.info_label.text = "Exported gfx and palette to folder ./#{@output_folder}"
end

Expand Down

0 comments on commit 623307c

Please sign in to comment.