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
.doc
import doc_brief
, doc_description
, doc_idname
, doc_name
8 from .utils
.functions
import convert_duration_to_frames
11 class POWER_SEQUENCER_OT_value_offset(bpy
.types
.Operator
):
12 """Instantly offset selected strips, either using frames or seconds. Allows to
13 nudge the selection quickly, using keyboard shortcuts
17 "name": doc_name(__qualname__
),
19 "description": doc_description(__doc__
),
22 {"type": "LEFT_ARROW", "value": "PRESS", "shift": True, "alt": True},
23 {"direction": "left"},
24 "Offset the selection to the left.",
27 {"type": "RIGHT_ARROW", "value": "PRESS", "shift": True, "alt": True},
28 {"direction": "right"},
29 "Offset the selection to the right.",
32 "keymap": "Sequencer",
34 bl_idname
= doc_idname(__qualname__
)
35 bl_label
= doc
["name"]
36 bl_description
= doc_brief(doc
["description"])
37 bl_options
= {"REGISTER", "UNDO"}
39 direction
: bpy
.props
.EnumProperty(
41 ("left", "left", "Move the selection to the left"),
42 ("right", "right", "Move the selection to the right"),
45 description
="Move the selection given frames or seconds",
49 value_type
: bpy
.props
.EnumProperty(
51 ("seconds", "Seconds", "Move with the value as seconds"),
52 ("frames", "Frames", "Move with the value as frames"),
55 description
="Toggle between offset in frames or seconds",
58 offset
: bpy
.props
.FloatProperty(
60 description
="Offset amount to apply",
67 def poll(cls
, context
):
68 return context
.selected_sequences
70 def invoke(self
, context
, event
):
71 self
.offset
= abs(self
.offset
)
72 if self
.direction
== "left":
74 return self
.execute(context
)
76 def execute(self
, context
):
78 convert_duration_to_frames(context
, self
.offset
)
79 if self
.value_type
== "seconds"
82 return bpy
.ops
.transform
.seq_slide(value
=(offset_frames
, 0))