Esempio n. 1
0
def _get_live_trf_function(spec, field_id, layout):

    fields = match_fields(spec, field_id)
    assert len(fields) == 1
    field = fields[0]
    livechange_funcs = field['livechange']

    def keyframes_callback(t_id):
        livechange_funcs[t_id]()

    @test_cuepoints(points=get_data_debug_positions(spec, field_id),
                    nb_keyframes=len(livechange_funcs),
                    keyframes_callback=keyframes_callback,
                    tolerance=1,
                    exercise_serialization=False,
                    debug_positions=False)
    @scene(seed=scene.Range(range=[0, 100]),
           debug_positions=scene.Bool(),
           color_tint=scene.Bool(),
           trf_step=scene.Range(range=[0, len(livechange_funcs)]))
    def scene_func(cfg,
                   seed=0,
                   debug_positions=True,
                   color_tint=False,
                   trf_step=0):
        s = _live_scene(cfg, spec, field_id, seed, layout, debug_positions,
                        color_tint)
        for i in range(trf_step):
            keyframes_callback(i)
        return s

    return scene_func
Esempio n. 2
0
def _get_live_function(spec, field_id, layout):

    fields = match_fields(spec, field_id)
    assert len(fields) == 1
    field = fields[0]
    data_src = field['livechange']

    def keyframes_callback(t_id):
        if t_id:
            v = data_src[t_id - 1]
            field['node'].set_value(*v)

    @test_cuepoints(points=get_data_debug_positions(spec, field_id),
                    nb_keyframes=len(data_src) + 1,
                    keyframes_callback=keyframes_callback,
                    tolerance=1,
                    exercise_serialization=False,
                    debug_positions=False)
    @scene(seed=scene.Range(range=[0, 100]),
           debug_positions=scene.Bool(),
           color_tint=scene.Bool())
    def scene_func(cfg, seed=0, debug_positions=True, color_tint=False):
        return _live_scene(cfg, spec, field_id, seed, layout, debug_positions,
                           color_tint)

    return scene_func
Esempio n. 3
0
def _get_data_function(field_id, layout):
    nb_keyframes = 5 if 'animated' in field_id else 1
    spec = _get_data_spec(layout)

    @test_cuepoints(points=get_data_debug_positions(spec, field_id),
                    nb_keyframes=nb_keyframes,
                    tolerance=1,
                    debug_positions=False)
    @scene(seed=scene.Range(range=[0, 100]), debug_positions=scene.Bool(), color_tint=scene.Bool())
    def scene_func(cfg, seed=0, debug_positions=True, color_tint=False):
        return _data_scene(cfg, spec, field_id, seed, layout, debug_positions, color_tint)
    return scene_func
Esempio n. 4
0
def _get_data_function(spec, category, field_type, layout):
    nb_keyframes = 5 if "animated" in category else 1
    fields = match_fields(spec, category, field_type)

    @test_cuepoints(
        points=get_data_debug_positions(fields),
        nb_keyframes=nb_keyframes,
        tolerance=1,
        debug_positions=False,
    )
    @scene(seed=scene.Range(range=[0, 100]),
           debug_positions=scene.Bool(),
           color_tint=scene.Bool())
    def scene_func(cfg, seed=0, debug_positions=True, color_tint=False):
        cfg.duration = ANIM_DURATION
        return get_field_scene(cfg, spec, category, field_type, seed,
                               debug_positions, layout, color_tint)

    return scene_func