diff options
author | McCabe Maxsted | 2009-01-13 15:05:23 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-01-13 15:05:23 -0700 |
commit | ce53ebbb532061b1cba3bb6f9b6a3978e1c122a4 (patch) | |
tree | 2ff2d7ae224e1cb06699ad434cb77475ba6fc80f /linden/indra/llinventory | |
parent | Backported message timeout changes (diff) | |
parent | Merge branch '1.1.0a-gstreamer' into next (diff) | |
download | meta-impy-ce53ebbb532061b1cba3bb6f9b6a3978e1c122a4.zip meta-impy-ce53ebbb532061b1cba3bb6f9b6a3978e1c122a4.tar.gz meta-impy-ce53ebbb532061b1cba3bb6f9b6a3978e1c122a4.tar.bz2 meta-impy-ce53ebbb532061b1cba3bb6f9b6a3978e1c122a4.tar.xz |
merged in jacek's quickfilter and gstreamer branches
Diffstat (limited to 'linden/indra/llinventory')
-rw-r--r-- | linden/indra/llinventory/llinventory.cpp | 138 | ||||
-rw-r--r-- | linden/indra/llinventory/llinventory.h | 12 | ||||
-rw-r--r-- | linden/indra/llinventory/llinventorytype.h | 86 | ||||
-rw-r--r-- | linden/indra/llinventory/llwearabletype.h | 54 |
4 files changed, 290 insertions, 0 deletions
diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp index 0c7e0ed..e492889 100644 --- a/linden/indra/llinventory/llinventory.cpp +++ b/linden/indra/llinventory/llinventory.cpp | |||
@@ -73,6 +73,116 @@ const U8 TASK_INVENTORY_ASSET_KEY = 1; | |||
73 | const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); | 73 | const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); |
74 | 74 | ||
75 | 75 | ||
76 | /** | ||
77 | * @brief Return the equivalent new inventory type. | ||
78 | * | ||
79 | * Takes an inventory type, asset type, and inventory flags, | ||
80 | * and returns the equivalent LLInventory::NType. | ||
81 | * | ||
82 | * For example, an inventory type of IT_WEARABLE, asset type | ||
83 | * of AT_BODYPART, and flags indicated WT_SHAPE, would be | ||
84 | * converted to NIT_SHAPE. | ||
85 | * | ||
86 | * Returns the most specific type that can be determined, | ||
87 | * or NIT_NONE if no type could be determined. | ||
88 | * | ||
89 | */ | ||
90 | LLInventoryType::NType calc_ntype( | ||
91 | LLInventoryType::EType inv_type, | ||
92 | LLAssetType::EType asset_type, | ||
93 | U32 flags ) | ||
94 | { | ||
95 | switch( inv_type ) | ||
96 | { | ||
97 | |||
98 | // WEARABLES | ||
99 | case LLInventoryType::IT_WEARABLE: | ||
100 | { | ||
101 | switch( asset_type ) | ||
102 | { | ||
103 | // BODY PARTS | ||
104 | case LLAssetType::AT_BODYPART: | ||
105 | { | ||
106 | switch( flags & LLInventoryItem::II_FLAGS_WEARABLES_MASK ) | ||
107 | { | ||
108 | case WT_SHAPE: return LLInventoryType::NIT_SHAPE; | ||
109 | case WT_SKIN: return LLInventoryType::NIT_SKIN; | ||
110 | case WT_HAIR: return LLInventoryType::NIT_HAIR; | ||
111 | case WT_EYES: return LLInventoryType::NIT_EYES; | ||
112 | default: return LLInventoryType::NIT_BODYPART; | ||
113 | } | ||
114 | } | ||
115 | |||
116 | // CLOTHING | ||
117 | case LLAssetType::AT_CLOTHING: | ||
118 | { | ||
119 | switch( flags & LLInventoryItem::II_FLAGS_WEARABLES_MASK ) | ||
120 | { | ||
121 | case WT_SHIRT: return LLInventoryType::NIT_SHIRT; | ||
122 | case WT_PANTS: return LLInventoryType::NIT_PANTS; | ||
123 | case WT_SHOES: return LLInventoryType::NIT_SHOES; | ||
124 | case WT_SOCKS: return LLInventoryType::NIT_SOCKS; | ||
125 | case WT_JACKET: return LLInventoryType::NIT_JACKET; | ||
126 | case WT_GLOVES: return LLInventoryType::NIT_GLOVES; | ||
127 | case WT_UNDERSHIRT: return LLInventoryType::NIT_UNDERSHIRT; | ||
128 | case WT_UNDERPANTS: return LLInventoryType::NIT_UNDERPANTS; | ||
129 | case WT_SKIRT: return LLInventoryType::NIT_SKIRT; | ||
130 | default: return LLInventoryType::NIT_CLOTHING; | ||
131 | } | ||
132 | } | ||
133 | default: | ||
134 | return LLInventoryType::NIT_WEARABLE; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | // TEXTURES | ||
139 | case LLInventoryType::IT_TEXTURE: | ||
140 | return LLInventoryType::NIT_TEXTURE; | ||
141 | |||
142 | // SNAPSHOTS | ||
143 | case LLInventoryType::IT_SNAPSHOT: | ||
144 | return LLInventoryType::NIT_SNAPSHOT; | ||
145 | |||
146 | // CALLING CARDS | ||
147 | case LLInventoryType::IT_CALLINGCARD: | ||
148 | return LLInventoryType::NIT_CALLCARD; | ||
149 | |||
150 | // LANDMARKS | ||
151 | case LLInventoryType::IT_LANDMARK: | ||
152 | return LLInventoryType::NIT_LANDMARK; | ||
153 | |||
154 | // SOUNDS | ||
155 | case LLInventoryType::IT_SOUND: | ||
156 | return LLInventoryType::NIT_SOUND; | ||
157 | |||
158 | // ANIMATIONS | ||
159 | case LLInventoryType::IT_ANIMATION: | ||
160 | return LLInventoryType::NIT_ANIMATION; | ||
161 | |||
162 | // GESTURES | ||
163 | case LLInventoryType::IT_GESTURE: | ||
164 | return LLInventoryType::NIT_GESTURE; | ||
165 | |||
166 | // NOTECARDS | ||
167 | case LLInventoryType::IT_NOTECARD: | ||
168 | return LLInventoryType::NIT_NOTECARD; | ||
169 | |||
170 | // SCRIPTS | ||
171 | case LLInventoryType::IT_LSL: | ||
172 | return LLInventoryType::NIT_SCRIPT_LSL2; | ||
173 | |||
174 | // OBJECTS | ||
175 | case LLInventoryType::IT_OBJECT: | ||
176 | case LLInventoryType::IT_ATTACHMENT: | ||
177 | return LLInventoryType::NIT_OBJECT; | ||
178 | |||
179 | // UNKNOWN TYPE! | ||
180 | default: | ||
181 | return LLInventoryType::NIT_NONE; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | |||
76 | ///---------------------------------------------------------------------------- | 186 | ///---------------------------------------------------------------------------- |
77 | /// Class LLInventoryObject | 187 | /// Class LLInventoryObject |
78 | ///---------------------------------------------------------------------------- | 188 | ///---------------------------------------------------------------------------- |
@@ -290,11 +400,13 @@ LLInventoryItem::LLInventoryItem( | |||
290 | mDescription(desc), | 400 | mDescription(desc), |
291 | mSaleInfo(sale_info), | 401 | mSaleInfo(sale_info), |
292 | mInventoryType(inv_type), | 402 | mInventoryType(inv_type), |
403 | mNInventoryType(LLInventoryType::NIT_NONE), | ||
293 | mFlags(flags), | 404 | mFlags(flags), |
294 | mCreationDate(creation_date_utc) | 405 | mCreationDate(creation_date_utc) |
295 | { | 406 | { |
296 | LLStringUtil::replaceNonstandardASCII(mDescription, ' '); | 407 | LLStringUtil::replaceNonstandardASCII(mDescription, ' '); |
297 | LLStringUtil::replaceChar(mDescription, '|', ' '); | 408 | LLStringUtil::replaceChar(mDescription, '|', ' '); |
409 | recalcNInventoryType(); | ||
298 | } | 410 | } |
299 | 411 | ||
300 | LLInventoryItem::LLInventoryItem() : | 412 | LLInventoryItem::LLInventoryItem() : |
@@ -304,6 +416,7 @@ LLInventoryItem::LLInventoryItem() : | |||
304 | mDescription(), | 416 | mDescription(), |
305 | mSaleInfo(), | 417 | mSaleInfo(), |
306 | mInventoryType(LLInventoryType::IT_NONE), | 418 | mInventoryType(LLInventoryType::IT_NONE), |
419 | mNInventoryType(LLInventoryType::NIT_NONE), | ||
307 | mFlags(0), | 420 | mFlags(0), |
308 | mCreationDate(0) | 421 | mCreationDate(0) |
309 | { | 422 | { |
@@ -328,6 +441,7 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other) | |||
328 | mDescription = other->mDescription; | 441 | mDescription = other->mDescription; |
329 | mSaleInfo = other->mSaleInfo; | 442 | mSaleInfo = other->mSaleInfo; |
330 | mInventoryType = other->mInventoryType; | 443 | mInventoryType = other->mInventoryType; |
444 | mNInventoryType = other->mNInventoryType; | ||
331 | mFlags = other->mFlags; | 445 | mFlags = other->mFlags; |
332 | mCreationDate = other->mCreationDate; | 446 | mCreationDate = other->mCreationDate; |
333 | } | 447 | } |
@@ -399,6 +513,12 @@ U32 LLInventoryItem::getCRC32() const | |||
399 | } | 513 | } |
400 | 514 | ||
401 | 515 | ||
516 | void LLInventoryItem::recalcNInventoryType() | ||
517 | { | ||
518 | setNInventoryType( calc_ntype(mInventoryType, mType, mFlags) ); | ||
519 | } | ||
520 | |||
521 | |||
402 | void LLInventoryItem::setDescription(const std::string& d) | 522 | void LLInventoryItem::setDescription(const std::string& d) |
403 | { | 523 | { |
404 | std::string new_desc(d); | 524 | std::string new_desc(d); |
@@ -415,14 +535,27 @@ void LLInventoryItem::setPermissions(const LLPermissions& perm) | |||
415 | mPermissions = perm; | 535 | mPermissions = perm; |
416 | } | 536 | } |
417 | 537 | ||
538 | void LLInventoryItem::setType(LLAssetType::EType type) | ||
539 | { | ||
540 | mType = type; | ||
541 | recalcNInventoryType(); | ||
542 | } | ||
543 | |||
418 | void LLInventoryItem::setInventoryType(LLInventoryType::EType inv_type) | 544 | void LLInventoryItem::setInventoryType(LLInventoryType::EType inv_type) |
419 | { | 545 | { |
420 | mInventoryType = inv_type; | 546 | mInventoryType = inv_type; |
547 | recalcNInventoryType(); | ||
548 | } | ||
549 | |||
550 | void LLInventoryItem::setNInventoryType(LLInventoryType::NType inv_type) | ||
551 | { | ||
552 | mNInventoryType = inv_type; | ||
421 | } | 553 | } |
422 | 554 | ||
423 | void LLInventoryItem::setFlags(U32 flags) | 555 | void LLInventoryItem::setFlags(U32 flags) |
424 | { | 556 | { |
425 | mFlags = flags; | 557 | mFlags = flags; |
558 | recalcNInventoryType(); | ||
426 | } | 559 | } |
427 | 560 | ||
428 | void LLInventoryItem::setCreationDate(time_t creation_date_utc) | 561 | void LLInventoryItem::setCreationDate(time_t creation_date_utc) |
@@ -446,6 +579,11 @@ LLInventoryType::EType LLInventoryItem::getInventoryType() const | |||
446 | return mInventoryType; | 579 | return mInventoryType; |
447 | } | 580 | } |
448 | 581 | ||
582 | LLInventoryType::NType LLInventoryItem::getNInventoryType() const | ||
583 | { | ||
584 | return mNInventoryType; | ||
585 | } | ||
586 | |||
449 | U32 LLInventoryItem::getFlags() const | 587 | U32 LLInventoryItem::getFlags() const |
450 | { | 588 | { |
451 | return mFlags; | 589 | return mFlags; |
diff --git a/linden/indra/llinventory/llinventory.h b/linden/indra/llinventory/llinventory.h index d3cce6b..c573f74 100644 --- a/linden/indra/llinventory/llinventory.h +++ b/linden/indra/llinventory/llinventory.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "llsaleinfo.h" | 42 | #include "llsaleinfo.h" |
43 | #include "llsd.h" | 43 | #include "llsd.h" |
44 | #include "lluuid.h" | 44 | #include "lluuid.h" |
45 | #include "llwearabletype.h" | ||
45 | #include "llxmlnode.h" | 46 | #include "llxmlnode.h" |
46 | 47 | ||
47 | // consts for Key field in the task inventory update message | 48 | // consts for Key field in the task inventory update message |
@@ -56,6 +57,10 @@ enum | |||
56 | }; | 57 | }; |
57 | 58 | ||
58 | 59 | ||
60 | LLInventoryType::NType calc_ntype( LLInventoryType::EType inv_type, | ||
61 | LLAssetType::EType asset_type, | ||
62 | U32 flags ); | ||
63 | |||
59 | 64 | ||
60 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 65 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
61 | // Class LLInventoryObject | 66 | // Class LLInventoryObject |
@@ -131,6 +136,7 @@ protected: | |||
131 | std::string mDescription; | 136 | std::string mDescription; |
132 | LLSaleInfo mSaleInfo; | 137 | LLSaleInfo mSaleInfo; |
133 | LLInventoryType::EType mInventoryType; | 138 | LLInventoryType::EType mInventoryType; |
139 | LLInventoryType::NType mNInventoryType; | ||
134 | U32 mFlags; | 140 | U32 mFlags; |
135 | time_t mCreationDate; // seconds from 1/1/1970, UTC | 141 | time_t mCreationDate; // seconds from 1/1/1970, UTC |
136 | 142 | ||
@@ -236,6 +242,7 @@ public: | |||
236 | const std::string& getDescription() const; | 242 | const std::string& getDescription() const; |
237 | const LLSaleInfo& getSaleInfo() const; | 243 | const LLSaleInfo& getSaleInfo() const; |
238 | LLInventoryType::EType getInventoryType() const; | 244 | LLInventoryType::EType getInventoryType() const; |
245 | LLInventoryType::NType getNInventoryType() const; | ||
239 | U32 getFlags() const; | 246 | U32 getFlags() const; |
240 | time_t getCreationDate() const; | 247 | time_t getCreationDate() const; |
241 | U32 getCRC32() const; // really more of a checksum. | 248 | U32 getCRC32() const; // really more of a checksum. |
@@ -246,7 +253,9 @@ public: | |||
246 | void setDescription(const std::string& new_desc); | 253 | void setDescription(const std::string& new_desc); |
247 | void setSaleInfo(const LLSaleInfo& sale_info); | 254 | void setSaleInfo(const LLSaleInfo& sale_info); |
248 | void setPermissions(const LLPermissions& perm); | 255 | void setPermissions(const LLPermissions& perm); |
256 | void setType(LLAssetType::EType type); | ||
249 | void setInventoryType(LLInventoryType::EType inv_type); | 257 | void setInventoryType(LLInventoryType::EType inv_type); |
258 | void setNInventoryType(LLInventoryType::NType inv_type); | ||
250 | void setFlags(U32 flags); | 259 | void setFlags(U32 flags); |
251 | void setCreationDate(time_t creation_date_utc); | 260 | void setCreationDate(time_t creation_date_utc); |
252 | 261 | ||
@@ -277,6 +286,9 @@ public: | |||
277 | LLSD asLLSD() const; | 286 | LLSD asLLSD() const; |
278 | bool fromLLSD(LLSD& sd); | 287 | bool fromLLSD(LLSD& sd); |
279 | 288 | ||
289 | private: | ||
290 | void recalcNInventoryType(); | ||
291 | |||
280 | }; | 292 | }; |
281 | 293 | ||
282 | BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b); | 294 | BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b); |
diff --git a/linden/indra/llinventory/llinventorytype.h b/linden/indra/llinventory/llinventorytype.h index 00a4d28..f228cd0 100644 --- a/linden/indra/llinventory/llinventorytype.h +++ b/linden/indra/llinventory/llinventorytype.h | |||
@@ -71,6 +71,92 @@ public: | |||
71 | IT_NONE = -1 | 71 | IT_NONE = -1 |
72 | }; | 72 | }; |
73 | 73 | ||
74 | |||
75 | /** | ||
76 | * @brief New enumerator for inventory types | ||
77 | * | ||
78 | * This is intended as a replacement to the above EType. | ||
79 | * EType will be phased out in favor of this enum. | ||
80 | * | ||
81 | * This enum acts as a bitfield, which This has several | ||
82 | * useful properties for filtering: | ||
83 | * | ||
84 | * 1. The inventory item's type can be compared by either | ||
85 | * equality or bitwise AND. Bitwise AND allows a quick | ||
86 | * check to see whether the type is one of multiple | ||
87 | * possible types. | ||
88 | * | ||
89 | * 2. It allows for a fast hierarchical organization, by | ||
90 | * defining a broad type (e.g. NIT_BODYPART) whose | ||
91 | * value is the bitwise OR-ing of several more specific | ||
92 | * sub-types (e.g. NIT_SKIN|NIT_HAIR|...). | ||
93 | * | ||
94 | */ | ||
95 | enum NType | ||
96 | { | ||
97 | /* No Type */ | ||
98 | NIT_NONE = 0x0000000, | ||
99 | |||
100 | /* Body Parts */ | ||
101 | NIT_SHAPE = 1 << 0, | ||
102 | NIT_SKIN = 1 << 1, | ||
103 | NIT_HAIR = 1 << 2, | ||
104 | NIT_EYES = 1 << 3, | ||
105 | NIT_BODYPART = 0x000000f, | ||
106 | |||
107 | /* Clothing */ | ||
108 | NIT_SHIRT = 1 << 4, | ||
109 | NIT_PANTS = 1 << 5, | ||
110 | NIT_SHOES = 1 << 6, | ||
111 | NIT_SOCKS = 1 << 7, | ||
112 | NIT_JACKET = 1 << 8, | ||
113 | NIT_GLOVES = 1 << 9, | ||
114 | NIT_UNDERSHIRT = 1 << 10, | ||
115 | NIT_UNDERPANTS = 1 << 11, | ||
116 | NIT_SKIRT = 1 << 12, | ||
117 | NIT_CLOTHING = 0x0001ff0, | ||
118 | |||
119 | /* Body Parts | Clothing */ | ||
120 | NIT_WEARABLE = 0x0001fff, | ||
121 | |||
122 | /* Images */ | ||
123 | NIT_TEXTURE = 1 << 13, | ||
124 | NIT_SNAPSHOT = 1 << 14, | ||
125 | NIT_IMAGE = 0x0006000, | ||
126 | |||
127 | /* Calling Cards */ | ||
128 | NIT_CALLCARD_OFF = 1 << 15, | ||
129 | NIT_CALLCARD_ON = 1 << 16, | ||
130 | NIT_CALLCARD = 0x0018000, | ||
131 | |||
132 | /* Landmarks */ | ||
133 | NIT_LANDMARK_UNUSED = 1 << 17, | ||
134 | NIT_LANDMARK_USED = 1 << 18, | ||
135 | NIT_LANDMARK = 0x0060000, | ||
136 | |||
137 | /* Sounds */ | ||
138 | NIT_SOUND = 1 << 19, | ||
139 | |||
140 | /* Animations */ | ||
141 | NIT_ANIMATION = 1 << 20, | ||
142 | |||
143 | /* Gestures */ | ||
144 | NIT_GESTURE = 1 << 21, | ||
145 | |||
146 | /* Notecards */ | ||
147 | NIT_NOTECARD = 1 << 22, | ||
148 | |||
149 | /* Scripts */ | ||
150 | NIT_SCRIPT_LSL2 = 1 << 23, | ||
151 | |||
152 | /* Objects */ | ||
153 | NIT_OBJECT = 1 << 24, | ||
154 | |||
155 | /* Bitwise OR-ing of all the above */ | ||
156 | NIT_ALL = 0x1ffffff, | ||
157 | }; | ||
158 | |||
159 | |||
74 | // machine transation between type and strings | 160 | // machine transation between type and strings |
75 | static EType lookup(const std::string& name); | 161 | static EType lookup(const std::string& name); |
76 | static const char* lookup(EType type); | 162 | static const char* lookup(EType type); |
diff --git a/linden/indra/llinventory/llwearabletype.h b/linden/indra/llinventory/llwearabletype.h new file mode 100644 index 0000000..b0a40b2 --- /dev/null +++ b/linden/indra/llinventory/llwearabletype.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /** | ||
2 | * @file llwearable.h | ||
3 | * @brief EWearableType enum definition | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2002-2008, 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 http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | ||
22 | * By copying, modifying or distributing this software, you acknowledge | ||
23 | * that you have read and understood your obligations described above, | ||
24 | * and agree to abide by those obligations. | ||
25 | * | ||
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
28 | * COMPLETENESS OR PERFORMANCE. | ||
29 | * $/LicenseInfo$ | ||
30 | */ | ||
31 | |||
32 | #ifndef LL_LLWEARABLETYPE_H | ||
33 | #define LL_LLWEARABLETYPE_H | ||
34 | |||
35 | enum EWearableType // If you change this, update LLWearable::getTypeName(), getTypeLabel(), and LLVOAvatar::getTEWearableType() | ||
36 | { | ||
37 | WT_SHAPE = 0, | ||
38 | WT_SKIN = 1, | ||
39 | WT_HAIR = 2, | ||
40 | WT_EYES = 3, | ||
41 | WT_SHIRT = 4, | ||
42 | WT_PANTS = 5, | ||
43 | WT_SHOES = 6, | ||
44 | WT_SOCKS = 7, | ||
45 | WT_JACKET = 8, | ||
46 | WT_GLOVES = 9, | ||
47 | WT_UNDERSHIRT = 10, | ||
48 | WT_UNDERPANTS = 11, | ||
49 | WT_SKIRT = 12, | ||
50 | WT_COUNT = 13, | ||
51 | WT_INVALID = 255 | ||
52 | }; | ||
53 | |||
54 | #endif // LL_LLWEARABLETYPE_H | ||