diff options
author | Jacques Lucke <mail@jlucke.com> | 2018-09-26 12:00:27 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2018-09-26 12:04:40 +0300 |
commit | 08f39b75b9bf459d7b2cd2a06a258abdcebba840 (patch) | |
tree | e4005812f0fef06afc486d06a5a9d06b03ea1aab /io_mesh_stl/blender_utils.py | |
parent | c1784de17c70135a05f3212652fef98d5c2055b2 (diff) |
Port 'STL format' addon to Blender 2.8
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3730
Diffstat (limited to 'io_mesh_stl/blender_utils.py')
-rw-r--r-- | io_mesh_stl/blender_utils.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py index d6ee400c..3c895560 100644 --- a/io_mesh_stl/blender_utils.py +++ b/io_mesh_stl/blender_utils.py @@ -57,12 +57,10 @@ def create_and_link_mesh(name, faces, face_nors, points, global_matrix): mesh.update() - scene = bpy.context.scene - obj = bpy.data.objects.new(name, mesh) - scene.objects.link(obj) - scene.objects.active = obj - obj.select = True + bpy.context.collection.objects.link(obj) + bpy.context.view_layer.objects.active = obj + obj.select_set("SELECT") def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False, triangulate=True): @@ -88,7 +86,7 @@ def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False, triangulate=Tru except RuntimeError: raise StopIteration - mat = global_matrix * ob.matrix_world + mat = global_matrix @ ob.matrix_world mesh.transform(mat) if mat.is_negative: mesh.flip_normals() |