00001
00032 #ifndef LL_LLWEARABLE_H
00033 #define LL_LLWEARABLE_H
00034
00035 #include "lluuid.h"
00036 #include "llstring.h"
00037 #include "llpermissions.h"
00038 #include "llsaleinfo.h"
00039 #include "llassetstorage.h"
00040
00041 class LLViewerInventoryItem;
00042
00043 enum EWearableType
00044 {
00045 WT_SHAPE = 0,
00046 WT_SKIN = 1,
00047 WT_HAIR = 2,
00048 WT_EYES = 3,
00049 WT_SHIRT = 4,
00050 WT_PANTS = 5,
00051 WT_SHOES = 6,
00052 WT_SOCKS = 7,
00053 WT_JACKET = 8,
00054 WT_GLOVES = 9,
00055 WT_UNDERSHIRT = 10,
00056 WT_UNDERPANTS = 11,
00057 WT_SKIRT = 12,
00058 WT_COUNT = 13,
00059 WT_INVALID = 255
00060 };
00061
00062 class LLWearable
00063 {
00064 public:
00065 LLWearable(const LLTransactionID& transactionID);
00066 LLWearable(const LLAssetID& assetID);
00067 ~LLWearable();
00068
00069 const LLAssetID& getID() { return mAssetID; }
00070 const LLTransactionID& getTransactionID() { return mTransactionID; }
00071
00072 BOOL readData( const char *buffer );
00073 BOOL isDirty();
00074 BOOL isOldVersion();
00075
00076 void writeToAvatar( BOOL set_by_user );
00077 void readFromAvatar();
00078 void removeFromAvatar( BOOL set_by_user ) { LLWearable::removeFromAvatar( mType, set_by_user ); }
00079 static void removeFromAvatar( EWearableType type, BOOL set_by_user );
00080
00081 BOOL exportFile(LLFILE* file);
00082 BOOL importFile(LLFILE* file);
00083
00084 EWearableType getType() const { return mType; }
00085 void setType( EWearableType type ) { mType = type; }
00086
00087 void setName( const LLString& name ) { mName = name; }
00088 const LLString& getName() { return mName; }
00089
00090 void setDescription( const LLString& desc ) { mDescription = desc; }
00091 const LLString& getDescription() { return mDescription; }
00092
00093 void setPermissions( const LLPermissions& p ) { mPermissions = p; }
00094 const LLPermissions& getPermissions() { return mPermissions; }
00095
00096 void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; }
00097 const LLSaleInfo& getSaleInfo() { return mSaleInfo; }
00098
00099 const char* getTypeLabel() const { return LLWearable::sTypeLabel[ mType ]; }
00100 const char* getTypeName() const { return LLWearable::sTypeName[ mType ]; }
00101
00102 void setParamsToDefaults();
00103 void setTexturesToDefaults();
00104
00105 LLAssetType::EType getAssetType() const { return LLWearable::typeToAssetType( mType ); }
00106
00107 static EWearableType typeNameToType( const LLString& type_name );
00108 static const char* typeToTypeName( EWearableType type ) { return (type<WT_COUNT) ? LLWearable::sTypeName[type] : "invalid"; }
00109 static const char* typeToTypeLabel( EWearableType type ) { return (type<WT_COUNT) ? LLWearable::sTypeLabel[type] : "invalid"; }
00110 static LLAssetType::EType typeToAssetType( EWearableType wearable_type );
00111
00112 void saveNewAsset();
00113 static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
00114
00115 BOOL isMatchedToInventoryItem( LLViewerInventoryItem* item );
00116
00117 void copyDataFrom( LLWearable* src );
00118
00119 static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
00120
00121 void dump();
00122
00123 private:
00124 static S32 sCurrentDefinitionVersion;
00125 S32 mDefinitionVersion;
00126 LLString mName;
00127 LLString mDescription;
00128 LLPermissions mPermissions;
00129 LLSaleInfo mSaleInfo;
00130 LLAssetID mAssetID;
00131 LLTransactionID mTransactionID;
00132 EWearableType mType;
00133
00134 typedef std::map<S32, F32> param_map_t;
00135 param_map_t mVisualParamMap;
00136 typedef std::map<S32, LLUUID> te_map_t;
00137 te_map_t mTEMap;
00138
00139 static const char* sTypeName[ WT_COUNT ];
00140 static const char* sTypeLabel[ WT_COUNT ];
00141 };
00142
00143 #endif // LL_LLWEARABLE_H