Add keymaps, specials menu and auto center view checkbox #3
24
__init__.py
24
__init__.py
@ -45,7 +45,7 @@ class C3DB_OT_restore(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
class C3DB_OT_restore_and_next(bpy.types.Operator):
|
||||
"""Restore selected 3D Cursor and go to next one in the list"""
|
||||
"""Restore selected 3D Cursor and select next one in the list"""
|
||||
bl_idname = "c3db.restore_and_next"
|
||||
bl_label = "Load & next"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
@ -69,7 +69,7 @@ class C3DB_OT_restore_and_next(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
class C3DB_OT_restore_and_previous(bpy.types.Operator):
|
||||
"""Restore selected 3D Cursor and go to previous one in the list"""
|
||||
"""Restore selected 3D Cursor and select previous one in the list"""
|
||||
bl_idname = "c3db.restore_and_previous"
|
||||
bl_label = "Load & previous"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
@ -176,11 +176,12 @@ class C3DB_PT_panel(bpy.types.Panel):
|
||||
row.operator("view3d.view_center_cursor", text="Center View")
|
||||
row = layout.row()
|
||||
row.operator("c3db.restore_and_next")
|
||||
row = layout.row()
|
||||
row.operator("c3db.restore_and_previous")
|
||||
|
||||
classes = (C3DB_PG_properties, C3DB_UL_list, C3DB_OT_save, C3DB_OT_restore, C3DB_OT_restore_and_next, C3DB_OT_restore_and_previous, C3DB_OT_remove_from_list, C3DB_OT_move_up_list, C3DB_OT_move_down_list, C3DB_PT_panel)
|
||||
|
||||
addon_keymaps = []
|
||||
c3db_keymaps = []
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
@ -192,13 +193,19 @@ def register():
|
||||
km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
|
||||
|
||||
kmi = km.keymap_items.new(C3DB_OT_save.bl_idname, 'S', 'PRESS', ctrl=True, shift=True)
|
||||
addon_keymaps.append((km, kmi))
|
||||
c3db_keymaps.append((km, kmi))
|
||||
|
||||
kmi = km.keymap_items.new(C3DB_OT_remove_from_list.bl_idname, 'D', 'PRESS', ctrl=True, shift=True)
|
||||
c3db_keymaps.append((km, kmi))
|
||||
|
||||
kmi = km.keymap_items.new(C3DB_OT_restore.bl_idname, 'R', 'PRESS', ctrl=True)
|
||||
c3db_keymaps.append((km, kmi))
|
||||
|
||||
kmi = km.keymap_items.new(C3DB_OT_restore_and_next.bl_idname, 'R', 'PRESS', ctrl=True, shift=True)
|
||||
addon_keymaps.append((km, kmi))
|
||||
c3db_keymaps.append((km, kmi))
|
||||
|
||||
kmi = km.keymap_items.new(C3DB_OT_restore_and_previous.bl_idname, 'R', 'PRESS', ctrl=True, shift=True, alt=True)
|
||||
addon_keymaps.append((km, kmi))
|
||||
c3db_keymaps.append((km, kmi))
|
||||
|
||||
def unregister():
|
||||
for cls in classes:
|
||||
@ -207,10 +214,9 @@ def unregister():
|
||||
del bpy.types.Scene.C3DB_3Dcursors_index
|
||||
|
||||
wm = bpy.context.window_manager
|
||||
for km, kmi in addon_keymaps:
|
||||
for km, kmi in c3db_keymaps:
|
||||
km.keymap_items.remove(kmi)
|
||||
addon_keymaps.clear()
|
||||
c3db_keymaps.clear()
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user