diff options
Diffstat (limited to 'indra/newview/llwearable.h')
-rw-r--r-- | indra/newview/llwearable.h | 110 |
1 files changed, 77 insertions, 33 deletions
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h index 7ebdd788ce..fd614ade64 100644 --- a/indra/newview/llwearable.h +++ b/indra/newview/llwearable.h @@ -2,31 +2,25 @@ * @file llwearable.h * @brief LLWearable class header file * - * $LicenseInfo:firstyear=2002&license=viewergpl$ + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. * - * Copyright (c) 2002-2009, 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. * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * 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. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -38,9 +32,14 @@ #include "llpermissions.h" #include "llsaleinfo.h" #include "llassetstorage.h" -#include "llwearabledictionary.h" +#include "llwearabletype.h" +#include "llfile.h" +#include "lllocaltextureobject.h" class LLViewerInventoryItem; +class LLVisualParam; +class LLTexGlobalColorInfo; +class LLTexGlobalColor; class LLWearable { @@ -60,10 +59,11 @@ public: // Accessors //-------------------------------------------------------------------- public: - const LLAssetID& getID() const { return mAssetID; } + const LLUUID& getItemID() const; + const LLAssetID& getAssetID() const { return mAssetID; } const LLTransactionID& getTransactionID() const { return mTransactionID; } - EWearableType getType() const { return mType; } - void setType(EWearableType type) { mType = type; } + LLWearableType::EType getType() const { return mType; } + void setType(LLWearableType::EType type); const std::string& getName() const { return mName; } void setName(const std::string& name) { mName = name; } const std::string& getDescription() const { return mDescription; } @@ -75,15 +75,18 @@ public: const std::string& getTypeLabel() const; const std::string& getTypeName() const; LLAssetType::EType getAssetType() const; + S32 getDefinitionVersion() const { return mDefinitionVersion; } + void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; } public: + typedef std::vector<LLVisualParam*> visual_param_vec_t; + BOOL isDirty() const; BOOL isOldVersion() const; - void writeToAvatar( BOOL set_by_user ); - void readFromAvatar(); - void removeFromAvatar( BOOL set_by_user ) { LLWearable::removeFromAvatar( mType, set_by_user ); } - static void removeFromAvatar( EWearableType type, BOOL set_by_user ); + void writeToAvatar(); + void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); } + static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ); BOOL exportFile(LLFILE* file) const; BOOL importFile(LLFILE* file); @@ -99,8 +102,45 @@ public: static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; } friend std::ostream& operator<<(std::ostream &s, const LLWearable &w); + void setItemID(const LLUUID& item_id); + + LLLocalTextureObject* getLocalTextureObject(S32 index); + const LLLocalTextureObject* getLocalTextureObject(S32 index) const; + + void setLocalTextureObject(S32 index, LLLocalTextureObject <o); + void addVisualParam(LLVisualParam *param); + void setVisualParams(); + void setVisualParamWeight(S32 index, F32 value, BOOL upload_bake); + F32 getVisualParamWeight(S32 index) const; + LLVisualParam* getVisualParam(S32 index) const; + void getVisualParams(visual_param_vec_t &list); + void animateParams(F32 delta, BOOL upload_bake); + + LLColor4 getClothesColor(S32 te) const; + void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake ); + + void revertValues(); + void saveValues(); + void pullCrossWearableValues(); + + BOOL isOnTop() const; + + // Something happened that requires the wearable's label to be updated (e.g. worn/unworn). + void setLabelUpdated() const; + + // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem, + // not the wearable asset itself. + void refreshName(); private: + typedef std::map<S32, LLLocalTextureObject*> te_map_t; + typedef std::map<S32, LLVisualParam *> visual_param_index_map_t; + + void createLayers(S32 te); + void createVisualParams(); + void syncImages(te_map_t &src, te_map_t &dst); + void destroyTextures(); + static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. std::string mName; @@ -109,12 +149,16 @@ private: LLSaleInfo mSaleInfo; LLAssetID mAssetID; LLTransactionID mTransactionID; - EWearableType mType; + LLWearableType::EType mType; typedef std::map<S32, F32> param_map_t; - param_map_t mVisualParamMap; // maps visual param id to weight - typedef std::map<S32, LLUUID> te_map_t; - te_map_t mTEMap; // maps TE to Image ID + param_map_t mSavedVisualParamMap; // last saved version of visual params + + visual_param_index_map_t mVisualParamIndexMap; + + te_map_t mTEMap; // maps TE to LocalTextureObject + te_map_t mSavedTEMap; // last saved version of TEMap + LLUUID mItemID; // ID of the inventory item in the agent's inventory }; #endif // LL_LLWEARABLE_H |