Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / release / ui / space_time.py
1
2 import bpy
3
4 class TIME_HT_header(bpy.types.Header):
5         __space_type__ = "TIMELINE"
6
7         def draw(self, context):
8                 layout = self.layout
9                 
10                 st = context.space_data
11                 scene = context.scene
12                 rd = context.scene.render_data
13                 tools = context.tool_settings
14                 screen = context.screen
15
16                 row = layout.row(align=True)
17                 row.template_header()
18
19                 if context.area.show_menus:
20                         sub = row.row(align=True)
21                         sub.itemM("TIME_MT_view")
22                         sub.itemM("TIME_MT_frame")
23                         sub.itemM("TIME_MT_playback")
24
25                 layout.itemR(scene, "use_preview_range", text="PR", toggle=True)
26                 
27                 row = layout.row(align=True)
28                 if not scene.use_preview_range:
29                         row.itemR(scene, "start_frame", text="Start")
30                         row.itemR(scene, "end_frame", text="End")
31                 else:
32                         row.itemR(scene, "preview_range_start_frame", text="Start")
33                         row.itemR(scene, "preview_range_end_frame", text="End")
34                 
35                 layout.itemR(scene, "current_frame", text="")
36
37                 row = layout.row(align=True)
38                 row.item_booleanO("screen.frame_jump", "end", False, text="", icon='ICON_REW')
39                 row.item_booleanO("screen.keyframe_jump", "next", False, text="", icon='ICON_PREV_KEYFRAME')
40                 if not screen.animation_playing:
41                         row.item_booleanO("screen.animation_play", "reverse", True, text="", icon='ICON_PLAY_REVERSE')
42                         row.itemO("screen.animation_play", text="", icon='ICON_PLAY')
43                 else:
44                         sub = row.row()
45                         sub.scale_x = 2.0
46                         sub.itemO("screen.animation_play", text="", icon='ICON_PAUSE')
47                 row.item_booleanO("screen.keyframe_jump", "next", True, text="", icon='ICON_NEXT_KEYFRAME')
48                 row.item_booleanO("screen.frame_jump", "end", True, text="", icon='ICON_FF')
49                 
50                 layout.itemR(rd, "sync_audio", text="", toggle=True, icon='ICON_SPEAKER')
51                 
52                 layout.itemS()
53                 
54                 row = layout.row(align=True)
55                 row.itemR(tools, "enable_auto_key", text="", toggle=True, icon='ICON_REC')
56                 sub = row.row()
57                 sub.active = tools.enable_auto_key
58                 sub.itemR(tools, "autokey_mode", text="")
59                 if screen.animation_playing and tools.enable_auto_key:
60                         subsub = row.row()
61                         subsub.itemR(tools, "record_with_nla", toggle=True)
62                 
63                 layout.itemS()
64                 
65                 row = layout.row(align=True)
66                 row.itemR(scene, "active_keying_set", text="")
67                 row.itemO("anim.insert_keyframe", text="", icon="ICON_KEY_HLT")
68                 row.itemO("anim.delete_keyframe", text="", icon="ICON_KEY_DEHLT")
69
70 class TIME_MT_view(bpy.types.Menu):
71         __space_type__ = "TIMELINE"
72         __label__ = "View"
73
74         def draw(self, context):
75                 layout = self.layout
76                 
77                 st = context.space_data
78                 
79                 layout.itemO("anim.time_toggle")
80                 
81                 layout.itemS()
82                 
83                 layout.itemR(st, "only_selected")
84
85 class TIME_MT_frame(bpy.types.Menu):
86         __space_type__ = "TIMELINE"
87         __label__ = "Frame"
88
89         def draw(self, context):
90                 layout = self.layout
91                 
92                 layout.itemO("marker.add", text="Add Marker")
93                 layout.itemO("marker.duplicate", text="Duplicate Marker")
94                 layout.itemO("marker.move", text="Grab/Move Marker")
95                 layout.itemO("marker.delete", text="Delete Marker")
96                 layout.itemL(text="ToDo: Name Marker")
97                 
98                 layout.itemS()
99                 
100                 layout.itemO("time.start_frame_set")
101                 layout.itemO("time.end_frame_set")
102
103 class TIME_MT_playback(bpy.types.Menu):
104         __space_type__ = "TIMELINE"
105         __label__ = "Playback"
106
107         def draw(self, context):
108                 layout = self.layout
109                 
110                 st = context.space_data
111                 
112                 layout.itemR(st, "play_top_left")
113                 layout.itemR(st, "play_all_3d")
114                 layout.itemR(st, "play_anim")
115                 layout.itemR(st, "play_buttons")
116                 layout.itemR(st, "play_image")
117                 layout.itemR(st, "play_sequencer")
118                 layout.itemS()
119                 layout.itemR(st, "continue_physics")
120
121 bpy.types.register(TIME_HT_header)
122 bpy.types.register(TIME_MT_view)
123 bpy.types.register(TIME_MT_frame)
124 bpy.types.register(TIME_MT_playback)