In [1]:
from pikov import pikov
gamekitty = pikov.Pikov.open('gamekitty.pikov')

In [2]:
# Find any absorbing (dead-end) frames
# to see how many clips left to connect.
gamekitty.find_absorbing_frames()


Out[2]:
(Frame(id='crouch_0'),
 Frame(id='crouch_mirror_0'),
 Frame(id='crouch_to_sit_2'),
 Frame(id='crouch_to_sit_mirror_2'),
 Frame(id='jump_6'),
 Frame(id='jump_mirror_6'),
 Frame(id='jump_to_stand_2'),
 Frame(id='jump_to_stand_mirror_2'),
 Frame(id='lie_down_1'),
 Frame(id='lie_down_mirror_1'),
 Frame(id='sit_0'),
 Frame(id='sit_mirror_0'),
 Frame(id='sit_paw_3'),
 Frame(id='sit_paw_mirror_3'),
 Frame(id='sit_to_crouch_2'),
 Frame(id='sit_to_crouch_mirror_2'),
 Frame(id='sit_to_stand_3'),
 Frame(id='sit_to_stand_mirror_3'),
 Frame(id='sleep_3'),
 Frame(id='sleep_mirror_3'),
 Frame(id='stand_to_jump_3'),
 Frame(id='stand_to_jump_mirror_3'),
 Frame(id='stand_to_sit_4'),
 Frame(id='stand_to_sit_mirror_4'),
 Frame(id='stand_to_walk_1'),
 Frame(id='stand_to_walk_mirror_1'),
 Frame(id='stand_waggle_1'),
 Frame(id='stand_waggle_mirror_1'),
 Frame(id='turn_from_sit_6'),
 Frame(id='turn_from_sit_mirror_6'),
 Frame(id='turn_from_stand_7'),
 Frame(id='turn_from_stand_mirror_7'),
 Frame(id='walk_11'),
 Frame(id='walk_mirror_11'))

Add all transitions to clips where gamekitty does not move side-to-side.


In [7]:
def connect_frames(
    sit, sit_paw, sit_to_stand, stand_waggle, stand_to_sit,
    sit_paw_end, sit_to_stand_end, stand_waggle_end,
    stand_to_sit_end, 
    crouch, sit_to_crouch, sit_to_crouch_end, crouch_to_sit, crouch_to_sit_end,
    lie_down, lie_down_end, sleep, sleep_end,
    stand_to_walk, stand_to_walk_end, stand_to_jump, stand_to_jump_end,
    jump, jump_end, jump_to_stand, jump_to_stand_end, walk, walk_end
):
    sit.transition_to(sit)
    sit.transition_to(sit_to_stand)
    sit.transition_to(sit_paw)
    sit_paw_end.transition_to(sit)
    sit_to_stand_end.transition_to(stand_waggle)
    stand_waggle_end.transition_to(stand_waggle)
    stand_waggle_end.transition_to(stand_to_sit)
    stand_to_sit_end.transition_to(sit)
    
    # Intentionally allow a transition from the first frame in stand_waggle.
    # stand_waggle.transition_to(stand_to_sit)
    
    # Crouch
    sit.transition_to(sit_to_crouch)
    sit_to_crouch_end.transition_to(crouch)
    crouch.transition_to(crouch)
    crouch.transition_to(crouch_to_sit)
    crouch_to_sit_end.transition_to(sit)
    
    # Sleepy time
    crouch.transition_to(lie_down)
    lie_down_end.transition_to(lie_down)
    lie_down_end.transition_to(sleep)
    sleep.transition_to(lie_down_end)
    sleep_end.transition_to(sleep)
    lie_down.transition_to(crouch)
    
    # Moving (walk, jump)
    stand_waggle_end.transition_to(stand_to_walk)
    stand_waggle_end.transition_to(stand_to_jump)
    stand_to_jump_end.transition_to(jump)
    jump_end.transition_to(jump)
    jump_end.transition_to(jump_to_stand)
    jump_to_stand_end.transition_to(stand_waggle)
    stand_to_walk_end.transition_to(walk)
    walk_end.transition_to(walk)
    walk_end.transition_to(stand_waggle)

