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') | ||||
| st = context.space_data | st = context.space_data | ||||
| if horizontal: | if horizontal: | ||||
| row = layout.row() | row = layout.row() | ||||
| sub = row.row(align=True) | sub = row.row(align=True) | ||||
| else: | else: | ||||
| sub = layout | sub = layout | ||||
| sub.popover( | |||||
| panel="TIME_PT_playback", | |||||
| text="Playback", | |||||
| ) | |||||
| sub.popover( | |||||
| panel="TIME_PT_keyframing_settings", | |||||
| text="Keying", | |||||
| ) | |||||
| # Add a separator to keep the popover button from aligning with the menu button. | # Add a separator to keep the popover button from aligning with the menu button. | ||||
| sub.separator(factor=0.4) | sub.separator(factor=0.4) | ||||
| if horizontal: | if horizontal: | ||||
| sub = row.row(align=True) | sub = row.row(align=True) | ||||
| sub.menu("TIME_MT_view") | sub.menu("TIME_MT_view") | ||||
| if st.show_markers: | if st.show_markers: | ||||
| Show All 13 Lines | class TIME_MT_view(Menu): | ||||
| bl_label = "View" | bl_label = "View" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| scene = context.scene | scene = context.scene | ||||
| st = context.space_data | st = context.space_data | ||||
| layout.prop(context.scene, "show_subframe", text="Show Subframes") | |||||
| layout.prop(st, "show_seconds") | layout.prop(st, "show_seconds") | ||||
| layout.prop(st, "show_locked_time") | layout.prop(st, "show_locked_time") | ||||
| layout.separator() | layout.separator() | ||||
| layout.prop(st, "show_markers") | layout.prop(st, "show_markers") | ||||
| layout.separator() | layout.separator() | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| col.prop(screen, "use_play_3d_editors", text="3D Viewport") | col.prop(screen, "use_play_3d_editors", text="3D Viewport") | ||||
| col.prop(screen, "use_play_animation_editors", text="Animation Editors") | col.prop(screen, "use_play_animation_editors", text="Animation Editors") | ||||
| col.prop(screen, "use_play_image_editors", text="Image Editor") | col.prop(screen, "use_play_image_editors", text="Image Editor") | ||||
| 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.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 | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| # only for timeline editor | # only for timeline editor | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||