Sun position: remove unused prop in HDRI mode
[blender-addons.git] / space_view3d_pie_menus / pie_animation_menu.py
blobeda7ed4d97257b5e568a1d27d54ffa5d91e01983
1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
19 # <pep8 compliant>
21 bl_info = {
22 "name": "Hotkey: 'Shift Spacebar'",
23 "description": "Pie menu for Timeline controls",
24 "author": "pitiwazou, meta-androcto",
25 "version": (0, 1, 1),
26 "blender": (2, 80, 0),
27 "location": "3D View",
28 "warning": "",
29 "doc_url": "",
30 "category": "Animation Pie"
33 import bpy
34 from bpy.types import (
35 Menu,
36 Operator,
39 # Pie Animation
42 class PIE_MT_PieAnimation(Menu):
43 bl_idname = "PIE_MT_animation"
44 bl_label = "Pie Animation"
46 def draw(self, context):
47 layout = self.layout
48 pie = layout.menu_pie()
49 # 4 - LEFT
50 pie.operator("screen.frame_jump", text="Jump REW", icon='REW').end = False
51 # 6 - RIGHT
52 pie.operator("screen.frame_jump", text="Jump FF", icon='FF').end = True
53 # 2 - BOTTOM
54 pie.operator("screen.animation_play", text="Reverse", icon='PLAY_REVERSE').reverse = True
55 # 8 - TOP
56 if not context.screen.is_animation_playing: # Play / Pause
57 pie.operator("screen.animation_play", text="Play", icon='PLAY')
58 else:
59 pie.operator("screen.animation_play", text="Stop", icon='PAUSE')
60 # 7 - TOP - LEFT
61 pie.operator("screen.keyframe_jump", text="Previous FR", icon='PREV_KEYFRAME').next = False
62 # 9 - TOP - RIGHT
63 pie.operator("screen.keyframe_jump", text="Next FR", icon='NEXT_KEYFRAME').next = True
64 # 1 - BOTTOM - LEFT
65 pie.operator("insert.autokeyframe", text="Auto Keyframe", icon='REC')
66 # 3 - BOTTOM - RIGHT
67 pie.menu("VIEW3D_MT_object_animation", text="Keyframe Menu", icon="KEYINGSET")
70 # Insert Auto Keyframe
71 class PIE_OT_InsertAutoKeyframe(Operator):
72 bl_idname = "insert.autokeyframe"
73 bl_label = "Insert Auto Keyframe"
74 bl_description = "Toggle Insert Auto Keyframe"
75 bl_options = {'REGISTER', 'UNDO'}
77 def execute(self, context):
78 ts = context.tool_settings
80 ts.use_keyframe_insert_auto ^= 1
82 for area in context.screen.areas:
83 if area.type == 'TIMELINE':
84 area.tag_redraw()
86 return {'FINISHED'}
89 classes = (
90 PIE_MT_PieAnimation,
91 PIE_OT_InsertAutoKeyframe
94 addon_keymaps = []
97 def register():
98 for cls in classes:
99 bpy.utils.register_class(cls)
101 wm = bpy.context.window_manager
102 if wm.keyconfigs.addon:
103 # Animation
104 km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
105 kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', shift=True)
106 kmi.properties.name = "PIE_MT_animation"
107 addon_keymaps.append((km, kmi))
110 def unregister():
111 for cls in classes:
112 bpy.utils.unregister_class(cls)
114 wm = bpy.context.window_manager
115 kc = wm.keyconfigs.addon
116 if kc:
117 for km, kmi in addon_keymaps:
118 km.keymap_items.remove(kmi)
119 addon_keymaps.clear()
122 if __name__ == "__main__":
123 register()