From 7d97abc05b0a7a4fd146bffb29e3d9a4c9ecc567 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 12 Nov 2019 14:30:25 +0900 Subject: [PATCH] Efl.Ui.Animation_View: Implement sector playing feature Summary: play_sector method is API for playing section. If the animation object has section information, user can play the section. Get the start and end section name and get the frame of each section. And set and play the min and max frames of the current animation object. Depends on D10506 Test Plan: For example. Animation objects have "first","second" and "third" sectors. And sector "second" has duration information. User can use it like this: efl_ui_animation_view_play_sector(anim_view, "first", "second"); efl_ui_animation_view_play_sector(anim_view, "second", NULL); efl_ui_animation_view_play_sector(anim_view, "first", NULL); // first sector ~ end frame of animation object. efl_ui_animation_view_play_sector(anim_view, "second", "third"); efl_ui_animation_view_play_sector(anim_view, "second", "wrong name"); Reviewers: Hermet, smohanty, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10507 --- src/lib/elementary/efl_ui_animation_view.c | 31 +++++++++++++++++++++ src/lib/elementary/efl_ui_animation_view.eo | 19 +++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c index 82aba0f3c4..074ebfdf8d 100644 --- a/src/lib/elementary/efl_ui_animation_view.c +++ b/src/lib/elementary/efl_ui_animation_view.c @@ -468,6 +468,37 @@ _efl_ui_animation_view_play(Eo *obj, Efl_Ui_Animation_View_Data *pd) return EINA_TRUE; } +Eina_Bool _efl_ui_animation_view_play_sector(Eo *obj, Efl_Ui_Animation_View_Data *pd, const char *start, const char *end) +{ + int start_frame = 0; + int end_frame = evas_object_vg_animated_frame_count_get(pd->vg) - 1; + + if (start && end) + { + efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, NULL); + efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL); + } + else + { + if (start) + { + efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, &end_frame); + } + else if (end) + { + efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL); + } + } + + efl_ui_animation_view_min_frame_set(obj, start_frame); + if (start_frame < end_frame) + efl_ui_animation_view_max_frame_set(obj, end_frame); + + if (!efl_ui_animation_view_play(obj)) + return EINA_FALSE; + return EINA_TRUE; +} + EOLIAN static Eina_Bool _efl_ui_animation_view_stop(Eo *obj, Efl_Ui_Animation_View_Data *pd) { diff --git a/src/lib/elementary/efl_ui_animation_view.eo b/src/lib/elementary/efl_ui_animation_view.eo index 2d090bbee7..f06c9b1ce2 100644 --- a/src/lib/elementary/efl_ui_animation_view.eo +++ b/src/lib/elementary/efl_ui_animation_view.eo @@ -135,6 +135,25 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, return: bool; [[$true when it's successful. $false otherwise.]] } + play_sector { + [[Play animation of sector one time instantly when it's available. + + If end sector is NULL, only start sector is referenced. + If both the start and end sectors are valid, + Play is played and stoped at starting point of each sector. + + If start is null and end is valid, playback starts from 0 frame to the start frame of the end sector. + If both sectors start and end are invalid. Play from 0 frame to the last frame of animation view object. + + Note: This method use to @.min_frame, @.max_frame (@.min_progress, @.max_progress) internally. + So if you have changed the min or max frame(progress) it can be changed to the sector frame. + ]] + params { + @in start: string; [[ The name of start sector ]] + @in end: string; [[ The name of end sector ]] + } + return: bool; [[$true when it's successful. $false otherwise.]] + } play_back { [[Play back animation one time instantly when it's available.