I added a mode switch to get back into edit mode! def execute(self, context): if bpy.context.mode != 'EDIT_MESH': bpy.ops.object.editmode_toggle() return{'FINISHED'} bpy.ops.view3d.snap_cursor_to_selected() bpy.ops.object.editmode_toggle() bpy.ops.object.origin_set(type='ORIGIN_CURSOR') if bpy.context.mode != 'Object': bpy.ops.object.editmode_toggle() return{'FINISHED'}
I added a mode switch to get back into edit mode!
ReplyDeletedef execute(self, context):
if bpy.context.mode != 'EDIT_MESH':
bpy.ops.object.editmode_toggle()
return{'FINISHED'}
bpy.ops.view3d.snap_cursor_to_selected()
bpy.ops.object.editmode_toggle()
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
if bpy.context.mode != 'Object':
bpy.ops.object.editmode_toggle()
return{'FINISHED'}