INNER CODE UNIT · Python
add_eye_blink
TimoBolkart/voca · edit_sequences.py:46
def add_eye_blink(source_path, out_path, flame_model_fname, num_blinks, blink_duration, uv_template_fname='', texture_img_fname=''):
'''
Load existing animation sequence in "zero pose" and add eye blinks over time
:param source_path: path of the animation sequence (files must be provided in OBJ file format)
:param out_path: output path of the altered sequence
:param flame_model_fname: path of the FLAME model
:param num_blinks: number of blinks within the sequence
:param blink_duration: duration of a blink in number of frames
'''
if not os.path.exists(out_path):
os.makedirs(out_path)
# Load sequence files
sequence_fnames = sorted(glob.glob(os.path.join(source_path, '*.obj')))
num_frames = len(sequence_fnames)
if num_frames == 0:
print('No sequence meshes found')