diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2018-12-02 18:44:57 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2018-12-02 18:44:57 +0300 |
commit | 6706c91ecf7dd759293b5a7e0b2b75e3c1d7c2e1 (patch) | |
tree | 1a2e3a6ad0514f259793fa4562207f5e9f9d3409 /io_scene_gltf2/blender | |
parent | 6e91aa7bedbe09045d1218fc90367d405a722c16 (diff) |
glTF: Fix light export + export options refactoring
Diffstat (limited to 'io_scene_gltf2/blender')
6 files changed, 6 insertions, 15 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_export.py b/io_scene_gltf2/blender/exp/gltf2_blender_export.py index ae2db26b..1adbe473 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_export.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_export.py @@ -43,9 +43,9 @@ def save(operator, exporter.add_animation(animation) buffer = bytes() - if export_settings[gltf2_blender_export_keys.FORMAT] == 'ASCII': + if export_settings[gltf2_blender_export_keys.FORMAT] != 'GLB': # .gltf - if export_settings[gltf2_blender_export_keys.EMBED_BUFFERS]: + if export_settings[gltf2_blender_export_keys.FORMAT] == 'GLTF': exporter.finalize_buffer(export_settings[gltf2_blender_export_keys.FILE_DIRECTORY]) else: exporter.finalize_buffer(export_settings[gltf2_blender_export_keys.FILE_DIRECTORY], diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py b/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py index 06271a04..ca9ca139 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py @@ -39,13 +39,11 @@ FILE_DIRECTORY = 'gltf_filedirectory' BINARY_FILENAME = 'gltf_binaryfilename' YUP = 'gltf_yup' MORPH = 'gltf_morph' -INDICES = 'gltf_indices' BAKE_SKINS = 'gltf_bake_skins' TEX_COORDS = 'gltf_texcoords' COLORS = 'gltf_colors' NORMALS = 'gltf_normals' TANGENTS = 'gltf_tangents' -FORCE_INDICES = 'gltf_force_indices' MORPH_TANGENT = 'gltf_morph_tangent' MORPH_NORMAL = 'gltf_morph_normal' MOVE_KEYFRAMES = 'gltf_move_keyframes' diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py index a5220129..c26429d3 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py @@ -970,10 +970,6 @@ def extract_primitives(glTF, blender_mesh, blender_vertex_groups, modifiers, exp # range_indices = 65536 - if export_settings[gltf2_blender_export_keys.INDICES] == 'UNSIGNED_BYTE': - range_indices = 256 - elif export_settings[gltf2_blender_export_keys.INDICES] == 'UNSIGNED_INT': - range_indices = 4294967296 # 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 b89f51d7..42dd9bd7 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -80,7 +80,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] == 'ASCII': + if export_settings[gltf2_blender_export_keys.FORMAT] != 'GLB': # as usual we just store the data in place instead of already resolving the references return __get_image_data(sockets_or_slots) return None diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py index 6186159c..dbfafbde 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py @@ -49,12 +49,12 @@ def gather_node(blender_object, export_settings): ) node.translation, node.rotation, node.scale = __gather_trans_rot_scale(blender_object, export_settings) - if blender_object.type == 'LIGHT': + if blender_object.type == 'LIGHT' and export_settings[gltf2_blender_export_keys.LIGHTS]: correction_node = __get_correction_node(blender_object, export_settings) correction_node.extensions = {"KHR_lights_punctual": node.extensions["KHR_lights_punctual"]} del node.extensions["KHR_lights_punctual"] node.children.append(correction_node) - if blender_object.type == 'CAMERA': + if blender_object.type == 'CAMERA' and export_settings[gltf2_blender_export_keys.CAMERAS]: correction_node = __get_correction_node(blender_object, export_settings) correction_node.camera = node.camera node.camera = None diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py index 5b3e607b..4fa025b2 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives.py @@ -15,7 +15,7 @@ import bpy from typing import List, Optional -from .gltf2_blender_export_keys import INDICES, FORCE_INDICES, NORMALS, MORPH_NORMAL, TANGENTS, MORPH_TANGENT, MORPH +from .gltf2_blender_export_keys import NORMALS, MORPH_NORMAL, TANGENTS, MORPH_TANGENT, MORPH from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached from io_scene_gltf2.blender.exp import gltf2_blender_extract @@ -83,9 +83,6 @@ def __gather_indices(blender_primitive, blender_mesh, modifiers, export_settings print_console('ERROR', 'Invalid max_index: ' + str(max_index)) return None - if export_settings[FORCE_INDICES]: - component_type = gltf2_io_constants.ComponentType.from_legacy_define(export_settings[INDICES]) - element_type = gltf2_io_constants.DataType.Scalar binary_data = gltf2_io_binary_data.BinaryData.from_list(indices, component_type) return gltf2_io.Accessor( |