選択をリング状に変換するため、Select > Edge Ring を実行します。
EdgeRingを実行した途端、Infoパネルに一行追加される事に注目してください。
この増えた行が、Edge Ringsのコマンドです。引き続き
選択を一つ飛ばしにする (Select > Checker Deselect)
選択をもとにループ選択をする (Select > Edge Loops)
選択してあるものを除去する (Mesh > Delete > Dissolve Edges)
を実行すると、下図のように合計4個のコマンドが表示されます。
このコマンドは後に使用するので、コピーしてメモ帳などに控えてください。
<アドオンの作成>
1、コードのペースト
アドオンを1から作るのは骨がおれるので、ほとんどの部分を流用します。
Text Editorで新規テキストを作成し、下のコードを張り付けてください。 ※ペースト用コードを表示
# ##### BEGIN GPL LICENSE BLOCK ####### This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software Foundation,# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "My Addon", # addon's name"description": "This is ...", # addon's description"category": "Mesh", # addon's category
}
classMy_macro:
# 1 to register in the menu. Otherwise 0.
in_menu = 1# name in the menu
menu_name = "Menu Name"# tooltip
tooltip = "This is my macro"# command name. Only lowercase, number, and "_" are available.
program_name = "my_command"# If you register shortcut now, select from the below list.
shortcut_key = "NONE"# If you don't register shortcut, here is meaningless.
shortcut_shift = 1# If you hold down the Shift, 1. Otherwise 0.
shortcut_ctrl = 1# If you hold down the Ctrl, 0. Otherwise 0.
shortcut_alt = 1# If you hold down the Alt, 0. Otherwise 0.@staticmethoddefmy_commands():
'''Paste commands here.'''# Align the head of commands with this line.'''Available characters can be used as shortcut"NONE","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N","O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","SEMI_COLON", "PERIOD", "COMMA", "QUOTE", "ACCENT_GRAVE", "MINUS", "PLUS","SLASH", "BACK_SLASH", "EQUAL", "LEFT_BRACKET", "RIGHT_BRACKET","F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12","F13", "F14", "F15", "F16", "F17", "F18", "F19","ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE","NUMPAD_0", "NUMPAD_1", "NUMPAD_2", "NUMPAD_3", "NUMPAD_4", "NUMPAD_5","NUMPAD_6", "NUMPAD_7", "NUMPAD_8", "NUMPAD_9","NUMPAD_PERIOD", "NUMPAD_SLASH", "NUMPAD_ASTERIX", "NUMPAD_MINUS","NUMPAD_ENTER", "NUMPAD_PLUS","ESC", "TAB", "RET", "SPACE", "LINE_FEED", "BACK_SPACE", "DEL", "PAUSE","INSERT", "HOME", "PAGE_UP", "PAGE_DOWN", "END","LEFT_ARROW", "DOWN_ARROW", "RIGHT_ARROW", "UP_ARROW","LEFTMOUSE", "MIDDLEMOUSE", "RIGHTMOUSE", "BUTTON4MOUSE", "BUTTON5MOUSE","BUTTON6MOUSE", "BUTTON7MOUSE", "WHEELUPMOUSE", "WHEELDOWNMOUSE","WHEELINMOUSE", "WHEELOUTMOUSE", "MOUSEROTATE", "MOUSEMOVE","INBETWEEN_MOUSEMOVE", "ACTIONMOUSE", "SELECTMOUSE","TRACKPADPAN", "TRACKPADZOOM", "PEN", "ERASER", "EVT_TWEAK_L", "EVT_TWEAK_M","EVT_TWEAK_R", "EVT_TWEAK_A", "EVT_TWEAK_S", "LEFT_CTRL", "LEFT_ALT","LEFT_SHIFT", "RIGHT_ALT", "RIGHT_CTRL", "RIGHT_SHIFT", "OSKEY", "GRLESS","MEDIA_PLAY", "MEDIA_STOP", "MEDIA_FIRST", "MEDIA_LAST", "TEXTINPUT","WINDOW_DEACTIVATE", "TIMER", "TIMER0", "TIMER1", "TIMER2", "TIMER_JOBS","TIMER_AUTOSAVE", "TIMER_REPORT", "TIMERREGION", "NDOF_MOTION","NDOF_BUTTON_MENU", "NDOF_BUTTON_FIT", "NDOF_BUTTON_TOP", "NDOF_BUTTON_BOTTOM","NDOF_BUTTON_LEFT", "NDOF_BUTTON_RIGHT", "NDOF_BUTTON_FRONT","NDOF_BUTTON_BACK", "NDOF_BUTTON_ISO1", "NDOF_BUTTON_ISO2","NDOF_BUTTON_ROLL_CW", "NDOF_BUTTON_ROLL_CCW", "NDOF_BUTTON_SPIN_CW","NDOF_BUTTON_SPIN_CCW", "NDOF_BUTTON_TILT_CW", "NDOF_BUTTON_TILT_CCW","NDOF_BUTTON_ROTATE", "NDOF_BUTTON_PANZOOM", "NDOF_BUTTON_DOMINANT","NDOF_BUTTON_PLUS", "NDOF_BUTTON_MINUS", "NDOF_BUTTON_ESC", "NDOF_BUTTON_ALT","NDOF_BUTTON_SHIFT", "NDOF_BUTTON_CTRL", "NDOF_BUTTON_1", "NDOF_BUTTON_2","NDOF_BUTTON_3", "NDOF_BUTTON_4", "NDOF_BUTTON_5", "NDOF_BUTTON_6","NDOF_BUTTON_7", "NDOF_BUTTON_8", "NDOF_BUTTON_9", "NDOF_BUTTON_10","NDOF_BUTTON_A", "NDOF_BUTTON_B", "NDOF_BUTTON_C"'''# Don't edit under this line.import bpy
classMyTool(bpy.types.Operator):
__doc__ = My_macro.tooltip
bl_idname = "mesh.{}".format(My_macro.program_name)
bl_label = My_macro.menu_name
bl_options = {'REGISTER', 'UNDO'}
defexecute(self, context):
My_macro.my_commands()
return {'FINISHED'}
# store keymaps here to access after registration
addon_keymaps = []
defmenu_func(self, context):
self.layout.operator(MyTool.bl_idname)
defregister():
bpy.utils.register_class(MyTool)
# register menuif My_macro.in_menu:
bpy.types.VIEW3D_MT_edit_mesh.append(menu_func)
if My_macro.shortcut_key != 'NONE':
# handle the keymap
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name='Mesh', space_type='EMPTY')
kmi = km.keymap_items.new(MyTool.bl_idname,
My_macro.shortcut_key,
'PRESS',
ctrl=My_macro.shortcut_ctrl,
shift=My_macro.shortcut_shift,
alt=My_macro.shortcut_alt
)
addon_keymaps.append(km)
defunregister():
bpy.utils.unregister_class(MyTool)
# unregister menuif My_macro.in_menu:
bpy.types.VIEW3D_MT_edit_mesh.remove(menu_func)
# handle the keymap
wm = bpy.context.window_manager
for km in addon_keymaps:
wm.keyconfigs.addon.keymaps.remove(km)
# clear the listdel addon_keymaps[:]
if __name__ == "__main__":
register()
# ##### BEGIN GPL LICENSE BLOCK ####### This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software Foundation,# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## ##### END GPL LICENSE BLOCK #####
bl_info = {
"name": "My Addon", # addon's name"description": "This is ...", # addon's description"category": "Object", # addon's category
}
classMy_macro:
# 1 to register in the menu. Otherwise 0.
in_menu = 1# name in the menu
menu_name = "Menu Name"# tooltip
tooltip = "This is my macro"# command name. Only lowercase, number, and "_" are available.
program_name = "my_command"# If you register shortcut now, select from the below list.
shortcut_key = "NONE"# If you don't register shortcut, here is meaningless.
shortcut_shift = 1# If you hold down the Shift, 1. Otherwise 0.
shortcut_ctrl = 1# If you hold down the Ctrl, 0. Otherwise 0.
shortcut_alt = 1# If you hold down the Alt, 0. Otherwise 0.@staticmethoddefmy_commands():
'''Paste commands here.'''# Align the head of commands with this line.'''Available characters can be used as shortcut"NONE","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N","O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","SEMI_COLON", "PERIOD", "COMMA", "QUOTE", "ACCENT_GRAVE", "MINUS", "PLUS","SLASH", "BACK_SLASH", "EQUAL", "LEFT_BRACKET", "RIGHT_BRACKET","F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12","F13", "F14", "F15", "F16", "F17", "F18", "F19","ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE","NUMPAD_0", "NUMPAD_1", "NUMPAD_2", "NUMPAD_3", "NUMPAD_4", "NUMPAD_5","NUMPAD_6", "NUMPAD_7", "NUMPAD_8", "NUMPAD_9","NUMPAD_PERIOD", "NUMPAD_SLASH", "NUMPAD_ASTERIX", "NUMPAD_MINUS","NUMPAD_ENTER", "NUMPAD_PLUS","ESC", "TAB", "RET", "SPACE", "LINE_FEED", "BACK_SPACE", "DEL", "PAUSE","INSERT", "HOME", "PAGE_UP", "PAGE_DOWN", "END","LEFT_ARROW", "DOWN_ARROW", "RIGHT_ARROW", "UP_ARROW","LEFTMOUSE", "MIDDLEMOUSE", "RIGHTMOUSE", "BUTTON4MOUSE", "BUTTON5MOUSE","BUTTON6MOUSE", "BUTTON7MOUSE", "WHEELUPMOUSE", "WHEELDOWNMOUSE","WHEELINMOUSE", "WHEELOUTMOUSE", "MOUSEROTATE", "MOUSEMOVE","INBETWEEN_MOUSEMOVE", "ACTIONMOUSE", "SELECTMOUSE","TRACKPADPAN", "TRACKPADZOOM", "PEN", "ERASER", "EVT_TWEAK_L", "EVT_TWEAK_M","EVT_TWEAK_R", "EVT_TWEAK_A", "EVT_TWEAK_S", "LEFT_CTRL", "LEFT_ALT","LEFT_SHIFT", "RIGHT_ALT", "RIGHT_CTRL", "RIGHT_SHIFT", "OSKEY", "GRLESS","MEDIA_PLAY", "MEDIA_STOP", "MEDIA_FIRST", "MEDIA_LAST", "TEXTINPUT","WINDOW_DEACTIVATE", "TIMER", "TIMER0", "TIMER1", "TIMER2", "TIMER_JOBS","TIMER_AUTOSAVE", "TIMER_REPORT", "TIMERREGION", "NDOF_MOTION","NDOF_BUTTON_MENU", "NDOF_BUTTON_FIT", "NDOF_BUTTON_TOP", "NDOF_BUTTON_BOTTOM","NDOF_BUTTON_LEFT", "NDOF_BUTTON_RIGHT", "NDOF_BUTTON_FRONT","NDOF_BUTTON_BACK", "NDOF_BUTTON_ISO1", "NDOF_BUTTON_ISO2","NDOF_BUTTON_ROLL_CW", "NDOF_BUTTON_ROLL_CCW", "NDOF_BUTTON_SPIN_CW","NDOF_BUTTON_SPIN_CCW", "NDOF_BUTTON_TILT_CW", "NDOF_BUTTON_TILT_CCW","NDOF_BUTTON_ROTATE", "NDOF_BUTTON_PANZOOM", "NDOF_BUTTON_DOMINANT","NDOF_BUTTON_PLUS", "NDOF_BUTTON_MINUS", "NDOF_BUTTON_ESC", "NDOF_BUTTON_ALT","NDOF_BUTTON_SHIFT", "NDOF_BUTTON_CTRL", "NDOF_BUTTON_1", "NDOF_BUTTON_2","NDOF_BUTTON_3", "NDOF_BUTTON_4", "NDOF_BUTTON_5", "NDOF_BUTTON_6","NDOF_BUTTON_7", "NDOF_BUTTON_8", "NDOF_BUTTON_9", "NDOF_BUTTON_10","NDOF_BUTTON_A", "NDOF_BUTTON_B", "NDOF_BUTTON_C"'''# Don't edit under this line.import bpy
classMyTool(bpy.types.Operator):
__doc__ = My_macro.tooltip
bl_idname = "object.{}".format(My_macro.program_name)
bl_label = My_macro.menu_name
bl_options = {'REGISTER', 'UNDO'}
defexecute(self, context):
My_macro.my_commands()
return {'FINISHED'}
# store keymaps here to access after registration
addon_keymaps = []
defmenu_func(self, context):
self.layout.operator(MyTool.bl_idname)
defregister():
bpy.utils.register_class(MyTool)
# register menuif My_macro.in_menu:
bpy.types.VIEW3D_MT_object.append(menu_func)
if My_macro.shortcut_key != 'NONE':
# handle the keymap
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name='Object', space_type='EMPTY')
kmi = km.keymap_items.new(MyTool.bl_idname,
My_macro.shortcut_key,
'PRESS',
ctrl=My_macro.shortcut_ctrl,
shift=My_macro.shortcut_shift,
alt=My_macro.shortcut_alt
)
addon_keymaps.append(km)
defunregister():
bpy.utils.unregister_class(MyTool)
# unregister menuif My_macro.in_menu:
bpy.types.VIEW3D_MT_object.remove(menu_func)
# handle the keymap
wm = bpy.context.window_manager
for km in addon_keymaps:
wm.keyconfigs.addon.keymaps.remove(km)
# clear the listdel addon_keymaps[:]
if __name__ == "__main__":
register()