Import_3ds: Improved distance cue node setup
[blender-addons.git] / power_sequencer / operators / markers_snap_matching_strips.py
blobdb137274c7c4babba68590409a4c61c115b447af
1 # SPDX-FileCopyrightText: 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
3 # SPDX-License-Identifier: GPL-3.0-or-later
5 import bpy
7 from .utils.doc import doc_name, doc_idname, doc_brief, doc_description
10 class POWER_SEQUENCER_OT_markers_snap_matching_strips(bpy.types.Operator):
11 """
12 Snap selected strips to markers with the same name
13 """
15 doc = {
16 "name": doc_name(__qualname__),
17 "demo": "",
18 "description": doc_description(__doc__),
19 "shortcuts": [],
20 "keymap": "Sequencer",
22 bl_idname = doc_idname(__qualname__)
23 bl_label = doc["name"]
24 bl_description = doc_brief(doc["description"])
25 bl_options = {"REGISTER", "UNDO"}
27 @classmethod
28 def poll(cls, context):
29 return context.scene.timeline_markers
31 def execute(self, context):
32 timeline_markers = context.scene.timeline_markers
34 for strip in context.selected_sequences:
35 for marker in timeline_markers:
36 if marker.name in strip.name:
37 strip.frame_start = marker.frame - strip.frame_offset_start
38 return {"FINISHED"}