From c74141a346b4260c9124c601e383727aec00e934 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sat, 10 Oct 2020 11:11:08 +0800 Subject: [PATCH] fix move 2 cursor error --- ballance_blender_plugin/add_elements.py | 2 +- ballance_blender_plugin/utils.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ballance_blender_plugin/add_elements.py b/ballance_blender_plugin/add_elements.py index f5f99da..564ab7d 100644 --- a/ballance_blender_plugin/add_elements.py +++ b/ballance_blender_plugin/add_elements.py @@ -111,7 +111,7 @@ class BALLANCE_OT_add_rail(bpy.types.Operator): bpy.ops.object.join() # apply 3d cursor - firstObj.matrix_world = bpy.context.scene.cursor.matrix + utils.Move2Cursor(firstObj) return {'FINISHED'} diff --git a/ballance_blender_plugin/utils.py b/ballance_blender_plugin/utils.py index a61b6ab..a4aa152 100644 --- a/ballance_blender_plugin/utils.py +++ b/ballance_blender_plugin/utils.py @@ -11,8 +11,11 @@ def ShowMessageBox(message, title, icon): bpy.context.window_manager.popup_menu(draw, title = title, icon = icon) def AddSceneAndMove2Cursor(obj): - obj.matrix_world = bpy.context.scene.cursor.matrix + Move2Cursor(obj) view_layer = bpy.context.view_layer collection = view_layer.active_layer_collection.collection collection.objects.link(obj) + +def Move2Cursor(obj): + obj.location = bpy.context.scene.cursor.location