Export_3ds: Improved distance cue node search
[blender-addons.git] / power_sequencer / operators / toggle_selected_mute.py
blobba6c01afd4cb99500ed573b52e2dc9ed387952aa
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_toggle_selected_mute(bpy.types.Operator):
11 """
12 Mute or unmute selected sequences
13 """
15 doc = {
16 "name": doc_name(__qualname__),
17 "demo": "",
18 "description": doc_description(__doc__),
19 "shortcuts": [
21 {"type": "H", "value": "PRESS"},
22 {"use_unselected": False},
23 "Mute or Unmute Selected Strips",
26 {"type": "H", "value": "PRESS", "alt": True},
27 {"use_unselected": True},
28 "Mute or Unmute Selected Strips",
31 "keymap": "Sequencer",
33 bl_idname = doc_idname(__qualname__)
34 bl_label = doc["name"]
35 bl_description = doc_brief(doc["description"])
36 bl_options = {"REGISTER", "UNDO"}
38 use_unselected: bpy.props.BoolProperty(
39 name="Use unselected", description="Toggle non selected sequences", default=False
42 @classmethod
43 def poll(cls, context):
44 return context.selected_sequences
46 def execute(self, context):
47 selection = context.selected_sequences
49 if self.use_unselected:
50 selection = [s for s in context.sequences if s not in selection]
52 if not selection:
53 self.report({"WARNING"}, "No sequences to toggle muted")
54 return {"CANCELLED"}
56 mute = not selection[0].mute
57 for s in selection:
58 s.mute = mute
59 return {"FINISHED"}