Power Sequencer: update to version 1.5, fix for Blender 2.83

This makes the add-on compatible with Blender 2.83 after renaming the cut operator to split.
The update brings mainly bug fixes and quality of life improvements.

Changelog: https://github.com/GDQuest/blender-power-sequencer/blob/master/CHANGELOG.md#power-sequencer-1
36 Commits: https://github.com/GDQuest/blender-power-sequencer/compare/1.4.0...fb55bc77cf31920ddfe6fd4342b11e53ac988c93
This commit is contained in:
Nathan Lovato 2020-05-14 14:40:24 -06:00
parent 3b7dd92024
commit c9f09d722a
103 changed files with 345 additions and 292 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -38,11 +38,11 @@ bl_info = {
"name": "Power Sequencer",
"description": "Video editing tools for content creators",
"author": "Nathan Lovato",
"version": (1, 4, 0),
"blender": (2, 80, 0),
"version": (1, 5, 0),
"blender": (2, 81, 0),
"location": "Sequencer",
"tracker_url": "https://github.com/GDquest/Blender-power-sequencer/issues",
"doc_url": "https://www.gdquest.com/docs/documentation/power-sequencer/",
"wiki_url": "https://www.gdquest.com/docs/documentation/power-sequencer/",
"support": "COMMUNITY",
"category": "Sequencer",
}
@ -70,13 +70,11 @@ def register():
bpy.utils.register_class(cls)
# Register tools
version_min_toolbar = (2, 83, 0)
if is_blender_version_compatible(version_min_toolbar):
classes_tool = get_tool_classes()
last_tool = {"builtin.cut"}
for index, cls in enumerate(classes_tool):
bpy.utils.register_tool(cls, after=last_tool, separator=index == 0)
last_tool = {cls.bl_idname}
classes_tool = get_tool_classes()
last_tool = {"builtin.cut"}
for index, cls in enumerate(classes_tool):
bpy.utils.register_tool(cls, after=last_tool, separator=index == 0)
last_tool = {cls.bl_idname}
# Register keymaps
keymaps = register_shortcuts(classes_operator)
@ -98,10 +96,8 @@ def unregister():
for cls in classes_operator:
bpy.utils.unregister_class(cls)
version_min_toolbar = (2, 82, 0)
if is_blender_version_compatible(version_min_toolbar):
for cls in classes_tool:
bpy.utils.unregister_tool(cls)
for cls in classes_tool:
bpy.utils.unregister_tool(cls)
unregister_ui()
unregister_preferences()
@ -109,11 +105,3 @@ def unregister():
unregister_handlers()
print("Unregistered {}".format(bl_info["name"]))
def is_blender_version_compatible(version: Tuple[int, int, int]) -> bool:
"""Returns True if the `version` is greater or equal to the current Blender version.
Converts the versions to integers to compare them."""
version_int = version[0] * 1000 + version[1] * 10 + version[2]
blender_version_int = bpy.app.version[0] * 1000 + bpy.app.version[1] * 10 + bpy.app.version[2]
return blender_version_int >= version_int

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -28,7 +28,7 @@ def get_operator_classes():
classes = []
print(__name__)
for path in module_paths:
module = importlib.import_module(path, package="power_sequencer.operators")
module = importlib.import_module(path, package="blender_power_sequencer.operators")
operator_names = [entry for entry in dir(module) if entry.startswith("POWER_SEQUENCER_OT")]
classes.extend([getattr(module, name) for name in operator_names])
return classes

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -15,6 +15,7 @@
# not, see <https://www.gnu.org/licenses/>.
#
import bpy
import subprocess
from .utils.doc import doc_name, doc_idname, doc_brief, doc_description

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -16,6 +16,10 @@
#
import numpy as np
from scipy.signal import hamming, lfilter
from scipy.fftpack import fft
from scipy.fftpack.realtransforms import dct
from .trfbank import trfbank
from .segment_axis import segment_axis
@ -52,10 +56,6 @@ def mfcc(input, nwin=256, nfft=512, fs=16000, nceps=13):
spoken sentences", IEEE Trans. Acoustics. Speech, Signal Proc.
ASSP-28 (4): 357-366, August 1980."""
from scipy.signal import hamming, lfilter
from scipy.fftpack import fft
from scipy.fftpack.realtransforms import dct
# MFCC parameters: taken from auditory toolbox
over = nwin - 160
# Pre-emphasis factor (to take into account the -6dB/octave rolloff of the

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -18,6 +18,13 @@ import bpy
from operator import attrgetter
from .utils.doc import doc_name, doc_idname, doc_brief, doc_description
from .utils.functions import (
slice_selection,
get_frame_range,
get_channel_range,
trim_strips,
find_strips_in_range,
)
class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
@ -35,11 +42,21 @@ class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
{"direction": "up"},
"Move to Open Channel Above",
),
(
{"type": "UP_ARROW", "value": "PRESS", "ctrl": True, "alt": True},
{"direction": "up", "trim_target_channel": True},
"Move to Channel Above and Trim",
),
(
{"type": "DOWN_ARROW", "value": "PRESS", "alt": True},
{"direction": "down"},
"Move to Open Channel Below",
),
(
{"type": "DOWN_ARROW", "value": "PRESS", "ctrl": True, "alt": True},
{"direction": "down", "trim_target_channel": True},
"Move to Channel Below and Trim",
),
],
"keymap": "Sequencer",
}
@ -57,6 +74,11 @@ class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
description="Move the sequences up or down",
default="up",
)
trim_target_channel: bpy.props.BoolProperty(
name="Trim strips",
description="Trim strips to make space in the target channel",
default=False,
)
@classmethod
def poll(cls, context):
@ -65,15 +87,27 @@ class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
def execute(self, context):
selection = [s for s in context.selected_sequences if not s.lock]
if not selection:
return {"CANCELLED"}
return {"FINISHED"}
selection = sorted(selection, key=attrgetter("channel", "frame_final_start"))
selection_blocks = slice_selection(context, selection)
for block in selection_blocks:
sequences = sorted(block, key=attrgetter("channel", "frame_final_start"))
frame_start, frame_end = get_frame_range(sequences)
channel_start, channel_end = get_channel_range(sequences)
if self.direction == "up":
for s in reversed(selection):
s.channel += 1
elif self.direction == "down":
for s in selection:
if s.channel > 1:
s.channel -= 1
if self.trim_target_channel:
to_delete, to_trim = find_strips_in_range(frame_start, frame_end, context.sequences)
channel_trim = (
channel_end + 1 if self.direction == "up" else max(1, channel_start - 1)
)
to_trim = [s for s in to_trim if s.channel == channel_trim]
to_delete = [s for s in to_delete if s.channel == channel_trim]
trim_strips(context, frame_start, frame_end, to_trim, to_delete)
if self.direction == "up":
for s in reversed(sequences):
s.channel += 1
elif self.direction == "down":
for s in sequences:
s.channel = max(1, s.channel - 1)
return {"FINISHED"}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -62,4 +62,4 @@ class POWER_SEQUENCER_OT_split_strips_under_cursor(bpy.types.Operator):
if deselect:
bpy.ops.sequencer.select_all(action="DESELECT")
(context.selected_sequences or bpy.ops.power_sequencer.select_strips_under_cursor())
return bpy.ops.sequencer.cut(frame=context.scene.frame_current, side=self.side)
return bpy.ops.sequencer.split(frame=context.scene.frame_current, side=self.side)

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -53,6 +53,11 @@ class POWER_SEQUENCER_OT_gap_remove(bpy.types.Operator):
description="Frame to remove gaps from, defaults at the time cursor",
default=-1,
)
move_time_cursor: bpy.props.BoolProperty(
name="Move Time Cursor",
description="Move the time cursor when closing the gap.",
default=False,
)
@classmethod
def poll(cls, context):
@ -84,11 +89,14 @@ class POWER_SEQUENCER_OT_gap_remove(bpy.types.Operator):
)
self.gaps_remove(context, blocks_after_gap, gap_frame)
if self.move_time_cursor:
context.scene.frame_current = gap_frame
return {"FINISHED"}
def find_gap_frame(self, context, frame, sorted_sequences):
"""
Takes a list sequences sorted by frame_final_start
Finds and returns the frame at which the gap starts.
Takes a list sequences sorted by frame_final_start.
"""
strips_start = min(sorted_sequences, key=attrgetter("frame_final_start")).frame_final_start
strips_end = max(sorted_sequences, key=attrgetter("frame_final_end")).frame_final_end
@ -108,7 +116,7 @@ class POWER_SEQUENCER_OT_gap_remove(bpy.types.Operator):
def gaps_remove(self, context, sequence_blocks, gap_frame_start):
"""
Recursively removes gaps between blocks of sequences
Recursively removes gaps between blocks of sequences.
"""
gap_frame = gap_frame_start

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -22,13 +22,12 @@ from .utils.functions import convert_duration_to_frames
from .utils.doc import doc_name, doc_idname, doc_brief, doc_description
class POWER_SEQUENCER_OT_make_still_image(bpy.types.Operator):
class POWER_SEQUENCER_OT_make_hold_frame(bpy.types.Operator):
"""
*brief* Make still image from active strip
*brief* Make a hold frame from the active strip.
Converts image under the cursor to a still image, to create a pause effect in the video,
using the active sequence
Converts the image under the cursor to a hold frame, to create a pause effect in the video,
using the active sequence.
"""
doc = {
@ -52,7 +51,7 @@ class POWER_SEQUENCER_OT_make_still_image(bpy.types.Operator):
@classmethod
def poll(cls, context):
return context.selected_sequences
return context.scene.sequence_editor.active_strip.type in SequenceTypes.VIDEO
def invoke(self, context, event):
window_manager = context.window_manager
@ -64,56 +63,42 @@ class POWER_SEQUENCER_OT_make_still_image(bpy.types.Operator):
sequencer = bpy.ops.sequencer
transform = bpy.ops.transform
start_frame = scene.frame_current
frame_start = scene.frame_current
if not active.frame_final_start <= frame_start < active.frame_final_end:
return {"FINISHED"}
if frame_start == active.frame_final_start:
scene.frame_current = frame_start + 1
# Detect the gap automatically
offset = convert_duration_to_frames(context, self.strip_duration)
if active.type not in SequenceTypes.VIDEO:
self.report(
{"ERROR_INVALID_INPUT"},
"You must select a video or meta strip. \
You selected a strip of type"
+ str(active.type)
+ " instead.",
)
return {"CANCELLED"}
if not active.frame_final_start <= start_frame < active.frame_final_end:
self.report(
{"ERROR_INVALID_INPUT"},
"Your time cursor must be on the frame you want \
to convert to a still image.",
)
return {"CANCELLED"}
if start_frame == active.frame_final_start:
scene.frame_current = start_frame + 1
if self.strip_duration <= 0.0:
strips = sorted(
scene.sequence_editor.sequences, key=operator.attrgetter("frame_final_start")
)
for s in strips:
if s.frame_final_start > active.frame_final_start and s.channel == active.channel:
next = s
break
offset = next.frame_final_start - active.frame_final_end
try:
next_strip_start = next(
s
for s in sorted(context.sequences, key=operator.attrgetter("frame_final_start"))
if s.frame_final_start > active.frame_final_end
).frame_final_start
offset = next_strip_start - active.frame_final_end
except Exception:
pass
active.select = True
source_blend_type = active.blend_type
sequencer.cut(frame=scene.frame_current, type="SOFT", side="RIGHT")
sequencer.split(frame=scene.frame_current, type="SOFT", side="RIGHT")
transform.seq_slide(value=(offset, 0))
sequencer.cut(frame=scene.frame_current + offset + 1, type="SOFT", side="LEFT")
sequencer.split(frame=scene.frame_current + offset + 1, type="SOFT", side="LEFT")
transform.seq_slide(value=(-offset, 0))
sequencer.meta_make()
active = scene.sequence_editor.active_strip
active.name = "Still image"
active.name = "Hold frame"
active.blend_type = source_blend_type
active.select_right_handle = True
transform.seq_slide(value=(offset, 0))
scene.frame_current = start_frame
scene.frame_current = frame_start
active.select = True
active.select_right_handle = False

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -47,5 +47,5 @@ class POWER_SEQUENCER_OT_meta_resize_to_content(bpy.types.Operator):
def execute(self, context):
selected_meta_strips = (s for s in context.selected_sequences if s.type == "META")
for s in selected_meta_strips:
s.frame_final_start, s.frame_final_end = get_frame_range(context, s.sequences)
s.frame_final_start, s.frame_final_end = get_frame_range(s.sequences)
return {"FINISHED"}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -96,15 +96,18 @@ class POWER_SEQUENCER_OT_mouse_trim_instantly(bpy.types.Operator):
for s in context.sequences
if s.frame_final_start <= frame <= s.frame_final_end and not s.lock
]
if not to_trim:
return {"FINISHED"}
frame_cut_closest = min(get_frame_range(context, to_trim), key=lambda f: abs(frame - f))
frame_cut_closest = min(get_frame_range(to_trim), key=lambda f: abs(frame - f))
frame_start = min(frame, frame_cut_closest)
frame_end = max(frame, frame_cut_closest)
trim_strips(context, frame_start, frame_end, to_trim=to_trim)
context.scene.frame_current = frame_start
context.scene.frame_current = frame
if self.gap_remove and self.select_mode == "CURSOR":
bpy.ops.power_sequencer.gap_remove()
bpy.ops.power_sequencer.gap_remove(frame=frame_start, move_time_cursor=True)
return {"FINISHED"}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -267,7 +267,7 @@ class POWER_SEQUENCER_OT_mouse_trim(bpy.types.Operator):
else:
frame_current = context.scene.frame_current
context.scene.frame_current = self.trim_start
bpy.ops.sequencer.cut(frame=context.scene.frame_current, type="SOFT", side="BOTH")
bpy.ops.sequencer.split(frame=context.scene.frame_current, type="SOFT", side="BOTH")
context.scene.frame_current = frame_current
def find_strips_to_cut(self, context):

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -77,7 +77,7 @@ class POWER_SEQUENCER_OT_preview_closest_cut(bpy.types.Operator):
return {"CANCELLED"}
if scene.frame_preview_start == start and scene.frame_preview_end == end:
start, end = get_frame_range(context, context.sequences)
start, end = get_frame_range(context.sequences)
set_preview_range(context, start, end)
return {"FINISHED"}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -54,6 +54,6 @@ class POWER_SEQUENCER_OT_preview_to_selection(bpy.types.Operator):
if len(context.selected_sequences) >= 1
else context.sequences
)
frame_start, frame_end = get_frame_range(context, sequences)
frame_start, frame_end = get_frame_range(sequences)
set_preview_range(context, frame_start, frame_end - 1)
return {"FINISHED"}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -81,7 +81,7 @@ class POWER_SEQUENCER_OT_ripple_delete(bpy.types.Operator):
sequencer.select_all(action="DESELECT")
for s in block:
s.select = True
selection_start = get_frame_range(context, block)[0]
selection_start = get_frame_range(block)[0]
sequencer.delete()
scene.frame_current = selection_start

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -53,35 +53,41 @@ class POWER_SEQUENCER_OT_scene_create_from_selection(bpy.types.Operator):
def execute(self, context):
start_scene_name = context.scene.name
if len(context.selected_sequences) != 0:
selection = context.selected_sequences[:]
selection_start_frame = min(
selection, key=attrgetter("frame_final_start")
).frame_final_start
selection_start_channel = min(selection, key=attrgetter("channel")).channel
selection = context.selected_sequences
selection_start_frame = min(
selection, key=attrgetter("frame_final_start")
).frame_final_start
selection_start_channel = min(selection, key=attrgetter("channel")).channel
# Create new scene for the scene strip
bpy.ops.scene.new(type="FULL_COPY")
context.window.scene.name = context.selected_sequences[0].name
print(context.selected_sequences[0].name)
new_scene_name = context.window.scene.name
###after full copy also unselected strips are in the sequencer... Delete those strips
bpy.ops.sequencer.select_all(action="INVERT")
bpy.ops.power_sequencer.delete_direct()
frame_offset = selection_start_frame - 1
for s in context.sequences:
try:
s.frame_start -= frame_offset
except Exception:
continue
bpy.ops.sequencer.select_all()
bpy.ops.power_sequencer.preview_to_selection()
# Create new scene for the scene strip
bpy.ops.scene.new(type="FULL_COPY")
new_scene_name = context.scene.name
# Back to start scene
bpy.context.window.scene = bpy.data.scenes[start_scene_name]
bpy.ops.sequencer.select_all(action="INVERT")
bpy.ops.power_sequencer.delete_direct()
frame_offset = selection_start_frame - 1
for s in context.sequences:
try:
s.frame_start -= frame_offset
except Exception:
continue
bpy.ops.sequencer.select_all()
bpy.ops.power_sequencer.preview_to_selection()
# Back to start scene
context.screen.scene = bpy.data.scenes[start_scene_name]
bpy.ops.power_sequencer.delete_direct()
bpy.ops.sequencer.scene_strip_add(
frame_start=selection_start_frame, channel=selection_start_channel, scene=new_scene_name
)
scene_strip = context.selected_sequences[0]
scene_strip.use_sequence = True
bpy.ops.power_sequencer.delete_direct()
bpy.ops.sequencer.scene_strip_add(
frame_start=selection_start_frame, channel=selection_start_channel, scene=new_scene_name
)
scene_strip = context.selected_sequences[0]
# scene_strip.use_sequence = True
return {"FINISHED"}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -42,7 +42,7 @@ class POWER_SEQUENCER_OT_merge_from_scene_strip(bpy.types.Operator):
bl_description = doc_brief(doc["description"])
bl_options = {"REGISTER", "UNDO"}
delete_scene = BoolProperty(
delete_scene: BoolProperty(
name="Delete Strip's scene",
description="Delete the SceneStrip's scene after the merging",
default=True,
@ -75,34 +75,42 @@ class POWER_SEQUENCER_OT_merge_from_scene_strip(bpy.types.Operator):
context.window.scene = strip_scene
bpy.ops.scene.delete()
context.window.scene = start_scene
self.report(type={"WARNING"}, message="All animations on source scene were lost")
self.report(type={"WARNING"}, message="Merged scenes lose all their animation data.")
return {"FINISHED"}
def merge_strips(self, context, source_scene, target_scene):
context.window.scene = source_scene
current_frame = context.scene.frame_current
context.scene.frame_current = context.scene.frame_start
bpy.ops.sequencer.select_all(action="SELECT")
bpy.ops.sequencer.copy()
context.scene.frame_current = current_frame
context.window.scene = target_scene
current_frame = context.scene.frame_current
active = context.scene.sequence_editor.active_strip
context.scene.frame_current = active.frame_final_start
context.scene.frame_current = active.frame_start
bpy.ops.sequencer.select_all(action="DESELECT")
bpy.ops.sequencer.paste()
context.scene.frame_current = current_frame
def merge_markers(self, source_scene, target_scene):
def merge_markers(self, context, source_scene, target_scene):
if len(source_scene.timeline_markers) == 0:
return
if len(target_scene.timeline_markers) > 0:
bpy.ops.marker.select_all(action="DESELECT")
bpy.context.screen.scene = source_scene
bpy.context.window.scene = source_scene
bpy.ops.marker.select_all(action="SELECT")
bpy.ops.marker.make_links_scene(scene=target_scene.name)
bpy.context.screen.scene = target_scene
active = bpy.context.screen.scene.sequence_editor.active_strip
time_offset = active.frame_final_start
bpy.context.window.scene = target_scene
active = bpy.context.window.scene.sequence_editor.active_strip
# Offset to account for source scenes starting on any frame.
time_offset = active.frame_start - source_scene.frame_start
bpy.ops.marker.move(frames=time_offset)
bpy.ops.marker.select_all(action="DESELECT")

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -49,5 +49,5 @@ class POWER_SEQUENCER_OT_open_scene_strip(bpy.types.Operator):
return {"FINISHED"}
strip_scene = active_strip.scene
context.screen.scene = bpy.data.scenes[strip_scene.name]
context.window.scene = bpy.data.scenes[strip_scene.name]
return {"FINISHED"}

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -57,6 +57,9 @@ class POWER_SEQUENCER_OT_swap_strips(bpy.types.Operator):
return context.selected_sequences
def execute(self, context):
if len(context.selected_sequences) != 2:
return {"CANCELLED"}
strip_1 = context.selected_sequences[0]
if len(context.selected_sequences) == 1:
strip_2 = self.find_closest_strip_vertical(context, strip_1, self.direction)
@ -229,19 +232,19 @@ class POWER_SEQUENCER_OT_swap_strips(bpy.types.Operator):
return
return max(strips_below, key=attrgetter("channel"))
def are_linked(self, strip_1, strip_2):
return (
strip_1.frame_final_start == strip_2.frame_final_start
and strip_1.frame_final_end == strip_2.frame_final_end
)
def are_linked(self, strip_1, strip_2):
return (
strip_1.frame_final_start == strip_2.frame_final_start
and strip_1.frame_final_end == strip_2.frame_final_end
)
def swap_with_effect(self, strip_1, strip_2):
effect_strip = strip_1 if hasattr(strip_1, "input_1") else strip_2
other_strip = strip_1 if effect_strip != strip_1 else strip_2
def swap_with_effect(self, strip_1, strip_2):
effect_strip = strip_1 if hasattr(strip_1, "input_1") else strip_2
other_strip = strip_1 if effect_strip != strip_1 else strip_2
effect_strip_channel = effect_strip.channel
other_strip_channel = other_strip.channel
effect_strip_channel = effect_strip.channel
other_strip_channel = other_strip.channel
effect_strip.channel -= 1
other_strip.channel = effect_strip_channel
effect_strip.channel = other_strip_channel
effect_strip.channel -= 1
other_strip.channel = effect_strip_channel
effect_strip.channel = other_strip_channel

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -22,7 +22,7 @@ import bpy
from .utils.functions import convert_duration_to_frames, trim_strips
from .utils.doc import doc_name, doc_idname, doc_brief, doc_description
from .utils.functions import find_closest_surrounding_cuts_frames
from .utils.functions import find_closest_surrounding_cuts_frames, find_strips_in_range
class POWER_SEQUENCER_OT_trim_to_surrounding_cuts(bpy.types.Operator):
@ -87,7 +87,9 @@ class POWER_SEQUENCER_OT_trim_to_surrounding_cuts(bpy.types.Operator):
)
return {"CANCELLED"}
to_delete, to_trim = self.find_strips_in_range(context, left_cut_frame, right_cut_frame)
to_delete, to_trim = find_strips_in_range(
left_cut_frame, right_cut_frame, context.sequences
)
trim_start, trim_end = (left_cut_frame + margin_frame, right_cut_frame - margin_frame)
trim_strips(context, trim_start, trim_end, to_trim, to_delete)
@ -100,36 +102,3 @@ class POWER_SEQUENCER_OT_trim_to_surrounding_cuts(bpy.types.Operator):
context.scene.frame_current = trim_start
return {"FINISHED"}
def find_strips_in_range(
self, context, start_frame, end_frame, sequences=[], find_overlapping=True
):
"""
Returns strips which start and end within a certain frame range, or that overlap a
certain frame range
Args:
- start_frame, the start of the frame range
- end_frame, the end of the frame range
- sequences (optional): only work with these sequences.
If it doesn't receive any, the function works with all the sequences in the current context
- find_overlapping (optional): find and return a list of strips that overlap the
frame range
Returns a tuple of two lists:
[0], strips entirely in the frame range
[1], strips that only overlap the frame range
"""
strips_in_range = []
strips_overlapping_range = []
sequences = sequences if sequences else context.sequences
for s in sequences:
if start_frame < s.frame_final_start <= end_frame:
if start_frame <= s.frame_final_end < end_frame:
strips_in_range.append(s)
elif find_overlapping:
strips_overlapping_range.append(s)
elif find_overlapping and start_frame <= s.frame_final_end <= end_frame:
strips_overlapping_range.append(s)
if s.frame_final_start < start_frame and s.frame_final_end > end_frame:
strips_overlapping_range.append(s)
return strips_in_range, strips_overlapping_range

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
@ -40,7 +40,7 @@ def find_linked(context, sequences, selected_sequences):
Returns a list of all the linked sequences, but not the sequences passed to the function
"""
start, end = get_frame_range(context, sequences, selected_sequences)
start, end = get_frame_range(sequences, selected_sequences)
sequences_in_range = [s for s in sequences if is_in_range(context, s, start, end)]
effects = (s for s in sequences_in_range if s.type in SequenceTypes.EFFECT)
selected_effects = (s for s in sequences if s.type in SequenceTypes.EFFECT)
@ -158,7 +158,7 @@ def find_strips_mouse(context, frame, channel, select_linked=False):
return sequences
def get_frame_range(context, sequences=[], get_from_start=False):
def get_frame_range(sequences, get_from_start=False):
"""
Returns a tuple with the minimum and maximum frames of the
list of passed sequences.
@ -177,6 +177,16 @@ def get_frame_range(context, sequences=[], get_from_start=False):
return start, end
def get_channel_range(sequences):
"""
Returns a tuple with the minimum and maximum channels of the
list of passed sequences.
"""
start = min(sequences, key=attrgetter("channel")).channel
end = max(sequences, key=attrgetter("channel")).channel
return start, end
def get_mouse_frame_and_channel(context, event):
"""
Convert mouse coordinates from the event, from
@ -259,12 +269,13 @@ def slice_selection(context, sequences):
return broken_selection
def trim_strips(context, start_frame, end_frame, to_trim=[], to_delete=[]):
def trim_strips(context, frame_start, frame_end, to_trim, to_delete=[]):
"""
Remove the footage and audio between start_frame and end_frame.
Removes the footage and audio between frame_start and frame_end.
You must pass the list of strips to trim to the function for it to work.
"""
trim_start = min(start_frame, end_frame)
trim_end = max(start_frame, end_frame)
trim_start = min(frame_start, frame_end)
trim_end = max(frame_start, frame_end)
to_trim = [s for s in to_trim if s.type in SequenceTypes.CUTABLE]
@ -276,8 +287,8 @@ def trim_strips(context, start_frame, end_frame, to_trim=[], to_delete=[]):
if is_strip_longer_than_trim_range:
bpy.ops.sequencer.select_all(action="DESELECT")
s.select = True
bpy.ops.sequencer.cut(frame=trim_start, type="SOFT", side="RIGHT")
bpy.ops.sequencer.cut(frame=trim_end, type="SOFT", side="LEFT")
bpy.ops.sequencer.split(frame=trim_start, type="SOFT", side="RIGHT")
bpy.ops.sequencer.split(frame=trim_end, type="SOFT", side="LEFT")
to_delete.append(context.selected_sequences[0])
continue
@ -291,11 +302,11 @@ def trim_strips(context, start_frame, end_frame, to_trim=[], to_delete=[]):
return {"FINISHED"}
def delete_strips(to_delete=[]):
def delete_strips(to_delete):
"""
Remove the footage and audio between start_frame and end_frame.
Deletes the list of sequences `to_delete`
"""
if to_delete == []:
if not to_delete:
return
bpy.ops.sequencer.select_all(action="DESELECT")
for s in to_delete:
@ -391,3 +402,39 @@ def apply_time_offset(context, sequences=[], offset=0):
bpy.ops.sequencer.select_all(action="DESELECT")
for s in selection:
s.select = True
def find_strips_in_range(frame_start, frame_end, sequences, find_overlapping=True):
"""
Returns a tuple of two lists: (strips_inside_range, strips_overlapping_range)
strips_inside_range are strips entirely contained in the frame range.
strips_overlapping_range are strips that only overlap the frame range.
Args:
- frame_start, the start of the frame range
- frame_end, the end of the frame range
- sequences (optional): only work with these sequences.
If it doesn't receive any, the function works with all the sequences in the current context
- find_overlapping (optional): find and return a list of strips that overlap the
frame range
"""
strips_inside_range = []
strips_overlapping_range = []
for s in sequences:
if (
frame_start <= s.frame_final_start <= frame_end
and frame_start <= s.frame_final_end <= frame_end
):
strips_inside_range.append(s)
elif find_overlapping:
if (
frame_start <= s.frame_final_end <= frame_end
or frame_start <= s.frame_final_start <= frame_end
):
strips_overlapping_range.append(s)
if find_overlapping:
if s.frame_final_start < frame_start and s.frame_final_end > frame_end:
strips_overlapping_range.append(s)
return strips_inside_range, strips_overlapping_range

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -101,7 +101,7 @@ def get_commands_video_1(cfg, clargs, **kwargs):
out: iter(tuple(str))
Iterator containing commands.
"""
cmd = "ffmpeg -hwaccel auto -y -v quiet -stats -i '{path_i_1}' {common_all}"
cmd = "ffmpeg -hwaccel auto -y -v quiet -stats -noautorotate -i '{path_i_1}' {common_all}"
common = (
"-pix_fmt yuv420p"
" -g 1"
@ -186,5 +186,5 @@ def get_commands_vi(cfg, clargs, **kwargs):
An iterator with the 1st element as a tag (the `what` parameter) and the 2nd
element as the iterator of the actual commands.
"""
ws = filter(lambda x: x != "all", cfg["extensions"])
ws = filter(lambda x: x is not "all", cfg["extensions"])
return chain.from_iterable(map(lambda w: get_commands(cfg, clargs, what=w, **kwargs), ws))

