20,741
edits
(→Issues) |
|||
Line 209: | Line 209: | ||
== Proof of Concept == | == Proof of Concept == | ||
{{WIP}} | {{WIP}} | ||
{{Note|This is just intended to demonstrate the concept; as mentioned before, it would make sense to move this to the run() method of the GeneralInitOperation struct, so that we can access the gl-vendor and gl-renderer information to proceed from here. | |||
}} | |||
<syntaxhighlight lang="diff">diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx | |||
index b7fea20..615d0a9 100644 | |||
--- a/src/Main/fg_init.cxx | |||
+++ b/src/Main/fg_init.cxx | |||
@@ -469,7 +469,24 @@ int fgInitConfig ( int argc, char **argv, bool reinit ) | |||
SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences"); | |||
fgLoadProps("preferences.xml", globals->get_props()); | |||
SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences"); | |||
- | |||
+ | |||
+ // Next, try to load defaults for /sim/rendering | |||
+ SGPropertyNode* fgroot = globals->get_props(); | |||
+ try { | |||
+ SGPropertyNode* rendering = fgroot->getNode("/sim/rendering"); | |||
+ std::string path = "Profiles/graphics.xml"; | |||
+ if(rendering) { | |||
+ SG_LOG(SG_INPUT, SG_INFO, "Loading graphics profiles from:" <<path); | |||
+ fgLoadProps(path.c_str(), rendering); | |||
+ } | |||
+ else SG_LOG(SG_INPUT, SG_ALERT, "Could not acquire handle to /sim/rendering for loading graphics profile from "<<path); | |||
+ } | |||
+ catch (const std::exception& e) { | |||
+ SG_LOG(SG_INPUT, SG_INFO, "caught std::exception trying to read graphics profile"); | |||
+ } catch (...) { | |||
+ SG_LOG(SG_INPUT, SG_INFO, "caught generic exception trying to read graphics profile"); | |||
+ } | |||
+ | |||
// do not load user settings when reset to default is requested, or if | |||
// told to explicitly ignore | |||
if (options->isOptionSet("restore-defaults") || options->isOptionSet("ignore-autosave")) | |||
</syntaxhighlight> | |||
{{Note|$FG_ROOT/Profiles/graphics.xml (this is just a copy of the /rendering portion of preferences.xml for now) | {{Note|$FG_ROOT/Profiles/graphics.xml (this is just a copy of the /rendering portion of preferences.xml for now) | ||
Line 469: | Line 506: | ||
</PropertyList> | </PropertyList> | ||
<!-- end of graphics.xml --> | <!-- end of graphics.xml --> | ||
</syntaxhighlight> | </syntaxhighlight> |