In [8]:
connect_frames(
    sit=gamekitty.get_frame('sit_0'),
    sit_paw=gamekitty.get_frame('sit_paw_0'),
    sit_to_stand=gamekitty.get_frame('sit_to_stand_0'),
    stand_waggle=gamekitty.get_frame('stand_waggle_0'),
    stand_to_sit=gamekitty.get_frame('stand_to_sit_0'),
    sit_paw_end=gamekitty.get_frame('sit_paw_3'),
    sit_to_stand_end=gamekitty.get_frame('sit_to_stand_3'),
    stand_waggle_end=gamekitty.get_frame('stand_waggle_1'),
    stand_to_sit_end=gamekitty.get_frame('stand_to_sit_4'),
    crouch=gamekitty.get_frame('crouch_0'),
    sit_to_crouch=gamekitty.get_frame('sit_to_crouch_0'),
    sit_to_crouch_end=gamekitty.get_frame('sit_to_crouch_2'),
    crouch_to_sit=gamekitty.get_frame('crouch_to_sit_0'),
    crouch_to_sit_end=gamekitty.get_frame('crouch_to_sit_2'),
    lie_down=gamekitty.get_frame('lie_down_0'),
    lie_down_end=gamekitty.get_frame('lie_down_1'),
    sleep = gamekitty.get_frame('sleep_0'),
    sleep_end = gamekitty.get_frame('sleep_3'),
    stand_to_walk = gamekitty.get_frame('stand_to_walk_0'),
    stand_to_walk_end = gamekitty.get_frame('stand_to_walk_1'),
    stand_to_jump = gamekitty.get_frame('stand_to_jump_0'),
    stand_to_jump_end = gamekitty.get_frame('stand_to_jump_3'),
    jump = gamekitty.get_frame('jump_0'),
    jump_end = gamekitty.get_frame('jump_6'),
    jump_to_stand = gamekitty.get_frame('jump_to_stand_0'),
    jump_to_stand_end = gamekitty.get_frame('jump_to_stand_2'),
    walk = gamekitty.get_frame('walk_0'),
    walk_end = gamekitty.get_frame('walk_11'),
)

In [9]:
# Missing any transitions?
gamekitty.find_absorbing_frames()


Out[9]:
(Frame(id='crouch_mirror_0'),
 Frame(id='crouch_to_sit_mirror_2'),
 Frame(id='jump_mirror_6'),
 Frame(id='jump_to_stand_mirror_2'),
 Frame(id='lie_down_mirror_1'),
 Frame(id='sit_mirror_0'),
 Frame(id='sit_paw_mirror_3'),
 Frame(id='sit_to_crouch_mirror_2'),
 Frame(id='sit_to_stand_mirror_3'),
 Frame(id='sleep_mirror_3'),
 Frame(id='stand_to_jump_mirror_3'),
 Frame(id='stand_to_sit_mirror_4'),
 Frame(id='stand_to_walk_mirror_1'),
 Frame(id='stand_waggle_mirror_1'),
 Frame(id='turn_from_sit_6'),
 Frame(id='turn_from_sit_mirror_6'),
 Frame(id='turn_from_stand_7'),
 Frame(id='turn_from_stand_mirror_7'),
 Frame(id='walk_mirror_11'))

