diff options
author | Anchor Linden <anchor@lindenlab.com> | 2018-03-02 02:25:59 -0800 |
---|---|---|
committer | Anchor Linden <anchor@lindenlab.com> | 2018-03-02 02:25:59 -0800 |
commit | 8f64a9edea9d4230cdc845c126955e23990823cb (patch) | |
tree | 8b8554c288f5ce826c30fff4e8c387cb93ad16fe /indra/newview/llviewerobject.cpp | |
parent | 92bd48fd6db7c906b5c6a140875219e662939e57 (diff) |
[MAINT 8081] - show/hide avatar base mesh regions if avatar joint attachments are using server bakes. pass the magic ids correctly across ui and texture entry.
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r-- | indra/newview/llviewerobject.cpp | 100 |
1 files changed, 10 insertions, 90 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 3c249c2420..8a58807a29 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4358,64 +4358,19 @@ void LLViewerObject::sendTEUpdate() const // TODO send media type - - const U32 MAX_TES = 32; - - LLUUID texture_id[MAX_TES]; - S32 last_face_index = llmin((U32)getNumTEs(), MAX_TES) - 1; - - if (last_face_index > -1) - { - S8 face_index; - for (face_index = 0; face_index <= last_face_index; face_index++) - { - LLTextureEntry* entry = getTE((U8)face_index); - texture_id[face_index] = entry->getID(); - - LLViewerFetchedTexture* fetched_texture = gTextureList.findImage(entry->getID(), TEX_LIST_STANDARD); - if (fetched_texture && fetched_texture->getFTType() == FTT_SERVER_BAKE) - { - const LLUUID new_id = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::localTextureIndexToMagicId((LLAvatarAppearanceDefines::ETextureIndex)fetched_texture->getBakedTextureIndex()); - entry->setID(new_id.notNull() ? new_id : IMG_DEFAULT_AVATAR); - } - } - } - packTEMessage(msg); - if (last_face_index > -1) - { - S8 face_index; - for (face_index = 0; face_index <= last_face_index; face_index++) - { - LLTextureEntry* entry = getTE((U8)face_index); - entry->setID(texture_id[face_index]); - } - } - LLViewerRegion *regionp = getRegion(); msg->sendReliable( regionp->getHost() ); } LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) { - if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) + if (!isAttachment()) { return NULL; } - LLVOAvatar* avatar = getAvatar(); - if (avatar) - { - LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); - return avatar->getBakedTextureImage(texIndex, avatar->getTE(texIndex)->getID()); - } - - return NULL; -} - -LLTextureEntry* LLViewerObject::getBakedTextureEntryForMagicId(const LLUUID& id) -{ if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) { return NULL; @@ -4425,7 +4380,7 @@ LLTextureEntry* LLViewerObject::getBakedTextureEntryForMagicId(const LLUUID& id) if (avatar) { LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); - return avatar->getTE(texIndex); + return avatar->getBakedTextureImage(texIndex, avatar->getTE(texIndex)->getID()); } return NULL; @@ -4433,20 +4388,11 @@ LLTextureEntry* LLViewerObject::getBakedTextureEntryForMagicId(const LLUUID& id) void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) { - const LLTextureEntry* baked_entry = getBakedTextureEntryForMagicId(texture_entry.getID()); - if (baked_entry) - { - LLPrimitive::setTE(te, *baked_entry); - - const LLUUID& image_id = baked_entry->getID(); - mTEImages[te] = getBakedTextureForMagicId(image_id); - } - else - { LLPrimitive::setTE(te, texture_entry); - const LLUUID& image_id = getTE(te)->getID(); - mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + const LLUUID& image_id = getTE(te)->getID(); + LLViewerTexture* bakedTexture = getBakedTextureForMagicId(image_id); + mTEImages[te] = bakedTexture ? bakedTexture : LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (getTE(te)->getMaterialParams().notNull()) { @@ -4456,25 +4402,16 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } - } - } void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) { - if (imagep) - { - LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); - if (baked_texture) - { - imagep = baked_texture; - } - } - if (mTEImages[te] != imagep) { - mTEImages[te] = imagep; LLPrimitive::setTETexture(te, imagep->getID()); + + LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); + mTEImages[te] = baked_texture ? baked_texture : imagep; setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4485,22 +4422,14 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) { - if (image) - { - LLViewerTexture* baked_texture = getBakedTextureForMagicId(image->getID()); - if (baked_texture) - { - image = baked_texture; - } - } - const LLUUID& uuid = image->getID(); S32 retval = 0; if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = image; + LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); + mTEImages[te] = baked_texture ? baked_texture : image; setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4589,18 +4518,9 @@ void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image) S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim - - LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); - if (baked_texture) - { - return setTETextureCore(te, baked_texture); - } - else - { LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); return setTETextureCore(te, image); - } } S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid) |