summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2026-04-01 19:50:33 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2026-04-01 19:50:33 +0300
commitf5908eddc683dd705d334c88377139e39bbfb54f (patch)
tree75c0ff026fe13c0a507a4527b697aa212736998d /indra/llinventory
parentd045f9aa32789a35628aced166145c182751acbf (diff)
parentf209affdfdf271098843ba400d7a75b00f827233 (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')
-rw-r--r--indra/llinventory/llinventory.cpp66
-rw-r--r--indra/llinventory/llinventory.h11
-rw-r--r--indra/llinventory/llinventorydefines.h5
-rw-r--r--indra/llinventory/llinventorytype.h7
4 files changed, 81 insertions, 8 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
{
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index 181c46226c..c22b17ab66 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -24,11 +24,11 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLINVENTORY_H
-#define LL_LLINVENTORY_H
+#pragma once
#include "llfoldertype.h"
#include "llinventorytype.h"
+#include "llinventorydefines.h"
#include "llpermissions.h"
#include "llrefcount.h"
#include "llsaleinfo.h"
@@ -72,6 +72,7 @@ public:
const LLUUID& getParentUUID() const;
virtual const LLUUID& getThumbnailUUID() const;
virtual bool getIsFavorite() const;
+ virtual const 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
@@ -166,6 +169,7 @@ public:
virtual const std::string& getActualDescription() const; // Does not follow links
virtual const LLSaleInfo& getSaleInfo() const;
virtual LLInventoryType::EType getInventoryType() const;
+ virtual U8 getInventorySubType() const { return getFlags() & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK; }
virtual U32 getFlags() const;
virtual time_t getCreationDate() const;
virtual U32 getCRC32() const; // really more of a checksum.
@@ -182,6 +186,7 @@ public:
void setSaleInfo(const LLSaleInfo& sale_info);
void setPermissions(const LLPermissions& perm);
void setInventoryType(LLInventoryType::EType inv_type);
+ void setInventorySubType(U8 sub_type) { setFlags((getFlags() & ~LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK) | (sub_type & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK)); }
void setFlags(U32 flags);
void setCreator(const LLUUID& creator); // only used for calling cards
@@ -294,5 +299,3 @@ protected:
LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item);
LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat);
LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat);
-
-#endif // LL_LLINVENTORY_H
diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h
index 8e7bd87ac4..9088d172d9 100644
--- a/indra/llinventory/llinventorydefines.h
+++ b/indra/llinventory/llinventorydefines.h
@@ -24,8 +24,7 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLINVENTORYDEFINES_H
-#define LL_LLINVENTORYDEFINES_H
+#pragma once
// Consts for "key" field in the task inventory update message
extern const U8 TASK_INVENTORY_ITEM_KEY;
@@ -97,5 +96,3 @@ public:
// on a pre-existing inventory item (DEV-28098 and DEV-30997)
};
};
-
-#endif // LL_LLINVENTORYDEFINES_H
diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
index c90f8aa107..0627b8df3c 100644
--- a/indra/llinventory/llinventorytype.h
+++ b/indra/llinventory/llinventorytype.h
@@ -150,6 +150,13 @@ private:
~LLInventoryType( void );
};
+// Subtypes for scripts, (inventory type IT_LSL).
+enum ScriptSubtype_t
+{
+ SST_LSL = 0,
+ SST_LUA = 1
+};
+
// helper function that returns true if inventory type and asset type
// are potentially compatible. For example, an attachment must be an
// object, but a wearable can be a bodypart or clothing asset.