fix move 2 cursor error

This commit is contained in:
yyc12345 2020-10-10 11:11:08 +08:00
parent b3ee636848
commit c74141a346
2 changed files with 5 additions and 2 deletions

View File

@ -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'}

View File

@ -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