diff options
| author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2026-08-25 12:56:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-25 12:56:22 -0400 |
| commit | 2e9c387fee881022aec13d5c85f901539683c18f (patch) | |
| tree | d2cc89444771d96871b3126c9462f072dc059e32 /indra/llxml/llcontrol.cpp | |
| parent | 92289533c1b95bc0fb2cdcc1217ae539485ea244 (diff) | |
| parent | a402fd4da91bbce03340e174505c06feede65866 (diff) | |
Merge branch 'develop' into project/lua_editor
Diffstat (limited to 'indra/llxml/llcontrol.cpp')
| -rw-r--r-- | indra/llxml/llcontrol.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 84d03a6d0c..eccf672e46 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -192,20 +192,6 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value) storable_value = false; } } - else if (TYPE_LLSD == type() && value.isString()) - { - LLPointer<LLSDNotationParser> parser = new LLSDNotationParser; - LLSD result; - std::stringstream value_stream(value.asString()); - if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE) - { - storable_value = result; - } - else - { - storable_value = value; - } - } else { storable_value = value; @@ -735,6 +721,30 @@ void LLControlGroup::setLLSD(std::string_view name, const LLSD& val) set(name, val); } +bool LLControlVariable::setValueFromNotation(const std::string& notation, bool saved_value) +{ + if (mType == TYPE_LLSD) + { + LLPointer<LLSDNotationParser> parser = new LLSDNotationParser; + LLSD result; + std::stringstream value_stream(notation); + S32 parse_count = parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED); + if (parse_count != LLSDParser::PARSE_FAILURE) + { + setValue(result, saved_value); + return true; + } + LL_WARNS("Controls") << "Failed to parse LLSD notation for control '" + << mName << "': " << notation << LL_ENDL; + } + else + { + LL_WARNS("Controls") << "setValueFromNotation() called on non-LLSD control '" + << mName << "' (type " << LLControlGroup::typeEnumToString(mType) << "); ignoring." << LL_ENDL; + } + return false; +} + void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val) { if (name.empty()) |
