diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2018-12-02 10:33:14 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2018-12-02 10:33:14 +0300 |
commit | dcfaadf5feb1e6c92a889bf2bb162a8a1f74fcd3 (patch) | |
tree | fbc759ab8eba56510e83d7807ffab95ba6650457 /io_scene_gltf2/blender | |
parent | 9fcbabfcab0f60910c196226c79874edcae80b65 (diff) |
glTF: fix vertex color import + export option tweaks
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py | 1 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_cameras.py | 4 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_mesh.py | 10 |
3 files changed, 8 insertions, 7 deletions
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 9e47645a..06271a04 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_export_keys.py @@ -40,7 +40,6 @@ BINARY_FILENAME = 'gltf_binaryfilename' YUP = 'gltf_yup' MORPH = 'gltf_morph' INDICES = 'gltf_indices' -CAMERA_INFINITE = 'gltf_camera_infinite' BAKE_SKINS = 'gltf_bake_skins' TEX_COORDS = 'gltf_texcoords' COLORS = 'gltf_colors' diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_cameras.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_cameras.py index b09092ca..9640a7ce 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_cameras.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_cameras.py @@ -106,9 +106,7 @@ def __gather_perspective(blender_object, export_settings): perspective.yfov = 2.0 * math.atan(math.tan(blender_camera.angle * 0.5) / perspective.aspectRatio) perspective.znear = blender_camera.clip_start - - if not export_settings[gltf2_blender_export_keys.CAMERA_INFINITE]: - perspective.zfar = blender_camera.clip_end + perspective.zfar = blender_camera.clip_end return perspective return None diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py index 88396455..aafb9498 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py @@ -143,7 +143,7 @@ class BlenderMesh(): if 'COLOR_0' in prim.attributes.keys(): # Create vertex color, once only per object if vertex_color is None: - vertex_color = obj.data.vertex_colors.new("COLOR_0") + vertex_color = obj.data.vertex_colors.new(name="COLOR_0") color_data = BinaryData.get_data_from_accessor(gltf, prim.attributes['COLOR_0']) @@ -152,7 +152,11 @@ class BlenderMesh(): vert_idx = mesh.loops[loop_idx].vertex_index if vert_idx in range(offset, offset + prim.vertices_length): cpt_idx = vert_idx - offset - vertex_color.data[loop_idx].color = color_data[cpt_idx][0:3] - # TODO : no alpha in vertex color + # check dimension, and add alpha if needed + if len(color_data[cpt_idx]) == 3: + vertex_color_data = color_data[cpt_idx] + (1.0,) + else: + vertex_color_data = color_data[cpt_idx] + vertex_color.data[loop_idx].color = vertex_color_data offset = offset + prim.vertices_length |