void InlineNode::parseField(const char* fieldName,VRMLFile& vrmlFile) { if(strcmp(fieldName,"url")==0) { vrmlFile.parseField(url); /* Load the external VRML file: */ std::string externalFileName=vrmlFile.getFullUrl(url.getValue(0)); Misc::FileCharacterSource externalFile(externalFileName.c_str()); SceneGraph::VRMLFile externalVrmlFile(externalFileName,externalFile,vrmlFile.getNodeCreator()); externalVrmlFile.parse(this); } else GroupNode::parseField(fieldName,vrmlFile); }
void XMLSerializer::LoadEntity( ticpp::Element* element ) { std::string name; element->GetAttribute( "name", &name ); IWorldEntity* entity = _world->CreateEntity( name ); std::string src; element->GetAttribute( "src", &src, false ); NodePtrMap components; if ( !src.empty( ) ) { IResource* resource = Management::Get( )->GetResourceManager( )->GetResource( src ); Document externalFile( resource->GetFileBuffer( )->fileBytes ); for( Iterator< Element > child = externalFile.FirstChildElement( false ); child != child.end( ); child++ ) { this->LoadEntityComponents( &*child, components ); } } this->LoadEntityComponents( element, components ); for( NodePtrMap::iterator i = components.begin( ); i != components.end( ); ++i ) { if ( Management::Get( )->GetSystemManager( )->HasSystem( ( *i ).first ) ) { IComponentSerializer* serializer = ComponentSerializerFactory::Create( ( *i ).first ); ISystemComponent* component = serializer->DeSerialize( name, ( *i ).second->ToElement( ), _world->GetSystemScenes( ) ); entity->AddComponent( component ); delete serializer; } delete ( *i ).second; } entity->Initialize( ); }