浏览代码

Merge pull request #108 from Jason0214/fix_shape_key_value

Fix Shape key modifier may be applied to mesh data
Lu Jiacheng 6 年之前
父节点
当前提交
e91f8e828c
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      io_scene_godot/converters/mesh.py
  2. 0 0
      tests/reference_exports/shape_key/animation_shapekey.escn

+ 8 - 0
io_scene_godot/converters/mesh.py

@@ -179,10 +179,16 @@ class MeshResourceExporter:
                 if not isinstance(modifier, bpy.types.ArmatureModifier):
                 if not isinstance(modifier, bpy.types.ArmatureModifier):
                     modifier.show_render = False
                     modifier.show_render = False
 
 
+        # set shape key to basis key which would have index 0
+        self.object.show_only_shape_key = True
+        self.object.active_shape_key_index = 0
+
         mesh = self.object.to_mesh(bpy.context.scene,
         mesh = self.object.to_mesh(bpy.context.scene,
                                    True,
                                    True,
                                    "RENDER")
                                    "RENDER")
 
 
+        self.object.show_only_shape_key = False
+
         # if the original mesh has an object link material,
         # if the original mesh has an object link material,
         # the new created mesh would use it as data link material,
         # the new created mesh would use it as data link material,
         # seems a bug of Blender,
         # seems a bug of Blender,
@@ -292,6 +298,8 @@ class MeshResourceExporter:
                 "RENDER"
                 "RENDER"
             )
             )
 
 
+            self.object.show_only_shape_key = False
+
             triangulate_mesh(shape_key_mesh)
             triangulate_mesh(shape_key_mesh)
 
 
             if self.has_tangents:
             if self.has_tangents:

文件差异内容过多而无法显示
+ 0 - 0
tests/reference_exports/shape_key/animation_shapekey.escn


部分文件因为文件数量过多而无法显示