glTF exporter: Fix T71313 Bad normal export this normal modifiers
This commit is contained in:
parent
97b11857d3
commit
3a774beff7
Notes:
blender-bot
2023-02-14 00:19:13 +01:00
Referenced by issue blender/blender#71313, glTF export: Wrong custom normals that depend on autosmooth angle
|
@ -15,7 +15,7 @@
|
|||
bl_info = {
|
||||
'name': 'glTF 2.0 format',
|
||||
'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
|
||||
"version": (1, 1, 9),
|
||||
"version": (1, 1, 10),
|
||||
'blender': (2, 81, 6),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -248,11 +248,12 @@ def __gather_mesh(blender_object, export_settings):
|
|||
if export_settings[gltf2_blender_export_keys.APPLY]:
|
||||
auto_smooth = blender_object.data.use_auto_smooth
|
||||
edge_split = None
|
||||
if auto_smooth:
|
||||
some_normals_modifier = any([m in modifier_normal_types for m in [mod.type for mod in blender_object.modifiers]])
|
||||
if auto_smooth and not some_normals_modifier:
|
||||
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 = any([m in modifier_normal_types for m in [mod.type for mod in blender_object.modifiers]])
|
||||
blender_object.data.use_auto_smooth = some_normals_modifier
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
armature_modifiers = {}
|
||||
|
@ -275,7 +276,7 @@ def __gather_mesh(blender_object, export_settings):
|
|||
for idx, show_viewport in armature_modifiers.items():
|
||||
blender_object.modifiers[idx].show_viewport = show_viewport
|
||||
|
||||
if auto_smooth:
|
||||
if auto_smooth and not some_normals_modifier:
|
||||
blender_object.data.use_auto_smooth = True
|
||||
blender_object.modifiers.remove(edge_split)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue