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:
Hermet Park 2023-11-15 20:20:23 +09:00
parent 1a4135f08f
commit 7aa8f07946

View file

@ -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);
}
}
}