summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2012-09-06 02:53:55 +0000
committerDon Kjer <don@lindenlab.com>2012-09-06 02:53:55 +0000
commit85d0bcc0630bfbf8b50be3a47a113c4f8d6ec9df (patch)
treeaa12b717648de8e4f689055907bcfa7640907bd6 /indra/newview
parent2cb3b8ef6bbfa328e35b9c066f0b5c3ceebba55f (diff)
Extracted mWearableDatas from LLAgentWearables into llappearance/LLWearableData. Moved LLDriverParam into llappearance
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/CMakeLists.txt2
-rwxr-xr-xindra/newview/llagentwearables.cpp360
-rwxr-xr-xindra/newview/llagentwearables.h34
-rw-r--r--indra/newview/lldriverparam.cpp647
-rw-r--r--indra/newview/lldriverparam.h128
-rw-r--r--indra/newview/llfloateravatartextures.cpp4
-rw-r--r--indra/newview/lllocalbitmaps.cpp2
-rw-r--r--indra/newview/llpaneleditwearable.cpp2
-rw-r--r--indra/newview/llphysicsmotion.cpp12
-rw-r--r--indra/newview/llsidepanelappearance.cpp2
-rw-r--r--indra/newview/llviewerwearable.cpp35
-rw-r--r--indra/newview/llviewerwearable.h8
-rwxr-xr-xindra/newview/llvoavatar.cpp68
-rwxr-xr-xindra/newview/llvoavatar.h14
-rwxr-xr-xindra/newview/llvoavatarself.cpp30
-rwxr-xr-xindra/newview/llvoavatarself.h5
16 files changed, 142 insertions, 1211 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 214071fa67..21b1512e58 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -158,7 +158,6 @@ set(viewer_SOURCE_FILES
lldrawpooltree.cpp
lldrawpoolwater.cpp
lldrawpoolwlsky.cpp
- lldriverparam.cpp
lldynamictexture.cpp
llemote.cpp
llenvmanager.cpp
@@ -728,7 +727,6 @@ set(viewer_HEADER_FILES
lldrawpooltree.h
lldrawpoolwater.h
lldrawpoolwlsky.h
- lldriverparam.h
lldynamictexture.h
llemote.h
llenvmanager.h
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 08238e1aea..40cedc1b35 100755
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -119,7 +119,7 @@ void LLAgentWearables::dump()
llinfos << "Type: " << i << " count " << count << llendl;
for (U32 j=0; j<count; j++)
{
- LLViewerWearable* wearable = getWearable((LLWearableType::EType)i,j);
+ LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
if (wearable == NULL)
{
llinfos << " " << j << " NULL wearable" << llendl;
@@ -159,6 +159,7 @@ struct LLAgentDumper
};
LLAgentWearables::LLAgentWearables() :
+ LLWearableData(),
mWearablesLoaded(FALSE)
, mCOFChangeInProgress(false)
{
@@ -182,12 +183,11 @@ void LLAgentWearables::initClass()
}
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
-{
- if (avatar)
- {
- avatar->outputRezTiming("Sending wearables request");
- sendAgentWearablesRequest();
- }
+{
+ llassert(avatar);
+ avatar->outputRezTiming("Sending wearables request");
+ sendAgentWearablesRequest();
+ setAvatarAppearance(avatar);
}
// wearables
@@ -312,7 +312,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
{
for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
{
- LLViewerWearable* wearable = getWearable((LLWearableType::EType)type,index);
+ LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type,index);
if (wearable)
{
if (wearable->getItemID().isNull())
@@ -354,7 +354,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
U8 type_u8 = (U8)type;
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8);
- LLViewerWearable* wearable = getWearable((LLWearableType::EType)type, 0);
+ LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type, 0);
if (wearable)
{
//llinfos << "Sending wearable " << wearable->getName() << llendl;
@@ -382,7 +382,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update,
const std::string new_name)
{
- LLViewerWearable* old_wearable = getWearable(type, index);
+ LLViewerWearable* old_wearable = getViewerWearable(type, index);
if(!old_wearable) return;
bool name_changed = !new_name.empty() && (new_name != old_wearable->getName());
if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion())
@@ -465,7 +465,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
llwarns << "LLAgent::saveWearableAs() not copyable." << llendl;
return;
}
- LLViewerWearable* old_wearable = getWearable(type, index);
+ LLViewerWearable* old_wearable = getViewerWearable(type, index);
if (!old_wearable)
{
llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl;
@@ -518,7 +518,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
{
- LLViewerWearable* wearable = getWearable(type, index);
+ LLViewerWearable* wearable = getViewerWearable(type, index);
llassert(wearable);
if (wearable)
{
@@ -553,7 +553,7 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
if (curr_item_id == item_id)
{
- LLViewerWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
+ LLViewerWearable* old_wearable = getViewerWearable((LLWearableType::EType)i,j);
llassert(old_wearable);
if (!old_wearable) continue;
@@ -647,7 +647,7 @@ const LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& it
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- const LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
+ const LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
{
return curr_wearable;
@@ -664,7 +664,7 @@ LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
+ LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
{
return curr_wearable;
@@ -680,7 +680,7 @@ LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_i
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
+ LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
{
return curr_wearable;
@@ -699,215 +699,55 @@ void LLAgentWearables::sendAgentWearablesRequest()
gAgent.sendReliableMessage();
}
-// static
-BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
+LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/)
{
- return (gAgentWearables.getWearableCount(type) > 0);
+ return dynamic_cast<LLViewerWearable*> (getWearable(type, index));
}
-LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
+const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const
{
- wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return NULL;
- }
- wearableentry_vec_t& wearable_vec = wearable_iter->second;
- if (index>=wearable_vec.size())
- {
- return NULL;
- }
- else
- {
- return wearable_vec[index];
- }
+ return dynamic_cast<const LLViewerWearable*> (getWearable(type, index));
}
-void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLViewerWearable *wearable)
-{
-
- LLViewerWearable *old_wearable = getWearable(type,index);
- if (!old_wearable)
- {
- pushWearable(type,wearable);
- return;
- }
-
- wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- llwarns << "invalid type, type " << type << " index " << index << llendl;
- return;
- }
- wearableentry_vec_t& wearable_vec = wearable_iter->second;
- if (index>=wearable_vec.size())
- {
- llwarns << "invalid index, type " << type << " index " << index << llendl;
- }
- else
- {
- wearable_vec[index] = wearable;
- old_wearable->setLabelUpdated();
- wearableUpdated(wearable);
- checkWearableAgainstInventory(wearable);
- }
-}
-
-U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable)
-{
- if (wearable == NULL)
- {
- // no null wearables please!
- llwarns << "Null wearable sent for type " << type << llendl;
- return MAX_CLOTHING_PER_TYPE;
- }
- if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
- {
- mWearableDatas[type].push_back(wearable);
- wearableUpdated(wearable);
- checkWearableAgainstInventory(wearable);
- return mWearableDatas[type].size()-1;
- }
- return MAX_CLOTHING_PER_TYPE;
-}
-
-void LLAgentWearables::wearableUpdated(LLViewerWearable *wearable)
+// static
+BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
{
- gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE);
- wearable->refreshName();
- wearable->setLabelUpdated();
-
- wearable->pullCrossWearableValues();
-
- // Hack pt 2. If the wearable we just loaded has definition version 24,
- // then force a re-save of this wearable after slamming the version number to 22.
- // This number was incorrectly incremented for internal builds before release, and
- // this fix will ensure that the affected wearables are re-saved with the right version number.
- // the versions themselves are compatible. This code can be removed before release.
- if( wearable->getDefinitionVersion() == 24 )
- {
- wearable->setDefinitionVersion(22);
- U32 index = getWearableIndex(wearable);
- llinfos << "forcing werable type " << wearable->getType() << " to version 22 from 24" << llendl;
- saveWearable(wearable->getType(),index,TRUE);
- }
-
+ return (gAgentWearables.getWearableCount(type) > 0);
}
-void LLAgentWearables::popWearable(LLViewerWearable *wearable)
+// virtual
+void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
{
- if (wearable == NULL)
- {
- // nothing to do here. move along.
- return;
- }
-
- U32 index = getWearableIndex(wearable);
- LLWearableType::EType type = wearable->getType();
-
- if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
+ if (isAgentAvatarValid())
{
- popWearable(type, index);
+ const BOOL upload_result = removed;
+ gAgentAvatarp->wearableUpdated(wearable->getType(), upload_result);
}
-}
-void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
-{
- LLViewerWearable *wearable = getWearable(type, index);
- if (wearable)
- {
- mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
- }
- wearable->setLabelUpdated();
- }
-}
+ LLWearableData::wearableUpdated(wearable, removed);
-U32 LLAgentWearables::getWearableIndex(const LLViewerWearable *wearable) const
-{
- if (wearable == NULL)
+ if (!removed)
{
- return MAX_CLOTHING_PER_TYPE;
- }
+ LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable);
+ viewer_wearable->refreshName();
- const LLWearableType::EType type = wearable->getType();
- wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- llwarns << "tried to get wearable index with an invalid type!" << llendl;
- return MAX_CLOTHING_PER_TYPE;
- }
- const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- for(U32 index = 0; index < wearable_vec.size(); index++)
- {
- if (wearable_vec[index] == wearable)
+ // Hack pt 2. If the wearable we just loaded has definition version 24,
+ // then force a re-save of this wearable after slamming the version number to 22.
+ // This number was incorrectly incremented for internal builds before release, and
+ // this fix will ensure that the affected wearables are re-saved with the right version number.
+ // the versions themselves are compatible. This code can be removed before release.
+ if( wearable->getDefinitionVersion() == 24 )
{
- return index;
+ wearable->setDefinitionVersion(22);
+ U32 index = getWearableIndex(wearable);
+ llinfos << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << llendl;
+ saveWearable(wearable->getType(),index,TRUE);
}
- }
-
- return MAX_CLOTHING_PER_TYPE;
-}
-const LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
-{
- wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return NULL;
- }
- const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- if (index>=wearable_vec.size())
- {
- return NULL;
- }
- else
- {
- return wearable_vec[index];
+ checkWearableAgainstInventory(viewer_wearable);
}
}
-LLViewerWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
-{
- U32 count = getWearableCount(type);
- if ( count == 0)
- {
- return NULL;
- }
-
- return getWearable(type, count-1);
-}
-
-LLViewerWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
-{
- if (getWearableCount(type) == 0)
- {
- return NULL;
- }
-
- return getWearable(type, 0);
-}
-
-U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
-{
- wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
- if (wearable_iter == mWearableDatas.end())
- {
- return 0;
- }
- const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- return wearable_vec.size();
-}
-
-U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
-{
- const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
- return getWearableCount(wearable_type);
-}
-
-
BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const
{
return mItemsAwaitingWearableUpdate.find(item_id) != mItemsAwaitingWearableUpdate.end();
@@ -920,7 +760,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
{
- const LLViewerWearable *wearable = getWearable(type,index);
+ const LLViewerWearable *wearable = getViewerWearable(type,index);
if (wearable)
return wearable->getItemID();
else
@@ -929,7 +769,7 @@ const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
{
- const LLViewerWearable *wearable = getWearable(type,index);
+ const LLViewerWearable *wearable = getViewerWearable(type,index);
if (wearable)
return wearable->getAssetID();
else
@@ -1095,7 +935,7 @@ void LLAgentWearables::recoverMissingWearableDone()
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
{
- LLViewerWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index);
+ LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)wearable_type, wearable_index);
if (!wearable)
{
llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
@@ -1305,7 +1145,7 @@ void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_
}
else
{
- LLViewerWearable* old_wearable = getWearable(type,index);
+ LLViewerWearable* old_wearable = getViewerWearable(type,index);
if (old_wearable)
{
@@ -1360,10 +1200,10 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
//LLAgentDumper dumper("removeWearable");
if (do_remove_all)
{
- S32 max_entry = mWearableDatas[type].size()-1;
+ S32 max_entry = getWearableCount(type)-1;
for (S32 i=max_entry; i>=0; i--)
{
- LLViewerWearable* old_wearable = getWearable(type,i);
+ LLViewerWearable* old_wearable = getViewerWearable(type,i);
//queryWearableCache(); // moved below
if (old_wearable)
{
@@ -1371,11 +1211,11 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
old_wearable->removeFromAvatar(TRUE);
}
}
- mWearableDatas[type].clear();
+ clearWearableType(type);
}
else
{
- LLViewerWearable* old_wearable = getWearable(type, index);
+ LLViewerWearable* old_wearable = getViewerWearable(type, index);
//queryWearableCache(); // moved below
if (old_wearable)
@@ -1439,8 +1279,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
{
pushWearable(type,new_wearable);
}
- wearableUpdated(new_wearable);
- checkWearableAgainstInventory(new_wearable);
+ const BOOL removed = FALSE;
+ wearableUpdated(new_wearable, removed);
}
}
@@ -1491,7 +1331,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearab
{
// Remove old wearable, if any
// MULTI_WEARABLE: hardwired to 0
- LLViewerWearable* old_wearable = getWearable(type,0);
+ LLViewerWearable* old_wearable = getViewerWearable(type,0);
if (old_wearable)
{
const LLUUID& old_item_id = old_wearable->getItemID();
@@ -1560,9 +1400,10 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara
if (do_append && getWearableItemID(type,0).notNull())
{
new_wearable->setItemID(new_item->getUUID());
- mWearableDatas[type].push_back(new_wearable);
+ const bool trigger_updated = false;
+ pushWearable(type, new_wearable, trigger_updated);
llinfos << "Added additional wearable for type " << type
- << " size is now " << mWearableDatas[type].size() << llendl;
+ << " size is now " << getWearableCount(type) << llendl;
checkWearableAgainstInventory(new_wearable);
}
else
@@ -1570,7 +1411,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara
// Replace the old wearable with a new one.
llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
- LLViewerWearable *old_wearable = getWearable(type,0);
+ LLViewerWearable *old_wearable = getViewerWearable(type,0);
LLUUID old_item_id;
if (old_wearable)
{
@@ -1585,7 +1426,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara
gInventory.notifyObservers();
}
llinfos << "Replaced current element 0 for type " << type
- << " size is now " << mWearableDatas[type].size() << llendl;
+ << " size is now " << getWearableCount(type) << llendl;
}
//llinfos << "LLVOAvatar::setWearableItem()" << llendl;
@@ -1652,46 +1493,14 @@ void LLAgentWearables::queryWearableCache()
}
}
-LLUUID LLAgentWearables::computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
- BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
+// virtual
+void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const
{
- LLUUID hash_id;
- bool hash_computed = false;
- LLMD5 hash;
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
-
- for (U8 i=0; i < baked_dict->mWearables.size(); i++)
- {
- const LLWearableType::EType baked_type = baked_dict->mWearables[i];
- const U32 num_wearables = getWearableCount(baked_type);
- for (U32 index = 0; index < num_wearables; ++index)
- {
- const LLViewerWearable* wearable = getWearable(baked_type,index);
- if (wearable)
- {
- LLUUID asset_id = wearable->getAssetID();
- hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
- hash_computed = true;
- }
- }
- }
- if (hash_computed)
+ // Add some garbage into the hash so that it becomes invalid.
+ if (isAgentAvatarValid())
{
- hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES);
-
- // Add some garbage into the hash so that it becomes invalid.
- if (!generate_valid_hash)
- {
- if (isAgentAvatarValid())
- {
- hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
- }
- }
- hash.finalize();
- hash.raw_digest(hash_id.mData);
+ hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
}
-
- return hash_id;
}
// User has picked "remove from avatar" from a menu.
@@ -1875,13 +1684,13 @@ void LLAgentWearables::checkWearablesLoaded() const
// Returns false if the given wearable is already topmost/bottommost
// (depending on closer_to_body parameter).
-bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body)
+bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) const
{
- const LLViewerWearable* wearable = getWearableFromItemID(item_id);
+ const LLWearable* wearable = getWearableFromItemID(item_id);
if (!wearable) return false;
LLWearableType::EType wtype = wearable->getType();
- const LLViewerWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
+ const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
if (!marginal_wearable) return false;
return wearable != marginal_wearable;
@@ -1918,7 +1727,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
{
for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
{
- LLViewerWearable *wearable = getWearable((LLWearableType::EType)type,count);
+ LLViewerWearable *wearable = getViewerWearable((LLWearableType::EType)type,count);
llassert(wearable);
if (wearable)
{
@@ -1933,28 +1742,39 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos
if (!item) return false;
if (!item->isWearableType()) return false;
- wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(item->getWearableType());
- if (wearable_iter == mWearableDatas.end()) return false;
-
- wearableentry_vec_t& wearable_vec = wearable_iter->second;
- if (wearable_vec.empty()) return false;
+ LLWearableType::EType type = item->getWearableType();
+ U32 wearable_count = getWearableCount(type);
+ if (0 == wearable_count) return false;
const LLUUID& asset_id = item->getAssetUUID();
//nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
- if (closer_to_body && asset_id == wearable_vec.front()->getAssetID()) return false;
- if (!closer_to_body && asset_id == wearable_vec.back()->getAssetID()) return false;
+ if (closer_to_body)
+ {
+ LLViewerWearable* bottom_wearable = dynamic_cast<LLViewerWearable*>( getBottomWearable(type) );
+ if (bottom_wearable->getAssetID() == asset_id)
+ {
+ return false;
+ }
+ }
+ else // !closer_to_body
+ {
+ LLViewerWearable* top_wearable = dynamic_cast<LLViewerWearable*>( getTopWearable(type) );
+ if (top_wearable->getAssetID() == asset_id)
+ {
+ return false;
+ }
+ }
- for (U32 i = 0; i < wearable_vec.size(); ++i)
+ for (U32 i = 0; i < wearable_count; ++i)
{
- LLViewerWearable* wearable = wearable_vec[i];
+ LLViewerWearable* wearable = getViewerWearable(type, i);
if (!wearable) continue;
if (wearable->getAssetID() != asset_id) continue;
//swapping wearables
U32 swap_i = closer_to_body ? i-1 : i+1;
- wearable_vec[i] = wearable_vec[swap_i];
- wearable_vec[swap_i] = wearable;
+ swapWearables(type, i, swap_i);
return true;
}
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 41995dd55b..a60fbc969b 100755
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -37,6 +37,7 @@
#include "llinventorymodel.h"
#include "llviewerinventory.h"
#include "llavatarappearancedefines.h"
+#include "llwearabledata.h"
class LLInventoryItem;
class LLVOAvatarSelf;
@@ -44,7 +45,7 @@ class LLViewerWearable;
class LLInitialWearablesFetch;
class LLViewerObject;
-class LLAgentWearables : public LLInitClass<LLAgentWearables>
+class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearableData
{
//--------------------------------------------------------------------
// Constructors / destructors / Initializers
@@ -78,7 +79,7 @@ public:
bool isCOFChangeInProgress() const { return mCOFChangeInProgress; }
void updateWearablesLoaded();
void checkWearablesLoaded() const;
- bool canMoveWearable(const LLUUID& item_id, bool closer_to_body);
+ bool canMoveWearable(const LLUUID& item_id, bool closer_to_body) const;
// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
bool canWearableBeRemoved(const LLViewerWearable* wearable) const;
@@ -94,36 +95,22 @@ public:
const LLViewerWearable* getWearableFromItemID(const LLUUID& item_id) const;
LLViewerWearable* getWearableFromItemID(const LLUUID& item_id);
LLViewerWearable* getWearableFromAssetID(const LLUUID& asset_id);
+ LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+ const LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
static BOOL selfHasWearable(LLWearableType::EType type);
- LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
- const LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
- LLViewerWearable* getTopWearable(const LLWearableType::EType type);
- LLViewerWearable* getBottomWearable(const LLWearableType::EType type);
- U32 getWearableCount(const LLWearableType::EType type) const;
- U32 getWearableCount(const U32 tex_index) const;
-
- 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, LLViewerWearable *wearable);
- U32 pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable);
- void wearableUpdated(LLViewerWearable *wearable);
- void popWearable(LLViewerWearable *wearable);
- void popWearable(const LLWearableType::EType type, U32 index);
-
+ /*virtual*/void wearableUpdated(LLWearable *wearable, BOOL removed);
public:
void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove);
void setWearableName(const LLUUID& item_id, const std::string& new_name);
+ // *TODO: Move this into llappearance/LLWearableData ?
void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);
- U32 getWearableIndex(const LLViewerWearable *wearable) const;
protected:
void setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append = false);
@@ -171,10 +158,9 @@ protected:
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(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
- BOOL generate_valid_hash = TRUE);
protected:
+ /*virtual*/ void invalidateBakedTextureHash(LLMD5& hash) const;
void sendAgentWearablesUpdate();
void sendAgentWearablesRequest();
void queryWearableCache();
@@ -243,10 +229,6 @@ private:
// Member variables
//--------------------------------------------------------------------
private:
- typedef std::vector<LLViewerWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
- typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
- wearableentry_map_t mWearableDatas;
-
static BOOL mInitialWearablesUpdateReceived;
BOOL mWearablesLoaded;
std::set<LLUUID> mItemsAwaitingWearableUpdate;
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
deleted file mode 100644
index 5abf72d51f..0000000000
--- a/indra/newview/lldriverparam.cpp
+++ /dev/null
@@ -1,647 +0,0 @@
-/**
- * @file lldriverparam.cpp
- * @brief A visual parameter that drives (controls) other visual parameters.
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "lldriverparam.h"
-
-#include "llfasttimer.h"
-#include "llvoavatar.h"
-#include "llvoavatarself.h"
-#include "llagent.h"
-#include "llviewerwearable.h"
-#include "llagentwearables.h"
-
-//-----------------------------------------------------------------------------
-// LLDriverParamInfo
-//-----------------------------------------------------------------------------
-
-LLDriverParamInfo::LLDriverParamInfo()
-{
-}
-
-BOOL LLDriverParamInfo::parseXml(LLXmlTreeNode* node)
-{
- llassert( node->hasName( "param" ) && node->getChildByName( "param_driver" ) );
-
- if( !LLViewerVisualParamInfo::parseXml( node ))
- return FALSE;
-
- LLXmlTreeNode* param_driver_node = node->getChildByName( "param_driver" );
- if( !param_driver_node )
- return FALSE;
-
- for (LLXmlTreeNode* child = param_driver_node->getChildByName( "driven" );
- child;
- child = param_driver_node->getNextNamedChild())
- {
- S32 driven_id;
- static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
- if( child->getFastAttributeS32( id_string, driven_id ) )
- {
- F32 min1 = mMinWeight;
- F32 max1 = mMaxWeight;
- F32 max2 = max1;
- F32 min2 = max1;
-
- // driven ________ //
- // ^ /| |\ //
- // | / | | \ //
- // | / | | \ //
- // | / | | \ //
- // | / | | \ //
- //-------|----|-------|----|-------> driver //
- // | min1 max1 max2 min2
-
- static LLStdStringHandle min1_string = LLXmlTree::addAttributeString("min1");
- child->getFastAttributeF32( min1_string, min1 ); // optional
- static LLStdStringHandle max1_string = LLXmlTree::addAttributeString("max1");
- child->getFastAttributeF32( max1_string, max1 ); // optional
- static LLStdStringHandle max2_string = LLXmlTree::addAttributeString("max2");
- child->getFastAttributeF32( max2_string, max2 ); // optional
- static LLStdStringHandle min2_string = LLXmlTree::addAttributeString("min2");
- child->getFastAttributeF32( min2_string, min2 ); // optional
-
- // Push these on the front of the deque, so that we can construct
- // them in order later (faster)
- mDrivenInfoList.push_front( LLDrivenEntryInfo( driven_id, min1, max1, max2, min2 ) );
- }
- else
- {
- llerrs << "<driven> Unable to resolve driven parameter: " << driven_id << llendl;
- return FALSE;
- }
- }
- return TRUE;
-}
-
-//virtual
-void LLDriverParamInfo::toStream(std::ostream &out)
-{
- LLViewerVisualParamInfo::toStream(out);
- out << "driver" << "\t";
- out << mDrivenInfoList.size() << "\t";
- for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
- {
- LLDrivenEntryInfo driven = *iter;
- out << driven.mDrivenID << "\t";
- }
-
- out << std::endl;
-
- if(isAgentAvatarValid())
- {
- for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
- {
- LLDrivenEntryInfo driven = *iter;
- LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getVisualParam(driven.mDrivenID);
- if (param)
- {
- param->getInfo()->toStream(out);
- if (param->getWearableType() != mWearableType)
- {
- if(param->getCrossWearable())
- {
- out << "cross-wearable" << "\t";
- }
- else
- {
- out << "ERROR!" << "\t";
- }
- }
- else
- {
- out << "valid" << "\t";
- }
- }
- else
- {
- llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl;
- }
- out << std::endl;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-// LLDriverParam
-//-----------------------------------------------------------------------------
-
-LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) :
- mCurrentDistortionParam( NULL ),
- mAvatarp(avatarp),
- mWearablep(NULL)
-{
- mDefaultVec.clear();
-}
-
-LLDriverParam::LLDriverParam(LLWearable *wearablep) :
- mCurrentDistortionParam( NULL ),
- mAvatarp(NULL),
- mWearablep(wearablep)
-{
- mDefaultVec.clear();
-}
-
-LLDriverParam::~LLDriverParam()
-{
-}
-
-BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
-{
- llassert(mInfo == NULL);
- if (info->mID < 0)
- return FALSE;
- mInfo = info;
- mID = info->mID;
-
- setWeight(getDefaultWeight(), FALSE );
-
- return TRUE;
-}
-
-void LLDriverParam::setWearable(LLWearable *wearablep)
-{
- if (wearablep)
- {
- mWearablep = wearablep;
- mAvatarp = NULL;
- }
-}
-
-void LLDriverParam::setAvatar(LLVOAvatar *avatarp)
-{
- if (avatarp)
- {
- mWearablep = NULL;
- mAvatarp = avatarp;
- }
-}
-
-/*virtual*/ LLViewerVisualParam* LLDriverParam::cloneParam(LLWearable* wearable) const
-{
- LLDriverParam *new_param;
- if (wearable)
- {
- new_param = new LLDriverParam(wearable);
- }
- else
- {
- if (mWearablep)
- {
- new_param = new LLDriverParam(mWearablep);
- }
- else
- {
- new_param = new LLDriverParam(mAvatarp);
- }
- }
- *new_param = *this;
- return new_param;
-}
-
-#if 0 // obsolete
-BOOL LLDriverParam::parseData(LLXmlTreeNode* node)
-{
- LLDriverParamInfo* info = new LLDriverParamInfo;
-
- info->parseXml(node);
- if (!setInfo(info))
- {
- delete info;
- return FALSE;
- }
- return TRUE;
-}
-#endif
-
-void LLDriverParam::setWeight(F32 weight, BOOL upload_bake)
-{
- F32 min_weight = getMinWeight();
- F32 max_weight = getMaxWeight();
- if (mIsAnimating)
- {
- // allow overshoot when animating
- mCurWeight = weight;
- }
- else
- {
- mCurWeight = llclamp(weight, min_weight, max_weight);
- }
-
- // driven ________
- // ^ /| |\ ^
- // | / | | \ |
- // | / | | \ |
- // | / | | \ |
- // | / | | \ |
- //-------|----|-------|----|-------> driver
- // | min1 max1 max2 min2
-
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- LLDrivenEntryInfo* info = driven->mInfo;
-
- F32 driven_weight = 0.f;
- F32 driven_min = driven->mParam->getMinWeight();
- F32 driven_max = driven->mParam->getMaxWeight();
-
- if (mIsAnimating)
- {
- // driven param doesn't interpolate (textures, for example)
- if (!driven->mParam->getAnimating())
- {
- continue;
- }
- if( mCurWeight < info->mMin1 )
- {
- if (info->mMin1 == min_weight)
- {
- if (info->mMin1 == info->mMax1)
- {
- driven_weight = driven_max;
- }
- else
- {
- //up slope extrapolation
- F32 t = (mCurWeight - info->mMin1) / (info->mMax1 - info->mMin1 );
- driven_weight = driven_min + t * (driven_max - driven_min);
- }
- }
- else
- {
- driven_weight = driven_min;
- }
-
- setDrivenWeight(driven,driven_weight,upload_bake);
- continue;
- }
- else
- if ( mCurWeight > info->mMin2 )
- {
- if (info->mMin2 == max_weight)
- {
- if (info->mMin2 == info->mMax2)
- {
- driven_weight = driven_max;
- }
- else
- {
- //down slope extrapolation
- F32 t = (mCurWeight - info->mMax2) / (info->mMin2 - info->mMax2 );
- driven_weight = driven_max + t * (driven_min - driven_max);
- }
- }
- else
- {
- driven_weight = driven_min;
- }
-
- setDrivenWeight(driven,driven_weight,upload_bake);
- continue;
- }
- }
-
- driven_weight = getDrivenWeight(driven, mCurWeight);
- setDrivenWeight(driven,driven_weight,upload_bake);
- }
-}
-
-F32 LLDriverParam::getTotalDistortion()
-{
- F32 sum = 0.f;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- sum += driven->mParam->getTotalDistortion();
- }
-
- return sum;
-}
-
-const LLVector4a &LLDriverParam::getAvgDistortion()
-{
- // It's not actually correct to take the average of averages, but it good enough here.
- LLVector4a sum;
- sum.clear();
- S32 count = 0;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- sum.add(driven->mParam->getAvgDistortion());
- count++;
- }
- sum.mul( 1.f/(F32)count);
-
- mDefaultVec = sum;
- return mDefaultVec;
-}
-
-F32 LLDriverParam::getMaxDistortion()
-{
- F32 max = 0.f;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- F32 param_max = driven->mParam->getMaxDistortion();
- if( param_max > max )
- {
- max = param_max;
- }
- }
-
- return max;
-}
-
-
-LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
-{
- LLVector4a sum;
- sum.clear();
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- sum.add(driven->mParam->getVertexDistortion( index, poly_mesh ));
- }
- return sum;
-}
-
-const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
-{
- mCurrentDistortionParam = NULL;
- const LLVector4a* v = NULL;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- v = driven->mParam->getFirstDistortion( index, poly_mesh );
- if( v )
- {
- mCurrentDistortionParam = driven->mParam;
- break;
- }
- }
-
- return v;
-};
-
-const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
-{
- llassert( mCurrentDistortionParam );
- if( !mCurrentDistortionParam )
- {
- return NULL;
- }
-
- LLDrivenEntry* driven = NULL;
- entry_list_t::iterator iter;
-
- // Set mDriven iteration to the right point
- for( iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- driven = &(*iter);
- if( driven->mParam == mCurrentDistortionParam )
- {
- break;
- }
- }
-
- llassert(driven);
- if (!driven)
- {
- return NULL; // shouldn't happen, but...
- }
-
- // We're already in the middle of a param's distortions, so get the next one.
- const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh );
- if( (!v) && (iter != mDriven.end()) )
- {
- // This param is finished, so start the next param. It might not have any
- // distortions, though, so we have to loop to find the next param that does.
- for( iter++; iter != mDriven.end(); iter++ )
- {
- driven = &(*iter);
- v = driven->mParam->getFirstDistortion( index, poly_mesh );
- if( v )
- {
- mCurrentDistortionParam = driven->mParam;
- break;
- }
- }
- }
-
- return v;
-};
-
-//-----------------------------------------------------------------------------
-// setAnimationTarget()
-//-----------------------------------------------------------------------------
-void LLDriverParam::setAnimationTarget( F32 target_value, BOOL upload_bake )
-{
- LLVisualParam::setAnimationTarget(target_value, upload_bake);
-
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- F32 driven_weight = getDrivenWeight(driven, mTargetWeight);
-
- // this isn't normally necessary, as driver params handle interpolation of their driven params
- // but texture params need to know to assume their final value at beginning of interpolation
- driven->mParam->setAnimationTarget(driven_weight, upload_bake);
- }
-}
-
-//-----------------------------------------------------------------------------
-// stopAnimating()
-//-----------------------------------------------------------------------------
-void LLDriverParam::stopAnimating(BOOL upload_bake)
-{
- LLVisualParam::stopAnimating(upload_bake);
-
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- driven->mParam->setAnimating(FALSE);
- }
-}
-
-/*virtual*/
-BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params)
-{
- BOOL success = TRUE;
- LLDriverParamInfo::entry_info_list_t::iterator iter;
- for (iter = getInfo()->mDrivenInfoList.begin(); iter != getInfo()->mDrivenInfoList.end(); ++iter)
- {
- LLDrivenEntryInfo *driven_info = &(*iter);
- S32 driven_id = driven_info->mDrivenID;
-
- // check for already existing links. Do not overwrite.
- BOOL found = FALSE;
- for (entry_list_t::iterator driven_iter = mDriven.begin(); driven_iter != mDriven.end() && !found; ++driven_iter)
- {
- if (driven_iter->mInfo->mDrivenID == driven_id)
- {
- found = TRUE;
- }
- }
-
- if (!found)
- {
- LLViewerVisualParam* param = (LLViewerVisualParam*)mapper(driven_id);
- bool push = param && (!only_cross_params || param->getCrossWearable());
- if (push)
- {
- mDriven.push_back(LLDrivenEntry( param, driven_info ));
- }
- else
- {
- success = FALSE;
- }
- }
- }
-
- return success;
-}
-
-void LLDriverParam::resetDrivenParams()
-{
- mDriven.clear();
- mDriven.reserve(getInfo()->mDrivenInfoList.size());
-}
-
-void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
-{
- bool needs_update = (getWearableType()==driven_type);
-
- // if the driver has a driven entry for the passed-in wearable type, we need to refresh the value
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
- {
- LLDrivenEntry* driven = &(*iter);
- if (driven && driven->mParam && driven->mParam->getCrossWearable() && driven->mParam->getWearableType() == driven_type)
- {
- needs_update = true;
- }
- }
-
-
- if (needs_update)
- {
- LLWearableType::EType driver_type = (LLWearableType::EType)getWearableType();
-
- // If we've gotten here, we've added a new wearable of type "type"
- // Thus this wearable needs to get updates from the driver wearable.
- // The call to setVisualParamWeight seems redundant, but is necessary
- // as the number of driven wearables has changed since the last update. -Nyx
- LLWearable *wearable = gAgentWearables.getTopWearable(driver_type);
- if (wearable)
- {
- wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID), false);
- }
- }
-}
-
-
-//-----------------------------------------------------------------------------
-// getDrivenWeight()
-//-----------------------------------------------------------------------------
-F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight)
-{
- F32 min_weight = getMinWeight();
- F32 max_weight = getMaxWeight();
- const LLDrivenEntryInfo* info = driven->mInfo;
-
- F32 driven_weight = 0.f;
- F32 driven_min = driven->mParam->getMinWeight();
- F32 driven_max = driven->mParam->getMaxWeight();
-
- if( input_weight <= info->mMin1 )
- {
- if( info->mMin1 == info->mMax1 &&
- info->mMin1 <= min_weight)
- {
- driven_weight = driven_max;
- }
- else
- {
- driven_weight = driven_min;
- }
- }
- else
- if( input_weight <= info->mMax1 )
- {
- F32 t = (input_weight - info->mMin1) / (info->mMax1 - info->mMin1 );
- driven_weight = driven_min + t * (driven_max - driven_min);
- }
- else
- if( input_weight <= info->mMax2 )
- {
- driven_weight = driven_max;
- }
- else
- if( input_weight <= info->mMin2 )
- {
- F32 t = (input_weight - info->mMax2) / (info->mMin2 - info->mMax2 );
- driven_weight = driven_max + t * (driven_min - driven_max);
- }
- else
- {
- if (info->mMax2 >= max_weight)
- {
- driven_weight = driven_max;
- }
- else
- {
- driven_weight = driven_min;
- }
- }
-
- return driven_weight;
-}
-
-void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
-{
- bool use_self = false;
- if(isAgentAvatarValid() &&
- mWearablep &&
- driven->mParam->getCrossWearable())
- {
- LLViewerWearable* wearable = dynamic_cast<LLViewerWearable*> (mWearablep);
- if (wearable->isOnTop())
- {
- use_self = true;
- }
- }
-
- if (use_self)
- {
- // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
- gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
- }
- else
- {
- driven->mParam->setWeight( driven_weight, upload_bake );
- }
-}
diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h
deleted file mode 100644
index 7a4d711d4e..0000000000
--- a/indra/newview/lldriverparam.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * @file lldriverparam.h
- * @brief A visual parameter that drives (controls) other visual parameters.
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLDRIVERPARAM_H
-#define LL_LLDRIVERPARAM_H
-
-#include "llviewervisualparam.h"
-#include "llwearabletype.h"
-
-class LLPhysicsMotion;
-class LLVOAvatar;
-class LLWearable;
-
-//-----------------------------------------------------------------------------
-
-struct LLDrivenEntryInfo
-{
- LLDrivenEntryInfo( S32 id, F32 min1, F32 max1, F32 max2, F32 min2 )
- : mDrivenID( id ), mMin1( min1 ), mMax1( max1 ), mMax2( max2 ), mMin2( min2 ) {}
- S32 mDrivenID;
- F32 mMin1;
- F32 mMax1;
- F32 mMax2;
- F32 mMin2;
-};
-
-struct LLDrivenEntry
-{
- LLDrivenEntry( LLViewerVisualParam* param, LLDrivenEntryInfo *info )
- : mParam( param ), mInfo( info ) {}
- LLViewerVisualParam* mParam;
- LLDrivenEntryInfo* mInfo;
-};
-
-//-----------------------------------------------------------------------------
-
-class LLDriverParamInfo : public LLViewerVisualParamInfo
-{
- friend class LLDriverParam;
-public:
- LLDriverParamInfo();
- /*virtual*/ ~LLDriverParamInfo() {};
-
- /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
-
- /*virtual*/ void toStream(std::ostream &out);
-
-protected:
- typedef std::deque<LLDrivenEntryInfo> entry_info_list_t;
- entry_info_list_t mDrivenInfoList;
-};
-
-//-----------------------------------------------------------------------------
-
-class LLDriverParam : public LLViewerVisualParam
-{
- friend class LLPhysicsMotion; // physics motion needs to access driven params directly.
-public:
- LLDriverParam(LLVOAvatar *avatarp);
- LLDriverParam(LLWearable *wearablep);
- ~LLDriverParam();
-
- // Special: These functions are overridden by child classes
- LLDriverParamInfo* getInfo() const { return (LLDriverParamInfo*)mInfo; }
- // This sets mInfo and calls initialization functions
- BOOL setInfo(LLDriverParamInfo *info);
-
- void setWearable(LLWearable *wearablep);
- void setAvatar(LLVOAvatar *avatarp);
- void updateCrossDrivenParams(LLWearableType::EType driven_type);
-
- /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
-
- // LLVisualParam Virtual functions
- ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
- /*virtual*/ void apply( ESex sex ) {} // apply is called separately for each driven param.
- /*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
- /*virtual*/ void setAnimationTarget( F32 target_value, BOOL upload_bake );
- /*virtual*/ void stopAnimating(BOOL upload_bake);
- /*virtual*/ BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
- /*virtual*/ void resetDrivenParams();
-
- // LLViewerVisualParam Virtual functions
- /*virtual*/ F32 getTotalDistortion();
- /*virtual*/ const LLVector4a& getAvgDistortion();
- /*virtual*/ F32 getMaxDistortion();
- /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh);
- /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
- /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
-
-protected:
- F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
- void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
-
-
- LLVector4a mDefaultVec; // temp holder
- typedef std::vector<LLDrivenEntry> entry_list_t;
- entry_list_t mDriven;
- LLViewerVisualParam* mCurrentDistortionParam;
- // Backlink only; don't make this an LLPointer.
- LLVOAvatar* mAvatarp;
- LLWearable* mWearablep;
-};
-
-#endif // LL_LLDRIVERPARAM_H
diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp
index 68bdf9a8d6..048837acfe 100644
--- a/indra/newview/llfloateravatartextures.cpp
+++ b/indra/newview/llfloateravatartextures.cpp
@@ -82,7 +82,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
if (avatarp->isSelf())
{
const LLWearableType::EType wearable_type = tex_entry->mWearableType;
- LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0);
if (wearable)
{
LLLocalTextureObject *lto = wearable->getLocalTextureObject(te);
@@ -174,7 +174,7 @@ void LLFloaterAvatarTextures::onClickDump(void* data)
LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
if (avatarp->isSelf())
{
- LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, 0);
if (wearable)
{
LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 3a199135b6..834172f58f 100644
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -483,7 +483,7 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp
U32 count = gAgentWearables.getWearableCount(type);
for(U32 wearable_iter = 0; wearable_iter < count; wearable_iter++)
{
- LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_iter);
+ LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_iter);
if (wearable)
{
std::vector<LLLocalTextureObject*> texture_list = wearable->getLocalTextureListSeq();
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 9aadca1d80..43bb1f57e0 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -922,7 +922,7 @@ void LLPanelEditWearable::onCommitSexChange()
}
bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
- LLViewerWearable* wearable = gAgentWearables.getWearable(type, index);
+ LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, index);
if (wearable)
{
wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index cb6989c9dd..ded7d66022 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -166,7 +166,7 @@ protected:
}
- void setParamValue(LLViewerVisualParam *param,
+ void setParamValue(const LLViewerVisualParam *param,
const F32 new_value_local,
F32 behavior_maxeffect);
@@ -673,12 +673,10 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
0,
FALSE);
}
- for (LLDriverParam::entry_list_t::iterator iter = driver_param->mDriven.begin();
- iter != driver_param->mDriven.end();
- ++iter)
+ S32 num_driven = driver_param->getDrivenParamsCount();
+ for (S32 i = 0; i < num_driven; ++i)
{
- LLDrivenEntry &entry = (*iter);
- LLViewerVisualParam *driven_param = entry.mParam;
+ const LLViewerVisualParam *driven_param = driver_param->getDrivenParam(i);
setParamValue(driven_param,position_new_local_clamped, behavior_maxeffect);
}
}
@@ -758,7 +756,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
}
// Range of new_value_local is assumed to be [0 , 1] normalized.
-void LLPhysicsMotion::setParamValue(LLViewerVisualParam *param,
+void LLPhysicsMotion::setParamValue(const LLViewerVisualParam *param,
F32 new_value_normalized,
F32 behavior_maxeffect)
{
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 6a692209e9..8c4a05b116 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -389,7 +389,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearab
if (!wearable)
{
- wearable = gAgentWearables.getWearable(LLWearableType::WT_SHAPE, 0);
+ wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0);
}
if (!wearable)
{
diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp
index 34f24ef330..eb3a212eae 100644
--- a/indra/newview/llviewerwearable.cpp
+++ b/indra/newview/llviewerwearable.cpp
@@ -632,11 +632,6 @@ void LLViewerWearable::revertValues()
}
}
-BOOL LLViewerWearable::isOnTop() const
-{
- return (this == gAgentWearables.getTopWearable(mType));
-}
-
void LLViewerWearable::createLayers(S32 te)
{
LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te);
@@ -736,27 +731,8 @@ void LLViewerWearable::destroyTextures()
mSavedTEMap.clear();
}
-void LLViewerWearable::pullCrossWearableValues()
-{
- // scan through all of the avatar's visual parameters
- for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam())
- {
- if( param )
- {
- LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param);
- if(driver_param)
- {
- // parameter is a driver parameter, have it update its
- driver_param->updateCrossDrivenParams(getType());
- }
- }
- }
-}
-
-
-void LLViewerWearable::setLabelUpdated() const
+// virtual
+void LLViewerWearable::setUpdated() const
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID());
}
@@ -771,6 +747,13 @@ void LLViewerWearable::refreshName()
}
}
+// virtual
+void LLViewerWearable::addToBakedTextureHash(LLMD5& hash) const
+{
+ LLUUID asset_id = getAssetID();
+ hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
+}
+
struct LLWearableSaveData
{
LLWearableType::EType mType;
diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h
index ccc26000f2..b3c1e3c3ba 100644
--- a/indra/newview/llviewerwearable.h
+++ b/indra/newview/llviewerwearable.h
@@ -86,17 +86,17 @@ public:
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;
+ /*virtual*/void setUpdated() const;
// the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
// not the wearable asset itself.
void refreshName();
+ // Update the baked texture hash.
+ /*virtual*/void addToBakedTextureHash(LLMD5& hash) const;
+
protected:
typedef std::map<S32, LLLocalTextureObject*> te_map_t;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b86c5d5e8f..2309ea3488 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -644,7 +644,7 @@ static F32 calc_bouncy_animation(F32 x);
LLVOAvatar::LLVOAvatar(const LLUUID& id,
const LLPCode pcode,
LLViewerRegion* regionp) :
- LLAvatarAppearance(),
+ LLAvatarAppearance(&gAgentWearables),
LLViewerObject(id, pcode, regionp),
mSpecialRenderMode(0),
mAttachmentGeometryBytes(0),
@@ -5860,30 +5860,6 @@ void LLVOAvatar::updateVisualParams()
updateHeadOffset();
}
-// virtual
-U32 LLVOAvatar::getWearableCount(const LLWearableType::EType type) const
-{
- return gAgentWearables.getWearableCount(type);
-}
-
-// virtual
-U32 LLVOAvatar::getWearableCount(const U32 tex_index) const
-{
- return gAgentWearables.getWearableCount(tex_index);
-}
-
-// virtual
-LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/)
-{
- return gAgentWearables.getWearable(type, index);
-}
-
-// virtual
-const LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const
-{
- return gAgentWearables.getWearable(type, index);
-}
-
//-----------------------------------------------------------------------------
// isActive()
//-----------------------------------------------------------------------------
@@ -7008,48 +6984,6 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
}
}
-// Unlike most wearable functions, this works for both self and other.
-BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
-{
- if (mIsDummy) return TRUE;
-
- switch(type)
- {
- case LLWearableType::WT_SHAPE:
- case LLWearableType::WT_SKIN:
- case LLWearableType::WT_HAIR:
- case LLWearableType::WT_EYES:
- return TRUE; // everyone has all bodyparts
- default:
- break; // Do nothing
- }
-
- /* switch(type)
- case LLWearableType::WT_SHIRT:
- indicator_te = TEX_UPPER_SHIRT; */
- for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
- tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
- ++tex_iter)
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second;
- if (texture_dict->mWearableType == type)
- {
- // If you're checking another avatar's clothing, you don't have component textures.
- // Thus, you must check to see if the corresponding baked texture is defined.
- // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing
- // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that
- // gets baked into a texture that always exists (upper or lower).
- if (texture_dict->mIsUsedByBakedTexture)
- {
- const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex);
- }
- return FALSE;
- }
- }
- return FALSE;
-}
-
//-----------------------------------------------------------------------------
// clampAttachmentPositions()
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 5f780da145..54719d2671 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -227,17 +227,6 @@ public:
/*virtual*/BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode
bool isBuilt() const { return mIsBuilt; }
-/********************************************************************************
- ** **
- ** WEARABLES
- **/
-public:
- /*virtual*/ U32 getWearableCount(const LLWearableType::EType type) const;
- /*virtual*/ U32 getWearableCount(const U32 tex_index) const;
-
- /*virtual*/ LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
- /*virtual*/ const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
-
private: //aligned members
LL_ALIGN_16(LLVector4a mImpostorExtents[2]);
@@ -755,9 +744,6 @@ public:
** WEARABLES
**/
-public:
- virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
-
//--------------------------------------------------------------------
// Attachments
//--------------------------------------------------------------------
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index e836a5e4a8..c1984fa738 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -74,9 +74,7 @@ LLPointer<LLVOAvatarSelf> gAgentAvatarp = NULL;
BOOL isAgentAvatarValid()
{
- return (gAgentAvatarp.notNull() &&
- (gAgentAvatarp->getRegion() != NULL) &&
- (!gAgentAvatarp->isDead()));
+ return (gAgentAvatarp.notNull() && gAgentAvatarp->isValid());
}
void selfStartPhase(const std::string& phase_name)
@@ -670,9 +668,15 @@ BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent)
}
// virtual
+BOOL LLVOAvatarSelf::isValid() const
+{
+ return ((getRegion() != NULL) && !isDead());
+}
+
+// virtual
void LLVOAvatarSelf::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
{
- if (isAgentAvatarValid())
+ if (isValid())
{
LLVOAvatar::idleUpdate(agent, world, time);
idleUpdateTractorBeam();
@@ -695,7 +699,7 @@ void LLVOAvatarSelf::resetJointPositions( void )
return LLVOAvatar::resetJointPositions();
}
// virtual
-BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake )
+BOOL LLVOAvatarSelf::setVisualParamWeight(const LLVisualParam *which_param, F32 weight, BOOL upload_bake )
{
if (!which_param)
{
@@ -723,7 +727,7 @@ BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bak
return setParamWeight(param,weight,upload_bake);
}
-BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL upload_bake )
+BOOL LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight, BOOL upload_bake )
{
if (!param)
{
@@ -736,7 +740,7 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL
U32 size = gAgentWearables.getWearableCount(type);
for (U32 count = 0; count < size; ++count)
{
- LLViewerWearable *wearable = gAgentWearables.getWearable(type,count);
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(type,count);
if (wearable)
{
wearable->setVisualParamWeight(param->getID(), weight, upload_bake);
@@ -762,7 +766,7 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation()
// apply wearable visual params to avatar
for (U32 type = 0; type < LLWearableType::WT_COUNT; type++)
{
- LLViewerWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
+ LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
if (wearable)
{
wearable->writeToAvatar();
@@ -1257,7 +1261,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
// Make sure the inventory is in sync with the avatar.
// Update COF contents, don't trigger appearance update.
- if (!isAgentAvatarValid())
+ if (!isValid())
{
llinfos << "removeItemLinks skipped, avatar is under destruction" << llendl;
}
@@ -1780,7 +1784,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
return;
}
LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(type);
- if (!gAgentWearables.getWearable(wearable_type,index))
+ if (!gAgentWearables.getViewerWearable(wearable_type,index))
{
// no wearable is loaded, cannot set the texture.
return;
@@ -1796,7 +1800,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
LLViewerTexLayerSet *layer_set = getLayerSet(type);
if (layer_set)
{
- layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getWearable(wearable_type,index));
+ layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getViewerWearable(wearable_type,index));
}
}
@@ -2286,7 +2290,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
for (U32 wearable_index = 0; wearable_index < count; ++wearable_index)
{
- LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, wearable_index);
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(wearable_type, wearable_index);
if (wearable)
{
const LLLocalTextureObject *texture = wearable->getLocalTextureObject((S32)t_index);
@@ -2361,7 +2365,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 wearable_index) const
{
LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i);
- LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_index);
+ LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_index);
if (wearable)
{
return wearable->getLocalTextureObject(i);
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 12886d2d36..2fe960cd1e 100755
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -97,7 +97,7 @@ public:
void resetJointPositions( void );
- /*virtual*/ BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
+ /*virtual*/ BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
/*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE );
/*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
/*virtual*/ void updateVisualParams();
@@ -111,7 +111,7 @@ public:
private:
// helper function. Passed in param is assumed to be in avatar's parameter list.
- BOOL setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL upload_bake = FALSE );
+ BOOL setParamWeight(const LLViewerVisualParam *param, F32 weight, BOOL upload_bake = FALSE );
@@ -131,6 +131,7 @@ private:
public:
/*virtual*/ bool isSelf() const { return true; }
+ /*virtual*/ BOOL isValid() const;
//--------------------------------------------------------------------
// Updates