[Bf-extensions-cvs] [cd176b26] master: Update power sequencer to v2.0.1

Nathan Lovato noreply at git.blender.org
Sun Jan 24 01:17:56 CET 2021


Commit: cd176b2617bd3ede969c3aa218ee54a79fc69f27
Author: Nathan Lovato
Date:   Sat Jan 23 18:17:35 2021 -0600
Branches: master
https://developer.blender.org/rBAcd176b2617bd3ede969c3aa218ee54a79fc69f27

Update power sequencer to v2.0.1

Changelog: https://github.com/GDQuest/blender-power-sequencer/blob/master/CHANGELOG.md#power-sequencer-201

Commit range: https://github.com/GDQuest/blender-power-sequencer/compare/1.5.0...2.0.1

===================================================================

M	power_sequencer/__init__.py
M	power_sequencer/addon_preferences.py
M	power_sequencer/operators/__init__.py
M	power_sequencer/operators/channel_offset.py
M	power_sequencer/operators/cut_strips_under_cursor.py
M	power_sequencer/operators/delete_direct.py
M	power_sequencer/operators/expand_to_surrounding_cuts.py
M	power_sequencer/operators/fade_add.py
M	power_sequencer/operators/fade_clear.py
M	power_sequencer/operators/gap_remove.py
M	power_sequencer/operators/make_hold_frame.py
M	power_sequencer/operators/scene_create_from_selection.py
M	power_sequencer/operators/scene_merge_from.py
M	power_sequencer/operators/select_all_left_or_right.py
M	power_sequencer/operators/snap.py
M	power_sequencer/operators/snap_selection.py
M	power_sequencer/operators/trim_left_or_right_handles.py
M	power_sequencer/operators/utils/functions.py
A	power_sequencer/operators/value_offset.py
D	power_sequencer/scripts/BPSProxy/bpsproxy/__init__.py
D	power_sequencer/scripts/BPSProxy/bpsproxy/__main__.py
D	power_sequencer/scripts/BPSProxy/bpsproxy/call.py
D	power_sequencer/scripts/BPSProxy/bpsproxy/commands.py
D	power_sequencer/scripts/BPSProxy/bpsproxy/config.py
D	power_sequencer/scripts/BPSProxy/bpsproxy/utils.py
D	power_sequencer/scripts/BPSProxy/setup.py
D	power_sequencer/scripts/BPSRender/bpsrender/__init__.py
D	power_sequencer/scripts/BPSRender/bpsrender/__main__.py
D	power_sequencer/scripts/BPSRender/bpsrender/bscripts/mixdown.py
D	power_sequencer/scripts/BPSRender/bpsrender/bscripts/probe.py
D	power_sequencer/scripts/BPSRender/bpsrender/bscripts/video.py
D	power_sequencer/scripts/BPSRender/bpsrender/calls.py
D	power_sequencer/scripts/BPSRender/bpsrender/commands.py
D	power_sequencer/scripts/BPSRender/bpsrender/config.py
D	power_sequencer/scripts/BPSRender/bpsrender/helpers.py
D	power_sequencer/scripts/BPSRender/bpsrender/setup.py
D	power_sequencer/scripts/BPSRender/setup.py

===================================================================

diff --git a/power_sequencer/__init__.py b/power_sequencer/__init__.py
index 3cb5d4f2..8d2c84db 100755
--- a/power_sequencer/__init__.py
+++ b/power_sequencer/__init__.py
@@ -38,11 +38,11 @@ bl_info = {
     "name": "Power Sequencer",
     "description": "Video editing tools for content creators",
     "author": "Nathan Lovato",
-    "version": (1, 5, 1),
-    "blender": (2, 90, 1),
+    "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",
 }
@@ -80,7 +80,7 @@ def register():
     keymaps = register_shortcuts(classes_operator)
     addon_keymaps += keymaps
 
-    # print("Registered {} with {} modules".format(bl_info["name"], len(modules)))
+    print("Registered {} with {} modules".format(bl_info["name"], len(modules)))
 
 
 def unregister():
@@ -104,4 +104,4 @@ def unregister():
     unregister_properties()
     unregister_handlers()
 
-    # print("Unregistered {}".format(bl_info["name"]))
+    print("Unregistered {}".format(bl_info["name"]))
diff --git a/power_sequencer/addon_preferences.py b/power_sequencer/addon_preferences.py
index 0ca31330..014f63dd 100644
--- a/power_sequencer/addon_preferences.py
+++ b/power_sequencer/addon_preferences.py
@@ -55,7 +55,7 @@ class PowerSequencerPreferences(bpy.types.AddonPreferences):
         error_message, info = "", ""
         try:
             info: str = subprocess.check_output([path, "-version"]).decode("utf-8")
-            info = info[:info.find("Copyright")]
+            info = info[: info.find("Copyright")]
             print(info)
         except (OSError, subprocess.CalledProcessError):
             error_message = "Path `{}` is not a valid ffmpeg executable".format(path)
diff --git a/power_sequencer/operators/__init__.py b/power_sequencer/operators/__init__.py
index 064ba9b3..406c8635 100755
--- a/power_sequencer/operators/__init__.py
+++ b/power_sequencer/operators/__init__.py
@@ -22,17 +22,13 @@ def get_operator_classes():
     """Returns the list of operators in the add-on"""
     this_file = os.path.dirname(__file__)
     module_files = [
-        f
-        for f in os.listdir(this_file)
-        if f.endswith(".py") and not f.startswith("__init__")
+        f for f in os.listdir(this_file) if f.endswith(".py") and not f.startswith("__init__")
     ]
     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.operators")
