LLAgentWearables Transition (1/1)
This commit is contained in:
@@ -105,6 +105,7 @@ set(viewer_SOURCE_FILES
|
||||
llagentdata.cpp
|
||||
llagentlanguage.cpp
|
||||
llagentpilot.cpp
|
||||
llagentwearables.cpp
|
||||
llanimstatelabels.cpp
|
||||
llappviewer.cpp
|
||||
llassetconverter.cpp
|
||||
@@ -579,6 +580,7 @@ set(viewer_HEADER_FILES
|
||||
llagentdata.h
|
||||
llagentlanguage.h
|
||||
llagentpilot.h
|
||||
llagentwearables.h
|
||||
llanimstatelabels.h
|
||||
llappearance.h
|
||||
llappviewer.h
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "cofmgr.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llcommonutils.h"
|
||||
#include "llerror.h"
|
||||
#include "llvoavatar.h"
|
||||
@@ -81,7 +82,7 @@ public:
|
||||
// Add all currently worn wearables
|
||||
for (S32 idxType = 0; idxType < WT_COUNT; idxType++)
|
||||
{
|
||||
const LLUUID& idItem = gAgent.getWearableItem((EWearableType)idxType);
|
||||
const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)idxType);
|
||||
if (idItem.isNull())
|
||||
continue;
|
||||
idItems.push_back(idItem);
|
||||
@@ -388,7 +389,7 @@ void LLCOFMgr::updateAttachments()
|
||||
}
|
||||
|
||||
// Don't remove attachments until avatar is fully loaded (should reduce random attaching/detaching/reattaching at log-on)
|
||||
LLAgent::userUpdateAttachments(items, !pAvatar->isFullyLoaded());
|
||||
LLAgentWearables::userUpdateAttachments(items, !pAvatar->isFullyLoaded());
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -431,7 +432,7 @@ void LLCOFMgr::onLinkWearableComplete(const LLUUID& idItem)
|
||||
m_PendingWearableLinks.erase(itPending);
|
||||
|
||||
// It may have been removed already in which case we should remove the COF link
|
||||
if (!gAgent.isWearingItem(idItemBase))
|
||||
if (!gAgentWearables.isWearingItem(idItemBase))
|
||||
removeCOFItemLinks(idItemBase);
|
||||
}
|
||||
|
||||
@@ -458,7 +459,7 @@ void LLCOFMgr::synchWearables()
|
||||
uuid_vec_t newItems;
|
||||
for (S32 idxType = 0; idxType < WT_COUNT; idxType++)
|
||||
{
|
||||
const LLUUID& idItem = gAgent.getWearableItem((EWearableType)idxType);
|
||||
const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)idxType);
|
||||
if (idItem.isNull())
|
||||
continue;
|
||||
newItems.push_back(idItem);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -819,7 +819,7 @@ private:
|
||||
|
||||
/********************************************************************************
|
||||
** **
|
||||
** Deperciated stuff. Move when ready.
|
||||
** Depreciated stuff. Move when ready.
|
||||
**/
|
||||
public:
|
||||
const LLUUID& getInventoryRootID() const { return mInventoryRootID; }
|
||||
@@ -833,164 +833,8 @@ private:
|
||||
LLUUID mInventoryRootID;
|
||||
static BOOL mForceTPose;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Wearables
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void setWearable( LLInventoryItem* new_item, LLWearable* wearable );
|
||||
static bool onSetWearableDialog( const LLSD& notification, const LLSD& response, LLWearable* wearable );
|
||||
void setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable );
|
||||
void setWearableOutfit( const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove );
|
||||
void queryWearableCache();
|
||||
|
||||
BOOL isWearableModifiable(EWearableType type);
|
||||
BOOL isWearableCopyable(EWearableType type);
|
||||
BOOL needsReplacement(EWearableType wearableType, S32 remove);
|
||||
U32 getWearablePermMask(EWearableType type);
|
||||
|
||||
LLInventoryItem* getWearableInventoryItem(EWearableType type);
|
||||
|
||||
LLWearable* getWearable( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL; }
|
||||
BOOL isWearingItem( const LLUUID& item_id );
|
||||
LLWearable* getWearableFromWearableItem( const LLUUID& item_id );
|
||||
const LLUUID& getWearableItem( EWearableType type ) { return (type < WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null; }
|
||||
|
||||
static EWearableType getTEWearableType( S32 te );
|
||||
static LLUUID getDefaultTEImageID( S32 te );
|
||||
|
||||
void copyWearableToInventory( EWearableType type );
|
||||
|
||||
void makeNewOutfit(
|
||||
const std::string& new_folder_name,
|
||||
const LLDynamicArray<S32>& wearables_to_include,
|
||||
const LLDynamicArray<S32>& attachments_to_include,
|
||||
BOOL rename_clothing);
|
||||
void makeNewOutfitDone(S32 index);
|
||||
|
||||
void removeWearable( EWearableType type );
|
||||
static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response );
|
||||
void removeWearableFinal( EWearableType type );
|
||||
|
||||
void sendAgentWearablesUpdate();
|
||||
|
||||
/**
|
||||
* @brief Only public because of addWearableToAgentInventoryCallback.
|
||||
*
|
||||
* NOTE: Do not call this method unless you are the inventory callback.
|
||||
* NOTE: This can suffer from race conditions when working on the
|
||||
* same values for index.
|
||||
* @param index The index in mWearableEntry.
|
||||
* @param item_id The inventory item id of the new wearable to wear.
|
||||
* @param wearable The actual wearable data.
|
||||
*/
|
||||
void addWearabletoAgentInventoryDone(
|
||||
S32 index,
|
||||
const LLUUID& item_id,
|
||||
LLWearable* wearable);
|
||||
|
||||
void saveWearableAs( EWearableType type, const std::string& new_name, BOOL save_in_lost_and_found );
|
||||
void saveWearable( EWearableType type, BOOL send_update = TRUE );
|
||||
void saveAllWearables();
|
||||
|
||||
void revertWearable( EWearableType type );
|
||||
void revertAllWearables();
|
||||
|
||||
void setWearableName( const LLUUID& item_id, const std::string& new_name );
|
||||
void createStandardWearables(BOOL female);
|
||||
void createStandardWearablesDone(S32 index);
|
||||
void createStandardWearablesAllDone();
|
||||
|
||||
BOOL areWearablesLoaded() { return mWearablesLoaded; }
|
||||
|
||||
// statics
|
||||
static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
|
||||
static void userRemoveWearable( void* userdata ); // userdata is EWearableType
|
||||
static void userRemoveAllClothes( void* userdata ); // userdata is NULL
|
||||
static void userRemoveAllClothesStep2(BOOL proceed, void* userdata ); // userdata is NULL
|
||||
static void userRemoveAllAttachments( void* userdata); // userdata is NULL
|
||||
static BOOL selfHasWearable( void* userdata ); // userdata is EWearableType
|
||||
|
||||
// static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array);
|
||||
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2.0a) | Added: Catznip-2.2.0a
|
||||
// Not the best way to go about this but other attempts changed far too much LL code to be a viable solution
|
||||
static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array, bool fAttachOnly = false);
|
||||
// [/SL:KB]
|
||||
static void userRemoveMultipleAttachments(llvo_vec_t& llvo_array);
|
||||
static void userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array);
|
||||
|
||||
protected:
|
||||
|
||||
// internal wearable functions
|
||||
void sendAgentWearablesRequest();
|
||||
static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata);
|
||||
void recoverMissingWearable(EWearableType type);
|
||||
void recoverMissingWearableDone();
|
||||
void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
|
||||
LLWearable* wearable, const LLUUID& category_id = LLUUID::null,
|
||||
BOOL notify = TRUE);
|
||||
|
||||
private:
|
||||
//--------------------------------------------------------------------
|
||||
// Wearables
|
||||
//--------------------------------------------------------------------
|
||||
struct LLWearableEntry
|
||||
{
|
||||
LLWearableEntry() : mItemID( LLUUID::null ), mWearable( NULL ) {}
|
||||
|
||||
LLUUID mItemID; // ID of the inventory item in the agent's inventory.
|
||||
LLWearable* mWearable;
|
||||
};
|
||||
LLWearableEntry mWearableEntry[ WT_COUNT ];
|
||||
BOOL mWearablesLoaded;
|
||||
|
||||
|
||||
class createStandardWearablesAllDoneCallback : public LLRefCount
|
||||
{
|
||||
protected:
|
||||
~createStandardWearablesAllDoneCallback();
|
||||
};
|
||||
class sendAgentWearablesUpdateCallback : public LLRefCount
|
||||
{
|
||||
protected:
|
||||
~sendAgentWearablesUpdateCallback();
|
||||
};
|
||||
|
||||
class addWearableToAgentInventoryCallback : public LLInventoryCallback
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
CALL_NONE = 0,
|
||||
CALL_UPDATE = 1,
|
||||
CALL_RECOVERDONE = 2,
|
||||
CALL_CREATESTANDARDDONE = 4,
|
||||
CALL_MAKENEWOUTFITDONE = 8
|
||||
} EType;
|
||||
|
||||
/**
|
||||
* @brief Construct a callback for dealing with the wearables.
|
||||
*
|
||||
* Would like to pass the agent in here, but we can't safely
|
||||
* count on it being around later. Just use gAgent directly.
|
||||
* @param cb callback to execute on completion (??? unused ???)
|
||||
* @param index Index for the wearable in the agent
|
||||
* @param wearable The wearable data.
|
||||
* @param todo Bitmask of actions to take on completion.
|
||||
*/
|
||||
addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount> cb,
|
||||
S32 index,
|
||||
LLWearable* wearable,
|
||||
U32 todo = CALL_NONE);
|
||||
virtual void fire(const LLUUID& inv_item);
|
||||
|
||||
private:
|
||||
S32 mIndex;
|
||||
LLWearable* mWearable;
|
||||
U32 mTodo;
|
||||
LLPointer<LLRefCount> mCB;
|
||||
};
|
||||
|
||||
/** DEPERCIATED
|
||||
/** DEPRECIATED
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
1794
indra/newview/llagentwearables.cpp
Normal file
1794
indra/newview/llagentwearables.cpp
Normal file
File diff suppressed because it is too large
Load Diff
351
indra/newview/llagentwearables.h
Normal file
351
indra/newview/llagentwearables.h
Normal file
@@ -0,0 +1,351 @@
|
||||
/**
|
||||
* @file llagentwearables.h
|
||||
* @brief LLAgentWearables class header file
|
||||
*
|
||||
* $LicenseInfo:firstyear=2000&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2000-2010, Linden Research, Inc.
|
||||
*
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* 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://secondlife.com/developers/opensource/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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LL_LLAGENTWEARABLES_H
|
||||
#define LL_LLAGENTWEARABLES_H
|
||||
|
||||
// libraries
|
||||
#include "llmemory.h"
|
||||
#include "llui.h"
|
||||
#include "lluuid.h"
|
||||
#include "llinventory.h"
|
||||
|
||||
// newview
|
||||
#include "llinventorymodel.h"
|
||||
#include "llviewerinventory.h"
|
||||
#include "llvoavatardefines.h"
|
||||
|
||||
class LLInventoryItem;
|
||||
class LLVOAvatar;
|
||||
class LLWearable;
|
||||
class LLInitialWearablesFetch;
|
||||
class LLViewerObject;
|
||||
class LLTexLayerTemplate;
|
||||
|
||||
typedef std::vector<LLViewerObject*> llvo_vec_t;
|
||||
|
||||
class LLAgentWearables : public LLInitClass<LLAgentWearables>
|
||||
{
|
||||
//--------------------------------------------------------------------
|
||||
// Constructors / destructors / Initializers
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
friend class LLInitialWearablesFetch;
|
||||
|
||||
LLAgentWearables();
|
||||
virtual ~LLAgentWearables();
|
||||
void setAvatarObject(LLVOAvatar *avatar);
|
||||
void createStandardWearables(BOOL female);
|
||||
void cleanup();
|
||||
//void dump();
|
||||
|
||||
// LLInitClass interface
|
||||
static void initClass();
|
||||
protected:
|
||||
void createStandardWearablesDone(S32 index);
|
||||
void createStandardWearablesAllDone();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Queries
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
BOOL isWearingItem(const LLUUID& item_id) const;
|
||||
BOOL isWearableModifiable(EWearableType type) const;
|
||||
BOOL isWearableModifiable(const LLUUID& item_id) const;
|
||||
|
||||
BOOL isWearableCopyable(EWearableType type) const;
|
||||
BOOL areWearablesLoaded() const { return mWearablesLoaded; };
|
||||
//void updateWearablesLoaded();
|
||||
//void checkWearablesLoaded() const;
|
||||
//bool canMoveWearable(const LLUUID& item_id, bool closer_to_body);
|
||||
|
||||
// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
|
||||
//bool canWearableBeRemoved(const LLWearable* wearable) const;
|
||||
|
||||
//void animateAllWearableParams(F32 delta, BOOL upload_bake);
|
||||
|
||||
BOOL needsReplacement(EWearableType wearableType, S32 remove);
|
||||
U32 getWearablePermMask(EWearableType type) const;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
const LLUUID& getWearableItemID(EWearableType type ) const;
|
||||
//const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
const LLWearable* getWearableFromItemID(const LLUUID& item_id) const;
|
||||
LLWearable* getWearableFromItemID(const LLUUID& item_id);
|
||||
//LLWearable* getWearableFromAssetID(const LLUUID& asset_id);
|
||||
LLInventoryItem* getWearableInventoryItem(EWearableType type);
|
||||
static BOOL selfHasWearable( void* userdata ); // userdata is EWearableType
|
||||
LLWearable* getWearable( const EWearableType type );
|
||||
const LLWearable* getWearable( const EWearableType type ) const;
|
||||
//const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
//LLWearable* getTopWearable(const LLWearableType::EType type);
|
||||
//LLWearable* getBottomWearable(const LLWearableType::EType type);
|
||||
//U32 getWearableCount(const LLWearableType::EType type) const;
|
||||
//U32 getWearableCount(const U32 tex_index) const;
|
||||
|
||||
|
||||
static EWearableType getTEWearableType( S32 te );
|
||||
static LLUUID getDefaultTEImageID( S32 te );
|
||||
|
||||
void copyWearableToInventory( EWearableType type );
|
||||
|
||||
static const U32 MAX_CLOTHING_PER_TYPE = 5;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Setters
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
// Low-level data structure setter - public access is via setWearableItem, etc.
|
||||
//void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
|
||||
//U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable);
|
||||
//void wearableUpdated(LLWearable *wearable);
|
||||
//void popWearable(LLWearable *wearable);
|
||||
//void popWearable(const LLWearableType::EType type, U32 index);
|
||||
|
||||
public:
|
||||
void setWearableItem(LLInventoryItem* new_item, LLWearable* wearable);
|
||||
void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove);
|
||||
void setWearableName(const LLUUID& item_id, const std::string& new_name);
|
||||
//void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index);
|
||||
//U32 getWearableIndex(LLWearable *wearable);
|
||||
|
||||
protected:
|
||||
void setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable );
|
||||
static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable);
|
||||
|
||||
void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
|
||||
LLWearable* wearable,
|
||||
const LLUUID& category_id = LLUUID::null,
|
||||
BOOL notify = TRUE);
|
||||
|
||||
/**
|
||||
* @brief Only public because of addWearableToAgentInventoryCallback.
|
||||
*
|
||||
* NOTE: Do not call this method unless you are the inventory callback.
|
||||
* NOTE: This can suffer from race conditions when working on the
|
||||
* same values for index.
|
||||
* @param index The index in mWearableEntry.
|
||||
* @param item_id The inventory item id of the new wearable to wear.
|
||||
* @param wearable The actual wearable data.
|
||||
*/
|
||||
void addWearabletoAgentInventoryDone(
|
||||
S32 index,
|
||||
const LLUUID& item_id,
|
||||
LLWearable* wearable);
|
||||
|
||||
void recoverMissingWearable(EWearableType type);
|
||||
void recoverMissingWearableDone();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Editing/moving wearables
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
//static void createWearable(LLWearableType::EType type, bool wear = false, const LLUUID& parent_id = LLUUID::null);
|
||||
//static void editWearable(const LLUUID& item_id);
|
||||
//bool moveWearable(const LLViewerInventoryItem* item, bool closer_to_body);
|
||||
|
||||
//void requestEditingWearable(const LLUUID& item_id);
|
||||
//void editWearableIfRequested(const LLUUID& item_id);
|
||||
|
||||
private:
|
||||
//LLUUID mItemToEdit;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Removing wearables
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void removeWearable( EWearableType type );
|
||||
private:
|
||||
void removeWearableFinal( EWearableType type );
|
||||
protected:
|
||||
static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
|
||||
static void userRemoveAllClothesStep2(BOOL proceed, void* userdata ); // userdata is NULL
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Server Communication
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
|
||||
static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
|
||||
//LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
|
||||
// BOOL generate_valid_hash = TRUE);
|
||||
|
||||
protected:
|
||||
void sendAgentWearablesUpdate();
|
||||
void sendAgentWearablesRequest();
|
||||
void queryWearableCache();
|
||||
//void updateServer();
|
||||
static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Outfits
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
|
||||
// Should only be called if we *know* we've never done so before, since users may
|
||||
// not want the Library outfits to stay in their quick outfit selector and can delete them.
|
||||
//void populateMyOutfitsFolder();
|
||||
void makeNewOutfit(
|
||||
const std::string& new_folder_name,
|
||||
const LLDynamicArray<S32>& wearables_to_include,
|
||||
const LLDynamicArray<S32>& attachments_to_include,
|
||||
BOOL rename_clothing);
|
||||
private:
|
||||
|
||||
void makeNewOutfitDone(S32 index);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Save Wearables
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void saveWearableAs( EWearableType type, const std::string& new_name, BOOL save_in_lost_and_found );
|
||||
void saveWearable( EWearableType type, BOOL send_update = TRUE );
|
||||
|
||||
void saveAllWearables();
|
||||
void revertWearable( EWearableType type );
|
||||
void revertAllWearables();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Static UI hooks
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
static void userRemoveWearable( void* userdata ); // userdata is EWearableType
|
||||
static void userRemoveAllClothes( void* userdata ); // userdata is NULL
|
||||
// static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array);
|
||||
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2.0a) | Added: Catznip-2.2.0a
|
||||
// Not the best way to go about this but other attempts changed far too much LL code to be a viable solution
|
||||
static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array, bool fAttachOnly = false);
|
||||
// [/SL:KB]
|
||||
static void userRemoveAllAttachments( void* userdata); // userdata is NULLy);
|
||||
static void userRemoveMultipleAttachments(llvo_vec_t& llvo_array);
|
||||
static void userRemoveAllAttachments();
|
||||
static void userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array);
|
||||
|
||||
BOOL itemUpdatePending(const LLUUID& item_id) const;
|
||||
U32 itemUpdatePendingCount() const;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Signals
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
/*typedef boost::function<void()> loading_started_callback_t;
|
||||
typedef boost::signals2::signal<void()> loading_started_signal_t;
|
||||
boost::signals2::connection addLoadingStartedCallback(loading_started_callback_t cb);
|
||||
|
||||
typedef boost::function<void()> loaded_callback_t;
|
||||
typedef boost::signals2::signal<void()> loaded_signal_t;
|
||||
boost::signals2::connection addLoadedCallback(loaded_callback_t cb);
|
||||
|
||||
void notifyLoadingStarted();
|
||||
void notifyLoadingFinished();*/
|
||||
|
||||
private:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Member variables
|
||||
//--------------------------------------------------------------------
|
||||
struct LLWearableEntry
|
||||
{
|
||||
LLWearableEntry() : mItemID( LLUUID::null ), mWearable( NULL ) {}
|
||||
|
||||
LLUUID mItemID; // ID of the inventory item in the agent's inventory.
|
||||
LLWearable* mWearable;
|
||||
};
|
||||
LLWearableEntry mWearableEntry[ WT_COUNT ];
|
||||
BOOL mWearablesLoaded;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Support classes
|
||||
//--------------------------------------------------------------------------------
|
||||
private:
|
||||
class createStandardWearablesAllDoneCallback : public LLRefCount
|
||||
{
|
||||
protected:
|
||||
~createStandardWearablesAllDoneCallback();
|
||||
};
|
||||
class sendAgentWearablesUpdateCallback : public LLRefCount
|
||||
{
|
||||
protected:
|
||||
~sendAgentWearablesUpdateCallback();
|
||||
};
|
||||
|
||||
class addWearableToAgentInventoryCallback : public LLInventoryCallback
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
CALL_NONE = 0,
|
||||
CALL_UPDATE = 1,
|
||||
CALL_RECOVERDONE = 2,
|
||||
CALL_CREATESTANDARDDONE = 4,
|
||||
CALL_MAKENEWOUTFITDONE = 8
|
||||
} EType;
|
||||
|
||||
/**
|
||||
* @brief Construct a callback for dealing with the wearables.
|
||||
*
|
||||
* Would like to pass the agent in here, but we can't safely
|
||||
* count on it being around later. Just use gAgent directly.
|
||||
* @param cb callback to execute on completion (??? unused ???)
|
||||
* @param index Index for the wearable in the agent
|
||||
* @param wearable The wearable data.
|
||||
* @param todo Bitmask of actions to take on completion.
|
||||
*/
|
||||
addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount> cb,
|
||||
S32 index,
|
||||
LLWearable* wearable,
|
||||
U32 todo = CALL_NONE);
|
||||
virtual void fire(const LLUUID& inv_item);
|
||||
|
||||
private:
|
||||
S32 mIndex;
|
||||
LLWearable* mWearable;
|
||||
U32 mTodo;
|
||||
LLPointer<LLRefCount> mCB;
|
||||
};
|
||||
|
||||
}; // LLAgentWearables
|
||||
|
||||
extern LLAgentWearables gAgentWearables;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Types
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#endif // LL_AGENTWEARABLES_H
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "llgroupmgr.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llwindow.h"
|
||||
#include "llviewerstats.h"
|
||||
#include "llmd5.h"
|
||||
@@ -4236,6 +4237,7 @@ void LLAppViewer::disconnectViewer()
|
||||
// close inventory interface, close all windows
|
||||
LLInventoryView::cleanup();
|
||||
|
||||
gAgentWearables.cleanup();
|
||||
gAgentCamera.cleanup();
|
||||
// Also writes cached agent settings to gSavedSettings
|
||||
gAgent.cleanup();
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "llmorphview.h"
|
||||
#include "llfloatertools.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "lltoolmorph.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llradiogroup.h"
|
||||
@@ -587,7 +588,7 @@ void LLPanelEditWearable::setSubpart( ESubpart subpart )
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
ESex avatar_sex = avatar->getSex();
|
||||
LLViewerInventoryItem* item;
|
||||
item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem(mType);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(mType);
|
||||
U32 perm_mask = 0x0;
|
||||
BOOL is_complete = FALSE;
|
||||
bool can_export = false;
|
||||
@@ -653,27 +654,27 @@ void LLPanelEditWearable::onBtnTakeOff( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
|
||||
LLWearable* wearable = gAgent.getWearable( self->mType );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( self->mType );
|
||||
if( !wearable )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gAgent.removeWearable( self->mType );
|
||||
gAgentWearables.removeWearable( self->mType );
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelEditWearable::onBtnSave( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
gAgent.saveWearable( self->mType );
|
||||
gAgentWearables.saveWearable( self->mType );
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelEditWearable::onBtnSaveAs( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
LLWearable* wearable = gAgent.getWearable( self->getType() );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( self->getType() );
|
||||
if( wearable )
|
||||
{
|
||||
LLWearableSaveAsDialog* save_as_dialog = new LLWearableSaveAsDialog( wearable->getName(), onSaveAsCommit, self );
|
||||
@@ -689,7 +690,7 @@ void LLPanelEditWearable::onSaveAsCommit( LLWearableSaveAsDialog* save_as_dialog
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
if( avatar )
|
||||
{
|
||||
gAgent.saveWearableAs( self->getType(), save_as_dialog->getItemName(), FALSE );
|
||||
gAgentWearables.saveWearableAs( self->getType(), save_as_dialog->getItemName(), FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,7 +699,7 @@ void LLPanelEditWearable::onSaveAsCommit( LLWearableSaveAsDialog* save_as_dialog
|
||||
void LLPanelEditWearable::onBtnRevert( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
gAgent.revertWearable( self->mType );
|
||||
gAgentWearables.revertWearable( self->mType );
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -737,7 +738,7 @@ bool LLPanelEditWearable::onSelectAutoWearOption(const LLSD& notification, const
|
||||
|
||||
bool LLPanelEditWearable::textureIsInvisible(ETextureIndex te)
|
||||
{
|
||||
if (gAgent.getWearable(mType))
|
||||
if (gAgentWearables.getWearable(mType))
|
||||
{
|
||||
LLVOAvatar *avatar = gAgent.getAvatarObject();
|
||||
if (avatar)
|
||||
@@ -873,7 +874,7 @@ void LLPanelEditWearable::addTextureDropTarget( ETextureIndex te, const std::str
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
if (avatar)
|
||||
{
|
||||
LLWearable* wearable = gAgent.getWearable(mType);
|
||||
LLWearable* wearable = gAgentWearables.getWearable(mType);
|
||||
if (wearable && mType == WT_ALPHA)
|
||||
{
|
||||
const LLTextureEntry* current_te = avatar->getTE(te);
|
||||
@@ -903,7 +904,7 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata )
|
||||
image = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
|
||||
}
|
||||
self->mTextureList[ctrl->getName()] = te;
|
||||
if (gAgent.getWearable(self->mType))
|
||||
if (gAgentWearables.getWearable(self->mType))
|
||||
{
|
||||
avatar->setLocTexTE(te, image, TRUE);
|
||||
avatar->wearableUpdated(self->mType, FALSE);
|
||||
@@ -955,14 +956,14 @@ void LLPanelEditWearable::draw()
|
||||
return;
|
||||
}
|
||||
|
||||
LLWearable* wearable = gAgent.getWearable( mType );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( mType );
|
||||
BOOL has_wearable = (wearable != NULL );
|
||||
BOOL is_dirty = isDirty();
|
||||
BOOL is_modifiable = FALSE;
|
||||
BOOL is_copyable = FALSE;
|
||||
BOOL is_complete = FALSE;
|
||||
LLViewerInventoryItem* item;
|
||||
item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem(mType);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(mType);
|
||||
if(item)
|
||||
{
|
||||
const LLPermissions& perm = item->getPermissions();
|
||||
@@ -1038,7 +1039,7 @@ void LLPanelEditWearable::draw()
|
||||
childSetTextArg("title_loading", "[DESC]", std::string(LLWearable::typeToTypeLabel( mType )));
|
||||
|
||||
std::string path;
|
||||
const LLUUID& item_id = gAgent.getWearableItem( wearable->getType() );
|
||||
const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType() );
|
||||
gInventory.appendPath(item_id, path);
|
||||
childSetVisible("path", TRUE);
|
||||
childSetTextArg("path", "[PATH]", path);
|
||||
@@ -1051,7 +1052,7 @@ void LLPanelEditWearable::draw()
|
||||
childSetTextArg("title", "[DESC]", wearable->getName() );
|
||||
|
||||
std::string path;
|
||||
const LLUUID& item_id = gAgent.getWearableItem( wearable->getType() );
|
||||
const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType() );
|
||||
gInventory.appendPath(item_id, path);
|
||||
childSetVisible("path", TRUE);
|
||||
childSetTextArg("path", "[PATH]", path);
|
||||
@@ -1198,7 +1199,7 @@ void LLPanelEditWearable::setVisible(BOOL visible)
|
||||
|
||||
BOOL LLPanelEditWearable::isDirty() const
|
||||
{
|
||||
LLWearable* wearable = gAgent.getWearable( mType );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( mType );
|
||||
if( !wearable )
|
||||
{
|
||||
return FALSE;
|
||||
@@ -1223,7 +1224,7 @@ void LLPanelEditWearable::onCommitSexChange( LLUICtrl*, void* userdata )
|
||||
return;
|
||||
}
|
||||
|
||||
if( !gAgent.isWearableModifiable(self->mType))
|
||||
if( !gAgentWearables.isWearableModifiable(self->mType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1933,10 +1934,10 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
|
||||
for( S32 i=0; i < WT_COUNT; i++ )
|
||||
{
|
||||
is_modifiable = FALSE;
|
||||
LLWearable* old_wearable = gAgent.getWearable((EWearableType)i);
|
||||
LLWearable* old_wearable = gAgentWearables.getWearable((EWearableType)i);
|
||||
if( old_wearable )
|
||||
{
|
||||
item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem((EWearableType)i);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((EWearableType)i);
|
||||
if(item)
|
||||
{
|
||||
const LLPermissions& perm = item->getPermissions();
|
||||
@@ -1957,10 +1958,10 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
|
||||
for( S32 i=0; i < WT_COUNT; i++ )
|
||||
{
|
||||
is_modifiable = FALSE;
|
||||
LLWearable* old_wearable = gAgent.getWearable((EWearableType)i);
|
||||
LLWearable* old_wearable = gAgentWearables.getWearable((EWearableType)i);
|
||||
if( old_wearable )
|
||||
{
|
||||
item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem((EWearableType)i);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((EWearableType)i);
|
||||
if(item)
|
||||
{
|
||||
const LLPermissions& perm = item->getPermissions();
|
||||
@@ -1985,7 +1986,7 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
|
||||
void LLFloaterCustomize::onBtnOk( void* userdata )
|
||||
{
|
||||
LLFloaterCustomize* floater = (LLFloaterCustomize*) userdata;
|
||||
gAgent.saveAllWearables();
|
||||
gAgentWearables.saveAllWearables();
|
||||
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
if ( avatar )
|
||||
@@ -2012,7 +2013,7 @@ void LLFloaterCustomize::onBtnMakeOutfit( void* userdata )
|
||||
|
||||
for( S32 i = 0; i < WT_COUNT; i++ )
|
||||
{
|
||||
BOOL enabled = (gAgent.getWearable( (EWearableType) i ) != NULL);
|
||||
BOOL enabled = (gAgentWearables.getWearable( (EWearableType) i ) != NULL);
|
||||
BOOL selected = (enabled && (WT_SHIRT <= i) && (i < WT_COUNT)); // only select clothing by default
|
||||
if (gAgent.isTeen()
|
||||
&& !edit_wearable_for_teens((EWearableType)i))
|
||||
@@ -2039,7 +2040,7 @@ void LLFloaterCustomize::onMakeOutfitCommit( LLMakeOutfitDialog* dialog, void* u
|
||||
|
||||
dialog->getIncludedItems( wearables_to_include, attachments_to_include );
|
||||
|
||||
gAgent.makeNewOutfit( dialog->getFolderName(), wearables_to_include, attachments_to_include, dialog->getRenameClothing() );
|
||||
gAgentWearables.makeNewOutfit( dialog->getFolderName(), wearables_to_include, attachments_to_include, dialog->getRenameClothing() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2745,13 +2746,13 @@ bool LLFloaterCustomize::onSaveDialog(const LLSD& notification, const LLSD& resp
|
||||
switch( option )
|
||||
{
|
||||
case 0: // "Save"
|
||||
gAgent.saveWearable( cur );
|
||||
gAgentWearables.saveWearable( cur );
|
||||
proceed = TRUE;
|
||||
break;
|
||||
|
||||
case 1: // "Don't Save"
|
||||
{
|
||||
gAgent.revertWearable( cur );
|
||||
gAgentWearables.revertWearable( cur );
|
||||
proceed = TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -2787,7 +2788,7 @@ void LLFloaterCustomize::fetchInventory()
|
||||
LLUUID item_id;
|
||||
for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
|
||||
{
|
||||
item_id = gAgent.getWearableItem((EWearableType)type);
|
||||
item_id = gAgentWearables.getWearableItemID((EWearableType)type);
|
||||
if(item_id.notNull())
|
||||
{
|
||||
ids.push_back(item_id);
|
||||
@@ -2813,7 +2814,7 @@ void LLFloaterCustomize::updateInventoryUI()
|
||||
panel = mWearablePanelList[i];
|
||||
if(panel)
|
||||
{
|
||||
item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem(panel->getType());
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(panel->getType());
|
||||
}
|
||||
if(item)
|
||||
{
|
||||
@@ -2848,7 +2849,7 @@ void LLFloaterCustomize::updateScrollingPanelUI()
|
||||
LLPanelEditWearable* panel = mWearablePanelList[sCurrentWearableType];
|
||||
if(panel)
|
||||
{
|
||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gAgent.getWearableInventoryItem(panel->getType());
|
||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(panel->getType());
|
||||
if(item)
|
||||
{
|
||||
U32 perm_mask = item->getPermissions().getMaskOwner();
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
// We need these because some of the code below relies on things like
|
||||
// gAgent root folder. Remove them once the abstraction leak is fixed.
|
||||
#include "llagent.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llappviewer.h"
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
@@ -4688,7 +4689,7 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item)
|
||||
mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
|
||||
BOOL passed = (0x1 << listener->getInventoryType() & mFilterOps.mFilterTypes || listener->getInventoryType() == LLInventoryType::IT_NONE)
|
||||
&& (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos)
|
||||
&& (mFilterWorn == false || gAgent.isWearingItem(item_id) ||
|
||||
&& (mFilterWorn == false || gAgentWearables.isWearingItem(item_id) ||
|
||||
(gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id)))
|
||||
&& ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions)
|
||||
&& (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include "cofmgr.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llcallingcard.h"
|
||||
#include "llcheckboxctrl.h" // for radio buttons
|
||||
@@ -1506,7 +1507,7 @@ BOOL LLFolderBridge::isItemRemovable()
|
||||
if ((item->getType() == LLAssetType::AT_CLOTHING ||
|
||||
item->getType() == LLAssetType::AT_BODYPART) && !item->getIsLinkType())
|
||||
{
|
||||
if( gAgent.isWearingItem( item->getUUID() ) )
|
||||
if( gAgentWearables.isWearingItem( item->getUUID() ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1660,7 +1661,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
|
||||
if( (item->getType() == LLAssetType::AT_CLOTHING) ||
|
||||
(item->getType() == LLAssetType::AT_BODYPART) )
|
||||
{
|
||||
if( gAgent.isWearingItem( item->getUUID() ) )
|
||||
if( gAgentWearables.isWearingItem( item->getUUID() ) )
|
||||
{
|
||||
is_movable = FALSE; // It's generally movable, but not into the trash!
|
||||
break;
|
||||
@@ -2845,7 +2846,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
|
||||
{
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
case LLAssetType::AT_BODYPART:
|
||||
is_movable = !gAgent.isWearingItem(inv_item->getUUID());
|
||||
is_movable = !gAgentWearables.isWearingItem(inv_item->getUUID());
|
||||
break;
|
||||
|
||||
case LLAssetType::AT_OBJECT:
|
||||
@@ -4818,7 +4819,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata )
|
||||
obj_items.insert(obj_items.end(), obj_items_new.begin(), obj_items_new.end());
|
||||
// [/RLVa:KB]
|
||||
|
||||
LLAgent::userUpdateAttachments(obj_items);
|
||||
LLAgentWearables::userUpdateAttachments(obj_items);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4926,7 +4927,7 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B
|
||||
|
||||
if(wearables.count() > 0)
|
||||
{
|
||||
gAgent.setWearableOutfit(items, wearables, !append);
|
||||
gAgentWearables.setWearableOutfit(items, wearables, !append);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
|
||||
@@ -5012,9 +5013,9 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata)
|
||||
{
|
||||
for(i = 0; i < wearable_count; ++i)
|
||||
{
|
||||
// if( gAgent.isWearingItem (item_array.get(i)->getUUID()) )
|
||||
// if( gAgentWearables.isWearingItem (item_array.get(i)->getUUID()) )
|
||||
// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.1.3b) | Modified: RLVa-0.2.2a
|
||||
LLWearable* pWearable = gAgent.getWearableFromWearableItem(item_array.get(i)->getLinkedUUID());
|
||||
LLWearable* pWearable = gAgentWearables.getWearableFromItemID(item_array.get(i)->getLinkedUUID());
|
||||
if ( (pWearable) && ( (!rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(pWearable->getType())) ) )
|
||||
// [/RLVa:KB]
|
||||
{
|
||||
@@ -5059,9 +5060,9 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata)
|
||||
|
||||
BOOL LLWearableBridge::renameItem(const std::string& new_name)
|
||||
{
|
||||
if( gAgent.isWearingItem( mUUID ) )
|
||||
if( gAgentWearables.isWearingItem( mUUID ) )
|
||||
{
|
||||
gAgent.setWearableName( mUUID, new_name );
|
||||
gAgentWearables.setWearableName( mUUID, new_name );
|
||||
}
|
||||
return LLItemBridge::renameItem(new_name);
|
||||
}
|
||||
@@ -5079,7 +5080,7 @@ BOOL LLWearableBridge::isItemRemovable()
|
||||
return TRUE;
|
||||
}
|
||||
// <edit>
|
||||
//if(gAgent.isWearingItem(mUUID)) return FALSE;
|
||||
//if(gAgentWearables.isWearingItem(mUUID)) return FALSE;
|
||||
// </edit>
|
||||
return LLInvFVBridge::isItemRemovable();
|
||||
}
|
||||
@@ -5088,7 +5089,7 @@ LLFontGL::StyleFlags LLWearableBridge::getLabelStyle() const
|
||||
{
|
||||
U8 font = LLFontGL::NORMAL;
|
||||
|
||||
if (gAgent.isWearingItem(mUUID))
|
||||
if (gAgentWearables.isWearingItem(mUUID))
|
||||
{
|
||||
font |= LLFontGL::BOLD;
|
||||
}
|
||||
@@ -5104,7 +5105,7 @@ LLFontGL::StyleFlags LLWearableBridge::getLabelStyle() const
|
||||
|
||||
std::string LLWearableBridge::getLabelSuffix() const
|
||||
{
|
||||
if( gAgent.isWearingItem( mUUID ) )
|
||||
if( gAgentWearables.isWearingItem( mUUID ) )
|
||||
{
|
||||
return LLItemBridge::getLabelSuffix() + " (worn)";
|
||||
}
|
||||
@@ -5133,7 +5134,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
|
||||
}
|
||||
else if ("take_off" == action)
|
||||
{
|
||||
if(gAgent.isWearingItem(mUUID))
|
||||
if(gAgentWearables.isWearingItem(mUUID))
|
||||
{
|
||||
LLViewerInventoryItem* item = getItem();
|
||||
if (item)
|
||||
@@ -5157,7 +5158,7 @@ void LLWearableBridge::openItem()
|
||||
}
|
||||
else if(isAgentInventory())
|
||||
{
|
||||
if (gAgent.isWearingItem(mUUID))
|
||||
if (gAgentWearables.isWearingItem(mUUID))
|
||||
{
|
||||
performAction(NULL, NULL, "take_off");
|
||||
}
|
||||
@@ -5270,7 +5271,7 @@ BOOL LLWearableBridge::canWearOnAvatar(void* user_data)
|
||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
|
||||
if(!item || !item->isComplete()) return FALSE;
|
||||
}
|
||||
return (!gAgent.isWearingItem(self->mUUID));
|
||||
return (!gAgentWearables.isWearingItem(self->mUUID));
|
||||
}
|
||||
|
||||
// Called from menus
|
||||
@@ -5286,7 +5287,7 @@ void LLWearableBridge::wearOnAvatar()
|
||||
{
|
||||
// Don't wear anything until initial wearables are loaded, can
|
||||
// destroy clothing items.
|
||||
if (!gAgent.areWearablesLoaded())
|
||||
if (!gAgentWearables.areWearablesLoaded())
|
||||
{
|
||||
LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
|
||||
return;
|
||||
@@ -5340,7 +5341,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userda
|
||||
// item->updateAssetOnServer();
|
||||
// wearable = new_wearable;
|
||||
// }
|
||||
gAgent.setWearable(item, wearable);
|
||||
gAgentWearables.setWearableItem(item, wearable);
|
||||
gInventory.notifyObservers();
|
||||
//self->getFolderItem()->refreshFromRoot();
|
||||
}
|
||||
@@ -5359,7 +5360,7 @@ BOOL LLWearableBridge::canEditOnAvatar(void* user_data)
|
||||
LLWearableBridge* self = (LLWearableBridge*)user_data;
|
||||
if(!self) return FALSE;
|
||||
|
||||
return (gAgent.isWearingItem(self->mUUID));
|
||||
return (gAgentWearables.isWearingItem(self->mUUID));
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -5375,7 +5376,7 @@ void LLWearableBridge::onEditOnAvatar(void* user_data)
|
||||
void LLWearableBridge::editOnAvatar()
|
||||
{
|
||||
LLUUID linked_id = gInventory.getLinkedItemID(mUUID);
|
||||
LLWearable* wearable = gAgent.getWearableFromWearableItem(linked_id);
|
||||
LLWearable* wearable = gAgentWearables.getWearableFromItemID(linked_id);
|
||||
if( wearable )
|
||||
{
|
||||
// Set the tab to the right wearable.
|
||||
@@ -5395,7 +5396,7 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data)
|
||||
LLWearableBridge* self = (LLWearableBridge*)user_data;
|
||||
if( self && (LLAssetType::AT_BODYPART != self->mAssetType) )
|
||||
{
|
||||
return gAgent.isWearingItem( self->mUUID );
|
||||
return gAgentWearables.isWearingItem( self->mUUID );
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -5405,7 +5406,7 @@ void LLWearableBridge::onRemoveFromAvatar(void* user_data)
|
||||
{
|
||||
LLWearableBridge* self = (LLWearableBridge*)user_data;
|
||||
if(!self) return;
|
||||
if(gAgent.isWearingItem(self->mUUID))
|
||||
if(gAgentWearables.isWearingItem(self->mUUID))
|
||||
{
|
||||
LLViewerInventoryItem* item = self->getItem();
|
||||
if (item)
|
||||
@@ -5427,14 +5428,14 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
|
||||
const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID);
|
||||
if(wearable)
|
||||
{
|
||||
if (gAgent.isWearingItem(item_id))
|
||||
if (gAgentWearables.isWearingItem(item_id))
|
||||
{
|
||||
EWearableType type = wearable->getType();
|
||||
|
||||
if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES) ) //&&
|
||||
//!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
|
||||
{
|
||||
gAgent.removeWearable( type );
|
||||
gAgentWearables.removeWearable( type );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3577,7 +3577,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
|
||||
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
if(!gAgent.isWearingItem(item->getUUID()))
|
||||
if(!gAgentWearables.isWearingItem(item->getUUID()))
|
||||
{
|
||||
allowed = true;
|
||||
}
|
||||
|
||||
@@ -1986,7 +1986,7 @@ public:
|
||||
virtual bool operator()(LLInventoryCategory* cat,
|
||||
LLInventoryItem* item)
|
||||
{
|
||||
return !gAgent.isWearingItem(item->getUUID());
|
||||
return !gAgentWearables.isWearingItem(item->getUUID());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llagentpilot.h"
|
||||
#include "llfloateravatarlist.h"
|
||||
#include "llfloateravatarpicker.h"
|
||||
@@ -2839,7 +2840,7 @@ bool idle_startup()
|
||||
else
|
||||
{
|
||||
// OK to just get the wearables
|
||||
if ( gAgent.areWearablesLoaded() )
|
||||
if ( gAgentWearables.areWearablesLoaded() )
|
||||
{
|
||||
// We have our clothing, proceed.
|
||||
//llinfos << "wearables loaded" << llendl;
|
||||
@@ -3522,7 +3523,7 @@ void register_viewer_callbacks(LLMessageSystem* msg)
|
||||
// LLFloaterRate::processReputationIndividualReply);
|
||||
|
||||
msg->setHandlerFuncFast(_PREHASH_AgentWearablesUpdate,
|
||||
LLAgent::processAgentInitialWearablesUpdate );
|
||||
LLAgentWearables::processAgentInitialWearablesUpdate );
|
||||
|
||||
msg->setHandlerFunc("ScriptControlChange",
|
||||
LLAgent::processScriptControlChange );
|
||||
@@ -3669,7 +3670,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
|
||||
has_name);
|
||||
if (0 == cat_array.count())
|
||||
{
|
||||
gAgent.createStandardWearables(gender);
|
||||
gAgentWearables.createStandardWearables(gender);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3794,6 +3795,11 @@ void LLStartUp::setStartupState( EStartupState state )
|
||||
|
||||
void reset_login()
|
||||
{
|
||||
gAgentWearables.cleanup();
|
||||
gAgentCamera.cleanup();
|
||||
gAgent.cleanup();
|
||||
LLWorld::getInstance()->destroyClass();
|
||||
|
||||
// OGPX : Save URL history file
|
||||
// This needs to be done on login failure because it gets read on *every* login attempt
|
||||
LLURLHistory::saveFile("url_history.xml");
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "imageids.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llcrc.h"
|
||||
#include "lldir.h"
|
||||
#include "llglheaders.h"
|
||||
@@ -82,7 +83,7 @@ LLBakedUploadData::LLBakedUploadData( LLVOAvatar* avatar,
|
||||
mStartTime = LLFrameTimer::getTotalTime(); // Record starting time
|
||||
for( S32 i = 0; i < WT_COUNT; i++ )
|
||||
{
|
||||
LLWearable* wearable = gAgent.getWearable( (EWearableType)i);
|
||||
LLWearable* wearable = gAgentWearables.getWearable( (EWearableType)i);
|
||||
if( wearable )
|
||||
{
|
||||
mWearableAssets[i] = wearable->getID();
|
||||
|
||||
575
indra/newview/lltexlayerparams.cpp
Normal file
575
indra/newview/lltexlayerparams.cpp
Normal file
@@ -0,0 +1,575 @@
|
||||
/**
|
||||
* @file lltexlayerparams.cpp
|
||||
* @brief Texture layer parameters
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2002-2010, Linden Research, Inc.
|
||||
*
|
||||
* 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://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* 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://secondlife.com/developers/opensource/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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "lltexlayerparams.h"
|
||||
|
||||
#include "llagentcamera.h"
|
||||
#include "llimagetga.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "llvoavatarself.h"
|
||||
#include "llwearable.h"
|
||||
#include "llui.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerParam
|
||||
//-----------------------------------------------------------------------------
|
||||
LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
|
||||
mTexLayer(layer),
|
||||
mAvatar(NULL)
|
||||
{
|
||||
if (mTexLayer != NULL)
|
||||
{
|
||||
mAvatar = mTexLayer->getTexLayerSet()->getAvatar();
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "LLTexLayerParam constructor passed with NULL reference for layer!" << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
LLTexLayerParam::LLTexLayerParam(LLVOAvatar *avatar) :
|
||||
mTexLayer(NULL)
|
||||
{
|
||||
mAvatar = avatar;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar )
|
||||
{
|
||||
LLViewerVisualParam::setInfo(info);
|
||||
|
||||
if (add_to_avatar)
|
||||
{
|
||||
mAvatar->addVisualParam( this);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerParamAlpha
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// static
|
||||
LLTexLayerParamAlpha::param_alpha_ptr_list_t LLTexLayerParamAlpha::sInstances;
|
||||
|
||||
// static
|
||||
void LLTexLayerParamAlpha::dumpCacheByteCount()
|
||||
{
|
||||
S32 gl_bytes = 0;
|
||||
getCacheByteCount( &gl_bytes);
|
||||
llinfos << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << llendl;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
|
||||
{
|
||||
*gl_bytes = 0;
|
||||
|
||||
for (param_alpha_ptr_list_t::iterator iter = sInstances.begin();
|
||||
iter != sInstances.end(); iter++)
|
||||
{
|
||||
LLTexLayerParamAlpha* instance = *iter;
|
||||
LLViewerTexture* tex = instance->mCachedProcessedTexture;
|
||||
if (tex)
|
||||
{
|
||||
S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
|
||||
|
||||
if (tex->hasGLTexture())
|
||||
{
|
||||
*gl_bytes += bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) :
|
||||
LLTexLayerParam(layer),
|
||||
mCachedProcessedTexture(NULL),
|
||||
mNeedsCreateTexture(FALSE),
|
||||
mStaticImageInvalid(FALSE),
|
||||
mAvgDistortionVec(1.f, 1.f, 1.f),
|
||||
mCachedEffectiveWeight(0.f)
|
||||
{
|
||||
sInstances.push_front(this);
|
||||
}
|
||||
|
||||
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLVOAvatar* avatar) :
|
||||
LLTexLayerParam(avatar),
|
||||
mCachedProcessedTexture(NULL),
|
||||
mNeedsCreateTexture(FALSE),
|
||||
mStaticImageInvalid(FALSE),
|
||||
mAvgDistortionVec(1.f, 1.f, 1.f),
|
||||
mCachedEffectiveWeight(0.f)
|
||||
{
|
||||
sInstances.push_front(this);
|
||||
}
|
||||
|
||||
|
||||
LLTexLayerParamAlpha::~LLTexLayerParamAlpha()
|
||||
{
|
||||
deleteCaches();
|
||||
sInstances.remove(this);
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLTexLayerParamAlpha::cloneParam(LLWearable* wearable) const
|
||||
{
|
||||
LLTexLayerParamAlpha *new_param = new LLTexLayerParamAlpha(mTexLayer);
|
||||
*new_param = *this;
|
||||
return new_param;
|
||||
}
|
||||
|
||||
void LLTexLayerParamAlpha::deleteCaches()
|
||||
{
|
||||
mStaticImageTGA = NULL; // deletes image
|
||||
mCachedProcessedTexture = NULL;
|
||||
mStaticImageRaw = NULL;
|
||||
mNeedsCreateTexture = FALSE;
|
||||
}
|
||||
|
||||
BOOL LLTexLayerParamAlpha::getMultiplyBlend() const
|
||||
{
|
||||
return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend;
|
||||
}
|
||||
|
||||
void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
|
||||
{
|
||||
if (mIsAnimating || mTexLayer == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
F32 min_weight = getMinWeight();
|
||||
F32 max_weight = getMaxWeight();
|
||||
F32 new_weight = llclamp(weight, min_weight, max_weight);
|
||||
U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
|
||||
U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
|
||||
if (cur_u8 != new_u8)
|
||||
{
|
||||
mCurWeight = new_weight;
|
||||
|
||||
if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||
{
|
||||
if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
|
||||
{
|
||||
upload_bake = FALSE;
|
||||
}
|
||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
mTexLayer->invalidateMorphMasks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL upload_bake)
|
||||
{
|
||||
// do not animate dummy parameters
|
||||
if (mIsDummy)
|
||||
{
|
||||
setWeight(target_value, upload_bake);
|
||||
return;
|
||||
}
|
||||
|
||||
mTargetWeight = target_value;
|
||||
setWeight(target_value, upload_bake);
|
||||
mIsAnimating = TRUE;
|
||||
if (mNext)
|
||||
{
|
||||
mNext->setAnimationTarget(target_value, upload_bake);
|
||||
}
|
||||
}
|
||||
|
||||
void LLTexLayerParamAlpha::animate(F32 delta, BOOL upload_bake)
|
||||
{
|
||||
if (mNext)
|
||||
{
|
||||
mNext->animate(delta, upload_bake);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLTexLayerParamAlpha::getSkip() const
|
||||
{
|
||||
if (!mTexLayer)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const LLVOAvatar *avatar = mTexLayer->getTexLayerSet()->getAvatar();
|
||||
|
||||
if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight)
|
||||
{
|
||||
F32 effective_weight = (avatar->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||
if (is_approx_zero(effective_weight))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
EWearableType type = (EWearableType)getWearableType();
|
||||
if ((type != WT_INVALID) && !avatar->isWearingWearableType(type))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
||||
{
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (!mTexLayer)
|
||||
{
|
||||
return success;
|
||||
}
|
||||
|
||||
F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatar()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||
BOOL weight_changed = effective_weight != mCachedEffectiveWeight;
|
||||
if (getSkip())
|
||||
{
|
||||
return success;
|
||||
}
|
||||
|
||||
LLTexLayerParamAlphaInfo *info = (LLTexLayerParamAlphaInfo *)getInfo();
|
||||
gGL.flush();
|
||||
if (info->mMultiplyBlend)
|
||||
{
|
||||
gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function
|
||||
}
|
||||
|
||||
if (!info->mStaticImageFileName.empty() && !mStaticImageInvalid)
|
||||
{
|
||||
if (mStaticImageTGA.isNull())
|
||||
{
|
||||
// Don't load the image file until we actually need it the first time. Like now.
|
||||
mStaticImageTGA = LLTexLayerStaticImageList::getInstance()->getImageTGA(info->mStaticImageFileName);
|
||||
// We now have something in one of our caches
|
||||
LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? TRUE : FALSE;
|
||||
|
||||
if (mStaticImageTGA.isNull())
|
||||
{
|
||||
llwarns << "Unable to load static file: " << info->mStaticImageFileName << llendl;
|
||||
mStaticImageInvalid = TRUE; // don't try again.
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
const S32 image_tga_width = mStaticImageTGA->getWidth();
|
||||
const S32 image_tga_height = mStaticImageTGA->getHeight();
|
||||
if (!mCachedProcessedTexture ||
|
||||
(mCachedProcessedTexture->getWidth() != image_tga_width) ||
|
||||
(mCachedProcessedTexture->getHeight() != image_tga_height) ||
|
||||
(weight_changed))
|
||||
{
|
||||
// llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl;
|
||||
mCachedEffectiveWeight = effective_weight;
|
||||
|
||||
if (!mCachedProcessedTexture)
|
||||
{
|
||||
mCachedProcessedTexture = LLViewerTextureManager::getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
|
||||
|
||||
// We now have something in one of our caches
|
||||
LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE;
|
||||
|
||||
mCachedProcessedTexture->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
|
||||
}
|
||||
|
||||
// Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed.
|
||||
mStaticImageRaw = NULL;
|
||||
mStaticImageRaw = new LLImageRaw;
|
||||
mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight);
|
||||
mNeedsCreateTexture = TRUE;
|
||||
}
|
||||
|
||||
if (mCachedProcessedTexture)
|
||||
{
|
||||
{
|
||||
// Create the GL texture, and then hang onto it for future use.
|
||||
if (mNeedsCreateTexture)
|
||||
{
|
||||
mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw);
|
||||
mNeedsCreateTexture = FALSE;
|
||||
gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
|
||||
mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
|
||||
LLGLSNoAlphaTest gls_no_alpha_test;
|
||||
gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
|
||||
gl_rect_2d_simple_tex(width, height);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
||||
// Don't keep the cache for other people's avatars
|
||||
// (It's not really a "cache" in that case, but the logic is the same)
|
||||
if (!mAvatar->isSelf())
|
||||
{
|
||||
mCachedProcessedTexture = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LLGLDisable no_alpha(GL_ALPHA_TEST);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.color4f(0.f, 0.f, 0.f, effective_weight);
|
||||
gl_rect_2d_simple(width, height);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerParamAlphaInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
LLTexLayerParamAlphaInfo::LLTexLayerParamAlphaInfo() :
|
||||
mMultiplyBlend(FALSE),
|
||||
mSkipIfZeroWeight(FALSE),
|
||||
mDomain(0.f)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node)
|
||||
{
|
||||
llassert(node->hasName("param") && node->getChildByName("param_alpha"));
|
||||
|
||||
if (!LLViewerVisualParamInfo::parseXml(node))
|
||||
return FALSE;
|
||||
|
||||
LLXmlTreeNode* param_alpha_node = node->getChildByName("param_alpha");
|
||||
if (!param_alpha_node)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static LLStdStringHandle tga_file_string = LLXmlTree::addAttributeString("tga_file");
|
||||
if (param_alpha_node->getFastAttributeString(tga_file_string, mStaticImageFileName))
|
||||
{
|
||||
// Don't load the image file until it's actually needed.
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// llwarns << "<param_alpha> element is missing tga_file attribute." << llendl;
|
||||
// }
|
||||
|
||||
static LLStdStringHandle multiply_blend_string = LLXmlTree::addAttributeString("multiply_blend");
|
||||
param_alpha_node->getFastAttributeBOOL(multiply_blend_string, mMultiplyBlend);
|
||||
|
||||
static LLStdStringHandle skip_if_zero_string = LLXmlTree::addAttributeString("skip_if_zero");
|
||||
param_alpha_node->getFastAttributeBOOL(skip_if_zero_string, mSkipIfZeroWeight);
|
||||
|
||||
static LLStdStringHandle domain_string = LLXmlTree::addAttributeString("domain");
|
||||
param_alpha_node->getFastAttributeF32(domain_string, mDomain);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LLTexLayerParamColor::LLTexLayerParamColor(LLTexLayerInterface* layer) :
|
||||
LLTexLayerParam(layer),
|
||||
mAvgDistortionVec(1.f, 1.f, 1.f)
|
||||
{
|
||||
}
|
||||
|
||||
LLTexLayerParamColor::LLTexLayerParamColor(LLVOAvatar *avatar) :
|
||||
LLTexLayerParam(avatar),
|
||||
mAvgDistortionVec(1.f, 1.f, 1.f)
|
||||
{
|
||||
}
|
||||
|
||||
LLTexLayerParamColor::~LLTexLayerParamColor()
|
||||
{
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLTexLayerParamColor::cloneParam(LLWearable* wearable) const
|
||||
{
|
||||
LLTexLayerParamColor *new_param = new LLTexLayerParamColor(mTexLayer);
|
||||
*new_param = *this;
|
||||
return new_param;
|
||||
}
|
||||
|
||||
LLColor4 LLTexLayerParamColor::getNetColor() const
|
||||
{
|
||||
const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo();
|
||||
|
||||
llassert(info->mNumColors >= 1);
|
||||
|
||||
F32 effective_weight = (mAvatar && (mAvatar->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
|
||||
|
||||
S32 index_last = info->mNumColors - 1;
|
||||
F32 scaled_weight = effective_weight * index_last;
|
||||
S32 index_start = (S32) scaled_weight;
|
||||
S32 index_end = index_start + 1;
|
||||
if (index_start == index_last)
|
||||
{
|
||||
return info->mColors[index_last];
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 weight = scaled_weight - index_start;
|
||||
const LLColor4 *start = &info->mColors[ index_start ];
|
||||
const LLColor4 *end = &info->mColors[ index_end ];
|
||||
return LLColor4((1.f - weight) * start->mV[VX] + weight * end->mV[VX],
|
||||
(1.f - weight) * start->mV[VY] + weight * end->mV[VY],
|
||||
(1.f - weight) * start->mV[VZ] + weight * end->mV[VZ],
|
||||
(1.f - weight) * start->mV[VW] + weight * end->mV[VW]);
|
||||
}
|
||||
}
|
||||
|
||||
void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake)
|
||||
{
|
||||
if (mIsAnimating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)getInfo();
|
||||
F32 min_weight = getMinWeight();
|
||||
F32 max_weight = getMaxWeight();
|
||||
F32 new_weight = llclamp(weight, min_weight, max_weight);
|
||||
U8 cur_u8 = F32_to_U8(mCurWeight, min_weight, max_weight);
|
||||
U8 new_u8 = F32_to_U8(new_weight, min_weight, max_weight);
|
||||
if (cur_u8 != new_u8)
|
||||
{
|
||||
mCurWeight = new_weight;
|
||||
|
||||
if (info->mNumColors <= 0)
|
||||
{
|
||||
// This will happen when we set the default weight the first time.
|
||||
return;
|
||||
}
|
||||
|
||||
if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||
{
|
||||
onGlobalColorChanged(upload_bake);
|
||||
if (mTexLayer)
|
||||
{
|
||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
}
|
||||
}
|
||||
|
||||
// llinfos << "param " << mName << " = " << new_weight << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
void LLTexLayerParamColor::setAnimationTarget(F32 target_value, BOOL upload_bake)
|
||||
{
|
||||
// set value first then set interpolating flag to ignore further updates
|
||||
mTargetWeight = target_value;
|
||||
setWeight(target_value, upload_bake);
|
||||
mIsAnimating = TRUE;
|
||||
if (mNext)
|
||||
{
|
||||
mNext->setAnimationTarget(target_value, upload_bake);
|
||||
}
|
||||
}
|
||||
|
||||
void LLTexLayerParamColor::animate(F32 delta, BOOL upload_bake)
|
||||
{
|
||||
if (mNext)
|
||||
{
|
||||
mNext->animate(delta, upload_bake);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerParamColorInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() :
|
||||
mOperation(LLTexLayerParamColor::OP_ADD),
|
||||
mNumColors(0)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node)
|
||||
{
|
||||
llassert(node->hasName("param") && node->getChildByName("param_color"));
|
||||
|
||||
if (!LLViewerVisualParamInfo::parseXml(node))
|
||||
return FALSE;
|
||||
|
||||
LLXmlTreeNode* param_color_node = node->getChildByName("param_color");
|
||||
if (!param_color_node)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::string op_string;
|
||||
static LLStdStringHandle operation_string = LLXmlTree::addAttributeString("operation");
|
||||
if (param_color_node->getFastAttributeString(operation_string, op_string))
|
||||
{
|
||||
LLStringUtil::toLower(op_string);
|
||||
if (op_string == "add") mOperation = LLTexLayerParamColor::OP_ADD;
|
||||
else if (op_string == "multiply") mOperation = LLTexLayerParamColor::OP_MULTIPLY;
|
||||
else if (op_string == "blend") mOperation = LLTexLayerParamColor::OP_BLEND;
|
||||
}
|
||||
|
||||
mNumColors = 0;
|
||||
|
||||
LLColor4U color4u;
|
||||
for (LLXmlTreeNode* child = param_color_node->getChildByName("value");
|
||||
child;
|
||||
child = param_color_node->getNextNamedChild())
|
||||
{
|
||||
if ((mNumColors < MAX_COLOR_VALUES))
|
||||
{
|
||||
static LLStdStringHandle color_string = LLXmlTree::addAttributeString("color");
|
||||
if (child->getFastAttributeColor4U(color_string, color4u))
|
||||
{
|
||||
mColors[ mNumColors ].setVec(color4u);
|
||||
mNumColors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mNumColors)
|
||||
{
|
||||
llwarns << "<param_color> is missing <value> sub-elements" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1))
|
||||
{
|
||||
llwarns << "<param_color> with operation\"blend\" must have exactly one <value>" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ void LLToolBar::onClickChat(void* user_data)
|
||||
// static
|
||||
void LLToolBar::onClickAppearance(void*)
|
||||
{
|
||||
if (gAgent.areWearablesLoaded())
|
||||
if (gAgentWearables.areWearablesLoaded())
|
||||
{
|
||||
gAgentCamera.changeCameraToCustomizeAvatar();
|
||||
}
|
||||
|
||||
@@ -1938,7 +1938,7 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
// <edit>
|
||||
/*if(!copyable && gAgent.isWearingItem(item->getUUID()))
|
||||
/*if(!copyable && gAgentWearables.isWearingItem(item->getUUID()))
|
||||
{
|
||||
acceptable = FALSE;
|
||||
}*/
|
||||
@@ -2038,7 +2038,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
|
||||
break;
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
if(gAgent.isWearingItem(item->getUUID()))
|
||||
if(gAgentWearables.isWearingItem(item->getUUID()))
|
||||
{
|
||||
worn = TRUE;
|
||||
}
|
||||
@@ -2559,7 +2559,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
|
||||
{
|
||||
// Don't wear anything until initial wearables are loaded, can
|
||||
// destroy clothing items.
|
||||
if (!gAgent.areWearablesLoaded())
|
||||
if (!gAgentWearables.areWearablesLoaded())
|
||||
{
|
||||
LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
|
||||
return ACCEPT_NO;
|
||||
@@ -2654,7 +2654,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
|
||||
{
|
||||
// Don't wear anything until initial wearables are loaded, can
|
||||
// destroy clothing items.
|
||||
if (!gAgent.areWearablesLoaded())
|
||||
if (!gAgentWearables.areWearablesLoaded())
|
||||
{
|
||||
LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
|
||||
return ACCEPT_NO;
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
// newview includes
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "jcfloaterareasearch.h"
|
||||
|
||||
#include "llagentpilot.h"
|
||||
@@ -2382,7 +2383,7 @@ class LLSelfRemoveAllAttachments : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLAgent::userRemoveAllAttachments(NULL);
|
||||
LLAgentWearables::userRemoveAllAttachments(NULL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -3902,7 +3903,7 @@ class LLEditEnableCustomizeAvatar : public view_listener_t
|
||||
{
|
||||
bool new_value = (gAgent.getAvatarObject() &&
|
||||
gAgent.getAvatarObject()->isFullyLoaded() &&
|
||||
gAgent.areWearablesLoaded());
|
||||
gAgentWearables.areWearablesLoaded());
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
@@ -6367,7 +6368,7 @@ class LLShowFloater : public view_listener_t
|
||||
}
|
||||
else if (floater_name == "appearance")
|
||||
{
|
||||
if (gAgent.areWearablesLoaded())
|
||||
if (gAgentWearables.areWearablesLoaded())
|
||||
{
|
||||
gAgentCamera.changeCameraToCustomizeAvatar();
|
||||
}
|
||||
@@ -9181,51 +9182,51 @@ class LLEditEnableTakeOff : public view_listener_t
|
||||
bool new_value = false;
|
||||
if (clothing == "shirt")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_SHIRT);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_SHIRT);
|
||||
}
|
||||
if (clothing == "pants")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_PANTS);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_PANTS);
|
||||
}
|
||||
if (clothing == "shoes")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_SHOES);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_SHOES);
|
||||
}
|
||||
if (clothing == "socks")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_SOCKS);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_SOCKS);
|
||||
}
|
||||
if (clothing == "jacket")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_JACKET);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_JACKET);
|
||||
}
|
||||
if (clothing == "gloves")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_GLOVES);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_GLOVES);
|
||||
}
|
||||
if (clothing == "undershirt")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_UNDERSHIRT);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERSHIRT);
|
||||
}
|
||||
if (clothing == "underpants")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_UNDERPANTS);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERPANTS);
|
||||
}
|
||||
if (clothing == "skirt")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_SKIRT);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_SKIRT);
|
||||
}
|
||||
if (clothing == "alpha")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_ALPHA);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_ALPHA);
|
||||
}
|
||||
if (clothing == "tattoo")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_TATTOO);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_TATTOO);
|
||||
}
|
||||
if (clothing == "physics")
|
||||
{
|
||||
new_value = LLAgent::selfHasWearable((void *)WT_PHYSICS);
|
||||
new_value = LLAgentWearables::selfHasWearable((void *)WT_PHYSICS);
|
||||
}
|
||||
|
||||
// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.1.3b) | Modified: RLVa-1.1.3b | OK
|
||||
@@ -9248,55 +9249,55 @@ class LLEditTakeOff : public view_listener_t
|
||||
std::string clothing = userdata.asString();
|
||||
if (clothing == "shirt")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_SHIRT);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_SHIRT);
|
||||
}
|
||||
else if (clothing == "pants")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_PANTS);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_PANTS);
|
||||
}
|
||||
else if (clothing == "shoes")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_SHOES);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_SHOES);
|
||||
}
|
||||
else if (clothing == "socks")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_SOCKS);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_SOCKS);
|
||||
}
|
||||
else if (clothing == "jacket")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_JACKET);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_JACKET);
|
||||
}
|
||||
else if (clothing == "gloves")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_GLOVES);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_GLOVES);
|
||||
}
|
||||
else if (clothing == "undershirt")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_UNDERSHIRT);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_UNDERSHIRT);
|
||||
}
|
||||
else if (clothing == "underpants")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_UNDERPANTS);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_UNDERPANTS);
|
||||
}
|
||||
else if (clothing == "skirt")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_SKIRT);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_SKIRT);
|
||||
}
|
||||
else if (clothing == "alpha")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_ALPHA);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_ALPHA);
|
||||
}
|
||||
else if (clothing == "tattoo")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_TATTOO);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_TATTOO);
|
||||
}
|
||||
else if (clothing == "physics")
|
||||
{
|
||||
LLAgent::userRemoveWearable((void*)WT_PHYSICS);
|
||||
LLAgentWearables::userRemoveWearable((void*)WT_PHYSICS);
|
||||
}
|
||||
else if (clothing == "all")
|
||||
{
|
||||
LLAgent::userRemoveAllClothes(NULL);
|
||||
LLAgentWearables::userRemoveAllClothes(NULL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include "cofmgr.h"
|
||||
#include "llagent.h" // Get state values from here
|
||||
#include "llagentwearables.h"
|
||||
#include "llanimationstates.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llviewercontrol.h"
|
||||
@@ -780,6 +781,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
|
||||
{
|
||||
mIsSelf = TRUE;
|
||||
gAgent.setAvatarObject(this);
|
||||
gAgentWearables.setAvatarObject(this);
|
||||
lldebugs << "Marking avatar as self " << id << llendl;
|
||||
}
|
||||
else
|
||||
@@ -4777,7 +4779,7 @@ void LLVOAvatar::updateVisibility()
|
||||
|
||||
if(isSelf())
|
||||
{
|
||||
if( !gAgent.areWearablesLoaded())
|
||||
if( !gAgentWearables.areWearablesLoaded())
|
||||
{
|
||||
visible = FALSE;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llassetuploadresponders.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llfloatercustomize.h"
|
||||
@@ -782,7 +783,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
|
||||
if( gFloaterCustomize )
|
||||
{
|
||||
LLViewerInventoryItem* item;
|
||||
item = (LLViewerInventoryItem*)gInventory.getItem(gAgent.getWearableItem(mType));
|
||||
item = (LLViewerInventoryItem*)gInventory.getItem(gAgentWearables.getWearableItemID(mType));
|
||||
U32 perm_mask = PERM_NONE;
|
||||
BOOL is_complete = FALSE;
|
||||
if(item)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llagentwearables.h"
|
||||
|
||||
#include "rlvhandler.h"
|
||||
#include "rlvinventory.h"
|
||||
@@ -740,7 +741,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
|
||||
LLUUID idCompositeItem;
|
||||
if ((type = LLWearable::typeNameToType(strComposite)) != WT_INVALID)
|
||||
{
|
||||
idCompositeItem = gAgent.getWearableItem(type);
|
||||
idCompositeItem = gAgentWearables.getWearableItemID(type);
|
||||
}
|
||||
else if ((idxAttachPt = getAttachPointIndex(strComposite, true)) != 0)
|
||||
{
|
||||
@@ -840,7 +841,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
|
||||
LLViewerInventoryCategory* pFolder;
|
||||
if ( (!isWearable(wtType)) ||
|
||||
( (gAgent.getWearable(wtType)) && (!isRemovable(wtType)) ) ||
|
||||
( (gRlvHandler.getCompositeInfo(gAgent.getWearableItem(wtType), NULL, &pFolder)) &&
|
||||
( (gRlvHandler.getCompositeInfo(gAgentWearables.getWearableItemID(wtType), NULL, &pFolder)) &&
|
||||
(pFolder->getUUID() != pItem->getParentUUID()) && (!gRlvHandler.canTakeOffComposite(pFolder)) ) )
|
||||
{
|
||||
return false;
|
||||
@@ -2003,7 +2004,7 @@ ERlvCmdRet RlvHandler::onGetOutfit(const RlvCommand& rlvCmd, std::string& strRep
|
||||
{
|
||||
// We never hide body parts, even if they're "locked" and we're hiding locked layers
|
||||
// (nor do we hide a layer if the issuing object is the only one that has this layer locked)
|
||||
bool fWorn = (gAgent.getWearable(wtRlvTypes[idxType])) &&
|
||||
bool fWorn = (gAgentWearables.getWearable(wtRlvTypes[idxType])) &&
|
||||
( (!RlvSettings::getHideLockedLayers()) ||
|
||||
(LLAssetType::AT_BODYPART == LLWearable::typeToAssetType(wtRlvTypes[idxType])) ||
|
||||
(RlvForceWear::isForceRemovable(wtRlvTypes[idxType], true, rlvCmd.getObjectID())) );
|
||||
@@ -2031,7 +2032,7 @@ ERlvCmdRet RlvHandler::onGetOutfitNames(const RlvCommand& rlvCmd, std::string& s
|
||||
switch (rlvCmd.getBehaviourType())
|
||||
{
|
||||
case RLV_BHVR_GETOUTFITNAMES: // Every layer that's worn
|
||||
fAdd = (gAgent.getWearable(wtType) != NULL);
|
||||
fAdd = (gAgentWearables.getWearable(wtType) != NULL);
|
||||
break;
|
||||
/*
|
||||
case RLV_BHVR_GETADDOUTFITNAMES: // Every layer that can be worn on (but ignore any locks set by the issuer)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "llvoavatar.h"
|
||||
#include "llwearablelist.h"
|
||||
#include "llwlparammanager.h"
|
||||
#include "llagentwearables.h"
|
||||
|
||||
#include "rlvhelper.h"
|
||||
#include "rlvinventory.h"
|
||||
@@ -211,7 +212,7 @@ RlvCommandOptionGetPath::RlvCommandOptionGetPath(const RlvCommand& rlvCmd)
|
||||
if (rlvCmdOption.isWearableType()) // <option> can be a clothing layer
|
||||
{
|
||||
EWearableType wtType = rlvCmdOption.getWearableType();
|
||||
m_idItems.push_back(gAgent.getWearableItem(wtType));
|
||||
m_idItems.push_back(gAgentWearables.getWearableItemID(wtType));
|
||||
}
|
||||
else if (rlvCmdOption.isAttachmentPoint()) // ... or it can specify an attachment point
|
||||
{
|
||||
@@ -330,7 +331,7 @@ bool RlvForceWear::isWearingItem(const LLInventoryItem* pItem)
|
||||
{
|
||||
case LLAssetType::AT_BODYPART:
|
||||
case LLAssetType::AT_CLOTHING:
|
||||
return gAgent.isWearingItem(pItem->getUUID());
|
||||
return gAgentWearables.isWearingItem(pItem->getUUID());
|
||||
case LLAssetType::AT_OBJECT:
|
||||
return (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->isWearingAttachment(pItem->getUUID()));
|
||||
case LLAssetType::AT_GESTURE:
|
||||
@@ -348,7 +349,7 @@ bool RlvForceWear::isWearingItem(const LLInventoryItem* pItem)
|
||||
void RlvForceWear::forceFolder(const LLViewerInventoryCategory* pFolder, EWearAction eAction, EWearFlags eFlags)
|
||||
{
|
||||
// [See LLWearableBridge::wearOnAvatar(): don't wear anything until initial wearables are loaded, can destroy clothing items]
|
||||
if (!gAgent.areWearablesLoaded())
|
||||
if (!gAgentWearables.areWearablesLoaded())
|
||||
{
|
||||
LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
|
||||
return;
|
||||
@@ -397,7 +398,7 @@ void RlvForceWear::forceFolder(const LLViewerInventoryCategory* pFolder, EWearAc
|
||||
}
|
||||
else
|
||||
{
|
||||
const LLWearable* pWearable = gAgent.getWearableFromWearableItem(pItem->getUUID());
|
||||
const LLWearable* pWearable = gAgentWearables.getWearableFromItemID(pItem->getUUID());
|
||||
if ( (pWearable) && (isForceRemovable(pWearable, false)) )
|
||||
remWearable(pWearable);
|
||||
}
|
||||
@@ -552,7 +553,7 @@ bool RlvForceWear::isForceRemovable(const LLWearable* pWearable, bool fCheckComp
|
||||
(pWearable) && (LLAssetType::AT_CLOTHING == pWearable->getAssetType())
|
||||
&& ( (idExcept.isNull()) ? !gRlvWearableLocks.isLockedWearable(pWearable)
|
||||
: !gRlvWearableLocks.isLockedWearableExcept(pWearable, idExcept) )
|
||||
&& (isStrippable(gAgent.getWearableItem(pWearable->getType())))
|
||||
&& (isStrippable(gAgentWearables.getWearableItemID(pWearable->getType())))
|
||||
#ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS
|
||||
&& ( (!fCheckComposite) || (!RlvSettings::getEnableComposites()) ||
|
||||
(!gRlvHandler.getCompositeInfo(pWearable->getItemID(), NULL, &pFolder)) || (gRlvHandler.canTakeOffComposite(pFolder)) )
|
||||
@@ -564,7 +565,7 @@ bool RlvForceWear::isForceRemovable(const LLWearable* pWearable, bool fCheckComp
|
||||
bool RlvForceWear::isForceRemovable(EWearableType wtType, bool fCheckComposite /*=true*/, const LLUUID& idExcept /*=LLUUID::null*/)
|
||||
{
|
||||
// Wearable type can be removed by an RLV command if there's at least one currently worn wearable that can be removed
|
||||
if (isForceRemovable(gAgent.getWearable(wtType), fCheckComposite, idExcept))
|
||||
if (isForceRemovable(gAgentWearables.getWearable(wtType), fCheckComposite, idExcept))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -581,7 +582,7 @@ void RlvForceWear::forceRemove(const LLWearable* pWearable)
|
||||
#ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS
|
||||
LLViewerInventoryCategory* pFolder = NULL;
|
||||
if ( (RlvSettings::getEnableComposites()) &&
|
||||
(gRlvHandler.getCompositeInfo(gAgent.getWearableItem(wtType), NULL, &pFolder)) )
|
||||
(gRlvHandler.getCompositeInfo(gAgentWearables.getWearableItemID(wtType), NULL, &pFolder)) )
|
||||
{
|
||||
// Wearable belongs to a composite folder so detach the entire folder (if we can take it off)
|
||||
if (gRlvHandler.canTakeOffComposite(pFolder))
|
||||
@@ -598,7 +599,7 @@ void RlvForceWear::forceRemove(const LLWearable* pWearable)
|
||||
// Checked: 2010-03-19 (RLVa-1.1.3a) | Added: RLVa-1.2.0a
|
||||
void RlvForceWear::forceRemove(EWearableType wtType)
|
||||
{
|
||||
forceRemove(gAgent.getWearable(wtType));
|
||||
forceRemove(gAgentWearables.getWearable(wtType));
|
||||
}
|
||||
|
||||
// Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a
|
||||
@@ -708,7 +709,7 @@ void RlvForceWear::remAttachment(const LLViewerObject* pAttachObj)
|
||||
// Checked: 2010-08-30 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c
|
||||
void RlvForceWear::addWearable(const LLViewerInventoryItem* pItem, EWearAction eAction)
|
||||
{
|
||||
const LLWearable* pWearable = gAgent.getWearableFromWearableItem(pItem->getLinkedUUID());
|
||||
const LLWearable* pWearable = gAgentWearables.getWearableFromItemID(pItem->getLinkedUUID());
|
||||
// When replacing remove all currently worn wearables of this type *unless* the item is currently worn
|
||||
if ( (ACTION_WEAR_REPLACE == eAction) && (!pWearable) )
|
||||
forceRemove(pItem->getWearableType());
|
||||
@@ -739,7 +740,7 @@ void RlvForceWear::addWearable(const LLViewerInventoryItem* pItem, EWearAction e
|
||||
void RlvForceWear::remWearable(const LLWearable* pWearable)
|
||||
{
|
||||
// Remove it from 'm_addWearables' if it's queued for wearing
|
||||
const LLViewerInventoryItem* pItem = gInventory.getItem(gAgent.getWearableItem(pWearable->getType()));
|
||||
const LLViewerInventoryItem* pItem = gInventory.getItem(gAgentWearables.getWearableItemID(pWearable->getType()));
|
||||
if ( (pItem) && (isAddWearable(pItem)) )
|
||||
{
|
||||
addwearables_map_t::iterator itAddWearables = m_addWearables.find(pItem->getWearableType());
|
||||
@@ -773,7 +774,7 @@ void RlvForceWear::done()
|
||||
if (m_remWearables.size())
|
||||
{
|
||||
for (std::list<const LLWearable*>::const_iterator itWearable = m_remWearables.begin(); itWearable != m_remWearables.end(); ++itWearable)
|
||||
gAgent.removeWearable((*itWearable)->getType());
|
||||
gAgentWearables.removeWearable((*itWearable)->getType());
|
||||
m_remWearables.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ void RlvInventory::fetchWornItems()
|
||||
// Fetch all currently worn clothing layers and body parts
|
||||
for (int type = 0; type < WT_COUNT; type++)
|
||||
{
|
||||
const LLUUID& idItem = gAgent.getWearableItem((EWearableType)type);
|
||||
const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)type);
|
||||
if (idItem.notNull())
|
||||
idItems.push_back(idItem);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "llattachmentsmgr.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "pipeline.h"
|
||||
#include "llagentwearables.h"
|
||||
|
||||
#include "rlvhelper.h"
|
||||
#include "rlvlocks.h"
|
||||
@@ -822,7 +823,7 @@ void RlvWearableLocks::addWearableTypeLock(EWearableType eType, const LLUUID& id
|
||||
bool RlvWearableLocks::canRemove(EWearableType eType) const
|
||||
{
|
||||
// NOTE: we return TRUE if the wearable type has at least one wearable that can be removed by the user
|
||||
LLWearable* pWearable = gAgent.getWearable(eType);
|
||||
LLWearable* pWearable = gAgentWearables.getWearable(eType);
|
||||
if ( (pWearable) && (!isLockedWearable(pWearable)) )
|
||||
return true;
|
||||
return false;
|
||||
@@ -832,7 +833,7 @@ bool RlvWearableLocks::canRemove(EWearableType eType) const
|
||||
bool RlvWearableLocks::hasLockedWearable(EWearableType eType) const
|
||||
{
|
||||
// NOTE: we return TRUE if there is at least 1 non-removable wearable currently worn on this wearable type
|
||||
LLWearable* pWearable = gAgent.getWearable(eType);
|
||||
LLWearable* pWearable = gAgentWearables.getWearable(eType);
|
||||
if ( (pWearable) && (isLockedWearable(pWearable)) )
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
//
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llagentwearables.h"
|
||||
#include "llviewerjointattachment.h"
|
||||
#include "llviewerobject.h"
|
||||
#include "llvoavatar.h"
|
||||
@@ -401,7 +402,7 @@ inline bool RlvWearableLocks::canRemove(const LLInventoryItem* pItem) const
|
||||
{
|
||||
// The specified item can be removed if its wearable can be removed
|
||||
RLV_ASSERT( (pItem) && (LLInventoryType::IT_WEARABLE == pItem->getInventoryType()) );
|
||||
const LLWearable* pWearable = (pItem) ? gAgent.getWearableFromWearableItem(pItem->getLinkedUUID()) : NULL;
|
||||
const LLWearable* pWearable = (pItem) ? gAgentWearables.getWearableFromItemID(pItem->getLinkedUUID()) : NULL;
|
||||
return (pWearable) && (!isLockedWearable(pWearable));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user