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 get_mouse_frame_and_channel
8 from .utils
.doc
import doc_name
, doc_idname
, doc_brief
, doc_description
11 class POWER_SEQUENCER_OT_trim_three_point_edit(bpy
.types
.Operator
):
13 Trim the closest strip under the mouse cursor in or out
17 "name": doc_name(__qualname__
),
19 "description": doc_description(__doc__
),
21 ({"type": "I", "value": "PRESS"}, {"side": "LEFT"}, "Trim In"),
22 ({"type": "O", "value": "PRESS"}, {"side": "RIGHT"}, "Trim Out"),
24 "keymap": "Sequencer",
26 bl_idname
= doc_idname(__qualname__
)
27 bl_label
= doc
["name"]
28 bl_description
= doc_brief(doc
["description"])
29 bl_options
= {"REGISTER", "UNDO"}
31 side
: bpy
.props
.EnumProperty(
32 items
=[("LEFT", "Left", "Left side"), ("RIGHT", "Right", "Right side")],
34 description
="Side of the strip(s) to trim, either LEFT or RIGHT",
39 def poll(cls
, context
):
40 return context
.sequences
42 def invoke(self
, context
, event
):
43 frame
, channel
= get_mouse_frame_and_channel(context
, event
)
44 bpy
.ops
.sequencer
.select_all(action
="DESELECT")
45 bpy
.ops
.power_sequencer
.select_closest_to_mouse(frame
=frame
, channel
=channel
)
46 if not context
.selected_sequences
:
47 bpy
.ops
.power_sequencer
.select_strips_under_cursor()
48 return self
.execute(context
)
50 def execute(self
, context
):
51 if not context
.selected_sequences
:
53 bpy
.ops
.power_sequencer
.trim_left_or_right_handles(side
=self
.side
)