From d609009748a604c1df2d8babfa4098260666d01a Mon Sep 17 00:00:00 2001 From: NBurn <7nburn@gmail.com> Date: Tue, 29 Jan 2019 10:54:49 -0500 Subject: addons: objects.link/unlink syntax update Changed objects.link and objects.unlink from scene to collection --- animation_add_corrective_shape_key.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'animation_add_corrective_shape_key.py') diff --git a/animation_add_corrective_shape_key.py b/animation_add_corrective_shape_key.py index 8a9bdb28..c18d3b89 100644 --- a/animation_add_corrective_shape_key.py +++ b/animation_add_corrective_shape_key.py @@ -200,12 +200,12 @@ class add_corrective_pose_shape(bpy.types.Operator): return {'FINISHED'} -def func_object_duplicate_flatten_modifiers(scene, obj): - mesh = obj.to_mesh(scene, True, 'PREVIEW') +def func_object_duplicate_flatten_modifiers(context, obj): + mesh = obj.to_mesh(context.scene, True, 'PREVIEW') name = obj.name + "_clean" new_object = bpy.data.objects.new(name, mesh) new_object.data = mesh - scene.objects.link(new_object) + context.collection.objects.link(new_object) return new_object @@ -220,10 +220,9 @@ class object_duplicate_flatten_modifiers(bpy.types.Operator): return context.active_object is not None def execute(self, context): - scene = context.scene obj_act = context.active_object - new_object = func_object_duplicate_flatten_modifiers(scene, obj_act) + new_object = func_object_duplicate_flatten_modifiers(context, obj_act) # setup the context bpy.ops.object.select_all(action='DESELECT') -- cgit v1.2.3