View File

@ -36,7 +36,7 @@ def checktools(tools):
msg = ["BPSProxy couldn't find external dependencies:"]
msg += [
"[{check}] {tool}: {path}".format(
check="v" if path != "" else "X", tool=tool, path=path or "NOT FOUND"
check="v" if path is not "" else "X", tool=tool, path=path or "NOT FOUND"
)
for tool, path in check["tools"]
]

View File

@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License along with Power Sequencer. If
# not, see <https://www.gnu.org/licenses/>.
#
from setuptools import setup
def readme():
with open("README.md") as f:
@ -21,11 +23,9 @@ def readme():
if __name__ == "__main__":
from setuptools import setup
setup(
name="bpsproxy",
version="0.2.0",
version="0.2.1",
description="Blender Power Sequencer proxy generator tool",
long_description=readme(),
long_description_content_type="text/markdown",

View File

@ -14,3 +14,4 @@
# You should have received a copy of the GNU General Public License along with Power Sequencer. If
# not, see <https://www.gnu.org/licenses/>.
#

View File

@ -41,7 +41,7 @@ def checktools(tools):
msg = ["BPSRender couldn't find external dependencies:"]
msg += [
"[{check}] {tool}: {path}".format(
check="v" if path != "" else "X", tool=tool, path=path or "NOT FOUND"
check="v" if path is not "" else "X", tool=tool, path=path or "NOT FOUND"
)
for tool, path in check["tools"]
]

View File

@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License along with Power Sequencer. If
# not, see <https://www.gnu.org/licenses/>.
#
from setuptools import setup
def readme():
with open("README.rst") as f:
@ -21,8 +23,6 @@ def readme():
if __name__ == "__main__":
from setuptools import setup
setup(
name="bpsrender",
version="0.1.40.post1",

View File

@ -27,7 +27,7 @@ def get_tool_classes():
module_paths = ["." + os.path.splitext(f)[0] for f in module_files]
classes = []
for path in module_paths:
module = importlib.import_module(path, package="power_sequencer.tools")
module = importlib.import_module(path, package="blender_power_sequencer.tools")
tool_names = [entry for entry in dir(module) if entry.startswith("POWER_SEQUENCER_TOOL")]
classes.extend([getattr(module, name) for name in tool_names])
return classes

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2016-2019 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#

Some files were not shown because too many files have changed in this diff Show More