Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'archipack/archipack_handle.py')
-rw-r--r--archipack/archipack_handle.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/archipack/archipack_handle.py b/archipack/archipack_handle.py
index fcdb570e..27da6b0b 100644
--- a/archipack/archipack_handle.py
+++ b/archipack/archipack_handle.py
@@ -26,23 +26,24 @@
# ----------------------------------------------------------
import bpy
+from .archipack_object import ArchipackCollectionManager
def create_handle(context, parent, mesh):
old = context.active_object
handle = bpy.data.objects.new("Handle", mesh)
handle['archipack_handle'] = True
- context.scene.objects.link(handle)
+ ArchipackCollectionManager.link_object_to_scene(context, handle)
modif = handle.modifiers.new('Subsurf', 'SUBSURF')
modif.render_levels = 4
modif.levels = 1
handle.parent = parent
handle.matrix_world = parent.matrix_world.copy()
- context.scene.objects.active = handle
+ context.view_layer.objects.active = handle
m = handle.archipack_material.add()
m.category = 'handle'
m.material = 'DEFAULT'
- context.scene.objects.active = old
+ context.view_layer.objects.active = old
return handle