Skip to content

Commit

Permalink
Export composed textures as JPEG unless PNG is required
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksii Pelykh committed Jun 18, 2020
1 parent b3dabee commit 0faef9b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018-2019 The glTF-Blender-IO authors.
# Copyright 2018-2020 The glTF-Blender-IO authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -101,9 +101,14 @@ def __gather_mime_type(sockets_or_slots, export_image, export_settings):

if export_settings["gltf_image_format"] == "AUTO":
image = export_image.blender_image()
if image is not None and __is_blender_image_a_jpeg(image):
return "image/jpeg"
return "image/png"
if image is not None:
return "image/jpeg" if __is_blender_image_a_jpeg(image) else "image/png"
for fill in export_image.fills.values():
if not isinstance(fill, FillImage):
continue
if not __is_blender_image_a_jpeg(fill.image):
return "image/png"
return "image/jpeg"

elif export_settings["gltf_image_format"] == "JPEG":
return "image/jpeg"
Expand Down

0 comments on commit 0faef9b

Please sign in to comment.