Esempio n. 1
0
void OSGLoader::setFieldContainerValue(FieldContainer *pNewNode)
{
    if(_pCurrentField != NULL)
    {
        FieldContainerPtrSFieldBase::EditHandlePtr pSFHandle = 
            boost::dynamic_pointer_cast<
                FieldContainerPtrSFieldBase::EditHandle>(
                    _pCurrentField);

        FieldContainerPtrMFieldBase::EditHandlePtr pMFHandle = 
            boost::dynamic_pointer_cast<
                FieldContainerPtrMFieldBase::EditHandle>(
                    _pCurrentField);

        EditMapFieldHandlePtr pMapHandle = 
            boost::dynamic_pointer_cast<
                EditMapFieldHandle>(_pCurrentField);

        if(pSFHandle != NULL && pSFHandle->isValid())
        {
            pSFHandle->set(pNewNode);
        }
        else if(pMFHandle != NULL && pMFHandle->isValid())
        {
            pMFHandle->add(pNewNode);
        }
        else if(pMapHandle != NULL && pMapHandle->isValid())
        {
            pMapHandle->add(pNewNode, "0");
        }
    }
}
void ComplexSceneManager::processUnresolved(void)
{
    std::vector<DeferredFCUse>::const_iterator uIt  = _vUnresolvedFCs.begin();
    std::vector<DeferredFCUse>::const_iterator uEnd = _vUnresolvedFCs.end  ();

    for(; uIt != uEnd; ++uIt)
    {
        if(uIt->_pDstCnt == NULL)
            continue;

        FieldContainer *pTmpFC = this->findNamedComponent(uIt->_szName.c_str());

        if(pTmpFC == NULL)
        {
            continue;
        }

        EditFieldHandlePtr pDstField = 
            uIt->_pDstCnt->editField(uIt->_uiDstFieldId);

        FieldContainerPtrSFieldBase::EditHandlePtr pSFHandle = 
            boost::dynamic_pointer_cast<
                FieldContainerPtrSFieldBase::EditHandle>(
                    pDstField);

        FieldContainerPtrMFieldBase::EditHandlePtr pMFHandle = 
            boost::dynamic_pointer_cast<
                FieldContainerPtrMFieldBase::EditHandle>(
                    pDstField);

        EditMapFieldHandlePtr pMapHandle = 
            boost::dynamic_pointer_cast<
                EditMapFieldHandle>(pDstField);

        if(pSFHandle != NULL && pSFHandle->isValid())
        {
            pSFHandle->set(pTmpFC);
        }
        else if(pMFHandle != NULL && pMFHandle->isValid())
        {
            pMFHandle->add(pTmpFC);
        }
        else if(pMapHandle != NULL && pMapHandle->isValid())
        {
            pMapHandle->add(pTmpFC, "0");
        }

    }
        
}