1 # SPDX-FileCopyrightText: 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
3 # SPDX-License-Identifier: GPL-3.0-or-later
7 from .utils
.functions
import find_neighboring_markers
8 from .utils
.doc
import doc_name
, doc_idname
, doc_brief
, doc_description
11 class POWER_SEQUENCER_OT_set_preview_between_markers(bpy
.types
.Operator
):
13 Set the timeline's preview range using the 2 markers closest to the time cursor
17 "name": doc_name(__qualname__
),
19 "description": doc_description(__doc__
),
21 "keymap": "Sequencer",
23 bl_idname
= doc_idname(__qualname__
)
24 bl_label
= doc
["name"]
25 bl_description
= doc_brief(doc
["description"])
26 bl_options
= {"REGISTER", "UNDO"}
29 def poll(cls
, context
):
30 return context
.scene
.sequence_editor
32 def invoke(self
, context
, event
):
33 if not context
.scene
.timeline_markers
:
34 self
.report({"ERROR_INVALID_INPUT"}, "There are no markers. Operation cancelled.")
37 frame
= context
.scene
.frame_current
38 previous_marker
, next_marker
= find_neighboring_markers(context
, frame
)
40 if not (previous_marker
and next_marker
):
41 self
.report({"ERROR_INVALID_INPUT"}, "There are no markers. Operation cancelled.")
44 frame_start
= previous_marker
.frame
if previous_marker
else 0
46 frame_end
= next_marker
.frame
48 from operator
import attrgetter
51 context
.scene
.sequence_editor
.sequences
, key
=attrgetter("frame_final_end")
54 from .utils
.functions
import set_preview_range
56 set_preview_range(context
, frame_start
, frame_end
)