[id](const auto& val){ return val->id() == id;});
if (search != mLayers.end()) i->setParentLayer(*search);
}
- i->setPrecompLayer(this);
+ // update the precomp layer if its not the root layer.
+ if (!layerModel->root()) i->setPrecompLayer(this);
}
}
bool hasGradient() const noexcept {return mHasGradient;}
bool hasMask() const noexcept {return mHasMask;}
bool hasRepeater() const noexcept {return mHasRepeater;}
+ bool root() const noexcept {return mRoot;}
int id() const noexcept{ return mId;}
int parentId() const noexcept{ return mParentId;}
int inFrame() const noexcept{return mInFrame;}
bool mHasMask{false};
bool mHasRepeater{false};
bool mHasGradient{false};
+ bool mRoot{false};
std::vector<std::shared_ptr<LOTMaskData>> mMasks;
};
void LottieParserImpl::parseLayers(LOTCompositionData *comp)
{
comp->mRootLayer = std::make_shared<LOTLayerData>();
+ comp->mRootLayer->mRoot = true;
comp->mRootLayer->mLayerType = LayerType::Precomp;
comp->mRootLayer->mTransform = std::make_shared<LOTTransformData>();
bool staticFlag = true;