diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-04-01 19:50:33 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2026-04-01 19:50:33 +0300 |
| commit | f5908eddc683dd705d334c88377139e39bbfb54f (patch) | |
| tree | 75c0ff026fe13c0a507a4527b697aa212736998d /indra/llinventory/llinventory.cpp | |
| parent | d045f9aa32789a35628aced166145c182751acbf (diff) | |
| parent | f209affdfdf271098843ba400d7a75b00f827233 (diff) | |
Merge branch 'project/lua_editor' into marchcat/devlinux-slua
# Conflicts:
# indra/llcommon/llstl.h
# indra/newview/app_settings/settings.xml
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
| -rw-r--r-- | indra/llinventory/llinventory.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index f126accfb8..1fcf70dc25 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -61,6 +61,8 @@ static const std::string INV_SALE_INFO_LABEL("sale_info"); static const std::string INV_FLAGS_LABEL("flags"); static const std::string INV_CREATION_DATE_LABEL("created_at"); static const std::string INV_TOGGLED_LABEL("toggled"); +static const std::string INV_SCRIPT_LABEL("script"); +static const std::string INV_RUNTIME_LABEL("runtime"); // key used by agent-inventory-service static const std::string INV_ASSET_TYPE_LABEL_WS("type_default"); @@ -109,6 +111,7 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other) mName = other->mName; mThumbnailUUID = other->mThumbnailUUID; mFavorite = other->mFavorite; + mRuntime = other->mRuntime; } const LLUUID& LLInventoryObject::getUUID() const @@ -131,6 +134,11 @@ bool LLInventoryObject::getIsFavorite() const return mFavorite; } +const std::string& LLInventoryObject::getRuntime() const +{ + return mRuntime; +} + const std::string& LLInventoryObject::getName() const { return mName; @@ -190,9 +198,23 @@ void LLInventoryObject::setFavorite(bool favorite) mFavorite = favorite; } +void LLInventoryObject::setRuntime(std::string_view runtime) +{ + // Store the runtime unconditionally; it will be validated/cleared + // when the final asset type is known (see setType()). + mRuntime = runtime; +} + void LLInventoryObject::setType(LLAssetType::EType type) { mType = type; + + // Only LSL text assets are expected to have a runtime; clear any + // previously stored runtime for other asset types. + if (mType != LLAssetType::AT_LSL_TEXT) + { + mRuntime.clear(); + } } @@ -279,6 +301,15 @@ bool LLInventoryObject::importLegacyStream(std::istream& input_stream) { setFavorite(false); } + + if (metadata.has("script") && metadata["script"].has("runtime")) + { + setRuntime(metadata["script"]["runtime"].asString()); + } + else + { + setRuntime(std::string()); + } } else if(0 == strcmp("name", keyword)) { @@ -421,6 +452,7 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other) mInventoryType = other->mInventoryType; mFlags = other->mFlags; mCreationDate = other->mCreationDate; + mRuntime = other->mRuntime; } // If this is a linked item, then the UUID of the base object is @@ -784,6 +816,16 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream) { setFavorite(false); } + + if (metadata.has("script") && metadata["script"].has("runtime")) + { + setRuntime(metadata["script"]["runtime"].asString()); + } + else + { + setRuntime(std::string()); + } + } else if(0 == strcmp("inv_type", keyword)) { @@ -949,6 +991,11 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); } + if (!mRuntime.empty()) + { + sd[INV_SCRIPT_LABEL] = LLSD().with(INV_RUNTIME_LABEL, mRuntime); + } + U32 mask = mPermissions.getMaskBase(); if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) || (mAssetUUID.isNull())) @@ -1050,6 +1097,23 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) continue; } + if (i->first == INV_SCRIPT_LABEL) + { + const LLSD& script_map = i->second; + const std::string w = INV_RUNTIME_LABEL; + if (script_map.has(w)) + { + mRuntime = script_map[w].asString(); + } + else + { + // Clear any stale runtime when a script block is present + // but no explicit runtime value is provided. + mRuntime.clear(); + } + continue; + } + if (i->first == INV_PERMISSIONS_LABEL) { mPermissions.importLLSD(i->second); @@ -1469,6 +1533,8 @@ bool LLInventoryCategory::importLegacyStream(std::istream& input_stream) { setFavorite(false); } + setRuntime(std::string()); + } else { |
