def SendSelectedToStory(): lfoldername = fb.FBSystem().CurrentTake.Name lFolder = fb.FBStoryFolder() lFolder.Label = lfoldername ## Character Track lCharTrack = fb.FBStoryTrack(fb.FBStoryTrackType.kFBStoryTrackCharacter, lFolder) # Assign our CurrentCharacter to the track lCharTrack.Details.append(fb.FBApplication().CurrentCharacter) # Set Character Track name to Current Character Name lCharTrack.Label = fb.FBApplication().CurrentCharacter.LongName # Insert current take in the newly created track lCharTrack.CopyTakeIntoTrack(fb.FBSystem().CurrentTake.LocalTimeSpan, fb.FBSystem().CurrentTake)
def SendAllCharactersToStory(): charIndex = 1 lClipList = [] lMyStartTime = 0 # Find all characters in the scene. Add them to story track for lChar in fb.FBSystem().Scene.Characters: # Create Track for one character lTrack = fb.FBStoryTrack(fb.FBStoryTrackType.kFBStoryTrackCharacter) # Specify the index of the character which is one lTrack.CharacterIndex = charIndex # Creating the track names based on character names and adding a 'Track' behind. lTrack.LongName = lChar.LongName + " Track" #lTrack.Ghost = self.ui.RBEnableGhost.isChecked() # Insert current take lClip = lTrack.CopyTakeIntoTrack( fb.FBSystem().CurrentTake.LocalTimeSpan, fb.FBSystem().CurrentTake) # Shift clip to start time at 0 lClip.Start = fb.FBTime(0, 0, 0, lMyStartTime) # adding one to the index so that it will repeat for the next character in the scene. charIndex = charIndex + 1 # insert current take. lClipList.append(lClip)
def create_story(self, clip_data=None): """Creates a video story video_track :param clip_data: :return: """ import os if clip_data is None: clip_data = [] # find the default Shot Track track_container = pyfbsdk.FBStory().RootEditFolder.Tracks shot_track = None character_track = None for track in track_container: if track.Label == "Shot Track": shot_track = track elif track.Label == "Character Track": character_track = track if not shot_track: # Create a Shot Track shot_track = pyfbsdk.FBStoryTrack( pyfbsdk.FBStoryTrackType.kFBStoryTrackShot ) if not character_track: character_track = pyfbsdk.FBStoryTrack( pyfbsdk.FBStoryTrackType.kFBStoryTrackCharacter ) # create clips for clip_info in clip_data: assert isinstance(clip_info, ClipData) # create a new camera clip_camera = pyfbsdk.FBCamera( 'Camera_Shot_%s' % str(clip_info.shot_name) ) # Create a Shot clip cut_in_fbtime = pyfbsdk.FBTime(0, 0, 0, clip_info.cut_in) cut_out_fbtime = pyfbsdk.FBTime(0, 0, 0, clip_info.cut_out) shot_clip = pyfbsdk.FBStoryClip( clip_camera, shot_track, cut_in_fbtime ) shot_clip.Stop = cut_out_fbtime shot_clip.Offset = cut_in_fbtime shot_clip.SetTime( None, None, cut_in_fbtime, cut_out_fbtime, False ) if clip_info.fps: shot_clip.UseSystemFrameRate = False shot_clip.FrameRate = clip_info.fps # shot_clip.ClipAnimationPath = str(clip_info.fbx_path) character_clip = pyfbsdk.FBStoryClip( str(clip_info.fbx_path), character_track, cut_in_fbtime ) character_clip.Stop = cut_out_fbtime character_clip.Offset = cut_in_fbtime # set the camera back plate to the video back_plate = pyfbsdk.FBTexture(str(clip_info.movie_path)) # set the back plate as the shot_clip back plate clip_camera.BackGroundTexture = back_plate # set the video offset back_plate.Video.TimeOffset = cut_in_fbtime