瀏覽代碼

Switch to Object mode before applying modifiers to avoid exception.

tschw 10 年之前
父節點
當前提交
2eb4b1d2c4
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      utils/exporters/blender/addons/io_three/exporter/api/object.py

+ 3 - 0
utils/exporters/blender/addons/io_three/exporter/api/object.py

@@ -330,6 +330,8 @@ def extract_mesh(obj, options, recalculate=False):
     """
     logger.debug('object.extract_mesh(%s, %s)', obj, options)
     apply_modifiers = options.get(constants.APPLY_MODIFIERS, True)
+    if apply_modifiers:
+        bpy.ops.object.mode_set(mode='OBJECT')
     mesh_node = obj.to_mesh(context.scene, apply_modifiers, RENDER)
 
     # transfer the geometry type to the extracted mesh
@@ -350,6 +352,7 @@ def extract_mesh(obj, options, recalculate=False):
                      original_mesh.name,
                      mesh_node.name)
 
+        bpy.ops.object.mode_set(mode='OBJECT')
         obj.select = True
         bpy.context.scene.objects.active = obj
         logger.info('Applying triangulation to %s', obj.data.name)