From 953eeb231c7d22d8b325486ec6e464fdc4ae71e8 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 21 Nov 2019 17:37:33 +0900 Subject: [PATCH] vector lottie: reset vg tree each frames. Since vector tree nodes are reusing instead of reconstrucion, We make it sure that dangling nodes invisible by clearing all nodes visibility. Only valid nodes will be reset to visible while setting up in the progress. --- src/static_libs/vg_common/vg_common_json.c | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/static_libs/vg_common/vg_common_json.c b/src/static_libs/vg_common/vg_common_json.c index 2c31d7881a..43ef86b353 100644 --- a/src/static_libs/vg_common/vg_common_json.c +++ b/src/static_libs/vg_common/vg_common_json.c @@ -351,14 +351,25 @@ _construct_masks(Efl_Canvas_Vg_Container *mtarget, LOTMask *masks, unsigned int } } +static void +_reset_vg_tree(Efl_VG *node) +{ + //Hide all nodes visibility + if (efl_isa(node, EFL_CANVAS_VG_CONTAINER_CLASS)) + { + Efl_VG* child; + Eina_Iterator *itr = efl_canvas_vg_container_children_get(node); + EINA_ITERATOR_FOREACH(itr, child) + _reset_vg_tree(child); + } + efl_gfx_entity_visible_set(node, EINA_FALSE); +} + static void _update_vg_tree(Efl_Canvas_Vg_Container *root, const LOTLayerNode *layer, int depth EINA_UNUSED) { - if (!layer->mVisible) - { - efl_gfx_entity_visible_set(root, EINA_FALSE); - return; - } + if (!layer->mVisible) return; + efl_gfx_entity_visible_set(root, EINA_TRUE); efl_gfx_color_set(root, layer->mAlpha, layer->mAlpha, layer->mAlpha, layer->mAlpha); @@ -523,6 +534,8 @@ vg_common_json_create_vg_node(Vg_File_Data *vfd) if (tree->keypath) efl_key_data_set(root, "_lot_node_name", tree->keypath); vfd->root = root; } + else _reset_vg_tree(root); + _update_vg_tree(root, tree, 1); #else return EINA_FALSE;