From 3087c4e458dc4e9fd016d2f17e37e0473ce5dce2 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Wed, 5 Dec 2018 21:41:39 +0100 Subject: glTF exporter: Options tweaks, image merging fixes --- io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py') diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py index d9cc17dc..d9583d08 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -48,7 +48,7 @@ def __filter_image(sockets_or_slots, export_settings): def __gather_buffer_view(sockets_or_slots, export_settings): - if export_settings[gltf2_blender_export_keys.FORMAT] != 'GLTF': + if export_settings[gltf2_blender_export_keys.FORMAT] != 'GLTF_SEPARATE': image = __get_image_data(sockets_or_slots) return gltf2_io_binary_data.BinaryData( data=image.to_image_data(__gather_mime_type(sockets_or_slots, export_settings))) @@ -79,7 +79,7 @@ def __gather_name(sockets_or_slots, export_settings): def __gather_uri(sockets_or_slots, export_settings): - if export_settings[gltf2_blender_export_keys.FORMAT] == 'GLTF': + if export_settings[gltf2_blender_export_keys.FORMAT] == 'GLTF_SEPARATE': # as usual we just store the data in place instead of already resolving the references return __get_image_data(sockets_or_slots) return None @@ -121,6 +121,7 @@ def __get_image_data(sockets_or_slots): pixels = [split_pixels_by_channels(result.shader_node.image)[channel]] else: pixels = split_pixels_by_channels(result.shader_node.image) + channel = 0 file_name = os.path.splitext(result.shader_node.image.name)[0] @@ -128,12 +129,13 @@ def __get_image_data(sockets_or_slots): file_name, result.shader_node.image.size[0], result.shader_node.image.size[1], + channel, pixels) if image is None: image = image_data else: - image.add_to_image(image_data) + image.add_to_image(channel, image_data) return image elif __is_slot(sockets_or_slots): @@ -144,6 +146,7 @@ def __get_image_data(sockets_or_slots): texture.name, texture.image.size[0], texture.image.size[1], + 0, pixels) return image_data else: -- cgit v1.2.3