From 1860441ee7cd4ec75c99cc372fccec839c525f46 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 28 Nov 2018 17:51:13 +0100 Subject: Use collection and instance terminology in Python API This follows naming convention agreed on in T56648. --- io_import_dxf/dxfimport/do.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'io_import_dxf') diff --git a/io_import_dxf/dxfimport/do.py b/io_import_dxf/dxfimport/do.py index be79908c..8db6b854 100644 --- a/io_import_dxf/dxfimport/do.py +++ b/io_import_dxf/dxfimport/do.py @@ -989,13 +989,13 @@ class Do: bbox = self._object_bbox(objects + inserts, block_scene, name, True) for i in inserts: - sub_group = i.dupli_group + sub_group = i.instance_collection block_scene.objects.unlink(i) block_group.objects.unlink(i) i_empty = bpy.data.objects.new(i.name, None) i_empty.matrix_basis = i.matrix_basis - i_empty.dupli_type = "GROUP" - i_empty.dupli_group = sub_group + i_empty.instance_type = "COLLECTION" + i_empty.instance_collection = sub_group block_group.objects.link(i_empty) block_scene.objects.link(i_empty) @@ -1006,8 +1006,8 @@ class Do: bpy.context.screen.scene = scene o = bbox.copy() # o.empty_display_size = 0.3 - o.dupli_type = "GROUP" - o.dupli_group = block_group + o.instance_type = "COLLECTION" + o.instance_collection = block_group group.objects.link(o) if invisible is not None: o.hide = invisible @@ -1021,7 +1021,7 @@ class Do: """ entity: DXF entity name: String; not used but required to be consistent with the methods being called from _call_type() - group: Blender group of type (bpy_types.group) being set if called from block() + group: Blender group of type (bpy_types.Collection) being set if called from block() invisible: boolean to control visibility; being set if called from block() """ aunits = self.dwg.header.get('$AUNITS', 0) @@ -1066,7 +1066,7 @@ class Do: entity.col_count, entity.row_count) o = bpy.data.objects.new(entity.name, dm) instance.parent = o - o.dupli_type = "VERTS" + o.instance_type = "VERTS" # insert transformations rot = radians(entity.rotation) if aunits == 0 else entity.rotation @@ -1342,11 +1342,11 @@ class Do: name: name of group (String) Finds group by name or creates it if it does not exist. """ - groups = bpy.data.groups + groups = bpy.data.collections if name in groups.keys(): group = groups[name] else: - group = bpy.data.groups.new(name) + group = bpy.data.collections.new(name) return group def _call_object_types(self, TYPE, entities, group, name, scene, separated=False): @@ -1466,9 +1466,9 @@ class Do: scene.objects.link(o) self._nest_block(o, blockname, blgroup, scene) - o.dupli_type = "FACES" - o.use_dupli_faces_scale = True - o.dupli_faces_scale = f + o.instance_type = "FACES" + o.use_instance_faces_scale = True + o.instance_faces_scale = f def _nest_block(self, parent, name, blgroup, scene): b = self.dwg.blocks[name] -- cgit v1.2.3