diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-04-28 23:29:46 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-04-28 23:29:46 +0000 |
commit | 16baf6c9d43fc29e697b5a460439ca664897450c (patch) | |
tree | 6c3ae45c538cbc90408ab72f3a02564cf5dce754 /indra/llxml | |
parent | 75ee8558abb662b6a0a6b559c61a9549818d2962 (diff) |
merge release-QAR-499 Viewer 1.20 RC 3
merge release-QAR-508 Viewer 1.20 RC 4
merge Branch_1-20-Viewer -r 85278 : 85828 -> release
Diffstat (limited to 'indra/llxml')
-rw-r--r-- | indra/llxml/llcontrol.cpp | 33 | ||||
-rw-r--r-- | indra/llxml/llcontrol.h | 2 |
2 files changed, 29 insertions, 6 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index a1d2620a6f..2c4fb3bccc 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -953,7 +953,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) return num_saved; } -U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as) +U32 LLControlGroup::loadFromFile(const LLString& filename) { LLString name; LLSD settings; @@ -965,24 +965,47 @@ U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declarat llwarns << "Cannot find file " << filename << " to load." << llendl; return 0; } + S32 ret = LLSDSerialize::fromXML(settings, infile); + if (ret <= 0) { infile.close(); llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl; - return loadFromFileLegacy(filename, require_declaration, declare_as); + return loadFromFileLegacy(filename, TRUE, TYPE_STRING); } - U32 validitems = 0; + U32 validitems = 0; int persist = 1; for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr) { name = (*itr).first; control_map = (*itr).second; - if(control_map.has("Persist")) persist = control_map["Persist"].asInteger(); + if(control_map.has("Persist")) + { + persist = control_map["Persist"].asInteger(); + } - declareControl(name, typeStringToEnum(control_map["Type"].asString()), control_map["Value"], control_map["Comment"].asString(), persist); + // If the control exists just set the value from the input file. + LLControlVariable* existing_control = getControl(name); + if(existing_control) + { + // Check persistence. If not persisted, we shouldn't be loading. + if(existing_control->isPersisted()) + { + existing_control->setValue(control_map["Value"]); + } + } + else + { + declareControl(name, + typeStringToEnum(control_map["Type"].asString()), + control_map["Value"], + control_map["Comment"].asString(), + persist + ); + } ++validitems; } diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index 7a638a7b73..7287731cfa 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -213,7 +213,7 @@ public: // as the given type. U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); U32 saveToFile(const LLString& filename, BOOL nondefault_only); - U32 loadFromFile(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); + U32 loadFromFile(const LLString& filename); void resetToDefaults(); |