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