gaf::GAFObject* MultipleTimelineTest::gaf_object()
{
    auto asset = gaf::GAFAsset::create(s_gafMultipleTimelines);

    switch (m_scene)
    {
    case SCENE_TIMELINE_1:
        asset->setRootTimeline("timeline1");
        break;
    case SCENE_TIMELINE_2: 
        asset->setRootTimeline("timeline2");
        break;
    case SCENE_COUNT:
        CCASSERT(false, "Wrong scene switch logic");
        break;
    case SCENE_DEFAULT:
    default:
        break;
    }

    auto object = asset->createObjectAndRun(true);
    object->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
    object->setPosition(Director::getInstance()->getVisibleSize() / 2);

    return object;
}
bool GAFAsset::setRootTimeline(uint32_t id)
{
    Timelines_t::iterator timeline = m_timelines.find(id);
    if (timeline != m_timelines.end())
    {
        setRootTimeline(timeline->second);
        return true;
    }
    return false;
}
bool GAFAsset::setRootTimeline(const std::string& name)
{
    for (Timelines_t::iterator i = m_timelines.begin(), e = m_timelines.end(); i != e; i++)
    {
        std::string tl_name = i->second->getLinkageName();
        if (tl_name.compare(name) == 0)
        {
            setRootTimeline(i->second);
            return true;
        }
    }
    return false;
}
GAFObject * GAFAsset::createObject()
{
    if (m_timelines.empty())
    {
        return nullptr;
    }

    if (m_rootTimeline == nullptr)
    {
        CCLOG("%s", "You haven't root timeline in this asset. Please set root timeline by setRootTimeline(...)");
        for (Timelines_t::iterator i = m_timelines.begin(), e = m_timelines.end(); i != e; i++)
        {
            if (!i->second->getLinkageName().empty())
            {
                setRootTimeline(i->second);
                break;
            }
        }
    }

    return GAFObject::create(this, m_rootTimeline);
}