Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Lovato <nathan@gdquest.com>2020-05-14 23:40:24 +0300
committerNathan Lovato <nathan@gdquest.com>2020-05-14 23:40:24 +0300
commitc9f09d722abbaeded92803fc8fbb3e286480b35e (patch)
treedc16b3524b860829515b9b34a45d4c87df8678be /power_sequencer/operators/scene_create_from_selection.py
parent3b7dd92024ac0ac2b58b3ef4e5cf7daee6dfdefb (diff)
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
Diffstat (limited to 'power_sequencer/operators/scene_create_from_selection.py')
-rw-r--r--power_sequencer/operators/scene_create_from_selection.py64
1 files changed, 35 insertions, 29 deletions
diff --git a/power_sequencer/operators/scene_create_from_selection.py b/power_sequencer/operators/scene_create_from_selection.py
index 4cf837d7..14b08768 100644
--- a/power_sequencer/operators/scene_create_from_selection.py
+++ b/power_sequencer/operators/scene_create_from_selection.py
@@ -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"}