From df0d0d12580471fe3c5fc0157fb56ba6bb54f2be Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sun, 6 Mar 2016 08:08:06 +0100 Subject: [PATCH] Update Ghoul version to accommodate public API bool parameter changes --- ext/ghoul | 2 +- modules/base/rendering/modelgeometry.cpp | 7 +++++-- modules/base/rendering/renderableplanet.cpp | 3 ++- modules/base/rendering/renderablesphere.cpp | 7 ++++--- .../rendering/renderablesphericalgrid.cpp | 4 +++- modules/base/rendering/renderablestars.cpp | 11 +++++++--- modules/newhorizons/util/labelparser.cpp | 7 +++++-- modules/onscreengui/src/gui.cpp | 5 +++-- src/engine/configurationmanager.cpp | 12 +++++++++-- src/engine/downloadmanager.cpp | 2 +- src/engine/logfactory.cpp | 20 +++++++++++++++++-- src/engine/openspaceengine.cpp | 17 ++++++++++++---- src/interaction/luaconsole.cpp | 6 +++++- src/properties/property.cpp | 6 +++++- src/scene/scene.cpp | 6 ++++-- src/scene/scenegraph.cpp | 9 ++++++--- src/scripting/scriptengine_lua.inl | 6 +++++- src/util/spicemanager.cpp | 5 +++-- 18 files changed, 101 insertions(+), 34 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 56cff7b8d7..a9b5025618 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 56cff7b8d7add5e3c74af74585b79368f788129e +Subproject commit a9b5025618ecd83353c923c81a31b305d509dbb1 diff --git a/modules/base/rendering/modelgeometry.cpp b/modules/base/rendering/modelgeometry.cpp index f39402ae02..f6aa6b295a 100644 --- a/modules/base/rendering/modelgeometry.cpp +++ b/modules/base/rendering/modelgeometry.cpp @@ -84,7 +84,7 @@ ModelGeometry::ModelGeometry(const ghoul::Dictionary& dictionary) } _file = FileSys.absolutePath(_file); - if (!FileSys.fileExists(_file, true)) + if (!FileSys.fileExists(_file, ghoul::filesystem::FileSystem::RawPath::Yes)) LERROR("Could not load OBJ file '" << _file << "': File not found"); @@ -145,7 +145,10 @@ void ModelGeometry::deinitialize() { } bool ModelGeometry::loadObj(const std::string& filename) { - std::string cachedFile = FileSys.cacheManager()->cachedFilename(filename, true); + std::string cachedFile = FileSys.cacheManager()->cachedFilename( + filename, + ghoul::filesystem::CacheManager::Persistent::Yes + ); bool hasCachedFile = FileSys.fileExists(cachedFile); if (hasCachedFile) { diff --git a/modules/base/rendering/renderableplanet.cpp b/modules/base/rendering/renderableplanet.cpp index eac65915f0..08032110cf 100644 --- a/modules/base/rendering/renderableplanet.cpp +++ b/modules/base/rendering/renderableplanet.cpp @@ -144,7 +144,8 @@ bool RenderablePlanet::initialize() { if (!_programObject) return false; } - _programObject->setIgnoreSubroutineUniformLocationError(true); + using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError; + _programObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes); loadTexture(); _geometry->initialize(this); diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index ba28d3d73d..72e5ff6589 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -155,8 +155,9 @@ void RenderableSphere::render(const RenderData& data) { // Activate shader - _shader->activate(); - _shader->setIgnoreUniformLocationError(true); + using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError; + _shader->activate(); + _shader->setIgnoreUniformLocationError(IgnoreError::Yes); _shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix()); _shader->setUniform("ModelTransform", transform); @@ -174,7 +175,7 @@ void RenderableSphere::render(const RenderData& data) { _sphere->render(); - _shader->setIgnoreUniformLocationError(false); + _shader->setIgnoreUniformLocationError(IgnoreError::No); _shader->deactivate(); } diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 9e79ee29d8..a08f95ca81 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -206,8 +206,10 @@ void RenderableSphericalGrid::render(const RenderData& data){ } + using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError; + // setup the data to the shader - _gridProgram->setIgnoreUniformLocationError(true); + _gridProgram->setIgnoreUniformLocationError(IgnoreError::Yes); _gridProgram->setUniform("ViewProjection", data.camera.viewProjectionMatrix()); _gridProgram->setUniform("ModelTransform", transform); setPscUniforms(_gridProgram, &data.camera, data.position); diff --git a/modules/base/rendering/renderablestars.cpp b/modules/base/rendering/renderablestars.cpp index 836ea1593e..e1d35fd81b 100644 --- a/modules/base/rendering/renderablestars.cpp +++ b/modules/base/rendering/renderablestars.cpp @@ -191,7 +191,8 @@ void RenderableStars::render(const RenderData& data) { glm::mat4 viewMatrix = data.camera.viewMatrix(); glm::mat4 projectionMatrix = data.camera.projectionMatrix(); - _program->setIgnoreUniformLocationError(true); + using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError; + _program->setIgnoreUniformLocationError(IgnoreError::Yes); //_program->setUniform("ViewProjection", data.camera.viewProjectionMatrix()); //_program->setUniform("ModelTransform", glm::mat4(1.f)); _program->setUniform("model", modelMatrix); @@ -222,7 +223,8 @@ void RenderableStars::render(const RenderData& data) { glDrawArrays(GL_POINTS, 0, nStars); glBindVertexArray(0); - _program->setIgnoreUniformLocationError(false); + using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError; + _program->setIgnoreUniformLocationError(IgnoreError::No); _program->deactivate(); glDepthMask(true); @@ -343,7 +345,10 @@ void RenderableStars::update(const UpdateData& data) { bool RenderableStars::loadData() { std::string _file = _speckFile; - std::string cachedFile = FileSys.cacheManager()->cachedFilename(_file, true); + std::string cachedFile = FileSys.cacheManager()->cachedFilename( + _file, + ghoul::filesystem::CacheManager::Persistent::Yes + ); bool hasCachedFile = FileSys.fileExists(cachedFile); if (hasCachedFile) { diff --git a/modules/newhorizons/util/labelparser.cpp b/modules/newhorizons/util/labelparser.cpp index 03d9bcd929..86bbf50f8d 100644 --- a/modules/newhorizons/util/labelparser.cpp +++ b/modules/newhorizons/util/labelparser.cpp @@ -141,12 +141,15 @@ bool LabelParser::create() { std::string previousTarget; std::string lblName = ""; - ghoul::filesystem::Directory sequenceDir(_fileName, true); + using RawPath = ghoul::filesystem::Directory::RawPath; + ghoul::filesystem::Directory sequenceDir(_fileName, RawPath::Yes); if (!FileSys.directoryExists(sequenceDir)) { LERROR("Could not load Label Directory '" << sequenceDir.path() << "'"); return false; } - std::vector sequencePaths = sequenceDir.read(true, false); // check inputs + using Recursive = ghoul::filesystem::Directory::Recursive; + using Sort = ghoul::filesystem::Directory::Sort; + std::vector sequencePaths = sequenceDir.read(Recursive::Yes, Sort::No); for (auto path : sequencePaths){ if (size_t position = path.find_last_of(".") + 1){ if (position != std::string::npos){ diff --git a/modules/onscreengui/src/gui.cpp b/modules/onscreengui/src/gui.cpp index a222998475..b984aedd0b 100644 --- a/modules/onscreengui/src/gui.cpp +++ b/modules/onscreengui/src/gui.cpp @@ -150,8 +150,9 @@ void GUI::setEnabled(bool enabled) { } void GUI::initialize() { - std::string cachedFile = FileSys.cacheManager()->cachedFilename(configurationFile, - "", true); + std::string cachedFile = FileSys.cacheManager()->cachedFilename( + configurationFile, "", ghoul::filesystem::CacheManager::Persistent::Yes + ); char* buffer = new char[cachedFile.size() + 1]; diff --git a/src/engine/configurationmanager.cpp b/src/engine/configurationmanager.cpp index cc399a6535..1d7605de6d 100644 --- a/src/engine/configurationmanager.cpp +++ b/src/engine/configurationmanager.cpp @@ -75,7 +75,9 @@ string ConfigurationManager::findConfiguration(const string& filename) { if (exists) return fullPath; - Directory nextDirectory = directory.parentDirectory(true); + Directory nextDirectory = directory.parentDirectory( + ghoul::filesystem::Directory::AbsolutePath::Yes + ); if (directory.path() == nextDirectory.path()) { // We have reached the root of the file system and did not find the file @@ -120,7 +122,13 @@ void ConfigurationManager::loadFromFile(const string& filename) { bool override = (basePathToken == fullKey); if (override) LINFOC("ConfigurationManager", "Overriding base path with '" << p << "'"); - FileSys.registerPathToken(std::move(fullKey), std::move(p), override); + + using Override = ghoul::filesystem::FileSystem::Override; + FileSys.registerPathToken( + std::move(fullKey), + std::move(p), + override ? Override::Yes : Override::No + ); } } diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index 46cfb3940f..c094e11033 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -202,7 +202,7 @@ std::vector DownloadManager::downloadRequestFiles( DownloadProgressCallback progressCallback) { std::vector futures; - FileSys.createDirectory(destination, true); + FileSys.createDirectory(destination, ghoul::filesystem::FileSystem::Recursive::Yes); // TODO: Check s ---abock // TODO: Escaping is necessary ---abock const std::string fullRequest =_requestURL.back() + "?" + diff --git a/src/engine/logfactory.cpp b/src/engine/logfactory.cpp index 48b7352dba..83ebd83bdc 100644 --- a/src/engine/logfactory.cpp +++ b/src/engine/logfactory.cpp @@ -74,14 +74,30 @@ std::unique_ptr createLog(const ghoul::Dictionary& dictiona bool logLevelStamp = true; dictionary.getValue(keyLogLevelStamping, logLevelStamp); + using Append = ghoul::logging::TextLog::Append; + using TimeStamping = ghoul::logging::Log::TimeStamping; + using DateStamping = ghoul::logging::Log::DateStamping; + using CategoryStamping = ghoul::logging::Log::CategoryStamping; + using LogLevelStamping = ghoul::logging::Log::LogLevelStamping; + if (type == valueHtmlLog) { return std::make_unique( - filename, append, timeStamp, dateStamp, categoryStamp, logLevelStamp + filename, + append ? Append::Yes : Append::No, + timeStamp ? TimeStamping::Yes : TimeStamping::No, + dateStamp ? DateStamping::Yes : DateStamping::No, + categoryStamp ? CategoryStamping::Yes : CategoryStamping::No, + logLevelStamp ? LogLevelStamping::Yes : LogLevelStamping::No ); } else if (type == valueTextLog) { return std::make_unique( - filename, append, timeStamp, dateStamp, categoryStamp, logLevelStamp + filename, + append ? Append::Yes : Append::No, + timeStamp ? TimeStamping::Yes : TimeStamping::No, + dateStamp ? DateStamping::Yes : DateStamping::No, + categoryStamp ? CategoryStamping::Yes : CategoryStamping::No, + logLevelStamp ? LogLevelStamping::Yes : LogLevelStamping::No ); } else { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 40d2924de7..c924357c9e 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -104,7 +104,9 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName, , _renderEngine(new RenderEngine) , _scriptEngine(new scripting::ScriptEngine) , _networkEngine(new NetworkEngine) - , _commandlineParser(new ghoul::cmdparser::CommandlineParser(programName, true)) + , _commandlineParser(new ghoul::cmdparser::CommandlineParser( + programName, ghoul::cmdparser::CommandlineParser::AllowUnknownCommands::Yes + )) , _console(new LuaConsole) , _moduleEngine(new ModuleEngine) , _gui(new gui::GUI) @@ -167,7 +169,10 @@ bool OpenSpaceEngine::create(int argc, char** argv, // logs from the configuration file. If the user requested as specific loglevel in the // configuration file, we will deinitialize this LogManager and reinitialize it later // with the correct LogLevel - LogManager::initialize(LogManager::LogLevel::Debug, true); + LogManager::initialize( + LogManager::LogLevel::Debug, + ghoul::logging::LogManager::ImmediateFlush::Yes + ); LogMgr.addLog(std::make_unique()); LDEBUG("Initialize FileSystem"); @@ -242,7 +247,7 @@ bool OpenSpaceEngine::create(int argc, char** argv, if (!FileSys.directoryExists(token)) { std::string p = absPath(token); LDEBUG("Directory '" << p << "' does not exist, creating."); - FileSys.createDirectory(p, true); + FileSys.createDirectory(p, ghoul::filesystem::FileSystem::Recursive::Yes); } } @@ -550,7 +555,11 @@ void OpenSpaceEngine::configureLogging() { LogManager::LogLevel level = LogManager::levelFromString(logLevel); LogManager::deinitialize(); - LogManager::initialize(level, immediateFlush); + using ImmediateFlush = ghoul::logging::LogManager::ImmediateFlush; + LogManager::initialize( + level, + immediateFlush ? ImmediateFlush::Yes : ImmediateFlush::No + ); LogMgr.addLog(std::make_unique()); } diff --git a/src/interaction/luaconsole.cpp b/src/interaction/luaconsole.cpp index 35ef609e04..506e395d5a 100644 --- a/src/interaction/luaconsole.cpp +++ b/src/interaction/luaconsole.cpp @@ -66,7 +66,11 @@ LuaConsole::LuaConsole() } void LuaConsole::initialize() { - _filename = FileSys.cacheManager()->cachedFilename(historyFile, "", true); + _filename = FileSys.cacheManager()->cachedFilename( + historyFile, + "", + ghoul::filesystem::CacheManager::Persistent::Yes + ); std::ifstream file(_filename, std::ios::binary | std::ios::in); if (file.good()) { diff --git a/src/properties/property.cpp b/src/properties/property.cpp index 99e3cee46f..99ea40b4d5 100644 --- a/src/properties/property.cpp +++ b/src/properties/property.cpp @@ -141,7 +141,11 @@ void Property::setReadOnly(bool state) { } void Property::setViewOption(std::string option, bool value) { - _metaData.setValue(_metaDataKeyViewPrefix + option, value, true); + _metaData.setValue( + _metaDataKeyViewPrefix + option, + value, + ghoul::Dictionary::CreateIntermediate::Yes + ); } const ghoul::Dictionary& Property::metaData() const { diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 30c5b4aea6..fe790c5fd5 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -90,8 +90,10 @@ bool Scene::initialize() { "fboPassProgram", "${SHADERS}/fboPass_vs.glsl", "${SHADERS}/fboPass_fs.glsl"); - if (!tmpProgram) return false; - tmpProgram->setIgnoreSubroutineUniformLocationError(true); + if (!tmpProgram) + return false; + + tmpProgram->setIgnoreSubroutineUniformLocationError(ProgramObject::IgnoreError::Yes); OsEng.configurationManager().setValue("fboPassProgram", tmpProgram.get()); return true; diff --git a/src/scene/scenegraph.cpp b/src/scene/scenegraph.cpp index 6dbfbcb9fd..cf69955fb5 100644 --- a/src/scene/scenegraph.cpp +++ b/src/scene/scenegraph.cpp @@ -81,7 +81,8 @@ bool SceneGraph::loadFromFile(const std::string& sceneDescription) { std::string absSceneFile = absPath(sceneDescription); // See if scene file exists - if (!FileSys.fileExists(absSceneFile, true)) { + using RawPath = ghoul::filesystem::FileSystem::RawPath; + if (!FileSys.fileExists(absSceneFile, RawPath::Yes)) { LERROR("Could not load scene file '" << absSceneFile << "'. " << "File not found"); return false; @@ -97,8 +98,10 @@ bool SceneGraph::loadFromFile(const std::string& sceneDescription) { return false; } - std::string sceneDescriptionDirectory = - ghoul::filesystem::File(absSceneFile, true).directoryName(); + std::string sceneDescriptionDirectory = ghoul::filesystem::File( + absSceneFile, + ghoul::filesystem::File::RawPath::Yes + ).directoryName(); std::string sceneDirectory("."); sceneDictionary.getValue(KeyPathScene, sceneDirectory); diff --git a/src/scripting/scriptengine_lua.inl b/src/scripting/scriptengine_lua.inl index 8ba3c375b4..38ce5a1b16 100644 --- a/src/scripting/scriptengine_lua.inl +++ b/src/scripting/scriptengine_lua.inl @@ -144,7 +144,11 @@ namespace luascriptfunctions { std::string pathToken = luaL_checkstring(L, -1); std::string path = luaL_checkstring(L, -2); - FileSys.registerPathToken(pathToken, path, true); + FileSys.registerPathToken( + pathToken, + path, + ghoul::filesystem::FileSystem::Override::Yes + ); return 0; } diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index 08310d30da..b74839b2db 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -211,7 +211,8 @@ SpiceManager::KernelHandle SpiceManager::loadKernel(string filePath) { // to the directory they reside in. The directory change is not necessary for regular // kernels ghoul::filesystem::Directory currentDirectory = FileSys.currentDirectory(); - string fileDirectory = ghoul::filesystem::File(path, true).directoryName(); + using RawPath = ghoul::filesystem::File::RawPath; + string fileDirectory = ghoul::filesystem::File(path, RawPath::Yes).directoryName(); FileSys.setCurrentDirectory(fileDirectory); LINFO("Loading SPICE kernel '" << path << "'"); @@ -223,7 +224,7 @@ SpiceManager::KernelHandle SpiceManager::loadKernel(string filePath) { throwOnSpiceError("Kernel loading"); - string fileExtension = ghoul::filesystem::File(path, true).fileExtension(); + string fileExtension = ghoul::filesystem::File(path, RawPath::Yes).fileExtension(); if (fileExtension == "bc" || fileExtension == "BC") findCkCoverage(path); // binary ck kernel else if (fileExtension == "bsp" || fileExtension == "BSP")