예제 #1
0
def fill_sequence_mlt(seq, SAVEFILE_VERSION):
    """
    Replaces sequences py objects with mlt objects
    """
    # Create tractor, field, multitrack
    seq.init_mlt_objects()

    # Grap and replace py tracks. Do this way to use same create
    # method as when originally created.
    py_tracks = seq.tracks
    seq.tracks = []

    # editorstate.project.c_seq needs to be available for sequence building
    editorstate.project.c_seq = seq

    # Create and fill MLT tracks.
    for py_track in py_tracks:
        mlt_track = seq.add_track(py_track.type)
        fill_track_mlt(mlt_track, py_track)
        # Set audio gain and pan filter values
        if hasattr(mlt_track, "gain_filter"
                   ):  # Hidden track and black track do not have these
            mlt_track.gain_filter.set("gain", str(mlt_track.audio_gain))
        if mlt_track.audio_pan != appconsts.NO_PAN:
            seq.add_track_pan_filter(
                mlt_track, mlt_track.audio_pan
            )  # only rtack with non-center pan values have pan filters

    # Create and connect compositors.
    mlt_compositors = []
    for py_compositor in seq.compositors:
        # Keeping backwards compability
        if SAVEFILE_VERSION < 3:
            FIX_N_TO_3_COMPOSITOR_COMPABILITY(py_compositor, SAVEFILE_VERSION)

        if not hasattr(py_compositor, "obey_autofollow"
                       ):  # "obey_autofollow" attr was added for 1.16
            py_compositor.obey_autofollow = True

        # Create new compositor object
        compositor = mlttransitions.create_compositor(py_compositor.type_id)
        compositor.create_mlt_objects(seq.profile)

        # Copy and set param values
        compositor.transition.properties = copy.deepcopy(
            py_compositor.transition.properties)
        _fix_wipe_relative_path(compositor)
        compositor.transition.update_editable_mlt_properties()

        compositor.transition.set_tracks(py_compositor.transition.a_track,
                                         py_compositor.transition.b_track)
        compositor.set_in_and_out(py_compositor.clip_in,
                                  py_compositor.clip_out)
        compositor.origin_clip_id = py_compositor.origin_clip_id

        mlt_compositors.append(compositor)

    seq.compositors = mlt_compositors
    seq.restack_compositors()

    # Connect sync relations
    for clip_n_track in sync_clips:
        clip, track = clip_n_track
        try:
            master_clip = all_clips[
                clip.sync_data.
                master_clip]  # master clip has been replaced with its id on save
            clip.sync_data.master_clip = master_clip  # put back reference to master clip
            resync.clip_added_to_timeline(
                clip, track
            )  # save data to enagble sync states monitoring after eddits
        except KeyError:
            clip.sync_data = None  # masterclip no longer on track V1
            resync.clip_removed_from_timeline(clip)

    # This sets MLT properties that actually do mute
    seq.set_tracks_mute_state()

    seq.length = None
예제 #2
0
 def create_compositor(self, compositor_type):
     compositor = mlttransitions.create_compositor(compositor_type)
     compositor.create_mlt_objects(self.profile)
     return compositor
예제 #3
0
def fill_sequence_mlt(seq, SAVEFILE_VERSION):
    """
    Replaces sequences py objects with mlt objects
    """
    # Create tractor, field, multitrack
    seq.init_mlt_objects()
    
    # Grap and replace py tracks. Do this way to use same create
    # method as when originally created.
    py_tracks = seq.tracks
    seq.tracks = []

    # editorstate.project.c_seq needs to be available for sequence building 
    editorstate.project.c_seq = seq
    
    # Create and fill MLT tracks.
    for py_track in py_tracks:
        mlt_track = seq.add_track(py_track.type)
        fill_track_mlt(mlt_track, py_track)
        # Set audio gain and pan filter values
        if hasattr(mlt_track, "gain_filter"): # Hidden track and black track do not have these
            mlt_track.gain_filter.set("gain", str(mlt_track.audio_gain))
        if mlt_track.audio_pan != appconsts.NO_PAN:
            seq.add_track_pan_filter(mlt_track, mlt_track.audio_pan) # only rtack with non-center pan values have pan filters
    
    # Create and connect compositors.
    mlt_compositors = []
    for py_compositor in seq.compositors:
            # Keeping backwards compability
            if SAVEFILE_VERSION < 3:
                FIX_N_TO_3_COMPOSITOR_COMPABILITY(py_compositor, SAVEFILE_VERSION)
            if not hasattr(py_compositor, "obey_autofollow"): # "obey_autofollow" attr was added for 1.16
                py_compositor.obey_autofollow = True
                
            # Create new compositor object
            compositor = mlttransitions.create_compositor(py_compositor.type_id)                                        
            compositor.create_mlt_objects(seq.profile)

            # Copy and set param values
            compositor.transition.properties = copy.deepcopy(py_compositor.transition.properties)
            _fix_wipe_relative_path(compositor)
            compositor.transition.update_editable_mlt_properties()
    
            compositor.transition.set_tracks(py_compositor.transition.a_track, py_compositor.transition.b_track)
            compositor.set_in_and_out(py_compositor.clip_in, py_compositor.clip_out)
            compositor.origin_clip_id = py_compositor.origin_clip_id
            compositor.obey_autofollow = py_compositor.obey_autofollow
           
            mlt_compositors.append(compositor)

    seq.compositors = mlt_compositors
    seq.restack_compositors()

    # Connect sync relations
    for clip_n_track in sync_clips:
        clip, track = clip_n_track
        try:
            master_clip = all_clips[clip.sync_data.master_clip] # master clip has been replaced with its id on save
            clip.sync_data.master_clip = master_clip # put back reference to master clip
            resync.clip_added_to_timeline(clip, track) # save data to enagble sync states monitoring after eddits
        except KeyError:
            clip.sync_data = None # masterclip no longer on track V1
            resync.clip_removed_from_timeline(clip)

    # This sets MLT properties that actually do mute
    seq.set_tracks_mute_state()

    seq.length = None
예제 #4
0
 def create_compositor(self, compositor_type):
     compositor = mlttransitions.create_compositor(compositor_type)
     compositor.create_mlt_objects(self.profile)
     return compositor