#
#The MIT License (MIT)
#
#Copyright (c) 2014 ishidourou
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in
#all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#THE SOFTWARE.
#
#(õÏÂøÀÃö×åöÜìøêÞøè│ÿ╝Úhttp://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_licenseóÂÈóÂÊÿ╝É
#
#Copyright (c) 2014 ishidourou
#
#ô╗åô╕ËóÁëõîÚóÂÁóÂËöÝáô╗╢óÁëõ╛ÓóÁÄóÀÁöÜìóÂ╜óÃÕóÃÈóÂæóÂçóÂâóÁÊóÂÈóÁ│ùÖâùÀãöÖÇöÛ╕óÁîóÃÕóÂáóÂäóÃëÿ╝Èô╗åô╕ËóÀÌóÂ╜óÃÕóÃÈóÂæóÂçóÂâóÀÍÿ╝É
#óÁîøäÇøã╜óÂÒõÏÖõ╛×óÁÙóÂËóÁÙóÁ╣óÁæóÁîô║║óÁëõï╛óÁ×óÀÁóÂ╜óÃÕóÃÈóÂæóÂçóÂâóÂÒ÷ÄáõÈ╢ùÙÐóÁëöÉ▒óÁÆóÁÓóÁèóÂÒ÷ÄáõÄßóÁçøè▒õÏïóÁ×óÁ╛óÁÙóÀÂ
#óÁÓóÂÌóÁëóÁïóÀÁóÂ╜óÃÕóÃÈóÂæóÂçóÂâóÁîøäÇøã╜óÂÒô╜┐÷ÔèóÀÁøäÇõÆÙóÀÁõäÉöÛ┤óÀÁ÷╡ÐõÐÈóÀÁöÎ▓ø╝ÉóÀÁùàÒõ╕ÃóÀÁóÂ╡óÃÖóÃéóÂäóÂ╗óÃ│óÂ╣óÀÁ
#óÁÊóÂÈóÁ│/óÁ╛óÁßóÁïø▓éõã▓óÁÙóÂËöèéõÈéóÀÁóÁÊóÂÈóÁ│óÂ╜óÃÕóÃÈóÂæóÂçóÂâóÂÒöÏÐô╛ÛóÁÙóÂË÷Û╕öÉËóÁëõÐÌóÁØóÁÓóÁèóÂÒøè▒õÏïóÁÙóÂËöèéõÈéóÂÂ
#÷ÄáõÈ╢ùÙÐóÁëõÐëóÁ╛óÂÌóÁ╛óÁÙóÀÂ
#
#ô╕ÊøèØóÁîøÑ×ô╜Üöèéøáè÷ä║óÁÊóÂÈóÁ│öÜìøè▒øë╛øáè÷ä║óÂÒóÀÁóÂ╜óÃÕóÃÈóÂæóÂçóÂâóÁîóÁÙóÁ╣óÁæóÁîøäÇøã╜óÁ╛óÁßóÁïùÇÍøæÁóÁêùÃèõÈÆóÁëøèØø╝É
#óÁÙóÂËóÂÂóÁîóÁèóÁ×óÁ╛óÁÙóÀÂ
#
#óÂ╜óÃÕóÃÈóÂæóÂçóÂâóÁïóÀÌ÷Ï╛÷Ê╢óÁîóÁ╛óÁ╛óÀÍóÁçóÀÁöØÎ÷ä║óÁçóÁÂóÂËóÁËöÚ×ù╗ÙóÁçóÁÂóÂËóÁËóÂÒõÕÏóÂÏóÁÚóÀÁô╜ÕóÂÉóÁîô┐Ýøè╝óÂÂóÁêóÁÏ
#öÏÐô╛ÛóÁÕóÂÌóÁ╛óÁÙóÀÂóÁÓóÁÓóÁçóÁÄóÁÆô┐Ýøè╝óÁèóÁïóÀÁõÕÆõÓÁöÀçóÀÁ÷É╣õîÚóÁî÷Ûî÷ÚÄóÁ╕óÁîùÁéõÐÈöÀçóÀÁóÁÊóÂÈóÁ│öèéõÈéùÝÞô╛╡õî│óÁë
#óÁäóÁÄóÁæóÁîô┐Ýøè╝óÂÂõÐëóÁ┐óÁ╛óÁÙóÁÌóÀÁóÁÝóÂÌóÁëùÙÐõîÚóÁÕóÂÌóÂËóÂÂóÁîóÁçóÁïóÁÂóÂÊóÁ╛óÁÛóÂÓóÀ ô╜ÜøÀÅóÁ╛óÁßóÁïøÑ×ô╜ÜöèéøÀÅóÁïóÀÁ
#õåÑ÷┤ÄøáÌ÷Â║óÀÁô╕Íö│ÕøáÌ÷Â║óÀÁóÁ╛óÁßóÁïóÁÝóÂÌô╗åõäÖóÁçóÁÂóÂÍóÁÆóÁèóÀÁóÂ╜óÃÕóÃÈóÂæóÂçóÂâóÁëø╡╖õÛàóÁ╛óÁßóÁïùÖâùÀãóÁ×óÀÁóÁÂóÂËóÁÄóÁï
#óÂ╜óÃÕóÃÈóÂæóÂçóÂâóÁîô╜┐÷ÔèóÁ╛óÁßóÁïóÁÝóÁîô╗ÖóÁîöÉ▒óÁÄóÁëóÂÈóÁãóÁæ÷ÔßóÁØóÂËô╕ÀõÈÇóÁîøëËö▒ÂóÀÁöÐÍõî│óÀÁóÁÝóÁîô╗ÖóÁî÷╛éõËÙóÁë
#óÁäóÁÄóÁæô╜ÕóÂÉóÁîø▓ìô╗╗óÂÂø▓àóÂÏóÁêóÁÄóÂÂóÁîóÁèóÁ×óÁ╛óÁÙóÀÂ
#
#####################################
# Quick Origin
# v.1.0
# (c)ishidourou 2014
####################################
bl_info = {
"name": "Quick Origin",
"author": "ishidourou",
"version": (1, 2),
"blender": (2, 80, 0),
"location": "View3D > Toolbar and View3D",
"description": "QuickOrigin",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": 'Mesh'}
import bpy
#import re
from bpy.props import *
class mes():
title = ('Quick Origin','óÂïóÂäóÃÃóÂïóÂêóÃêóÂ╕óÃ│')
btn01 = ('Set Origin','õÎß÷Â╣óÂÒøèíõîÚ')
def lang():
system = bpy.context.user_preferences.system
if system.use_international_fonts:
if system.language == 'ja_JP':
return 1
return 0
class QuickOriginPanel(bpy.types.Panel):
bl_category = "View"
bl_label = mes.title[lang()]
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
self.layout.operator("quick.origin")
class QuickOrigin(bpy.types.Operator):
bl_idname = "quick.origin"
bl_label = mes.btn01[lang()]
bl_options = {'REGISTER'}
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'}
def register():
bpy.utils.register_class(QuickOriginPanel)
bpy.utils.register_class(QuickOrigin)
kc = bpy.context.window_manager.keyconfigs.addon
if kc:
kmmm = kc.keymaps.new(name="Mesh", space_type="EMPTY")
kmmi1 = kmmm.keymap_items.new('quick.origin', 'O', 'PRESS', alt=True, shift=True)
def unregister():
bpy.utils.unregister_class(QuickOriginPanel)
bpy.utils.unregister_class(QuickOrigin)
if kc:
km = kc.keymaps["Mesh"]
for kmi in km.keymap_items:
if kmi.idname == 'quick.origin':
km.keymap_items.remove(kmi)
if __name__ == "__main__":
register()