Sequence creator
- manmohan manoj
 - Sep 20, 2022
 - 1 min read
 
A tool to replace Master sequence creator for personal use in unreal
import unreal as ue
def SeqCreate(SequenceShotMatrix):
    path = '/Game/Cinematic/Sequences/'
    editLib = ue.EditorAssetLibrary()
    editUtil = ue.EditorUtilityLibrary()
    AssetTooldHelp = ue.AssetToolsHelpers()
    editLib.make_directory(path)
    for seqence,shots in enumerate(SequenceShotMatrix):
        seqNum = (seqence+1).__str__().zfill(3)
        sequencePath = path+'seq_'+seqNum+'/';
        editLib.make_directory(sequencePath)
        master_sequence = AssetTooldHelp.get_asset_tools().create_asset(
                asset_name='Master'+'seq_'+seqNum,package_path=sequencePath,
                asset_class=ue.LevelSequence,factory=ue.LevelSequenceFactoryNew())
        
        for shot in range(shots):
            shotNum = (shot+1).__str__().zfill(3)
            shotPath = sequencePath+'shot_'+shotNum;
            editLib.make_directory(shotPath)
            shot_seq = AssetTooldHelp.get_asset_tools().create_asset(asset_name=shotNum,
                package_path=shotPath, asset_class=ue.LevelSequence,  
                factory=ue.LevelSequenceFactoryNew())
# add MovieSceneCinematicShotTrack track to your master_sequence
            shotsTrack = master_sequence.add_master_track(ue.MovieSceneCinematicShotTrack)
    # add a section to the track
            section = shotsTrack.add_section()
            # add your shot sequence to the section
            section.set_editor_property("sub_sequence",shot_seq)
            # set other properties on the section such as end frame
            if not shot:
                lastendframe = 0
            section.set_start_frame(lastendframe+1)            
            section.set_end_frame(lastendframe+50)
            lastendframe = lastendframe+50
if __name__ == "__main__":
    SequenceShotMatrix = [2,2,2]
    SeqCreate(SequenceShotMatrix)






Comments