std::vector<properties::Property*> allProperties() { std::vector<properties::Property*> properties; auto p = OsEng.globalPropertyOwner().propertiesRecursive(); properties.insert( properties.end(), p.begin(), p.end() ); const Scene* graph = sceneGraph(); std::vector<SceneGraphNode*> nodes = graph->allSceneGraphNodes(); for (SceneGraphNode* n : nodes) { auto p = n->propertiesRecursive(); properties.insert( properties.end(), p.begin(), p.end() ); } return properties; }
bool SceneFilePage::validatePage() { QDir path(m_scenePath->text()); path.makeAbsolute(); if (!path.exists()) { int result = QMessageBox::question(this, tr("Create directory?"), tr("The directory %1 does not exist!\n\nCreate it?").arg(path.absolutePath()), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); switch (result) { case QMessageBox::Cancel: return false; case QMessageBox::Yes: path.mkpath(path.absolutePath()); case QMessageBox::No: break; } } if (!m_sceneFile->text().endsWith(".scn", Qt::CaseInsensitive)) m_sceneFile->setText(m_sceneFile->text() + ".scn"); if(QFileInfo(QDir(m_scenePath->text()), m_sceneFile->text()).exists()) { if (QMessageBox::question( this, tr("Overwrite?"), tr("There is already a scene file with the name %1\nin %2\n\nShould the wizard overwrite it?").arg(m_sceneFile->text()).arg(m_scenePath->text()), QMessageBox::Ok, QMessageBox::Cancel | QMessageBox::Cancel | QMessageBox::Default) != QMessageBox::Ok) return false; } QDir::setCurrent(m_scenePath->text()); QFileInfo sceneGraphFile( m_sceneGraphFile->text() ); if( sceneGraphFile.isAbsolute() ) { QMessageBox::information( this, tr("Error"), tr("The scene graph file must be relative to the scene path!") ); return false; } if( !sceneGraphFile.dir().exists() ) path.mkpath( sceneGraphFile.path() ); if( !sceneGraphFile.exists() ) { QFile sceneGraph( sceneGraphFile.absoluteFilePath() ); if( !sceneGraph.open( QIODevice::WriteOnly ) ) { QMessageBox::warning( this, tr("Error"), tr("The scene graph file '%1' does not exist and couldn't be created!").arg( m_sceneGraphFile->text() ) ); return false; } sceneGraph.close(); } return true; }
SCENEGRAPHPLUGINEXP void dllLoadScene( const char* sceneFile ) { GameLog::logMessage("Setting Horde3D Paths"); XMLResults results; XMLNode scene = XMLNode::parseFile( sceneFile, "Configuration", &results); XMLNode& engineSettings(scene.getChildNode("EngineConfig")); if ( !engineSettings.isEmpty() ) { bool loadTextures = _stricmp(engineSettings.getAttribute("loadTextures", "true"), "true") == 0 || _stricmp(engineSettings.getAttribute("loadTextures", "1"), "1") == 0; GameLog::logMessage("LoadTextures: %s", loadTextures ? "enabled" : "disabled"); h3dSetOption( H3DOptions::LoadTextures, loadTextures ? 1.0f : 0.0f ); int shadowMapSize = atoi(engineSettings.getAttribute("shadowMapSize", "1024")); GameLog::logMessage("ShadowMapSize: %d", shadowMapSize); h3dSetOption( H3DOptions::ShadowMapSize, float( shadowMapSize) ); int anisotropyFactor = atoi(engineSettings.getAttribute("anisotropyFactor", "1")); GameLog::logMessage("Anisotropy: %d", anisotropyFactor); h3dSetOption( H3DOptions::MaxAnisotropy, float( anisotropyFactor ) ); bool texCompression = _stricmp(engineSettings.getAttribute("texCompression", "true"), "true") == 0 || _stricmp(engineSettings.getAttribute("texCompression", "1"), "1") == 0; GameLog::logMessage("TexCompression: %s", texCompression ? "enabled" : "disabled"); h3dSetOption( H3DOptions::TexCompression, texCompression ); int maxNumMessages = atoi(engineSettings.getAttribute("maxNumMessages", "1024")); h3dSetOption( H3DOptions::MaxNumMessages, float( maxNumMessages ) ); } // Loading scene graph XMLNode& sceneGraph(scene.getChildNode("SceneGraph")); if ( sceneGraph.isEmpty() ) GameLog::errorMessage("No Scene Graph Node found!"); else { GameLog::logMessage("Loading SceneGraph %s", sceneGraph.getAttribute("path")); // Environment H3DRes sceneGraphID = h3dAddResource( H3DResTypes::SceneGraph, sceneGraph.getAttribute("path"), 0 ); GameLog::logMessage("Loading Resources..."); // Load resources h3dutLoadResourcesFromDisk( "." ); GameLog::logMessage("Adding scene graph to root node"); // Add scene nodes H3DNode newSceneID = h3dAddNodes( H3DRootNode, sceneGraphID); SceneGraphManager::instance()->addNewHordeNode( newSceneID ); } // Use the specified render cam if (scene.getChildNode("ActiveCamera").getAttribute("name") && h3dFindNodes( H3DRootNode, scene.getChildNode("ActiveCamera").getAttribute("name"), H3DNodeTypes::Camera ) > 0) SceneGraphManager::instance()->setActiveCam( h3dGetNodeFindResult(0) ); }
SceneGraphNode* sceneGraphNode(const std::string& name) { const Scene* graph = sceneGraph(); return graph->sceneGraphNode(name); }