[Bf-extensions-cvs] [d3100f5f] master: glTF exporter: Don't mess with normals when doing Apply Modifiers

Julien Duroure noreply at git.blender.org
Thu Oct 8 19:17:44 CEST 2020


Commit: d3100f5f71ce71691b6d72bdc70ae3698a5e86ac
Author: Julien Duroure
Date:   Thu Oct 8 19:16:57 2020 +0200
Branches: master
https://developer.blender.org/rBAd3100f5f71ce71691b6d72bdc70ae3698a5e86ac

glTF exporter: Don't mess with normals when doing Apply Modifiers

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index d6d44f11..a13ef211 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 4, 32),
+    "version": (1, 4, 33),
     'blender': (2, 91, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
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 1a1abcd0..b1317097 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
@@ -253,12 +253,6 @@ def __gather_mesh(blender_object, library, export_settings):
     if blender_object.type != "MESH":
         return None
 
-    modifier_normal_types = [
-        "NORMAL_EDIT",
-        "WEIGHTED_NORMAL",
-        "BEVEL"
-    ]
-
     # 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
@@ -268,16 +262,6 @@ def __gather_mesh(blender_object, library, export_settings):
         modifiers = None
 
     if export_settings[gltf2_blender_export_keys.APPLY]:
-        auto_smooth = blender_object.data.use_auto_smooth
-        edge_split = None
-        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 = some_normals_modifier
-            bpy.context.view_layer.update()
-
         armature_modifiers = {}
         if export_settings[gltf2_blender_export_keys.SKINS]:
             # temporarily disable Armature modifiers if exporting skins
@@ -297,10 +281,6 @@ def __gather_mesh(blender_object, library, export_settings):
             # restore Armature modifiers
             for idx, show_viewport in armature_modifiers.items():
                 blender_object.modifiers[idx].show_viewport = show_viewport
-
-        if auto_smooth and not some_normals_modifier:
-            blender_object.data.use_auto_smooth = True
-            blender_object.modifiers.remove(edge_split)
     else:
         blender_mesh = blender_object.data
         skip_filter = False



More information about the Bf-extensions-cvs mailing list