diff options
Diffstat (limited to 'power_sequencer/operators/scene_merge_from.py')
-rw-r--r-- | power_sequencer/operators/scene_merge_from.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/power_sequencer/operators/scene_merge_from.py b/power_sequencer/operators/scene_merge_from.py index 792799e8..4e695b02 100644 --- a/power_sequencer/operators/scene_merge_from.py +++ b/power_sequencer/operators/scene_merge_from.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. # @@ -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") |