summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llassettype.cpp98
-rw-r--r--indra/llcommon/llassettype.h7
-rw-r--r--indra/llmessage/lltransfersourceasset.cpp49
-rw-r--r--indra/llmessage/lltransfersourceasset.h20
-rw-r--r--indra/newview/llinventorybridge.cpp2
5 files changed, 71 insertions, 105 deletions
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index 6d5b12d840..e5068f1bc5 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -45,19 +45,25 @@ struct AssetEntry : public LLDictionaryEntry
AssetEntry(const char *desc_name,
const char *type_name, // 8 character limit!
const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one
- bool can_link) // can you create a link to this type?
+ BOOL can_link, // can you create a link to this type?
+ BOOL can_fetch, // can you fetch this asset by ID?
+ BOOL can_know) // can you see this asset's ID?
:
LLDictionaryEntry(desc_name),
mTypeName(type_name),
mHumanName(human_name),
- mCanLink(can_link)
+ mCanLink(can_link),
+ mCanFetch(can_fetch),
+ mCanKnow(can_know)
{
llassert(strlen(mTypeName) <= 8);
}
const char *mTypeName;
const char *mHumanName;
- bool mCanLink;
+ BOOL mCanLink;
+ BOOL mCanFetch;
+ BOOL mCanKnow;
};
class LLAssetDictionary : public LLSingleton<LLAssetDictionary>,
@@ -69,32 +75,32 @@ public:
LLAssetDictionary::LLAssetDictionary()
{
- // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK?
- // |--------------------|-----------|-------------------|-----------|
- addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", FALSE));
- addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", FALSE));
- addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", FALSE));
- addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", FALSE));
- addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", FALSE));
- addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", TRUE));
- addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", TRUE));
- addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", FALSE));
- addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", TRUE));
- addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", FALSE));
- addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", FALSE));
- addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", FALSE));
- addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", TRUE));
- addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", FALSE));
- addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", FALSE));
- addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", FALSE));
- addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", FALSE));
- addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", TRUE));
- addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", FALSE));
-
- addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", FALSE));
- addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", FALSE));
-
- addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE));
+ // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK? CAN FETCH? CAN KNOW?
+ // |--------------------|-----------|-------------------|-----------|-----------|---------|
+ addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", FALSE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", FALSE, TRUE, TRUE));
+ addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", FALSE, TRUE, TRUE));
+ addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", TRUE, TRUE, TRUE));
+ addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", TRUE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", FALSE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", TRUE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", TRUE, TRUE, TRUE));
+ addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", FALSE, FALSE, FALSE));
+ addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", FALSE, TRUE, TRUE));
+ addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", TRUE, TRUE, TRUE));
+ addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", FALSE, FALSE, FALSE));
+
+ addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "sym link", FALSE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "sym folder link", FALSE, FALSE, TRUE));
+
+ addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE, FALSE, FALSE));
};
// static
@@ -196,7 +202,7 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_
}
// static
-bool LLAssetType::lookupCanLink(EType asset_type)
+BOOL LLAssetType::lookupCanLink(EType asset_type)
{
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
const AssetEntry *entry = dict->lookup(asset_type);
@@ -204,18 +210,18 @@ bool LLAssetType::lookupCanLink(EType asset_type)
{
return entry->mCanLink;
}
- return false;
+ return FALSE;
}
// static
// Not adding this to dictionary since we probably will only have these two types
-bool LLAssetType::lookupIsLinkType(EType asset_type)
+BOOL LLAssetType::lookupIsLinkType(EType asset_type)
{
if (asset_type == AT_LINK || asset_type == AT_LINK_FOLDER)
{
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
// static
@@ -225,3 +231,27 @@ const std::string &LLAssetType::badLookup()
return sBadLookup;
}
+
+// static
+BOOL LLAssetType::lookupIsAssetFetchByIDAllowed(EType asset_type)
+{
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ {
+ return entry->mCanFetch;
+ }
+ return FALSE;
+}
+
+// static
+BOOL LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
+{
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ {
+ return entry->mCanKnow;
+ }
+ return FALSE;
+}
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index c7bbc2e74a..4440e1bac3 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -143,9 +143,12 @@ public:
static EType getType(const std::string& desc_name);
static const std::string& getDesc(EType asset_type);
- static bool lookupCanLink(EType asset_type);
- static bool lookupIsLinkType(EType asset_type);
+ static BOOL lookupCanLink(EType asset_type);
+ static BOOL lookupIsLinkType(EType asset_type);
+ static BOOL lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download
+ static BOOL lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer
+
static const std::string& badLookup(); // error string when a lookup fails
protected:
diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp
index abfb432020..43f7c07e94 100644
--- a/indra/llmessage/lltransfersourceasset.cpp
+++ b/indra/llmessage/lltransfersourceasset.cpp
@@ -60,7 +60,7 @@ void LLTransferSourceAsset::initTransfer()
// to the simulator. This is subset of assets we allow to be
// simply pulled straight from the asset system.
LLUUID* tidp;
- if(is_asset_fetch_by_id_allowed(mParams.getAssetType()))
+ if(LLAssetType::lookupIsAssetFetchByIDAllowed(mParams.getAssetType()))
{
tidp = new LLUUID(getID());
gAssetStorage->getAssetData(
@@ -257,50 +257,3 @@ BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp)
return TRUE;
}
-
-/**
- * Helper functions
- */
-bool is_asset_fetch_by_id_allowed(LLAssetType::EType type)
-{
- // *FIX: Make this list smaller.
- bool rv = false;
- switch(type)
- {
- case LLAssetType::AT_SOUND:
- case LLAssetType::AT_LANDMARK:
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_ANIMATION:
- case LLAssetType::AT_GESTURE:
- rv = true;
- break;
- default:
- break;
- }
- return rv;
-}
-
-bool is_asset_id_knowable(LLAssetType::EType type)
-{
- // *FIX: Make this list smaller.
- bool rv = false;
- switch(type)
- {
- case LLAssetType::AT_TEXTURE:
- case LLAssetType::AT_SOUND:
- case LLAssetType::AT_LANDMARK:
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_NOTECARD:
- case LLAssetType::AT_BODYPART:
- case LLAssetType::AT_ANIMATION:
- case LLAssetType::AT_GESTURE:
- case LLAssetType::AT_LINK:
- case LLAssetType::AT_LINK_FOLDER:
- rv = true;
- break;
- default:
- break;
- }
- return rv;
-}
diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h
index 70b09b6aaf..8616595654 100644
--- a/indra/llmessage/lltransfersourceasset.h
+++ b/indra/llmessage/lltransfersourceasset.h
@@ -84,24 +84,4 @@ protected:
S32 mCurPos;
};
-/**
- * @brief Quick check to see if the asset allows direct download.
- *
- * This might not be the right place for this function call, but it
- * originally started life inside the LLTransferSourceAsset code.
- * @param type The type of asset.
- * @return Returns true if the asset can be fetched by id.
- */
-bool is_asset_fetch_by_id_allowed(LLAssetType::EType type);
-
-/**
- * @brief Quick check to see if all asset data can be known by the viewer.
- *
- * This might not be the right place for this function call, but it
- * originally started life inside the LLTransferSourceAsset code.
- * @param type The type of asset.
- * @return Returns true if the asset id can be transmitted to the viewer.
- */
-bool is_asset_id_knowable(LLAssetType::EType type);
-
#endif // LL_LLTRANSFERSOURCEASSET_H
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 1b6fa6dd9a..0fbf3148ac 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -596,7 +596,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID);
if (inv_item)
{
- is_asset_knowable = is_asset_id_knowable(inv_item->getType());
+ is_asset_knowable = LLAssetType::lookupIsAssetIDKnowable(inv_item->getType());
}
if ( !is_asset_knowable // disable menu item for Inventory items with unknown asset. EXT-5308
|| (! ( isItemPermissive() || gAgent.isGodlike() ) )