Files
SingularityViewer/indra/llappearance/llwearabletype.h
Aleric Inglewood cc9fc6b868 First attempt to deal with broken (pre multiwear) inventory items.
Since multiwear, the low 8 bit of inventory items, if they are of type
IT_WEARABLE, is used for the wearable type (WT_*). Older viewers and
bots (like Second Inventory) create inventory items with 0 in those
bits. This causes all those item to appear as shapes in multi-wear
capable viewers.

This gives rise to many problems:
1) You can't wear them, because the inventory and asset wearable type
mismatch, which makes Singularity just abort.
2) Before it aborts, it already removed your old shape, thinking you
are about to wear another shape - and told the server that you are
wearing this broken item now. The result is that you see no change,
until you relog when you are suddenly wearing the broken "shape"
and stay a cloud forever.

This commit detects the problem for AT_CLOTHING wearables, because
they are not compatible with the type 'shape' after all (which is
is AT_BODYPART). It still doesn't know what the wearable type is, but
sets the type temporarily to the new value WT_UNKNOWN. Since this is
at least not a shape anymore, it doesn't cause you shape to be removed
when wearing it. Moreover, once the asset is downloaded, the mismatch
is detected and corrected: you can now wear -say- pants, or other
clothing.

Inventory clothing items with an unknown wearable type now have a
red question mark icon in the inventory.

What does NOT work yet:

1) If you copy such an item and paste it, then the new copy has
a shape icon again (and all the previously mentioned problems).

2) If you wear broken hair, skin or eyes (which still show as
shapes in the inventory) then your shape is still removed, and
wearing them fails because they are not multiwear capable and you
are already wearing such a body part. What should be done here
is that the removed shape is added back and the real body part
that you're trying to wear is removed.

3) Although this code attempts to fix the mFlags in the inventory,
the icon in the inventory doesn't change from question mark to the
right thing.
2013-08-18 02:50:31 +02:00

91 lines
2.7 KiB
C++

/**
* @file llwearabletype.h
* @brief LLWearableType class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLWEARABLETYPE_H
#define LL_LLWEARABLETYPE_H
#include "llassettype.h"
#include "lldictionary.h"
#include "llinventorytype.h"
#include "llsingleton.h"
class LLTranslationBridge
{
public:
virtual ~LLTranslationBridge(){};
virtual std::string getString(const std::string &xml_desc) = 0;
};
class LLWearableType
{
public:
enum EType
{
WT_SHAPE = 0,
WT_SKIN = 1,
WT_HAIR = 2,
WT_EYES = 3,
WT_SHIRT = 4,
WT_PANTS = 5,
WT_SHOES = 6,
WT_SOCKS = 7,
WT_JACKET = 8,
WT_GLOVES = 9,
WT_UNDERSHIRT = 10,
WT_UNDERPANTS = 11,
WT_SKIRT = 12,
WT_ALPHA = 13,
WT_TATTOO = 14,
WT_PHYSICS = 15,
WT_UNKNOWN = 16, // Singu note: used for corrupt wearables that do not have their type set in the inventory database.
// While all the above values are serialized and stored in the database, this value is local only:
// When a new item with value 16 is added by upstream, just increase this value to 17 (and WT_COUNT to 18).
WT_COUNT = 17,
WT_INVALID = 255,
WT_NONE = -1,
};
static void initClass(LLTranslationBridge* trans); // initializes static members
static void cleanupClass(); // initializes static members
static const std::string& getTypeName(EType type);
static const std::string& getTypeDefaultNewName(EType type);
static const std::string& getTypeLabel(EType type);
static LLAssetType::EType getAssetType(EType type);
static EType typeNameToType(const std::string& type_name);
static LLInventoryType::EIconName getIconName(EType type);
static BOOL getDisableCameraSwitch(EType type);
static BOOL getAllowMultiwear(EType type);
protected:
LLWearableType() {}
~LLWearableType() {}
};
#endif // LL_LLWEARABLETYPE_H