mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
lottie/parser: Fix the shapes parsing logic.
Currently, it assumes "ty":"gr" for the related shapes children, which can be skipped since the children will be in the "it" scope. Some Lottie data is missing the "ty":"gr" field, and ThorVG couldn't display the content properly. It can ignore it with the context understanding.
This commit is contained in:
parent
1a4135f08f
commit
7aa8f07946
1 changed files with 13 additions and 2 deletions
|
@ -932,8 +932,19 @@ void LottieParser::parseShapes(LottieLayer* layer)
|
|||
{
|
||||
enterArray();
|
||||
while (nextArrayValue()) {
|
||||
parseObject(layer);
|
||||
}
|
||||
enterObject();
|
||||
while (auto key = nextObjectKey()) {
|
||||
if (!strcmp(key, "it")) {
|
||||
enterArray();
|
||||
while (nextArrayValue()) parseObject(layer);
|
||||
} else if (!strcmp(key, "ty")) {
|
||||
if (auto child = parseObject()) {
|
||||
if (child->hidden) delete(child);
|
||||
else layer->children.push(child);
|
||||
}
|
||||
} else skip(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue