diff --git a/application/F3DOptionsParser.cxx b/application/F3DOptionsParser.cxx index 3a64eb04eb..87ecbc5881 100644 --- a/application/F3DOptionsParser.cxx +++ b/application/F3DOptionsParser.cxx @@ -325,9 +325,8 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o try { - // TODO recover list of keys from somwhere std::map libArgs; - std::vector keys = options.getOptionStrings(); + std::vector keys = options.getNames(); for (const std::string& key : keys) { libArgs[key] = options.getString(key); @@ -468,7 +467,7 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o { options.setString(key, val); } - +/* #ifndef F3D_NO_DEPRECATED if (deprecatedQuiet) { @@ -488,7 +487,7 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o for (const std::string& input : deprecatedInputs) { - /* `deprecatedInputs` may contain an empty string instead of being empty itself */ + // `deprecatedInputs` may contain an empty string instead of being empty itself if (!input.empty()) { f3d::log::warn("--input option is deprecated, please use positional arguments instead."); @@ -497,7 +496,7 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o } inputs = deprecatedInputs; #endif - +*/ auto unmatched = result.unmatched(); bool found_unknown_option = false; for (std::string unknownOption : unmatched) @@ -567,6 +566,10 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o { // this will update the options using the config file without parsing actual argc/argv cxxOptions.parse(1, nullptr); + for(auto [key,val] : libArgs) + { + options.setString(key, val); + } } } catch (const cxxopts::exceptions::exception& ex) diff --git a/application/F3DStarter.cxx b/application/F3DStarter.cxx index cf4f41d787..91ec022bc8 100644 --- a/application/F3DStarter.cxx +++ b/application/F3DStarter.cxx @@ -383,8 +383,7 @@ F3DStarter::F3DStarter() : Internals(std::make_unique()) { // Set option outside of command line and config file - this->Internals->DynamicOptions.set( - "ui.dropzone-info", "Drop a file or HDRI to load it\nPress H to show cheatsheet"); + this->Internals->DynamicOptions.getStruct().ui.dropzone_info = "Drop a file or HDRI to load it\nPress H to show cheatsheet"; // Initialize dmon dmon_init(); @@ -510,9 +509,9 @@ int F3DStarter::Start(int argc, char** argv) // TODO: add a image::canRead // Load the file as an HDRI instead of adding it. - this->Internals->Engine->getOptions().set("render.hdri.file", file); - this->Internals->Engine->getOptions().set("render.hdri.ambient", true); - this->Internals->Engine->getOptions().set("render.background.skybox", true); + this->Internals->Engine->getOptions().getStruct().render.hdri.file = file; + this->Internals->Engine->getOptions().getStruct().render.hdri.ambient = true; + this->Internals->Engine->getOptions().getStruct().render.background.skybox = true; // Rendering now is needed for correct lighting this->Render(); @@ -557,13 +556,12 @@ int F3DStarter::Start(int argc, char** argv) if (!fullPath.empty()) { - this->Internals->Engine->getOptions().set( - "model.scivis.colormap", F3DColorMapTools::Read(fullPath)); + this->Internals->Engine->getOptions().getStruct().model.scivis.colormap = F3DColorMapTools::Read(fullPath); } else { f3d::log::error("Cannot find the colormap ", this->Internals->AppOptions.ColorMapFile); - this->Internals->Engine->getOptions().set("model.scivis.colormap", std::vector{}); + this->Internals->Engine->getOptions().getStruct().model.scivis.colormap = std::vector{}; } } @@ -896,8 +894,8 @@ void F3DStarter::LoadFile(int index, bool relativeIndex) loader.loadGeometry("", true); } - this->Internals->Engine->getOptions().set("ui.dropzone", !this->Internals->LoadedFile); - this->Internals->Engine->getOptions().set("ui.filename-info", filenameInfo); + this->Internals->Engine->getOptions().getStruct().ui.dropzone = !this->Internals->LoadedFile; + this->Internals->Engine->getOptions().getStruct().ui.filename_info = filenameInfo; } //---------------------------------------------------------------------------- @@ -948,18 +946,18 @@ void F3DStarter::SaveScreenshot(const std::string& filenameTemplate, bool minima f3d::options& options = this->Internals->Engine->getOptions(); f3d::options optionsCopy = this->Internals->Engine->getOptions(); -/* TODO - bool noBackground = this->Internals->AppOptions.NoBackground; + bool noBackground = this->Internals->AppOptions.NoBackground; + f3d::options_struct& optionStruct = options.getStruct(); if (minimal) { - options.set("ui.bar", false); - options.set("ui.cheatsheet", false); - options.set("ui.filename", false); - options.set("ui.fps", false); - options.set("ui.metadata", false); - options.set("ui.animation-progress", false); - options.set("interactor.axis", false); - options.set("render.grid.enable", false); + optionStruct.ui.scalar_bar = false; + optionStruct.ui.cheatsheet = false; + optionStruct.ui.filename = false; + optionStruct.ui.fps = false; + optionStruct.ui.metadata = false; + optionStruct.ui.animation_progress = false; + optionStruct.interactor.axis = false; + optionStruct.render.grid.enable = false; noBackground = true; } @@ -967,9 +965,8 @@ void F3DStarter::SaveScreenshot(const std::string& filenameTemplate, bool minima this->Internals->addOutputImageMetadata(img); img.save(path.string(), f3d::image::SaveFormat::PNG); - options.getAsDoubleRef("render.light.intensity") *= 5; + optionStruct.render.light.intensity = optionStruct.render.light.intensity * 5; this->Render(); - */ this->Internals->Engine->setOptions(optionsCopy); this->Render();