Fix io_anim_camera error exporting cameras with quotes in their name
[blender-addons.git] / power_sequencer / operators / set_timeline_range.py
blob65a90f4d87ef4d7abf1264912245d5705b42fcb6
1 # SPDX-License-Identifier: GPL-3.0-or-later
2 # Copyright 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
4 # This file is part of Power Sequencer.
6 import bpy
8 from .utils.doc import doc_name, doc_idname, doc_brief, doc_description
11 class POWER_SEQUENCER_OT_set_timeline_range(bpy.types.Operator):
12 """
13 Set the timeline start and end frame using the time cursor
14 """
16 doc = {
17 "name": doc_name(__qualname__),
18 "demo": "",
19 "description": doc_description(__doc__),
20 "shortcuts": [],
21 "keymap": "Sequencer",
23 bl_idname = doc_idname(__qualname__)
24 bl_label = doc["name"]
25 bl_description = doc_brief(doc["description"])
26 bl_options = {"REGISTER", "UNDO"}
28 adjust: bpy.props.EnumProperty(
29 items=[("start", "start", "start"), ("end", "end", "end")],
30 name="Adjust",
31 description="Change the start or the end frame of the timeline",
32 default="start",
35 @classmethod
36 def poll(cls, context):
37 return context.scene.sequence_editor
39 def execute(self, context):
40 scene = context.scene
41 if self.adjust == "start":
42 scene.frame_start = scene.frame_current
43 elif self.adjust == "end":
44 scene.frame_end = scene.frame_current - 1
45 return {"FINISHED"}