aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llwearable.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llwearable.h')
-rw-r--r--linden/indra/newview/llwearable.h138
1 files changed, 138 insertions, 0 deletions
diff --git a/linden/indra/newview/llwearable.h b/linden/indra/newview/llwearable.h
new file mode 100644
index 0000000..cfae5a5
--- /dev/null
+++ b/linden/indra/newview/llwearable.h
@@ -0,0 +1,138 @@
1/**
2 * @file llwearable.h
3 * @brief LLWearable class header file
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLWEARABLE_H
29#define LL_LLWEARABLE_H
30
31#include "lluuid.h"
32#include "llptrskipmap.h"
33#include "llstring.h"
34#include "llpermissions.h"
35#include "llsaleinfo.h"
36#include "llassetstorage.h"
37
38class LLViewerInventoryItem;
39
40enum EWearableType // If you change this, update LLWearable::getTypeName(), getTypeLabel(), and LLVOAvatar::getTEWearableType()
41{
42 WT_SHAPE = 0,
43 WT_SKIN = 1,
44 WT_HAIR = 2,
45 WT_EYES = 3,
46 WT_SHIRT = 4,
47 WT_PANTS = 5,
48 WT_SHOES = 6,
49 WT_SOCKS = 7,
50 WT_JACKET = 8,
51 WT_GLOVES = 9,
52 WT_UNDERSHIRT = 10,
53 WT_UNDERPANTS = 11,
54 WT_SKIRT = 12,
55 WT_COUNT = 13,
56 WT_INVALID = 255
57};
58
59class LLWearable
60{
61public:
62 LLWearable(const LLTransactionID& transactionID);
63 LLWearable(const LLAssetID& assetID);
64 ~LLWearable();
65
66 const LLAssetID& getID() { return mAssetID; }
67 const LLTransactionID& getTransactionID() { return mTransactionID; }
68
69 BOOL readData( const char *buffer );
70 BOOL isDirty();
71 BOOL isOldVersion();
72
73 void writeToAvatar( BOOL set_by_user );
74 void readFromAvatar();
75 void removeFromAvatar( BOOL set_by_user ) { LLWearable::removeFromAvatar( mType, set_by_user ); }
76 static void removeFromAvatar( EWearableType type, BOOL set_by_user );
77
78 BOOL exportFile(FILE* file);
79 BOOL importFile(FILE* file);
80
81 EWearableType getType() const { return mType; }
82 void setType( EWearableType type ) { mType = type; }
83
84 void setName( const std::string& name ) { mName = name; }
85 const std::string& getName() { return mName; }
86
87 void setDescription( const std::string& desc ) { mDescription = desc; }
88 const std::string& getDescription() { return mDescription; }
89
90 void setPermissions( const LLPermissions& p ) { mPermissions = p; }
91 const LLPermissions& getPermissions() { return mPermissions; }
92
93 void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; }
94 const LLSaleInfo& getSaleInfo() { return mSaleInfo; }
95
96 const char* getTypeLabel() const { return LLWearable::sTypeLabel[ mType ]; }
97 const char* getTypeName() const { return LLWearable::sTypeName[ mType ]; }
98
99 void setParamsToDefaults();
100 void setTexturesToDefaults();
101
102 LLAssetType::EType getAssetType() const { return LLWearable::typeToAssetType( mType ); }
103
104 static EWearableType typeNameToType( const LLString& type_name );
105 static const char* typeToTypeName( EWearableType type ) { return (type<WT_COUNT) ? LLWearable::sTypeName[type] : "invalid"; }
106 static const char* typeToTypeLabel( EWearableType type ) { return (type<WT_COUNT) ? LLWearable::sTypeLabel[type] : "invalid"; }
107 static LLAssetType::EType typeToAssetType( EWearableType wearable_type );
108
109 void saveNewAsset();
110 static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status );
111
112 BOOL isMatchedToInventoryItem( LLViewerInventoryItem* item );
113
114 void copyDataFrom( LLWearable* src );
115
116 static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
117
118 void dump();
119
120private:
121 static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
122 S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
123 LLString mName;
124 LLString mDescription;
125 LLPermissions mPermissions;
126 LLSaleInfo mSaleInfo;
127 LLAssetID mAssetID;
128 LLTransactionID mTransactionID;
129 EWearableType mType;
130
131 LLPtrSkipMap<S32, F32*> mVisualParamMap; // maps visual param id to weight
132 LLPtrSkipMap<S32, LLUUID*> mTEMap; // maps TE to Image ID
133
134 static const char* sTypeName[ WT_COUNT ];
135 static const char* sTypeLabel[ WT_COUNT ];
136};
137
138#endif // LL_LLWEARABLE_H