Action::ResultE enter(Node * const pNode)
    {
        Action::ResultE returnValue = Action::Continue;

        const Char8 *szName = OSG::getName(pNode);

        if(szName != NULL)
        {
            if(osgStringCmp(_szRefName.c_str(), szName) == 0)
            {
                _pResult = pNode;

                returnValue = Action::Quit;
            }
        }
        else if(pNode->getCore() != NULL)
        {
            szName = OSG::getName(pNode->getCore());

            if(szName != NULL)
            {
                if(osgStringCmp(_szRefName.c_str(), szName) == 0)
                {
                    _pResult = pNode;
                    
                    returnValue = Action::Quit;
                }
            }
        }
        
        return returnValue;
    }
示例#2
0
FieldContainer *CSMDrawer::findNamedComponent(const Char8 *szName) const
{
    MFUnrecChildCSMWindowPtr::const_iterator winIt  = _mfWindows.begin();
    MFUnrecChildCSMWindowPtr::const_iterator winEnd = _mfWindows.end  ();

    const Char8               *szTmpName   = NULL;

    while(winIt != winEnd)
    {
        szTmpName = OSG::getName(*winIt);

        if(szTmpName != NULL && osgStringCmp(szTmpName, szName) == 0)
        {
            return *winIt;
        }
        else
        {
            FieldContainer *tmpVal = (*winIt)->findNamedComponent(szName);

            if(tmpVal != NULL)
                return tmpVal;
        }

        ++winIt;
    }

    return NULL;
}
FieldContainer *ComplexSceneManager::resolveStatic(const Char8 *szName)
{
    std::vector<FieldContainerUnrecPtr>::const_iterator gIt  = 
        _vStaticGlobals.begin();

    std::vector<FieldContainerUnrecPtr>::const_iterator gEnd = 
        _vStaticGlobals.end  ();

          AttachmentContainer *pAttCnt     = NULL;
          Node                *pNode       = NULL;
    const Char8               *szTmpName   = NULL;

    while(gIt != gEnd)
    {
        pNode = dynamic_cast<Node *>((*gIt).get());

        if(pNode != NULL)
        {
            ElementFinder oFinder;

            oFinder._szRefName = szName;

            traverse(pNode, boost::bind(&ElementFinder::enter, &oFinder, _1));

            if(oFinder._pResult != NULL)
            {
                return oFinder._pResult;
            }
         }
        
        pAttCnt = dynamic_cast<AttachmentContainer *>((*gIt).get());

        if(pAttCnt != NULL)
        {
            szTmpName = OSG::getName(pAttCnt);
           
            if(szTmpName != NULL && osgStringCmp(szTmpName, szName) == 0)
            {
                return pAttCnt;
            }
            else
            {
#if 0                                                                    
                FieldContainer *tmpVal = pAttCnt->findNamedComponent(szName);
                
                if(tmpVal != NULL)
                    return tmpVal;
#endif
            }
        }

        ++gIt;
    }

    return NULL;
}
FieldContainer *AttachmentContainer::findNamedComponent(const Char8 *szName) 
{
    const Char8 *szTmpName = NULL;

    szTmpName = OSG::getName(this);
        
    if(szTmpName != NULL && osgStringCmp(szTmpName, szName) == 0)
    {
        return this;
    }
    
    return NULL;
}
FieldContainer *CSMWindow::findNamedComponent(const Char8 *szName) const
{
    if(_sfRenderOptions.getValue() != NULL)
    {
        const Char8 *szTmpName = OSG::getName(_sfRenderOptions.getValue());

        if(szTmpName != NULL && osgStringCmp(szTmpName, szName) == 0)
        {
            return _sfRenderOptions.getValue();
        }
    }

    return NULL;
}
FieldContainer *ComplexSceneManager::findNamedComponent(
    const Char8 *szName) const
{
    MFUnrecFieldContainerPtr::const_iterator gIt  = _mfGlobals.begin();
    MFUnrecFieldContainerPtr::const_iterator gEnd = _mfGlobals.end  ();

          AttachmentContainer *pAttCnt     = NULL;
          Node                *pNode       = NULL;
    const Char8               *szTmpName   = NULL;

    if(_sfDrawManager.getValue() != NULL)
    {
        szTmpName = OSG::getName(_sfDrawManager.getValue());

        if(szTmpName != NULL && osgStringCmp(szTmpName, szName) == 0)
        {
            return _sfDrawManager.getValue();
        }

         FieldContainer *tmpVal = 
             _sfDrawManager.getValue()->findNamedComponent(szName);

         if(tmpVal != NULL)
             return tmpVal;
    }

    while(gIt != gEnd)
    {
        pNode = dynamic_cast<Node *>(*gIt);

        if(pNode != NULL)
        {
            ElementFinder oFinder;

            oFinder._szRefName = szName;

            traverse(pNode, boost::bind(&ElementFinder::enter, &oFinder, _1));

            if(oFinder._pResult != NULL)
            {
                return oFinder._pResult;
            }
         }
        
        pAttCnt = dynamic_cast<AttachmentContainer *>(*gIt);

        if(pAttCnt != NULL)
        {
            szTmpName = OSG::getName(pAttCnt);
           
            if(szTmpName != NULL && osgStringCmp(szTmpName, szName) == 0)
            {
                return pAttCnt;
            }
            else
            {
                FieldContainer *tmpVal = pAttCnt->findNamedComponent(szName);
                
                if(tmpVal != NULL)
                    return tmpVal;
            }
        }

        ++gIt;
    }

    return NULL;
}