llassettype.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /**
  2. * @file llassettype.h
  3. * @brief Declaration of LLAssetType.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLASSETTYPE_H
  33. #define LL_LLASSETTYPE_H
  34. #include "llpreprocessor.h"
  35. #include <string>
  36. // Define to non-zero to support mesh *inventory* assets: this is useless,
  37. // since no such asset was ever created in SL (only in Aditi, in very early
  38. // days of the mesh viewer development, before it was finally decided that
  39. // meshes would be linked to object inventory items instead). HB
  40. #define LL_MESH_ASSET_SUPPORT 0
  41. // This enum is also used by the UI code and in the viewer (newview) code
  42. enum EDragAndDropType
  43. {
  44. DAD_NONE = 0,
  45. DAD_TEXTURE,
  46. DAD_SOUND,
  47. DAD_CALLINGCARD,
  48. DAD_LANDMARK,
  49. DAD_SCRIPT,
  50. DAD_CLOTHING,
  51. DAD_OBJECT,
  52. DAD_NOTECARD,
  53. DAD_CATEGORY,
  54. DAD_ROOT_CATEGORY,
  55. DAD_BODYPART,
  56. DAD_ANIMATION,
  57. DAD_GESTURE,
  58. DAD_LINK,
  59. #if LL_MESH_ASSET_SUPPORT
  60. DAD_MESH,
  61. DAD_GLTF,
  62. DAD_GLTF_BIN,
  63. #endif
  64. DAD_SETTINGS,
  65. DAD_MATERIAL,
  66. DAD_COUNT // Number of types in this enum
  67. };
  68. // Purely static class
  69. class LLAssetType
  70. {
  71. LLAssetType() = delete;
  72. ~LLAssetType() = delete;
  73. public:
  74. enum EType
  75. {
  76. // Used for painting the faces of geometry. Stored in typical j2c stream
  77. // format.
  78. AT_TEXTURE = 0,
  79. // Used to fill the aural spectrum.
  80. AT_SOUND = 1,
  81. // References instant message access to the user on the card.
  82. AT_CALLINGCARD = 2,
  83. // References to places in the world with location and a screen shot or
  84. // image saved.
  85. AT_LANDMARK = 3,
  86. // Old scripts that can be attached to an object (deprecated).
  87. AT_SCRIPT = 4,
  88. // A collection of textures and parameters that can be worn by an
  89. // avatar and represent a piece of clothing.
  90. AT_CLOTHING = 5,
  91. // Any combination of textures, sounds, and scripts that are associated
  92. // with a fixed piece of primitives-based geometry.
  93. AT_OBJECT = 6,
  94. // Just text.
  95. AT_NOTECARD = 7,
  96. // Folder holding a collection of inventory items. It is treated as an
  97. // item in the inventory and therefore needs a type.
  98. AT_CATEGORY = 8,
  99. // The LSL is the scripting language. We have split it into a text and
  100. // (deprecated) bytecode representation.
  101. AT_LSL_TEXT = 10,
  102. AT_LSL_BYTECODE = 11,
  103. // Uncompressed TGA texture.
  104. AT_TEXTURE_TGA = 12,
  105. // A collection of textures and mandatory parameters that can be worn
  106. // by an avatar and define its body.
  107. AT_BODYPART = 13,
  108. // Uncompressed sound.
  109. AT_SOUND_WAV = 17,
  110. // Uncompressed non-square image, not appropriate for use as a texture.
  111. AT_IMAGE_TGA = 18,
  112. // Compressed non-square image, not appropriate for use as a texture.
  113. AT_IMAGE_JPEG = 19,
  114. // Animation.
  115. AT_ANIMATION = 20,
  116. // Gesture, sequence of animations, sounds, chat, pauses.
  117. AT_GESTURE = 21,
  118. // Simstate file.
  119. AT_SIMSTATE = 22,
  120. // Inventory symbolic link.
  121. AT_LINK = 24,
  122. // Inventory folder link.
  123. AT_LINK_FOLDER = 25,
  124. // Marketplace folder. Same as an AT_CATEGORY but different display
  125. // methods.
  126. AT_MARKETPLACE_FOLDER = 26,
  127. // Mesh data in our proprietary SLM format: only for possible use in
  128. // assets cache (currently assets types not used by it) via the mesh
  129. // repository. Not represented by an inventory type.
  130. AT_MESH = 49,
  131. AT_RESERVED_1 = 50,
  132. AT_RESERVED_2 = 51,
  133. AT_RESERVED_3 = 52,
  134. AT_RESERVED_4 = 53,
  135. AT_RESERVED_5 = 54,
  136. AT_RESERVED_6 = 55,
  137. // Collection of settings.
  138. AT_SETTINGS = 56,
  139. // Render material.
  140. AT_MATERIAL = 57,
  141. // gLTF JSON document
  142. AT_GLTF = 58,
  143. // gLTF binary data
  144. AT_GLTF_BIN = 59,
  145. AT_COUNT,
  146. // +*********************************************************+
  147. // | TO ADD AN ELEMENT TO THIS ENUM: |
  148. // +*********************************************************+
  149. // | 1. INSERT BEFORE AT_COUNT |
  150. // | 2. INCREMENT AT_COUNT BY 1 |
  151. // | 3. ADD TO llassettype.cpp |
  152. // | 4. ADD TO llinventorytype.h and llinventorytype.cpp |
  153. // | 5. ADD ICON TO llinventoryicon.h and llinventoryicon.cpp|
  154. // +*********************************************************+
  155. AT_NONE = -1
  156. };
  157. ///////////////////////////////////////////////////////////////////////////
  158. // Machine translation between type and strings
  159. // Safe conversion to std::string, *TODO: deprecate
  160. static EType lookup(const char* name);
  161. static EType lookup(const std::string& type_name);
  162. static const char* lookup(EType asset_type);
  163. ///////////////////////////////////////////////////////////////////////////
  164. ///////////////////////////////////////////////////////////////////////////
  165. // Translations from a type to a human readable form.
  166. // Safe conversion to std::string, *TODO: deprecate
  167. static EType lookupHumanReadable(const char* desc_name);
  168. static EType lookupHumanReadable(const std::string& readable_name);
  169. static const char* lookupHumanReadable(EType asset_type);
  170. ///////////////////////////////////////////////////////////////////////////
  171. static EType getType(const std::string& desc_name);
  172. static const std::string& getDesc(EType asset_type);
  173. static bool lookupCanLink(EType asset_type);
  174. static bool lookupIsLinkType(EType asset_type);
  175. // Whether the asset allows direct download or not:
  176. static bool lookupIsAssetFetchByIDAllowed(EType asset_type);
  177. // Whether asset data can be known by the viewer or not:
  178. static bool lookupIsAssetIDKnowable(EType asset_type);
  179. // Error string when a lookup fails
  180. static const std::string& badLookup();
  181. // The following two static methods used to be defined in the (now removed)
  182. // indra/newview/llviewerassettype.h file. But there was strictly no reason
  183. // for not including them here instead, and getting rid of a superfluous
  184. // dictionary (LLViewerAssetDictionary) in the process...
  185. // Generates a good default description. You may want to add a verb or
  186. // agent name after this depending on your application.
  187. static void generateDescriptionFor(EType asset_type, std::string& desc);
  188. static EDragAndDropType lookupDragAndDropType(EType asset_type);
  189. };
  190. #endif // LL_LLASSETTYPE_H