-        operator_names = [
-            entry for entry in dir(module) if entry.startswith("POWER_SEQUENCER_OT")
-        ]
+        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
 
@@ -41,9 +37,7 @@ doc = {
     "sequencer.refresh_all": {
         "name": "Refresh All",
         "description": "",
-        "shortcuts": [
-            ({"type": "R", "value": "PRESS", "shift": True}, {}, "Refresh All")
-        ],
+        "shortcuts": [({"type": "R", "value": "PRESS", "shift": True}, {}, "Refresh All")],
         "demo": "",
         "keymap": "Sequencer",
     }
diff --git a/power_sequencer/operators/channel_offset.py b/power_sequencer/operators/channel_offset.py
index 35da1b47..48305c4b 100644
--- a/power_sequencer/operators/channel_offset.py
+++ b/power_sequencer/operators/channel_offset.py
@@ -14,17 +14,12 @@
 # You should have received a copy of the GNU General Public License along with Power Sequencer. If
 # not, see <https://www.gnu.org/licenses/>.
 #
-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,
-)
+import bpy
+
+from .utils.doc import doc_brief, doc_description, doc_idname, doc_name
+from .utils.functions import find_strips_in_range, move_selection, trim_strips
 
 
 class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
@@ -39,7 +34,7 @@ class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
         "shortcuts": [
             (
                 {"type": "UP_ARROW", "value": "PRESS", "alt": True},
-                {"direction": "up"},
+                {"direction": "up", "trim_target_channel": False},
                 "Move to Open Channel Above",
             ),
             (
@@ -49,7 +44,7 @@ class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
             ),
             (
                 {"type": "DOWN_ARROW", "value": "PRESS", "alt": True},
-                {"direction": "down"},
+                {"direction": "down", "trim_target_channel": False},
                 "Move to Open Channel Below",
             ),
             (
@@ -79,35 +74,71 @@ class POWER_SEQUENCER_OT_channel_offset(bpy.types.Operator):
         description="Trim strips to make space in the target channel",
         default=False,
     )
+    keep_selection_offset: bpy.props.BoolProperty(
+        name="Keep selection offset",
+        description="The selected strips preserve their relative positions",
+        default=True,
+    )
 
     @classmethod
     def poll(cls, context):
         return context.selected_sequences
 
     def execute(self, context):
+
+        max_channel = 32
+        min_channel = 1
+
+        if self.direction == "up":
+            channel_offset = +1
+            limit_channel = max_channel
+            comparison_function = min
+
+        if self.direction == "down":
+            channel_offset = -1
+            limit_channel = min_channel
+            comparison_function = max
+
         selection = [s for s in context.selected_sequences if not s.lock]
+
         if not selection:
             return {"FINISHED"}
 
-        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.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)
+        sequences = sorted(selection, key=attrgetter("channel", "frame_final_start"))
+        if self.direction == "up":
+            sequences = [s for s in reversed(sequences)]
+
+        head = sequences[0]
+        if not self.keep_selection_offset or (
+            head.channel != limit_channel and self.keep_selection_offset
+        ):
+            for s in sequences:
+                if self.trim_target_channel:
+                    channel_trim = s.channel + channel_offset
+                    strips_in_trim_channel = [
+                        sequence
+                        for sequence in context.sequences
+                        if (sequence.channel == channel_trim)
+                    ]
+                    if strips_in_trim_channel:
+                        to_delete, to_trim = find_strips_in_range(
+                            s.frame_final_start, s.frame_final_end, strips_in_trim_channel
+                        )
+                        trim_strips(
+                            context, s.frame_final_start, s.frame_final_end, to_trim, to_delete
+                        )
+
+                if not self.keep_selection_offset:
+                    s.channel = comparison_function(limit_channel, s.channel + channel_offset)
+                    if s.channel == limit_channel:
+                        move_selection(context, [s], 0, 0)
+
+            if self.keep_selection_offset:
+                start_frame = head.frame_final_start
+                x_difference = 0
+                while not head.channel == limit_channel:
+                    move_selection(context, sequences, -x_difference, channel_offset)
+                    x_difference = head.frame_final_start - start_frame
+                    if x_difference == 0:
+                        break
         return {"FINISHED"}
diff --git a/power_sequencer/operators/cut_strips_under_cursor.py b/power_sequencer/operators/cut_strips_under_cursor.py
index d7e1141a..3b54a17b 100644
--- a/power_sequencer/operators/cut_strips_under_cursor.py
+++ b/power_sequencer/operators/cut_strips_under_cursor.py
@@ -30,9 +30,7 @@ class POWER_SEQUENCER_OT_split_strips_under_cursor(bpy.types.Operator):
         "name": doc_name(__qualname__),
         "demo": "https://i.imgur.com/ZyEd0jD.gif",
         "description": doc_description(__doc__),
-        "shortcuts": [
-            ({"type": "K", "value": "PRESS"}, {}, "Cut All Strips Under Cursor")
-        ],
+        "shortcuts": [({"type": "K", "value": "PRESS"}, {}, "Cut All Strips Under Cursor")],
         "keymap": "Sequencer",
     }
     bl_idname = doc_idname(__qualname__)
@@ -66,10 +64,5 @@ class POWER_SEQUENCER_OT_split_strips_under_cursor(bpy.types.Operator):
                 deselect = False
         if deselect:
             bpy.ops.sequencer.select_all(action="DESELECT")
-        (
-            context.selected_sequences
-            or bpy.ops.power_sequencer.select_strips_under_cursor()
-        )
-    

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list