diff options
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_extract.py | 2 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py index 69c3f1d6..7adda5a4 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py @@ -588,7 +588,7 @@ def extract_primitives(glTF, blender_mesh, blender_vertex_groups, modifiers, exp vertex = blender_mesh.vertices[vertex_index] v = convert_swizzle_location(vertex.co, export_settings) - if blender_polygon.use_smooth: + if blender_polygon.use_smooth or blender_mesh.use_auto_smooth: if blender_mesh.has_custom_normals: n = convert_swizzle_location(blender_mesh.loops[loop_index].normal, export_settings) else: 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 c13af707..c0fa11ff 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py @@ -224,6 +224,11 @@ def __gather_mesh(blender_object, export_settings): if blender_object.type != "MESH": return None + modifier_normal_types = [ + "NORMAL_EDIT", + "WEIGHTED_NORMAL" + ] + # If not using vertex group, they are irrelevant for caching --> ensure that they do not trigger a cache miss vertex_groups = blender_object.vertex_groups modifiers = blender_object.modifiers @@ -239,7 +244,7 @@ def __gather_mesh(blender_object, export_settings): edge_split = blender_object.modifiers.new('Temporary_Auto_Smooth', 'EDGE_SPLIT') edge_split.split_angle = blender_object.data.auto_smooth_angle edge_split.use_edge_angle = not blender_object.data.has_custom_normals - blender_object.data.use_auto_smooth = False + blender_object.data.use_auto_smooth = any([m in modifier_normal_types for m in [mod.type for mod in blender_object.modifiers]]) bpy.context.view_layer.update() armature_modifiers = {} |