Skip to content

Commit

Permalink
Add operator to toggle mute a sequence with the mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanLovato committed Aug 26, 2017
1 parent f4e2e67 commit 9c13412
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions video_editing_mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,35 @@ def invoke(self, context, event):
return {"FINISHED"}


class MouseToggleMute(bpy.types.Operator):
"""Toggle mute a sequence as you click on it"""
bl_idname = "power_sequencer.mouse_toggle_mute"
bl_label = "PS.Toggle Mute with Mouse"
bl_options = {'REGISTER', 'UNDO'}

@classmethod
def poll(cls, context):
return context is not None

def invoke(self, context, event):
sequencer = bpy.ops.sequencer
frame_float, channel_float = context.region.view2d.region_to_view(
x=event.mouse_region_x,
y=event.mouse_region_y)
frame = floor(frame_float)
channel = floor(channel_float)

# Strip selection
sequencer.select_all(action='DESELECT')
to_select = find_strips_mouse(frame, channel)

if not to_select:
return {"CANCELLED"}

for s in to_select:
s.mute = not s.mute
return {"FINISHED"}

class EditCrossfade(bpy.types.Operator):
"""
Selects handles to edit crossfade
Expand Down

0 comments on commit 9c13412

Please sign in to comment.