diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llselectmgr.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 2 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 104 |
4 files changed, 118 insertions, 12 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 1b40c21824..1eddf92ddf 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -95,6 +95,7 @@ #include "llviewershadermgr.h" #include "llpanelface.h" #include "llglheaders.h" +#include "llinventoryobserver.h" LLViewerObject* getSelectedParentObject(LLViewerObject *object) ; // diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1fef20c94f..15d7ac7ad4 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4388,14 +4388,14 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) return NULL; } -void LLViewerObject::updateAvatarMeshVisibility(const LLUUID& id) +void LLViewerObject::updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id) { - if (!isAttachment()) + if (id == old_id) { return; } - if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) + if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(old_id) && !LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) { return; } @@ -4409,12 +4409,20 @@ void LLViewerObject::updateAvatarMeshVisibility(const LLUUID& id) void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) { + LLUUID old_image_id; + if (getTE(te)) + { + old_image_id = getTE(te)->getID(); + } + LLPrimitive::setTE(te, 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); + + + updateAvatarMeshVisibility(image_id,old_image_id); if (getTE(te)->getMaterialParams().notNull()) { @@ -4430,11 +4438,13 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) { if (mTEImages[te] != imagep) { + LLUUID old_image_id = getTE(te) ? getTE(te)->getID() : LLUUID::null; + LLPrimitive::setTETexture(te, imagep->getID()); LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); mTEImages[te] = baked_texture ? baked_texture : imagep; - updateAvatarMeshVisibility(imagep->getID()); + updateAvatarMeshVisibility(imagep->getID(), old_image_id); setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4445,6 +4455,7 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) { + LLUUID old_image_id = getTE(te)->getID(); const LLUUID& uuid = image->getID(); S32 retval = 0; if (uuid != getTE(te)->getID() || @@ -4453,7 +4464,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); + updateAvatarMeshVisibility(uuid,old_image_id); setChanged(TEXTURE); if (mDrawable.notNull()) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index f2b94a8db2..e6ed7d2fd5 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -570,7 +570,7 @@ public: public: LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id); - void updateAvatarMeshVisibility(const LLUUID& id); + void updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id); public: static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name); static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9b69f5a836..9f8c27cc6c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6430,6 +6430,44 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o LLSelectMgr::getInstance()->updatePointAt(); } + const U32 MAX_TES = 32; + + S32 last_face_index = llmin((U32)viewer_object->getNumTEs(), MAX_TES) - 1; + + if (last_face_index > -1) + { + S8 face_index; + for (face_index = 0; face_index <= last_face_index; face_index++) + { + LLTextureEntry* texEntry = viewer_object->getTE(face_index); + if (texEntry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(texEntry->getID())) + { + viewer_object->setTEImage(face_index, viewer_object->getBakedTextureForMagicId(texEntry->getID())); + } + } + } + + LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + LLViewerObject* objectp = *iter; + if (objectp) + { + for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++) + { + LLTextureEntry* tex_entry = objectp->getTE(face_index); + if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID())) + { + objectp->setTEImage(face_index, viewer_object->getBakedTextureForMagicId(tex_entry->getID())); + } + } + } + } + + + updateMeshVisibility(); + return attachment; } @@ -6569,7 +6607,6 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) //----------------------------------------------------------------------------- BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) { - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -6578,10 +6615,48 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) if (attachment->isObjectAttached(viewer_object)) { - updateVisualComplexity(); - cleanupAttachedMesh( viewer_object ); - + updateVisualComplexity(); + cleanupAttachedMesh(viewer_object); + attachment->removeObject(viewer_object); + + const U32 MAX_TES = 32; + + S32 last_face_index = llmin((U32)viewer_object->getNumTEs(), MAX_TES) - 1; + + if (last_face_index > -1) + { + S8 face_index; + for (face_index = 0; face_index <= last_face_index; face_index++) + { + LLTextureEntry* texEntry = viewer_object->getTE(face_index); + if (texEntry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(texEntry->getID())) + { + viewer_object->setTEImage(face_index, LLViewerTextureManager::getFetchedTexture(texEntry->getID(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + } + } + } + + LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + LLViewerObject* objectp = *iter; + if (objectp) + { + for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++) + { + LLTextureEntry* texEntry = viewer_object->getTE(face_index); + if (texEntry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(texEntry->getID())) + { + objectp->setTEImage(face_index, LLViewerTextureManager::getFetchedTexture(texEntry->getID(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + } + } + } + } + + updateMeshVisibility(); + LL_DEBUGS() << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << LL_ENDL; return TRUE; } @@ -7232,6 +7307,26 @@ void LLVOAvatar::updateMeshVisibility() bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT); } } + + LLViewerObject::const_child_list_t& child_list = objectp->getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + LLViewerObject* objectp = *iter; + if (objectp) + { + for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++) + { + LLTextureEntry* tex_entry = objectp->getTE(face_index); + bake_flag[BAKED_HEAD] |= (tex_entry->getID() == IMG_USE_BAKED_HEAD); + bake_flag[BAKED_EYES] |= (tex_entry->getID() == IMG_USE_BAKED_EYES); + bake_flag[BAKED_HAIR] |= (tex_entry->getID() == IMG_USE_BAKED_HAIR); + bake_flag[BAKED_LOWER] |= (tex_entry->getID() == IMG_USE_BAKED_LOWER); + bake_flag[BAKED_UPPER] |= (tex_entry->getID() == IMG_USE_BAKED_UPPER); + bake_flag[BAKED_SKIRT] |= (tex_entry->getID() == IMG_USE_BAKED_SKIRT); + } + } + } } } } @@ -8303,7 +8398,6 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte } } - updateMeshVisibility(); } // static |