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 convert_duration_to_frames
8 from .utils
.doc
import doc_name
, doc_idname
, doc_brief
, doc_description
11 class POWER_SEQUENCER_OT_jump_time_offset(bpy
.types
.Operator
):
13 *brief* Jump forward or backward in time
16 Move the time cursor forward or backward, using a duration in seconds.
18 The equivalent tool in Blender only works with frames, meaning the jump
19 will be different if your project's framerate is different. This tool
24 "name": doc_name(__qualname__
),
26 "description": doc_description(__doc__
),
29 {"type": "RIGHT_ARROW", "value": "PRESS", "shift": True},
30 {"direction": "forward"},
34 {"type": "LEFT_ARROW", "value": "PRESS", "shift": True},
35 {"direction": "backward"},
41 bl_idname
= doc_idname(__qualname__
)
42 bl_label
= doc
["name"]
43 bl_description
= doc_brief(doc
["description"])
44 bl_options
= {"REGISTER"}
46 duration
: bpy
.props
.FloatProperty(
48 description
="The length of the jump in seconds (default: 1.0)",
52 direction
: bpy
.props
.EnumProperty(
54 description
="Jump direction, either forward or backward",
56 ("forward", "Forward", "Jump forward in time"),
57 ("backward", "Backward", "Jump backward in time"),
62 def poll(cls
, context
):
65 def execute(self
, context
):
66 direction
= 1 if self
.direction
== "forward" else -1
67 context
.scene
.frame_current
+= (
68 convert_duration_to_frames(context
, self
.duration
) * direction