From 485193c7f530fa3d8574c74304e452ab6d012e41 Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Fri, 2 Mar 2018 15:29:07 -0800 Subject: [MAINT-8081] - update mesh visibility on tex change --- indra/newview/llselectmgr.cpp | 16 ---------------- indra/newview/llviewerobject.cpp | 22 ++++++++++++++++++++++ indra/newview/llviewerobject.h | 2 +- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 7b7b81f3e4..1b40c21824 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1648,14 +1648,6 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) objectp->setTEImage(te, LLViewerTextureManager::getFetchedTexture(mImageID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } - if (objectp->isAttachment()) - { - LLVOAvatar* avatar = objectp->getAvatar(); - if (avatar) - { - avatar->updateMeshVisibility(); - } - } return true; } }; @@ -1856,14 +1848,6 @@ BOOL LLSelectMgr::selectionRevertTextures() { object->setTEImage(te, LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); - if (object->isAttachment()) - { - LLVOAvatar* avatar = object->getAvatar(); - if (avatar) - { - avatar->updateMeshVisibility(); - } - } } } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 8a58807a29..ef5b5eef20 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4386,6 +4386,25 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) return NULL; } +void LLViewerObject::updateAvatarMeshVisibility(const LLUUID& id) +{ + if (!isAttachment()) + { + return; + } + + if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) + { + return; + } + + LLVOAvatar* avatar = getAvatar(); + if (avatar) + { + avatar->updateMeshVisibility(); + } +} + void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) { LLPrimitive::setTE(te, texture_entry); @@ -4393,6 +4412,7 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) 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); + updateAvatarMeshVisibility(image_id); if (getTE(te)->getMaterialParams().notNull()) { @@ -4412,6 +4432,7 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); mTEImages[te] = baked_texture ? baked_texture : imagep; + updateAvatarMeshVisibility(imagep->getID()); setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4430,6 +4451,7 @@ S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) retval = LLPrimitive::setTETexture(te, uuid); LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); mTEImages[te] = baked_texture ? baked_texture : image; + updateAvatarMeshVisibility(uuid); setChanged(TEXTURE); if (mDrawable.notNull()) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index b63a7ab910..1d7c164a44 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -568,7 +568,7 @@ public: public: LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id); - + void updateAvatarMeshVisibility(const LLUUID& id); public: static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name); static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name); -- cgit v1.2.3