Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_time.py
| # SPDX-License-Identifier: GPL-2.0-or-later | # SPDX-License-Identifier: GPL-2.0-or-later | ||||
| import bpy | import bpy | ||||
| from bpy.types import Menu, Panel | from bpy.types import Menu, Panel | ||||
| # Header buttons for timeline header (play, etc.) | # Header buttons for timeline header (play, etc.) | ||||
| class TIME_HT_editor_buttons: | class TIME_HT_editor_buttons: | ||||
| @staticmethod | @staticmethod | ||||
| def draw_header(context, layout): | def draw_header(context, layout): | ||||
| scene = context.scene | scene = context.scene | ||||
| tool_settings = context.tool_settings | tool_settings = context.tool_settings | ||||
| screen = context.screen | screen = context.screen | ||||
| layout.separator_spacer() | layout.separator_spacer() | ||||
| layout.popover( | |||||
| panel="TIME_PT_keyframing_settings", | |||||
| text="", | |||||
| icon="KEYINGSET" | |||||
| ) | |||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.prop(tool_settings, "use_keyframe_insert_auto", text="", toggle=True) | row.prop(tool_settings, "use_keyframe_insert_auto", text="", toggle=True) | ||||
| sub = row.row(align=True) | sub = row.row(align=True) | ||||
| sub.active = tool_settings.use_keyframe_insert_auto | sub.active = tool_settings.use_keyframe_insert_auto | ||||
| sub.popover( | sub.popover( | ||||
| panel="TIME_PT_auto_keyframing", | panel="TIME_PT_auto_keyframing", | ||||
| text="", | text="", | ||||
| ) | ) | ||||
| Show All 13 Lines | def draw_header(context, layout): | ||||
| row.operator("screen.animation_play", text="", icon='PLAY_REVERSE').reverse = True | row.operator("screen.animation_play", text="", icon='PLAY_REVERSE').reverse = True | ||||
| row.operator("screen.animation_play", text="", icon='PLAY') | row.operator("screen.animation_play", text="", icon='PLAY') | ||||
| else: | else: | ||||
| row.scale_x = 2 | row.scale_x = 2 | ||||
| row.operator("screen.animation_play", text="", icon='PAUSE') | row.operator("screen.animation_play", text="", icon='PAUSE') | ||||
| row.scale_x = 1 | row.scale_x = 1 | ||||
| row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True | row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True | ||||
| row.operator("screen.frame_jump", text="", icon='FF').end = True | row.operator("screen.frame_jump", text="", icon='FF').end = True | ||||
| row.popover( | |||||
| panel="TIME_PT_playback", | |||||
| text="" | |||||
| ) | |||||
| layout.separator_spacer() | layout.separator_spacer() | ||||
| row = layout.row() | row = layout.row() | ||||
| if scene.show_subframe: | if scene.show_subframe: | ||||
| row.scale_x = 1.15 | row.scale_x = 1.15 | ||||
| row.prop(scene, "frame_float", text="") | row.prop(scene, "frame_float", text="") | ||||
| else: | else: | ||||
| row.scale_x = 0.95 | row.scale_x = 0.95 | ||||
| row.prop(scene, "frame_current", text="") | row.prop(scene, "frame_current", text="") | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.prop(scene, "use_preview_range", text="", toggle=True) | row.prop(scene, "use_preview_range", text="", toggle=True) | ||||
| row.operator("anim.start_frame_set", text="", icon="TRIA_RIGHT") | |||||
| sub = row.row(align=True) | sub = row.row(align=True) | ||||
| sub.scale_x = 0.8 | sub.scale_x = 0.8 | ||||
| if not scene.use_preview_range: | if not scene.use_preview_range: | ||||
| sub.prop(scene, "frame_start", text="Start") | sub.prop(scene, "frame_start", text="") | ||||
| sub.prop(scene, "frame_end", text="End") | sub.prop(scene, "frame_end", text="") | ||||
| else: | else: | ||||
| sub.prop(scene, "frame_preview_start", text="Start") | sub.prop(scene, "frame_preview_start", text="") | ||||
| sub.prop(scene, "frame_preview_end", text="End") | sub.prop(scene, "frame_preview_end", text="") | ||||
| row.operator("anim.end_frame_set", text="", icon="TRIA_LEFT") | |||||
| class TIME_MT_editor_menus(Menu): | class TIME_MT_editor_menus(Menu): | ||||
| bl_idname = "TIME_MT_editor_menus" | bl_idname = "TIME_MT_editor_menus" | ||||
| bl_label = "" | bl_label = "" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| horizontal = (layout.direction == 'VERTICAL') | horizontal = (layout.direction == 'VERTICAL') | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| # NOTE: "action" now, since timeline is in the dopesheet editor, instead of as own editor | # NOTE: "action" now, since timeline is in the dopesheet editor, instead of as own editor | ||||
| layout.operator("action.view_all") | layout.operator("action.view_all") | ||||
| layout.operator("action.view_frame") | layout.operator("action.view_frame") | ||||
| layout.separator() | layout.separator() | ||||
| layout.menu("INFO_MT_area") | layout.menu("INFO_MT_area") | ||||
| class TIME_MT_cache(Menu): | class TIME_MT_cache(Menu): | ||||
| bl_label = "Cache" | bl_label = "Cache" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| st = context.space_data | st = context.space_data | ||||
| ▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| col.prop(screen, "use_play_properties_editors", text="Properties Editor") | col.prop(screen, "use_play_properties_editors", text="Properties Editor") | ||||
| col.prop(screen, "use_play_clip_editors", text="Movie Clip Editor") | col.prop(screen, "use_play_clip_editors", text="Movie Clip Editor") | ||||
| col.prop(screen, "use_play_node_editors", text="Node Editors") | col.prop(screen, "use_play_node_editors", text="Node Editors") | ||||
| col.prop(screen, "use_play_sequence_editors", text="Video Sequencer") | col.prop(screen, "use_play_sequence_editors", text="Video Sequencer") | ||||
| col = layout.column(heading="Show") | col = layout.column(heading="Show") | ||||
| col.prop(scene, "show_subframe", text="Subframes") | col.prop(scene, "show_subframe", text="Subframes") | ||||
| layout.separator() | |||||
| row = layout.row(align=True) | |||||
| row.operator("anim.start_frame_set") | |||||
| row.operator("anim.end_frame_set") | |||||
| class TIME_PT_keyframing_settings(TimelinePanelButtons, Panel): | class TIME_PT_keyframing_settings(TimelinePanelButtons, Panel): | ||||
| bl_label = "Keyframing Settings" | bl_label = "Keyframing Settings" | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| bl_region_type = 'HEADER' | bl_region_type = 'HEADER' | ||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| # only for timeline editor | |||||
| return cls.has_timeline(context) | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| scene = context.scene | scene = context.scene | ||||
| tool_settings = context.tool_settings | tool_settings = context.tool_settings | ||||
| col = layout.column(align=True) | col = layout.column(align=True) | ||||
| col.label(text="Active Keying Set") | col.label(text="Active Keying Set") | ||||
| Show All 10 Lines | |||||
| class TIME_PT_auto_keyframing(TimelinePanelButtons, Panel): | class TIME_PT_auto_keyframing(TimelinePanelButtons, Panel): | ||||
| bl_label = "Auto Keyframing" | bl_label = "Auto Keyframing" | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| bl_region_type = 'HEADER' | bl_region_type = 'HEADER' | ||||
| bl_ui_units_x = 9 | bl_ui_units_x = 9 | ||||
| @classmethod | |||||
| def poll(cls, context): | |||||
| # Only for timeline editor. | |||||
| return cls.has_timeline(context) | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| tool_settings = context.tool_settings | tool_settings = context.tool_settings | ||||
| prefs = context.preferences | prefs = context.preferences | ||||
| layout.active = tool_settings.use_keyframe_insert_auto | layout.active = tool_settings.use_keyframe_insert_auto | ||||
| Show All 24 Lines | |||||