From 4df8fe0138b992d91ee9ca7abe972d41df8df00d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 26 Mar 2026 09:59:43 -0700 Subject: Support for metadata and script subtype. --- indra/llinventory/llinventory.cpp | 65 +++++++++++++++++++++++++++++++++++++++ indra/llinventory/llinventory.h | 3 ++ 2 files changed, 68 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 3defad8f3b..c83717fef5 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; } +std::string LLInventoryObject::getRuntime() const +{ + return mRuntime; +} + const std::string& LLInventoryObject::getName() const { return mName; @@ -190,6 +198,18 @@ void LLInventoryObject::setFavorite(bool favorite) mFavorite = favorite; } +void LLInventoryObject::setRuntime(std::string_view runtime) +{ + if (getType() == LLAssetType::AT_LSL_TEXT) + { + mRuntime = runtime; + } + else + { + mRuntime.clear(); + } +} + void LLInventoryObject::setType(LLAssetType::EType type) { mType = type; @@ -279,6 +299,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 +450,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 +814,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 +989,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())) @@ -1052,6 +1097,17 @@ 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(); + } + continue; + } + if (i->first == INV_PERMISSIONS_LABEL) { mPermissions.importLLSD(i->second); @@ -1471,6 +1527,15 @@ bool LLInventoryCategory::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 { diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 58dea83617..ad270f317d 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -72,6 +72,7 @@ public: const LLUUID& getParentUUID() const; virtual const LLUUID& getThumbnailUUID() const; virtual bool getIsFavorite() const; + virtual std::string getRuntime() const; virtual const std::string& getName() const; virtual LLAssetType::EType getType() const; LLAssetType::EType getActualType() const; // bypasses indirection for linked items @@ -88,6 +89,7 @@ public: void setParent(const LLUUID& new_parent); virtual void setThumbnailUUID(const LLUUID& thumbnail_uuid); virtual void setFavorite(bool favorite); + virtual void setRuntime(std::string_view runtime); void setType(LLAssetType::EType type); virtual void setCreationDate(time_t creation_date_utc); // only stored for items @@ -114,6 +116,7 @@ protected: LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL. LLUUID mThumbnailUUID; bool mFavorite; + std::string mRuntime; LLAssetType::EType mType; std::string mName; time_t mCreationDate; // seconds from 1/1/1970, UTC -- cgit v1.3