// // Fill in the target list. // void CPageNetwork::ShowTargets() { Manager *manager; int mgr_no = 0; m_TTargets.DeleteAllItems(); // Determine what interfaces are visible to the selected item. if (theApp.pView->m_pWorkerView->GetSelectedType() == ALL_MANAGERS) return; // Loop through the managers and add them to the tree view. while (manager = theApp.manager_list.GetManager(mgr_no++)) { // Add all accessible interfaces to the target list. AddManager(manager); } }
void Entresol::ConstructFromXML(const String& EngineDataPath, const Mezzanine::ArchiveType ArchType, const String& InitializerFile) { //Add default manager factories AddAllEngineDefaultManagerFactories(); //Set some sane Defaults for some values. this->ManualLoopBreak = false; // Create Ogre. SetupOgre(); // Load the necessary plugins. SubSystemParticleFXPlugin = new Ogre::ParticleFXPlugin(); Ogre::Root::getSingleton().installPlugin(SubSystemParticleFXPlugin); // Set up the data we'll be populating. XML::Attribute CurrAttrib; String GUIInit, ResourceInit, PluginsInit, LogFileName; String PluginExtension, PluginPath; // Create or set the resource manager. /// @todo This currently forces our default resource manager to be constructed, which isn't in line with our factory/initiailzation design. /// This should be addressed somehow. if(ResourceManager::SingletonValid()) { AddManager(ResourceManager::GetSingletonPtr()); } else { AddManager(new ResourceManager(EngineDataPath, ArchType)); } // Open and load the initializer doc. ResourceManager* ResourceMan = GetResourceManager(); /// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready. Resource::FileStream InitStream(InitializerFile,EngineDataPath); XML::Document InitDoc; XML::ParseResult DocResult = InitDoc.Load(InitStream); if( DocResult.Status != XML::StatusOk ) { StringStream ExceptionStream; ExceptionStream << "Failed to parse XML file \"" << InitializerFile << "\"."; MEZZ_EXCEPTION(Exception::SYNTAX_ERROR_EXCEPTION_XML,ExceptionStream.str()); } XML::Node InitRoot = InitDoc.GetChild("InitializerRoot"); if( InitRoot.Empty() ) { StringStream ExceptionStream; ExceptionStream << "Failed to find expected Root node in \"" << InitializerFile << "\"."; MEZZ_EXCEPTION(Exception::SYNTAX_ERROR_EXCEPTION_XML,ExceptionStream.str()); } // Get the world settings and set them. XML::Node WorldSettings = InitRoot.GetChild("WorldSettings"); for( XML::NodeIterator SetIt = WorldSettings.begin() ; SetIt != WorldSettings.end() ; ++SetIt ) { String SecName = (*SetIt).Name(); if( "FrameSettings" == SecName ) { CurrAttrib = (*SetIt).GetAttribute("TargetFrameRate"); if(CurrAttrib.Empty()) { CurrAttrib = (*SetIt).GetAttribute("TargetFrameTime"); if(!CurrAttrib.Empty()) SetTargetFrameTimeMicroseconds(CurrAttrib.AsWhole()); }else{ this->SetTargetFrameRate(CurrAttrib.AsWhole()); } } else { MEZZ_EXCEPTION(Exception::SYNTAX_ERROR_EXCEPTION_XML,String("Unknown WorldSetting ")+SecName); } } SetupLogging(LogFileName); // Get the other initializer files we'll be using, since we'll need the plugins initializer. XML::Node InitFiles = InitRoot.GetChild("OtherInitializers"); for( XML::NodeIterator InitIt = InitFiles.begin() ; InitIt != InitFiles.end() ; ++InitIt ) { String InitFileName = (*InitIt).Name(); if( "PluginInit" == InitFileName ) { CurrAttrib = (*InitIt).GetAttribute("FileName"); if(!CurrAttrib.Empty()) PluginsInit = CurrAttrib.AsString(); } else if( "ResourceInit" == InitFileName ) { CurrAttrib = (*InitIt).GetAttribute("FileName"); if(!CurrAttrib.Empty()) ResourceInit = CurrAttrib.AsString(); } else if( "GUIInit" == InitFileName ) { CurrAttrib = (*InitIt).GetAttribute("FileName"); if(!CurrAttrib.Empty()) GUIInit = CurrAttrib.AsString(); } } // Load additional resource groups /*if(!ResourceInit.empty()) { /// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready. Resource::FileStream ResourceStream(ResourceInit,EngineDataPath); XML::Document ResourceDoc; ResourceDoc.Load(ResourceStream); // Get an iterator to the first resource group node, and declare them all. XML::Node ResourceLocations = ResourceDoc.GetChild("ResourceLocations"); for( XML::NodeIterator GroupIt = ResourceLocations.begin() ; GroupIt != ResourceLocations.end() ; ++GroupIt ) { String GroupName, GroupType, GroupPath; bool GroupRecursive = false; // Get the group path CurrAttrib = (*GroupIt).GetAttribute("GroupPath"); if(!CurrAttrib.Empty()) GroupPath = CurrAttrib.AsString(); // Get the group type CurrAttrib = (*GroupIt).GetAttribute("GroupType"); if(!CurrAttrib.Empty()) GroupType = CurrAttrib.AsString(); // Get the group name CurrAttrib = (*GroupIt).GetAttribute("GroupName"); if(!CurrAttrib.Empty()) GroupName = CurrAttrib.AsString(); // Get whether this is recursive CurrAttrib = (*GroupIt).GetAttribute("Recursive"); if(!CurrAttrib.Empty()) GroupRecursive = StringTool::ConvertToBool(CurrAttrib.AsString()); // Finally create the resource location. ResourceMan->AddAssetLocation(GroupPath,GroupType,GroupName,GroupRecursive); } // Get what resource groups should be initialized. XML::Node InitGroups = ResourceDoc.GetChild("InitGroups"); for( XML::NodeIterator InitIt = InitGroups.begin() ; InitIt != InitGroups.end() ; ++InitIt ) { String GroupName; CurrAttrib = (*InitIt).GetAttribute("GroupName"); if(!CurrAttrib.Empty()) GroupName = CurrAttrib.AsString(); ResourceMan->InitAssetGroup(GroupName); } }//*/ // Create the requested managers and set their necessary values. XML::Node Managers = InitRoot.GetChild("Managers"); for( XML::NodeIterator ManIt = Managers.begin() ; ManIt != Managers.end() ; ++ManIt ) { CreateManager( (*ManIt).Name(), (*ManIt) ); } // Load additional resource groups if(!ResourceInit.empty()) { /// @todo Replace this stack allocated stream for one initialized from the Resource Manager, after the system is ready. Resource::FileStream ResourceStream(ResourceInit,EngineDataPath); XML::Document ResourceDoc; ResourceDoc.Load(ResourceStream); // Get an iterator to the first resource group node, and declare them all. XML::Node ResourceLocations = ResourceDoc.GetChild("ResourceLocations"); for( XML::NodeIterator GroupIt = ResourceLocations.begin() ; GroupIt != ResourceLocations.end() ; ++GroupIt ) { String GroupName, GroupPath; ArchiveType GroupType; bool GroupRecursive = false; // Get the group path CurrAttrib = (*GroupIt).GetAttribute("GroupPath"); if(!CurrAttrib.Empty()) GroupPath = CurrAttrib.AsString(); // Get the group type CurrAttrib = (*GroupIt).GetAttribute("GroupType"); if(!CurrAttrib.Empty()) GroupType = ResourceManager::GetArchiveTypeFromString(CurrAttrib.AsString()); // Get the group name CurrAttrib = (*GroupIt).GetAttribute("GroupName"); if(!CurrAttrib.Empty()) GroupName = CurrAttrib.AsString(); // Get whether this is recursive CurrAttrib = (*GroupIt).GetAttribute("Recursive"); if(!CurrAttrib.Empty()) GroupRecursive = StringTools::ConvertToBool(CurrAttrib.AsString()); // Finally create the resource location. ResourceMan->AddAssetLocation(GroupPath,GroupType,GroupName,GroupRecursive); } // Get what resource groups should be initialized. XML::Node InitGroups = ResourceDoc.GetChild("InitGroups"); for( XML::NodeIterator InitIt = InitGroups.begin() ; InitIt != InitGroups.end() ; ++InitIt ) { String GroupName; CurrAttrib = (*InitIt).GetAttribute("GroupName"); if(!CurrAttrib.Empty()) GroupName = CurrAttrib.AsString(); ResourceMan->InitAssetGroup(GroupName); } } // Configure the UI if(!GUIInit.empty()) { /// @todo This is currently not implemented. } SanityChecks(); }