diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-16 16:01:17 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-16 17:43:14 +0300 |
commit | 901868a4b2fc6e70d9c74119d97c57de132859a3 (patch) | |
tree | 94f96b6fd5f8a1ec509c6551f504cad958c1688f /io_mesh_ply | |
parent | 2e5b7a4a044ab982af66def583ae16bb563a1357 (diff) |
Update for Depsgraph API changes
Addresses new behavior of object.to_mesh().
This is corresponding part for D4875.
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D4876
Diffstat (limited to 'io_mesh_ply')
-rw-r--r-- | io_mesh_ply/export_ply.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/io_mesh_ply/export_ply.py b/io_mesh_ply/export_ply.py index f465ed91..b14641be 100644 --- a/io_mesh_ply/export_ply.py +++ b/io_mesh_ply/export_ply.py @@ -201,12 +201,14 @@ def save( if bpy.ops.object.mode_set.poll(): bpy.ops.object.mode_set(mode='OBJECT') + mesh_owner_object = None if use_mesh_modifiers and obj.modifiers: depsgraph = context.evaluated_depsgraph_get() - mesh = obj.evaluated_get(depsgraph).to_mesh() - + mesh_owner_object = obj.evaluated_get(depsgraph) + mesh = mesh_owner_object.to_mesh() else: - mesh = obj.data.copy() + mesh_owner_object = obj + mesh = mesh_owner_object.to_mesh() if not mesh: raise Exception("Error, could not get mesh data from active object") @@ -221,6 +223,6 @@ def save( use_colors=use_colors, ) - bpy.data.meshes.remove(mesh) + mesh_owner_object.to_mesh_clear() return ret |