In [10]:
# Mirrored frames
connect_frames(
    sit=gamekitty.get_frame('sit_mirror_0'),
    sit_paw=gamekitty.get_frame('sit_paw_mirror_0'),
    sit_to_stand=gamekitty.get_frame('sit_to_stand_mirror_0'),
    stand_waggle=gamekitty.get_frame('stand_waggle_mirror_0'),
    stand_to_sit=gamekitty.get_frame('stand_to_sit_mirror_0'),
    sit_to_crouch=gamekitty.get_frame('sit_to_crouch_mirror_0'),
    crouch=gamekitty.get_frame('crouch_mirror_0'),
    crouch_to_sit=gamekitty.get_frame('crouch_to_sit_mirror_0'),
    sit_paw_end=gamekitty.get_frame('sit_paw_mirror_3'),
    sit_to_stand_end=gamekitty.get_frame('sit_to_stand_mirror_3'),
    stand_waggle_end=gamekitty.get_frame('stand_waggle_mirror_1'),
    stand_to_sit_end=gamekitty.get_frame('stand_to_sit_mirror_4'),
    sit_to_crouch_end=gamekitty.get_frame('sit_to_crouch_mirror_2'),
    crouch_to_sit_end=gamekitty.get_frame('crouch_to_sit_mirror_2'),
    lie_down=gamekitty.get_frame('lie_down_mirror_0'),
    lie_down_end=gamekitty.get_frame('lie_down_mirror_1'),
    sleep = gamekitty.get_frame('sleep_mirror_0'),
    sleep_end = gamekitty.get_frame('sleep_mirror_3'),
    stand_to_walk = gamekitty.get_frame('stand_to_walk_mirror_0'),
    stand_to_walk_end = gamekitty.get_frame('stand_to_walk_mirror_1'),
    stand_to_jump = gamekitty.get_frame('stand_to_jump_mirror_0'),
    stand_to_jump_end = gamekitty.get_frame('stand_to_jump_mirror_3'),
    jump = gamekitty.get_frame('jump_mirror_0'),
    jump_end = gamekitty.get_frame('jump_mirror_6'),
    jump_to_stand = gamekitty.get_frame('jump_to_stand_mirror_0'),
    jump_to_stand_end = gamekitty.get_frame('jump_to_stand_mirror_2'),
    walk = gamekitty.get_frame('walk_mirror_0'),
    walk_end = gamekitty.get_frame('walk_mirror_11'),
)

In [11]:
# Missing any transitions?
gamekitty.find_absorbing_frames()


Out[11]:
(Frame(id='turn_from_sit_6'),
 Frame(id='turn_from_sit_mirror_6'),
 Frame(id='turn_from_stand_7'),
 Frame(id='turn_from_stand_mirror_7'))

In [12]:
# Connect mirror to non-mirror
def connect_mirrors(
    sit,
    stand_waggle,
    stand_waggle_mirror,
    turn_from_sit,
    turn_from_sit_end,
    turn_from_stand,
    turn_from_stand_end,
):
    sit.transition_to(turn_from_sit)
    stand_waggle.transition_to(turn_from_stand)
    turn_from_sit_end.transition_to(stand_waggle_mirror)
    turn_from_stand_end.transition_to(stand_waggle_mirror)

In [13]:
# Connect mirror to non-mirror
connect_mirrors(
    sit = gamekitty.get_frame('sit_0'),
    stand_waggle = gamekitty.get_frame('stand_waggle_0'),
    stand_waggle_mirror = gamekitty.get_frame('stand_waggle_mirror_0'),
    turn_from_sit = gamekitty.get_frame('turn_from_sit_0'),
    turn_from_sit_end = gamekitty.get_frame('turn_from_sit_6'),
    turn_from_stand = gamekitty.get_frame('turn_from_stand_0'),
    turn_from_stand_end = gamekitty.get_frame('turn_from_stand_7'))

In [14]:
# Missing any transitions?
gamekitty.find_absorbing_frames()


Out[14]:
(Frame(id='turn_from_sit_mirror_6'), Frame(id='turn_from_stand_mirror_7'))

In [15]:
connect_mirrors(
    sit = gamekitty.get_frame('sit_mirror_0'),
    stand_waggle = gamekitty.get_frame('stand_waggle_mirror_0'),
    stand_waggle_mirror = gamekitty.get_frame('stand_waggle_0'),
    turn_from_sit = gamekitty.get_frame('turn_from_sit_mirror_0'),
    turn_from_sit_end = gamekitty.get_frame('turn_from_sit_mirror_6'),
    turn_from_stand = gamekitty.get_frame('turn_from_stand_mirror_0'),
    turn_from_stand_end = gamekitty.get_frame('turn_from_stand_mirror_7'))

In [16]:
# Missing any transitions?
gamekitty.find_absorbing_frames()


Out[16]:
()

In [ ]: