1 # SPDX-License-Identifier: GPL-3.0-or-later
2 # Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
5 from .utils
.doc
import doc_name
, doc_idname
, doc_brief
, doc_description
8 class POWER_SEQUENCER_OT_deselect_all_strips_left_or_right(bpy
.types
.Operator
):
10 Deselects all the strips at the left or right of the time cursor, based on the position
15 "name": doc_name(__qualname__
),
17 "description": doc_description(__doc__
),
20 {"type": "Q", "value": "PRESS", "alt": True},
22 "Deselect all strips to the left of the time cursor",
25 {"type": "E", "value": "PRESS", "alt": True},
27 "Deselect all strips to the right of the time cursor",
30 "keymap": "Sequencer",
32 bl_idname
= doc_idname(__qualname__
)
33 bl_label
= doc
["name"]
34 bl_description
= doc_brief(doc
["description"])
35 bl_options
= {"REGISTER", "UNDO"}
37 side
: bpy
.props
.EnumProperty(
39 description
="The side to deselect",
44 ("Deselect based on the mouse position relative to the" " time cursor"),
46 ("left", "Left", "Left of the time cursor"),
47 ("right", "Right", "Right of the time cursor"),
53 def poll(cls
, context
):
54 return context
.selected_sequences
56 def invoke(self
, context
, event
):
57 frame_current
= context
.scene
.frame_current
58 frame_mouse
= context
.region
.view2d
.region_to_view(event
.mouse_region_x
, 1)[0]
60 for s
in context
.sequences
:
61 if self
.side
== "left" or frame_mouse
< frame_current
and self
.side
== "mouse":
62 if s
.frame_final_end
< frame_current
:
64 elif self
.side
== "right" or frame_mouse
>= frame_current
and self
.side
== "mouse":
65 if s
.frame_final_start
>= frame_current
:
69 def deselect(self
, strip
):
71 strip
.select_left_handle
= False
72 strip
.select_right_handle
= False