summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatarself.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatarself.cpp')
-rwxr-xr-xindra/newview/llvoavatarself.cpp525
1 files changed, 268 insertions, 257 deletions
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 7a81063f83..77deb5e3bc 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -55,6 +55,8 @@
#include "llviewerobjectlist.h"
#include "llviewerstats.h"
#include "llviewerregion.h"
+#include "llviewertexlayer.h"
+#include "llviewerwearable.h"
#include "llappearancemgr.h"
#include "llmeshrepository.h"
#include "llvovolume.h"
@@ -72,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)
@@ -110,7 +110,7 @@ void selfStopAllPhases()
}
}
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
/*********************************************************************************
** **
@@ -188,7 +188,7 @@ void LLVOAvatarSelf::initInstance()
llinfos << "Self avatar object created. Starting timer." << llendl;
mDebugSelfLoadTimer.reset();
// clear all times to -1 for debugging
- for (U32 i =0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i)
+ for (U32 i =0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
{
for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j)
{
@@ -196,7 +196,7 @@ void LLVOAvatarSelf::initInstance()
}
}
- for (U32 i =0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
+ for (U32 i =0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
{
mDebugBakedTextureTimes[i][0] = -1.0f;
mDebugBakedTextureTimes[i][1] = -1.0f;
@@ -249,13 +249,11 @@ BOOL LLVOAvatarSelf::loadAvatarSelf()
llwarns << "avatar file: buildSkeleton() failed" << llendl;
return FALSE;
}
- // TODO: make loadLayersets() called only by self.
- //success &= loadLayersets();
return success;
}
-BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLVOAvatarSkeletonInfo *info)
+BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLAvatarSkeletonInfo *info)
{
LLMemType mt(LLMemType::MTYPE_AVATAR);
@@ -343,7 +341,6 @@ BOOL LLVOAvatarSelf::buildMenus()
}
else
{
- BOOL attachment_found = FALSE;
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
@@ -371,7 +368,6 @@ BOOL LLVOAvatarSelf::buildMenus()
gAttachPieMenu->addChild(item);
- attachment_found = TRUE;
break;
}
@@ -384,7 +380,6 @@ BOOL LLVOAvatarSelf::buildMenus()
}
else
{
- BOOL attachment_found = FALSE;
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
@@ -411,7 +406,6 @@ BOOL LLVOAvatarSelf::buildMenus()
gDetachPieMenu->addChild(item);
- attachment_found = TRUE;
break;
}
}
@@ -585,70 +579,6 @@ LLVOAvatarSelf::~LLVOAvatarSelf()
** **
*********************************************************************************/
-//virtual
-BOOL LLVOAvatarSelf::loadLayersets()
-{
- BOOL success = TRUE;
- for (LLVOAvatarXmlInfo::layer_info_list_t::const_iterator iter = sAvatarXmlInfo->mLayerInfoList.begin();
- iter != sAvatarXmlInfo->mLayerInfoList.end();
- ++iter)
- {
- // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
- const LLTexLayerSetInfo *info = *iter;
- LLTexLayerSet* layer_set = new LLTexLayerSet( this );
-
- if (!layer_set->setInfo(info))
- {
- stop_glerror();
- delete layer_set;
- llwarns << "avatar file: layer_set->parseData() failed" << llendl;
- return FALSE;
- }
-
- // scan baked textures and associate the layerset with the appropriate one
- EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
- ++baked_iter)
- {
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
- if (layer_set->isBodyRegion(baked_dict->mName))
- {
- baked_index = baked_iter->first;
- // ensure both structures are aware of each other
- mBakedTextureDatas[baked_index].mTexLayerSet = layer_set;
- layer_set->setBakedTexIndex(baked_index);
- break;
- }
- }
- // if no baked texture was found, warn and cleanup
- if (baked_index == BAKED_NUM_INDICES)
- {
- llwarns << "<layer_set> has invalid body_region attribute" << llendl;
- delete layer_set;
- return FALSE;
- }
-
- // scan morph masks and let any affected layers know they have an associated morph
- for (LLVOAvatar::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin();
- morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end();
- ++morph_iter)
- {
- LLMaskedMorph *morph = *morph_iter;
- LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer);
- if (layer)
- {
- layer->setHasMorph(TRUE);
- }
- else
- {
- llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl;
- success = FALSE;
- }
- }
- }
- return success;
-}
// virtual
BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent)
{
@@ -668,9 +598,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();
@@ -693,7 +629,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)
{
@@ -721,20 +657,28 @@ 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)
{
return FALSE;
}
+#if 0
+ // FIXME DRANO - kludgy way to avoid overwriting avatar state from wearables.
+ if (isUsingServerBakes() && !isUsingLocalAppearance())
+ {
+ return FALSE;
+ }
+#endif
+
if (param->getCrossWearable())
{
LLWearableType::EType type = (LLWearableType::EType)param->getWearableType();
U32 size = gAgentWearables.getWearableCount(type);
for (U32 count = 0; count < size; ++count)
{
- LLWearable *wearable = gAgentWearables.getWearable(type,count);
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable(type,count);
if (wearable)
{
wearable->setVisualParamWeight(param->getID(), weight, upload_bake);
@@ -763,7 +707,7 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation()
LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
if (wearable)
{
- wearable->writeToAvatar();
+ wearable->writeToAvatar(this);
}
}
@@ -806,18 +750,21 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys,
{
U32 retval = LLVOAvatar::processUpdateMessage(mesgsys,user_data,block_num,update_type,dp);
- if (mInitialBakesLoaded == false && retval == 0x0)
+ // FIXME DRANO - skipping in the case of !mFirstAppearanceMessageReceived prevents us from trying to
+ // load textures before we know where they come from (ie, from baking service or not);
+ // unknown impact on performance.
+ if (mInitialBakesLoaded == false && retval == 0x0 && mFirstAppearanceMessageReceived)
{
// call update textures to force the images to be created
updateMeshTextures();
// unpack the texture UUIDs to the texture slots
- retval = unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num);
+ retval = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num);
// need to trigger a few operations to get the avatar to use the new bakes
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- const LLVOAvatarDefines::ETextureIndex te = mBakedTextureDatas[i].mTextureIndex;
+ const LLAvatarAppearanceDefines::ETextureIndex te = mBakedTextureDatas[i].mTextureIndex;
LLUUID texture_id = getTEImage(te)->getID();
setNewBakedTexture(te, texture_id);
mInitialBakeIDs[i] = texture_id;
@@ -881,11 +828,15 @@ void LLVOAvatarSelf::removeMissingBakedTextures()
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(TRUE);
- invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE);
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ layerset->setUpdatesEnabled(TRUE);
+ invalidateComposite(layerset, FALSE);
}
updateMeshTextures();
- requestLayerSetUploads();
+ if (getRegion() && !getRegion()->getCentralBakeVersion())
+ {
+ requestLayerSetUploads();
+ }
}
}
@@ -942,7 +893,7 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
void LLVOAvatarSelf::idleUpdateTractorBeam()
{
// This is only done for yourself (maybe it should be in the agent?)
- if (!needsRenderBeam() || !mIsBuilt)
+ if (!needsRenderBeam() || !isBuilt())
{
mBeam = NULL;
}
@@ -1057,11 +1008,6 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode)
}
}
-/*virtual*/ BOOL LLVOAvatarSelf::isWearingWearableType(LLWearableType::EType type ) const
-{
- return gAgentWearables.getWearableCount(type) > 0;
-}
-
//-----------------------------------------------------------------------------
// updatedWearable( LLWearableType::EType type )
// forces an update to any baked textures relevant to type.
@@ -1069,26 +1015,27 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode)
//-----------------------------------------------------------------------------
void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_result )
{
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
- const LLVOAvatarDefines::EBakedTextureIndex index = baked_iter->first;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDefines::EBakedTextureIndex index = baked_iter->first;
if (baked_dict)
{
- for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
+ for (LLAvatarAppearanceDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
type_iter != baked_dict->mWearables.end();
++type_iter)
{
const LLWearableType::EType comp_type = *type_iter;
if (comp_type == type)
{
- if (mBakedTextureDatas[index].mTexLayerSet)
+ LLViewerTexLayerSet *layerset = getLayerSet(index);
+ if (layerset)
{
- mBakedTextureDatas[index].mTexLayerSet->setUpdatesEnabled(true);
- invalidateComposite(mBakedTextureDatas[index].mTexLayerSet, upload_result);
+ layerset->setUpdatesEnabled(true);
+ invalidateComposite(layerset, upload_result);
}
break;
}
@@ -1252,7 +1199,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;
}
@@ -1293,7 +1240,7 @@ BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id)
const LLViewerObject *attached_obj = gAgentAvatarp->getWornAttachment(item_id);
if (!attached_obj)
{
- LLAppearanceMgr::instance().removeCOFItemLinks(item_id, false);
+ LLAppearanceMgr::instance().removeCOFItemLinks(item_id);
}
}
return TRUE;
@@ -1301,9 +1248,9 @@ BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id)
return FALSE;
}
-U32 LLVOAvatarSelf::getNumWearables(LLVOAvatarDefines::ETextureIndex i) const
+U32 LLVOAvatarSelf::getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const
{
- LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
+ LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i);
return gAgentWearables.getWearableCount(type);
}
@@ -1334,11 +1281,8 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr
discard_level < local_tex_obj->getDiscard())
{
local_tex_obj->setDiscard(discard_level);
- if (isUsingBakedTextures())
- {
- requestLayerSetUpdate(index);
- }
- else
+ requestLayerSetUpdate(index);
+ if (isEditingAppearance())
{
LLVisualParamHint::requestHintUpdates();
}
@@ -1372,11 +1316,11 @@ BOOL LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLViewerTexture** tex
{
return FALSE;
}
- *tex_pp = local_tex_obj->getImage();
+ *tex_pp = dynamic_cast<LLViewerTexture*> (local_tex_obj->getImage());
return TRUE;
}
-LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
if (!isIndexLocalTexture(type))
{
@@ -1392,7 +1336,7 @@ LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLVOAvatarDefines::ETe
{
return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
}
- return local_tex_obj->getImage();
+ return dynamic_cast<LLViewerFetchedTexture*> (local_tex_obj->getImage());
}
const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) const
@@ -1413,29 +1357,30 @@ const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) c
// Returns true if at least the lowest quality discard level exists for every texture
// in the layerset.
//-----------------------------------------------------------------------------
-BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const
+BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const
{
/* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const EBakedTextureIndex baked_index = baked_iter->first;
if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
{
BOOL ret = true;
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
- ret &= (getLocalDiscardLevel(tex_index, wearable_index) >= 0);
+ BOOL tex_avail = (getLocalDiscardLevel(tex_index, wearable_index) >= 0);
+ ret &= tex_avail;
}
}
return ret;
@@ -1451,7 +1396,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset)
// Returns true if the highest quality discard level exists for every texture
// in the layerset.
//-----------------------------------------------------------------------------
-BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) const
+BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const
{
const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
// const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels.
@@ -1460,13 +1405,13 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) cons
{
if (layerset == mBakedTextureDatas[i].mTexLayerSet)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -1490,13 +1435,13 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -1510,22 +1455,22 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
return TRUE;
}
-BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const
+BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLAvatarAppearanceDefines::EBakedTextureIndex index) const
{
- const LLTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet;
+ const LLViewerTexLayerSet *layerset = getLayerSet(index);
if (!layerset) return FALSE;
- const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
+ const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
if (!layerset_buffer) return FALSE;
return !layerset_buffer->uploadNeeded();
}
-BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+BOOL LLVOAvatarSelf::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
LLUUID id;
BOOL isDefined = TRUE;
if (isIndexLocalTexture(type))
{
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(type);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(type);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
if (index >= wearable_count)
{
@@ -1552,7 +1497,7 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32
}
//virtual
-BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
if (isIndexBakedTexture(type))
{
@@ -1565,7 +1510,7 @@ BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32
}
//virtual
-BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
+BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const
{
if (isIndexBakedTexture(type))
{
@@ -1588,13 +1533,14 @@ void LLVOAvatarSelf::requestLayerSetUploads()
}
}
-void LLVOAvatarSelf::requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i)
+void LLVOAvatarSelf::requestLayerSetUpload(LLAvatarAppearanceDefines::EBakedTextureIndex i)
{
ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex;
const BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index));
- if (!layer_baked && mBakedTextureDatas[i].mTexLayerSet)
+ LLViewerTexLayerSet *layerset = getLayerSet(i);
+ if (!layer_baked && layerset)
{
- mBakedTextureDatas[i].mTexLayerSet->requestUpload();
+ layerset->requestUpload();
}
}
@@ -1608,8 +1554,8 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- LLTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet;
- if (layerset && layerset->getComposite() && layerset->getComposite()->uploadPending())
+ LLViewerTexLayerSet* layerset = getTexLayerSet(i);
+ if (layerset && layerset->getViewerComposite() && layerset->getViewerComposite()->uploadPending())
{
return true;
}
@@ -1619,22 +1565,23 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const
void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result )
{
- if( !layerset || !layerset->getUpdatesEnabled() )
+ LLViewerTexLayerSet *layer_set = dynamic_cast<LLViewerTexLayerSet*>(layerset);
+ if( !layer_set || !layer_set->getUpdatesEnabled() )
{
return;
}
// llinfos << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << llendl;
- layerset->requestUpdate();
- layerset->invalidateMorphMasks();
+ layer_set->requestUpdate();
+ layer_set->invalidateMorphMasks();
- if( upload_result )
+ if( upload_result && (getRegion() && !getRegion()->getCentralBakeVersion()))
{
llassert(isSelf());
- ETextureIndex baked_te = getBakedTE( layerset );
+ ETextureIndex baked_te = getBakedTE( layer_set );
setTEImage( baked_te, LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR) );
- layerset->requestUpload();
+ layer_set->requestUpload();
updateMeshTextures();
}
}
@@ -1643,7 +1590,8 @@ void LLVOAvatarSelf::invalidateAll()
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE);
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ invalidateComposite(layerset, TRUE);
}
//mDebugSelfLoadTimer.reset();
}
@@ -1661,17 +1609,19 @@ void LLVOAvatarSelf::setCompositeUpdatesEnabled( bool b )
void LLVOAvatarSelf::setCompositeUpdatesEnabled(U32 index, bool b)
{
- if (mBakedTextureDatas[index].mTexLayerSet )
+ LLViewerTexLayerSet *layerset = getTexLayerSet(index);
+ if (layerset )
{
- mBakedTextureDatas[index].mTexLayerSet->setUpdatesEnabled( b );
+ layerset->setUpdatesEnabled( b );
}
}
bool LLVOAvatarSelf::isCompositeUpdateEnabled(U32 index)
{
- if (mBakedTextureDatas[index].mTexLayerSet)
+ LLViewerTexLayerSet *layerset = getTexLayerSet(index);
+ if (layerset)
{
- return mBakedTextureDatas[index].mTexLayerSet->getUpdatesEnabled();
+ return layerset->getUpdatesEnabled();
}
return false;
}
@@ -1682,9 +1632,10 @@ void LLVOAvatarSelf::setupComposites()
{
ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex;
BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index));
- if (mBakedTextureDatas[i].mTexLayerSet)
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ if (layerset)
{
- mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(!layer_baked);
+ layerset->setUpdatesEnabled(!layer_baked);
}
}
}
@@ -1693,10 +1644,11 @@ void LLVOAvatarSelf::updateComposites()
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- if (mBakedTextureDatas[i].mTexLayerSet
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ if (layerset
&& ((i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT)))
{
- mBakedTextureDatas[i].mTexLayerSet->updateComposite();
+ layerset->updateComposite();
}
}
}
@@ -1709,11 +1661,12 @@ S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index)
const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, wearable_index);
if (local_tex_obj)
{
+ const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
if (type >= 0
&& local_tex_obj->getID() != IMG_DEFAULT_AVATAR
- && !local_tex_obj->getImage()->isMissingAsset())
+ && !image->isMissingAsset())
{
- return local_tex_obj->getImage()->getDiscardLevel();
+ return image->getDiscardLevel();
}
else
{
@@ -1738,7 +1691,7 @@ void LLVOAvatarSelf::getLocalTextureByteCount(S32* gl_bytes) const
const LLLocalTextureObject *local_tex_obj = getLocalTextureObject((ETextureIndex) type, num);
if (local_tex_obj)
{
- const LLViewerFetchedTexture* image_gl = local_tex_obj->getImage();
+ const LLViewerFetchedTexture* image_gl = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
if (image_gl)
{
S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents();
@@ -1773,8 +1726,8 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
llerrs << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << llendl;
return;
}
- LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType(type);
- if (!gAgentWearables.getWearable(wearable_type,index))
+ LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(type);
+ if (!gAgentWearables.getViewerWearable(wearable_type,index))
{
// no wearable is loaded, cannot set the texture.
return;
@@ -1787,10 +1740,10 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
return;
}
- LLTexLayerSet *layer_set = getLayerSet(type);
+ 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));
}
}
@@ -1810,15 +1763,12 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
local_tex_obj->setDiscard(tex_discard);
if (isSelf())
{
- if (gAgentAvatarp->isUsingBakedTextures())
- {
requestLayerSetUpdate(type);
+ if (isEditingAppearance())
+ {
+ LLVisualParamHint::requestHintUpdates();
+ }
}
- else
- {
- LLVisualParamHint::requestHintUpdates();
- }
- }
}
else
{
@@ -1832,8 +1782,9 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
local_tex_obj->setID(tex->getID());
setBakedReady(type,baked_version_ready,index);
}
+
//virtual
-void LLVOAvatarSelf::setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
+void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
{
if (!isIndexLocalTexture(type)) return;
LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index);
@@ -1852,16 +1803,16 @@ void LLVOAvatarSelf::dumpLocalTextures() const
/* ETextureIndex baked_equiv[] = {
TEX_UPPER_BAKED,
if (isTextureDefined(baked_equiv[i])) */
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
continue;
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- const ETextureIndex baked_equiv = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex;
+ const ETextureIndex baked_equiv = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex;
const std::string &name = texture_dict->mName;
const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(iter->first, 0);
@@ -1884,7 +1835,7 @@ void LLVOAvatarSelf::dumpLocalTextures() const
}
else
{
- const LLViewerFetchedTexture* image = local_tex_obj->getImage();
+ const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
llinfos << "LocTex " << name << ": "
<< "Discard " << image->getDiscardLevel() << ", "
@@ -1979,14 +1930,14 @@ BOOL LLVOAvatarSelf::getIsCloud() const
if (!mPreviousFullyLoaded)
{
- if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) &&
+ if (!isLocalTextureDataAvailable(getLayerSet(BAKED_LOWER)) &&
(!isTextureDefined(TEX_LOWER_BAKED, 0)))
{
lldebugs << "Lower textures not baked" << llendl;
return TRUE;
}
- if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) &&
+ if (!isLocalTextureDataAvailable(getLayerSet(BAKED_UPPER)) &&
(!isTextureDefined(TEX_UPPER_BAKED, 0)))
{
lldebugs << "Upper textures not baked" << llendl;
@@ -2057,7 +2008,7 @@ void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL fini
mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32();
}
-const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLTexLayerSet* layerset) const
+const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const
{
std::string text="";
@@ -2065,21 +2016,21 @@ const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLTexLayer
/* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const EBakedTextureIndex baked_index = baked_iter->first;
if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
text += llformat("%d-%s ( ",baked_index, baked_dict->mName.c_str());
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
if (wearable_count > 0)
{
@@ -2106,14 +2057,14 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
BOOL is_texture_final = TRUE;
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -2237,7 +2188,7 @@ const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) c
{
if (canGrabBakedTexture(baked_index))
{
- ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index);
+ ETextureIndex tex_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(baked_index);
if (tex_index == TEX_NUM_INDICES)
{
return LLUUID::null;
@@ -2249,7 +2200,7 @@ const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) c
BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
{
- ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index);
+ ETextureIndex tex_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(baked_index);
if (tex_index == TEX_NUM_INDICES)
{
return FALSE;
@@ -2268,19 +2219,19 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
// baked texture. We don't want people copying people's
// work via baked textures.
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin();
iter != baked_dict->mLocalTextures.end();
++iter)
{
const ETextureIndex t_index = (*iter);
- LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(t_index);
+ LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(t_index);
U32 count = gAgentWearables.getWearableCount(wearable_type);
lldebugs << "Checking index " << (U32) t_index << " count: " << count << llendl;
for (U32 wearable_index = 0; wearable_index < count; ++wearable_index)
{
- LLWearable *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);
@@ -2326,36 +2277,36 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
{
if (!isIndexLocalTexture(type)) return;
- if (!covered_by_baked)
+ if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR && imagep->getDiscardLevel() != 0)
{
- if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR && imagep->getDiscardLevel() != 0)
+ F32 desired_pixels;
+ desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
+
+ if (isUsingLocalAppearance())
{
- F32 desired_pixels;
- desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
imagep->setBoostLevel(getAvatarBoostLevel());
-
- imagep->resetTextureStats();
- imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
- imagep->addTextureStats( desired_pixels / texel_area_ratio );
imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ;
- imagep->forceUpdateBindStats() ;
- if (imagep->getDiscardLevel() < 0)
- {
- mHasGrey = TRUE; // for statistics gathering
- }
}
- else
+ imagep->resetTextureStats();
+ imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
+ imagep->addTextureStats( desired_pixels / texel_area_ratio );
+ imagep->forceUpdateBindStats() ;
+ if (imagep->getDiscardLevel() < 0)
{
- // texture asset is missing
mHasGrey = TRUE; // for statistics gathering
}
}
+ else
+ {
+ // texture asset is missing
+ mHasGrey = TRUE; // for statistics gathering
+ }
}
-LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 wearable_index) const
+LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 wearable_index) const
{
- LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
- LLWearable* wearable = gAgentWearables.getWearable(type, wearable_index);
+ LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i);
+ LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, wearable_index);
if (wearable)
{
return wearable->getLocalTextureObject(i);
@@ -2368,7 +2319,7 @@ LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::E
// getBakedTE()
// Used by the LayerSet. (Layer sets don't in general know what textures depend on them.)
//-----------------------------------------------------------------------------
-ETextureIndex LLVOAvatarSelf::getBakedTE( const LLTexLayerSet* layerset ) const
+ETextureIndex LLVOAvatarSelf::getBakedTE( const LLViewerTexLayerSet* layerset ) const
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
@@ -2382,9 +2333,9 @@ ETextureIndex LLVOAvatarSelf::getBakedTE( const LLTexLayerSet* layerset ) const
}
-void LLVOAvatarSelf::setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid)
+void LLVOAvatarSelf::setNewBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex i, const LLUUID &uuid)
{
- ETextureIndex index = LLVOAvatarDictionary::bakedToLocalTextureIndex(i);
+ ETextureIndex index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(i);
setNewBakedTexture(index, uuid);
}
@@ -2406,7 +2357,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
/* switch(te)
case TEX_HEAD_BAKED:
llinfos << "New baked texture: HEAD" << llendl; */
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(te);
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(te);
if (texture_dict->mIsBakedTexture)
{
debugBakedTextureUpload(texture_dict->mBakedTextureIndex, TRUE); // FALSE for start of upload, TRUE for finish.
@@ -2471,7 +2422,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << llendl;
LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << llendl;
LL_DEBUGS("Avatar") << "\t Load time for each texture: " << llendl;
- for (U32 i = 0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i)
+ for (U32 i = 0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
{
std::stringstream out;
out << "\t\t (" << i << ") ";
@@ -2499,19 +2450,19 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
}
}
LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << llendl;
- for (U32 i = 0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
+ for (U32 i = 0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
{
LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << llendl;
}
- for (LLVOAvatarDefines::LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
- const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first;
- const LLTexLayerSet *layerset = debugGetLayerSet(baked_index);
+ const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
+ const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index);
if (!layerset) continue;
- const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
+ const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite();
if (!layerset_buffer) continue;
LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl;
}
@@ -2544,7 +2495,8 @@ void LLVOAvatarSelf::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid
mHeadLayerSet->cancelUpload(); */
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- if ( mBakedTextureDatas[i].mTextureIndex == te && mBakedTextureDatas[i].mTexLayerSet)
+ LLViewerTexLayerSet *layerset = getTexLayerSet(i);
+ if ( mBakedTextureDatas[i].mTextureIndex == te && layerset)
{
if (mInitialBakeIDs[i] != LLUUID::null)
{
@@ -2558,7 +2510,7 @@ void LLVOAvatarSelf::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid
}
mInitialBakeIDs[i] = LLUUID::null;
}
- mBakedTextureDatas[i].mTexLayerSet->cancelUpload();
+ layerset->cancelUpload();
}
}
}
@@ -2577,17 +2529,17 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
/* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] =
TEX_HEAD_BAKED,
TEX_UPPER_BAKED, */
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (texture_dict->mIsBakedTexture)
{
if (texture_id == gAgentAvatarp->getTEImage(index)->getID())
{
- LLTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index);
+ LLViewerTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index);
if (layer_set)
{
llinfos << "TAT: rebake - matched entry " << (S32)index << llendl;
@@ -2611,15 +2563,6 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
}
}
-BOOL LLVOAvatarSelf::isUsingBakedTextures() const
-{
- // Composite textures are used during appearance mode.
- if (gAgentCamera.cameraCustomizeAvatar())
- return FALSE;
-
- return TRUE;
-}
-
void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
{
@@ -2628,7 +2571,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
ETextureIndex baked_index = mBakedTextureDatas[i].mTextureIndex;
- LLTexLayerSet* layer_set = getLayerSet(baked_index);
+ LLViewerTexLayerSet* layer_set = getLayerSet(baked_index);
if (layer_set)
{
if (slam_for_debug)
@@ -2660,7 +2603,7 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
case LOCTEX_UPPER_SHIRT:
if( mUpperBodyLayerSet )
mUpperBodyLayerSet->requestUpdate(); */
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
return;
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
@@ -2670,22 +2613,22 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
}
}
-LLTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
+LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
{
- /* switch(index)
- case TEX_HEAD_BAKED:
- case TEX_HEAD_BODYPAINT:
- return mHeadLayerSet; */
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
- if (texture_dict->mIsUsedByBakedTexture)
- {
- const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- return mBakedTextureDatas[baked_index].mTexLayerSet;
- }
- return NULL;
+ /* switch(index)
+ case TEX_HEAD_BAKED:
+ case TEX_HEAD_BODYPAINT:
+ return mHeadLayerSet; */
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
+ if (texture_dict->mIsUsedByBakedTexture)
+ {
+ const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+ return getLayerSet(baked_index);
+ }
+ return NULL;
}
-LLTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const
+LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const
{
/* switch(index)
case TEX_HEAD_BAKED:
@@ -2693,26 +2636,59 @@ LLTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const
return mHeadLayerSet; */
if (baked_index >= 0 && baked_index < BAKED_NUM_INDICES)
{
- return mBakedTextureDatas[baked_index].mTexLayerSet;
+ return getTexLayerSet(baked_index);
}
return NULL;
}
+
+
// static
-void LLVOAvatarSelf::onCustomizeStart()
+void LLVOAvatarSelf::onCustomizeStart(bool disable_camera_switch)
{
- // We're no longer doing any baking or invalidating on entering
- // appearance editing mode. Leaving function in place in case
- // further changes require us to do something at this point - Nyx
+ if (isAgentAvatarValid())
+ {
+ gAgentAvatarp->mIsEditingAppearance = true;
+ gAgentAvatarp->mUseLocalAppearance = true;
+
+ if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch)
+ {
+ gAgentCamera.changeCameraToCustomizeAvatar();
+ }
+
+#if 0
+ gAgentAvatarp->clearVisualParamWeights();
+ gAgentAvatarp->idleUpdateAppearanceAnimation();
+#endif
+
+ gAgentAvatarp->invalidateAll();
+ gAgentAvatarp->updateMeshTextures();
+ }
}
// static
-void LLVOAvatarSelf::onCustomizeEnd()
+void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch)
{
+
if (isAgentAvatarValid())
{
+ gAgentAvatarp->mIsEditingAppearance = false;
+ if (gAgentAvatarp->getRegion() && !gAgentAvatarp->getRegion()->getCentralBakeVersion())
+ {
+ // FIXME DRANO - move to sendAgentSetAppearance, make conditional on upload complete.
+ gAgentAvatarp->mUseLocalAppearance = false;
+ }
+
gAgentAvatarp->invalidateAll();
+
+ if (gSavedSettings.getBOOL("AppearanceCameraMovement") && !disable_camera_switch)
+ {
+ gAgentCamera.changeCameraToDefault();
+ gAgentCamera.resetView();
+ }
+
+ LLAppearanceMgr::instance().updateAppearanceFromCOF();
}
}
@@ -2725,12 +2701,12 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const
{
LLUUID texture_id[TEX_NUM_INDICES];
// pack away current TEs to make sure we don't send them out
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (!texture_dict->mIsBakedTexture)
{
LLTextureEntry* entry = getTE((U8) index);
@@ -2742,12 +2718,12 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const
bool success = packTEMessage(mesgsys);
// unpack TEs to make sure we don't re-trigger a bake
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (!texture_dict->mIsBakedTexture)
{
LLTextureEntry* entry = getTE((U8) index);
@@ -2803,3 +2779,38 @@ void LLVOAvatarSelf::dumpScratchTextureByteCount()
{
llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl;
}
+
+void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value);
+
+void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile)
+{
+ apr_file_t* file = outfile.getFileHandle();
+ if (!file)
+ {
+ return;
+ }
+
+
+ apr_file_printf( file, "\n<wearable_info>\n" );
+
+ LLWearableData *wd = getWearableData();
+ for (S32 type = 0; type < LLWearableType::WT_COUNT; type++)
+ {
+ const std::string& type_name = LLWearableType::getTypeName((LLWearableType::EType)type);
+ for (U32 j=0; j< wd->getWearableCount((LLWearableType::EType)type); j++)
+ {
+ LLViewerWearable *wearable = gAgentWearables.getViewerWearable((LLWearableType::EType)type,j);
+ apr_file_printf( file, "\n\t <wearable type=\"%s\" name=\"%s\"/>\n",
+ type_name.c_str(), wearable->getName().c_str() );
+ LLWearable::visual_param_vec_t v_params;
+ wearable->getVisualParams(v_params);
+ for (LLWearable::visual_param_vec_t::iterator it = v_params.begin();
+ it != v_params.end(); ++it)
+ {
+ LLVisualParam *param = *it;
+ dump_visual_param(file, param, param->getWeight());
+ }
+ }
+ }
+ apr_file_printf( file, "\n</wearable_info>\n" );
+}