diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c index bca8c1d4a4..82aba0f3c4 100644 --- a/src/lib/elementary/efl_ui_animation_view.c +++ b/src/lib/elementary/efl_ui_animation_view.c @@ -741,6 +741,7 @@ _efl_ui_animation_view_value_provider_override(Eo *obj EINA_UNUSED, Efl_Ui_Anima efl_ref(value_provider); pd->vp_list = eina_list_append(pd->vp_list, value_provider); + efl_key_data_set(pd->vg, "_vg_value_providers", pd->vp_list); } EAPI Elm_Animation_View* diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index 0c8e50bed3..660d1ebe1a 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c @@ -616,6 +616,8 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj, h = size.h; } + if (pd->vg_entry->vfd) + pd->vg_entry->vfd->vp_list = efl_key_data_get(obj->object, "_vg_value_providers"); root = evas_cache_vg_tree_get(vg_entry, pd->frame_idx); if (!root) return; diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index c80053c7f9..86bb885ce3 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -1541,6 +1541,7 @@ struct _Vg_File_Data Vg_File_Anim_Data *anim_data; //only when animation supported. int ref; int w, h; //default size + Eina_List *vp_list; //Value providers. void *loader_data; //loader specific local data diff --git a/src/static_libs/vg_common/vg_common.h b/src/static_libs/vg_common/vg_common.h index 520fcdbfd6..83f9224e45 100644 --- a/src/static_libs/vg_common/vg_common.h +++ b/src/static_libs/vg_common/vg_common.h @@ -7,6 +7,7 @@ #include "evas_common_private.h" #include "evas_private.h" +#include "evas_vg_private.h" /****************************************************************************************** * SVG Compatible feature implementation diff --git a/src/static_libs/vg_common/vg_common_json.c b/src/static_libs/vg_common/vg_common_json.c index 3b3d114503..5ad4150506 100644 --- a/src/static_libs/vg_common/vg_common_json.c +++ b/src/static_libs/vg_common/vg_common_json.c @@ -443,6 +443,59 @@ _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int de } #endif +#ifdef BUILD_VG_LOADER_JSON +void +_value_provider_override(Vg_File_Data *vfd) +{ + Lottie_Animation *lot_anim = (Lottie_Animation *) vfd->loader_data; + + Eina_List *l; + Efl_Gfx_Vg_Value_Provider *vp; + EINA_LIST_FOREACH(vfd->vp_list, l, vp) + { + const char *keypath; + Efl_Gfx_Vg_Value_Provider_Change_Flag flag; + flag = efl_gfx_vg_value_provider_changed_flag_get(vp); + + if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_FILL_COLOR) + { + int r, g, b, a; + r = g = b = a = 0; + efl_gfx_vg_value_provider_fill_color_get(vp, &r, &g, &b, &a); + keypath = efl_gfx_vg_value_provider_keypath_get(vp); + + lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_FILLCOLOR, (char*)keypath, r / 255.0, g / 255.0, b / 255.0); + lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_FILLOPACITY, (char*)keypath, (a / 255.0) * 100.0); + } + if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_STROKE_COLOR) + { + int r, g, b, a; + r = g = b = a = 0; + efl_gfx_vg_value_provider_stroke_color_get(vp, &r, &g, &b, &a); + keypath = efl_gfx_vg_value_provider_keypath_get(vp); + + lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_STROKECOLOR, (char*)keypath, r / 255.0, g / 255.0, b / 255.0); + lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_STROKEOPACITY, (char*)keypath, (a / 255.0) * 100.0); + } + if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_STROKE_WIDTH) + { + double w; + w = efl_gfx_vg_value_provider_stroke_width_get(vp); + keypath = efl_gfx_vg_value_provider_keypath_get(vp); + + lottie_animation_property_override(lot_anim, LOTTIE_ANIMATION_PROPERTY_STROKEWIDTH, (char*)keypath, w); + } + if (flag & EFL_GFX_VG_VALUE_PROVIDER_CHANGE_FLAG_TRANSFORM_MATRIX) + { + //TODO: When the lottie animation's transform property is implemented, + // the transform property override function have to added. + } + } +} + +#endif + + Eina_Bool vg_common_json_create_vg_node(Vg_File_Data *vfd) { @@ -450,6 +503,8 @@ vg_common_json_create_vg_node(Vg_File_Data *vfd) Lottie_Animation *lot_anim = (Lottie_Animation *) vfd->loader_data; if (!lot_anim) return EINA_FALSE; + if (vfd->vp_list) _value_provider_override(vfd); + unsigned int frame_num = (vfd->anim_data) ? vfd->anim_data->frame_num : 0; const LOTLayerNode *tree = lottie_animation_render_tree(lot_anim, frame_num,