MCPcopy Create free account
hub / github.com/Samsung/rlottie / parseTransformObject

Method parseTransformObject

src/lottie/lottieparser.cpp:1505–1570  ·  view source on GitHub ↗

* https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/transform.json */

Source from the content-addressed store, hash-verified

1503 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/transform.json
1504 */
1505model::Transform *LottieParserImpl::parseTransformObject(bool ddd)
1506{
1507 auto objT = allocator().make<model::Transform>();
1508
1509 auto obj = allocator().make<model::Transform::Data>();
1510 if (ddd) {
1511 obj->createExtraData();
1512 obj->mExtra->m3DData = true;
1513 }
1514
1515 while (const char *key = NextObjectKey()) {
1516 if (0 == strcmp(key, "nm")) {
1517 objT->setName(GetString());
1518 } else if (0 == strcmp(key, "a")) {
1519 parseProperty(obj->mAnchor);
1520 } else if (0 == strcmp(key, "p")) {
1521 EnterObject();
1522 bool separate = false;
1523 while (const char *key = NextObjectKey()) {
1524 if (0 == strcmp(key, "k")) {
1525 parsePropertyHelper(obj->mPosition);
1526 } else if (0 == strcmp(key, "s")) {
1527 obj->createExtraData();
1528 obj->mExtra->mSeparate = GetBool();
1529 separate = true;
1530 } else if (separate && (0 == strcmp(key, "x"))) {
1531 parseProperty(obj->mExtra->mSeparateX);
1532 } else if (separate && (0 == strcmp(key, "y"))) {
1533 parseProperty(obj->mExtra->mSeparateY);
1534 } else {
1535 Skip(key);
1536 }
1537 }
1538 } else if (0 == strcmp(key, "r")) {
1539 parseProperty(obj->mRotation);
1540 } else if (0 == strcmp(key, "s")) {
1541 parseProperty(obj->mScale);
1542 } else if (0 == strcmp(key, "o")) {
1543 parseProperty(obj->mOpacity);
1544 } else if (0 == strcmp(key, "hd")) {
1545 objT->setHidden(GetBool());
1546 } else if (0 == strcmp(key, "rx")) {
1547 parseProperty(obj->mExtra->m3DRx);
1548 } else if (0 == strcmp(key, "ry")) {
1549 parseProperty(obj->mExtra->m3DRy);
1550 } else if (0 == strcmp(key, "rz")) {
1551 parseProperty(obj->mExtra->m3DRz);
1552 } else {
1553 Skip(key);
1554 }
1555 }
1556 bool isStatic = obj->mAnchor.isStatic() && obj->mPosition.isStatic() &&
1557 obj->mRotation.isStatic() && obj->mScale.isStatic() &&
1558 obj->mOpacity.isStatic();
1559 if (obj->mExtra) {
1560 isStatic = isStatic && obj->mExtra->m3DRx.isStatic() &&
1561 obj->mExtra->m3DRy.isStatic() &&
1562 obj->mExtra->m3DRz.isStatic() &&

Callers

nothing calls this directly

Calls 7

GetBoolFunction · 0.85
createExtraDataMethod · 0.80
setHiddenMethod · 0.80
setMethod · 0.80
GetStringFunction · 0.50
setNameMethod · 0.45
isStaticMethod · 0.45

Tested by

no test coverage detected