diff options
author | Jacques Lucke <mail@jlucke.com> | 2018-10-02 17:24:12 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2018-10-02 17:24:12 +0300 |
commit | 3659c4da92d039c4045ac0af3fb2dfa9bca8b32e (patch) | |
tree | a59198aecbf282cc4fc81620c5652ff46f53cc42 /io_mesh_ply/export_ply.py | |
parent | 608cf349ae10c42228edf2e12fdc5c0868e80f8f (diff) |
port 'Stanford PLY format' addon to Blender 2.8
Here are a couple of example files for testing: https://people.sc.fsu.edu/~jburkardt/data/ply/ply.html
I removed the texture support that was implemented here: rBA471370
(it is no official part of the file format; the exporter did not support it; reimplementing it is a bit of a hassle)
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3754
Diffstat (limited to 'io_mesh_ply/export_ply.py')
-rw-r--r-- | io_mesh_ply/export_ply.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/io_mesh_ply/export_ply.py b/io_mesh_ply/export_ply.py index 8de5d674..b6ab8810 100644 --- a/io_mesh_ply/export_ply.py +++ b/io_mesh_ply/export_ply.py @@ -100,10 +100,8 @@ def save_mesh(filepath, col = active_col_layer[i] col = col.color1[:], col.color2[:], col.color3[:], col.color4[:] - f_verts = f.vertices - pf = ply_faces[i] - for j, vidx in enumerate(f_verts): + for j, vidx in enumerate(f.vertices): v = mesh_verts[vidx] if smooth: @@ -119,6 +117,7 @@ def save_mesh(filepath, color = (int(color[0] * 255.0), int(color[1] * 255.0), int(color[2] * 255.0), + 255 ) key = normal_key, uvcoord_key, color @@ -193,7 +192,6 @@ def save(operator, global_matrix=None ): - scene = context.scene obj = context.active_object if global_matrix is None: @@ -204,14 +202,15 @@ def save(operator, bpy.ops.object.mode_set(mode='OBJECT') if use_mesh_modifiers and obj.modifiers: - mesh = obj.to_mesh(scene, True, 'PREVIEW') + mesh = obj.to_mesh(context.depsgraph, True) + else: mesh = obj.data.copy() if not mesh: raise Exception("Error, could not get mesh data from active object") - mesh.transform(global_matrix * obj.matrix_world) + mesh.transform(global_matrix @ obj.matrix_world) if use_normals: mesh.calc_normals() @@ -221,7 +220,6 @@ def save(operator, use_colors=use_colors, ) - if use_mesh_modifiers: - bpy.data.meshes.remove(mesh) + bpy.data.meshes.remove(mesh) return ret |