From bfbcd6d16931819c43eea8e83963c9f86c6892dd Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Wed, 28 Feb 2018 22:14:38 -0800 Subject: [MAINT-8081] - bakes on mesh. 1st pass. changed texture panel to select bakes on objects. handle magic bake ids in LLViewerObject. --- indra/newview/llviewerobject.cpp | 130 +++++++++++++++++++++++++++++++++++---- 1 file changed, 118 insertions(+), 12 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 5de4029542..1bc3b3c726 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4358,31 +4358,119 @@ 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)) + { + 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; + } + + LLVOAvatar* avatar = getAvatar(); + if (avatar) + { + LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); + return avatar->getTE(texIndex); + } + + return NULL; +} + void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) { - LLPrimitive::setTE(te, 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); - - if (getTE(te)->getMaterialParams().notNull()) - { - const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); - mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - - const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); - mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + + if (getTE(te)->getMaterialParams().notNull()) + { + const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); + mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + + 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; @@ -4397,6 +4485,15 @@ 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() || @@ -4492,9 +4589,18 @@ 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 - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); - return setTETextureCore(te,image); + + 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) -- cgit v1.3 From 8f64a9edea9d4230cdc845c126955e23990823cb Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Fri, 2 Mar 2018 02:25:59 -0800 Subject: [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. --- indra/newview/llpanelface.cpp | 65 ++++++++++++++++--------- indra/newview/llselectmgr.cpp | 18 +++++++ indra/newview/lltexturectrl.cpp | 86 +++++++++++++++++++++++++++++++-- indra/newview/lltexturectrl.h | 5 ++ indra/newview/llviewerobject.cpp | 100 ++++----------------------------------- indra/newview/llviewerobject.h | 5 +- indra/newview/llviewertexture.h | 5 -- indra/newview/llvoavatar.cpp | 93 +++++++++++++++++++++++++++++++----- indra/newview/llvoavatar.h | 2 + 9 files changed, 242 insertions(+), 137 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7e75dca908..363fe3da04 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -867,41 +867,52 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } updateAlphaControls(); - - if(texture_ctrl) - { + + if (texture_ctrl) + { if (identical_diffuse) { - texture_ctrl->setTentative( FALSE ); - texture_ctrl->setEnabled( editable ); - texture_ctrl->setImageAssetID( id ); + texture_ctrl->setTentative(FALSE); + texture_ctrl->setEnabled(editable); + texture_ctrl->setImageAssetID(id); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); - } - else if (id.isNull()) + + if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) { - // None selected - texture_ctrl->setTentative( FALSE ); - texture_ctrl->setEnabled( FALSE ); - texture_ctrl->setImageAssetID( LLUUID::null ); - getChildView("combobox alphamode")->setEnabled( FALSE ); - getChildView("label alphamode")->setEnabled( FALSE ); - getChildView("maskcutoff")->setEnabled( FALSE); - getChildView("label maskcutoff")->setEnabled( FALSE ); + texture_ctrl->setBakeTextureEnabled(objectp->isAttachment()); } - else - { - // Tentative: multiple selected with different textures - texture_ctrl->setTentative( TRUE ); - texture_ctrl->setEnabled( editable ); - texture_ctrl->setImageAssetID( id ); + } + else if (id.isNull()) + { + // None selected + texture_ctrl->setTentative(FALSE); + texture_ctrl->setEnabled(FALSE); + texture_ctrl->setImageAssetID(LLUUID::null); + getChildView("combobox alphamode")->setEnabled(FALSE); + getChildView("label alphamode")->setEnabled(FALSE); + getChildView("maskcutoff")->setEnabled(FALSE); + getChildView("label maskcutoff")->setEnabled(FALSE); + } + else + { + // Tentative: multiple selected with different textures + texture_ctrl->setTentative(TRUE); + texture_ctrl->setEnabled(editable); + texture_ctrl->setImageAssetID(id); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); + + if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) + { + texture_ctrl->setBakeTextureEnabled(objectp->isAttachment()); + } } + } if (shinytexture_ctrl) @@ -2467,6 +2478,15 @@ void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) { LLUUID get(LLViewerObject* object, S32 te_index) { + LLTextureEntry *te = object->getTE(te_index); + if (te) + { + if ((te->getID() == IMG_USE_BAKED_EYES) || (te->getID() == IMG_USE_BAKED_HAIR) || (te->getID() == IMG_USE_BAKED_HEAD) || (te->getID() == IMG_USE_BAKED_LOWER) || (te->getID() == IMG_USE_BAKED_SKIRT) || (te->getID() == IMG_USE_BAKED_UPPER)) + { + return te->getID(); + } + } + LLUUID id; LLViewerTexture* image = object->getTEImage(te_index); if (image) @@ -2476,7 +2496,6 @@ void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) if (!id.isNull() && LLViewerMedia::textureHasMedia(id)) { - LLTextureEntry *te = object->getTE(te_index); if (te) { LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_STANDARD) : NULL; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index c44aca6fa5..7b7b81f3e4 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1647,6 +1647,15 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) // * Can just apply the texture and be done with it. 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; } }; @@ -1846,6 +1855,15 @@ BOOL LLSelectMgr::selectionRevertTextures() else { 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/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 854d328c71..0aeea15b97 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -32,6 +32,7 @@ #include "llrender.h" #include "llagent.h" #include "llviewertexturelist.h" +#include "llselectmgr.h" #include "llcheckboxctrl.h" #include "llcombobox.h" #include "llbutton.h" @@ -406,8 +407,8 @@ BOOL LLFloaterTexturePicker::postBuild() getChild("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this); getChild("hide_base_mesh_region")->setCommitCallback(onHideBaseMeshRegionCheck, this); - + setBakeTextureEnabled(FALSE); return TRUE; } @@ -482,7 +483,24 @@ void LLFloaterTexturePicker::draw() mTexturep = NULL; if(mImageAssetID.notNull()) { - mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID); + LLPointer texture = NULL; + + if ((mImageAssetID == IMG_USE_BAKED_EYES) || (mImageAssetID == IMG_USE_BAKED_HAIR) || (mImageAssetID == IMG_USE_BAKED_HEAD) || (mImageAssetID == IMG_USE_BAKED_LOWER) || (mImageAssetID == IMG_USE_BAKED_SKIRT) || (mImageAssetID == IMG_USE_BAKED_UPPER)) + { + if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) + { + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID); + texture = viewerTexture ? dynamic_cast(viewerTexture) : NULL; + } + } + + if (texture.isNull()) + { + texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID); + } + + mTexturep = texture; mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW); } @@ -783,6 +801,39 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata) self->getChild("l_bake_use_texture_combo_box")->setVisible(mode == 2); self->getChild("hide_base_mesh_region")->setVisible(false);// mode == 2); + + if (mode == 2) + { + S8 val = -1; + + LLUUID imageID = self->mImageAssetID; + if (imageID == IMG_USE_BAKED_HEAD) + { + val = 0; + } + else if (imageID == IMG_USE_BAKED_UPPER) + { + val = 1; + } + else if (imageID == IMG_USE_BAKED_LOWER) + { + val = 2; + } + else if (imageID == IMG_USE_BAKED_EYES) + { + val = 3; + } + else if (imageID == IMG_USE_BAKED_SKIRT) + { + val = 4; + } + else if (imageID == IMG_USE_BAKED_HAIR) + { + val = 5; + } + + self->getChild("l_bake_use_texture_combo_box")->setSelectedByValue(val, TRUE); + } } // static @@ -945,7 +996,9 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data } else { - onBtnCancel(self); + self->setCanApply(true, true); + self->setImageID(self->mOriginalImageAssetID); + self->commitIfImmediateSet(); } } @@ -1011,6 +1064,11 @@ void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled) mModeSelector->setIndexEnabled(1,enabled); } +void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled) +{ + mModeSelector->setIndexEnabled(2, enabled); +} + void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) { LLUUID inventory_item_id = findItemID(te.getID(), TRUE); @@ -1059,7 +1117,8 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mImageAssetID(p.image_id), mDefaultImageAssetID(p.default_image_id), mDefaultImageName(p.default_image_name), - mFallbackImage(p.fallback_image) + mFallbackImage(p.fallback_image), + mBakeTextureEnabled(FALSE) { // Default of defaults is white image for diff tex @@ -1256,6 +1315,8 @@ void LLTextureCtrl::showPicker(BOOL take_focus) if (root_floater) root_floater->addDependentFloater(floaterp); floaterp->openFloater(); + + texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled); } if (take_focus) @@ -1473,7 +1534,22 @@ void LLTextureCtrl::draw() } else if (!mImageAssetID.isNull()) { - LLPointer texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES,LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLPointer texture = NULL; + + if ((mImageAssetID == IMG_USE_BAKED_EYES) || (mImageAssetID == IMG_USE_BAKED_HAIR) || (mImageAssetID == IMG_USE_BAKED_HEAD) || (mImageAssetID == IMG_USE_BAKED_LOWER) || (mImageAssetID == IMG_USE_BAKED_SKIRT) || (mImageAssetID == IMG_USE_BAKED_UPPER)) + { + if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) + { + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID); + texture = viewerTexture ? dynamic_cast(viewerTexture) : NULL; + } + } + + if (texture.isNull()) + { + texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + } texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW); texture->forceToSaveRawImage(0) ; diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index e70849e5c9..ee43fdfb9e 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -198,6 +198,8 @@ public: LLViewerFetchedTexture* getTexture() { return mTexturep; } + void setBakeTextureEnabled(BOOL enabled) { mBakeTextureEnabled = enabled; } + private: BOOL allowDrop(LLInventoryItem* item); BOOL doDrop(LLInventoryItem* item); @@ -233,6 +235,7 @@ private: BOOL mShowLoadingPlaceholder; std::string mLoadingPlaceholderString; S32 mLabelWidth; + BOOL mBakeTextureEnabled; }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -326,6 +329,7 @@ public: static void onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *userdata); void setLocalTextureEnabled(BOOL enabled); + void setBakeTextureEnabled(BOOL enabled); protected: LLPointer mTexturep; @@ -367,6 +371,7 @@ private: bool mCanPreview; bool mPreviewSettingChanged; + texture_selected_callback mTextureSelectedCallback; floater_close_callback mOnFloaterCloseCallback; floater_commit_callback mOnFloaterCommitCallback; 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) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index bac96991fa..b63a7ab910 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -566,10 +566,9 @@ public: friend class LLViewerObjectList; friend class LLViewerMediaList; -private: +public: LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id); - LLTextureEntry* getBakedTextureEntryForMagicId(const LLUUID& 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/llviewertexture.h b/indra/newview/llviewertexture.h index 2bd2f83e93..c9dea17f63 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -417,9 +417,6 @@ public: void setInFastCacheList(bool in_list) { mInFastCacheList = in_list; } bool isInFastCacheList() { return mInFastCacheList; } - U8 getBakedTextureIndex() { return mBakedTextureIndex; } - void setBakedTextureIndex(U8 index) { mBakedTextureIndex = index; } - /*virtual*/bool isActiveFetching(); //is actively in fetching by the fetching pipeline. protected: @@ -522,8 +519,6 @@ protected: BOOL mForSculpt ; //a flag if the texture is used as sculpt data. BOOL mIsFetched ; //is loaded from remote or from cache, not generated locally. - U8 mBakedTextureIndex; //for FTT_SERVER_BAKE fetched textures - public: static LLPointer sMissingAssetImagep; // Texture to show for an image asset that is not in the database static LLPointer sWhiteImagep; // Texture to show NOTHING (whiteness) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index af98f78d0d..9b69f5a836 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2225,7 +2225,6 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU result->setIsMissingAsset(false); } - result->setBakedTextureIndex(te); } return result; } @@ -7198,6 +7197,83 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) } } + +//----------------------------------------------------------------------------- +// updateMeshVisibility() +// Hide the mesh joints if attachments are using baked textures +//----------------------------------------------------------------------------- +void LLVOAvatar::updateMeshVisibility() +{ + bool bake_flag[BAKED_NUM_INDICES]; + memset(bake_flag, 0, BAKED_NUM_INDICES*sizeof(bool)); + + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (attachment) + { + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject *objectp = (*attachment_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); + } + } + } + } + } + + for (S32 i = 0; i < mMeshLOD.size(); i++) + { + LLAvatarJoint* joint = mMeshLOD[i]; + if (i == MESH_ID_HAIR && bake_flag[BAKED_HAIR]) + { + joint->setVisible(!bake_flag[BAKED_HAIR], TRUE); + } + else if (i == MESH_ID_HEAD) + { + joint->setVisible(!bake_flag[BAKED_HEAD], TRUE); + } + else if (i == MESH_ID_SKIRT) + { + joint->setVisible(!bake_flag[BAKED_SKIRT], TRUE); + } + else if (i == MESH_ID_UPPER_BODY) + { + joint->setVisible(!bake_flag[BAKED_UPPER], TRUE); + } + else if (i == MESH_ID_LOWER_BODY) + { + joint->setVisible(!bake_flag[BAKED_LOWER], TRUE); + } + else if (i == MESH_ID_EYEBALL_LEFT) + { + joint->setVisible(!bake_flag[BAKED_EYES], TRUE); + } + else if (i == MESH_ID_EYEBALL_RIGHT) + { + joint->setVisible(!bake_flag[BAKED_EYES], TRUE); + } + else if (i == MESH_ID_EYELASH) + { + joint->setVisible(!bake_flag[BAKED_EYES], TRUE); + } + } +} + //----------------------------------------------------------------------------- // updateMeshTextures() // Uses the current TE values to set the meshes' and layersets' textures. @@ -8217,22 +8293,17 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte S8 face_index; for (face_index = 0; face_index <= last_face_index; face_index++) { - LLViewerTexture* viewer_texture = attached_object->getTEImage((U8)face_index); - - if (viewer_texture && ( (viewer_texture->getType() == LLViewerTexture::FETCHED_TEXTURE) || (viewer_texture->getType() == LLViewerTexture::LOD_TEXTURE) )) + LLTextureEntry* texEntry = attached_object->getTE(face_index); + if (texEntry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(texEntry->getID())) { - LLViewerFetchedTexture* fetched_texture = dynamic_cast(viewer_texture); - if (fetched_texture->getFTType() == FTT_SERVER_BAKE) - { - const LLUUID new_id = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::localTextureIndexToMagicId((LLAvatarAppearanceDefines::ETextureIndex)fetched_texture->getBakedTextureIndex()); - attached_object->setTETexture(face_index, new_id); - } - + attached_object->setTEImage(face_index, LLViewerTextureManager::getFetchedTexture(texEntry->getID(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } } } } + + updateMeshVisibility(); } // static diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4f876533ee..1b0044201f 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -654,6 +654,8 @@ public: void updateSexDependentLayerSets(); virtual void dirtyMesh(); // Dirty the avatar mesh void updateMeshData(); + void updateMeshVisibility(); + protected: void releaseMeshData(); virtual void restoreMeshData(); -- cgit v1.3 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(-) (limited to 'indra/newview/llviewerobject.cpp') 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.3 From d0b8617fe6052a94d3a1d06ca44475f05507c770 Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Mon, 26 Mar 2018 05:39:31 -0700 Subject: MAINT-8436,8412,8411,8446,8438: fixed attach/detach --- indra/newview/llselectmgr.cpp | 1 + indra/newview/llviewerobject.cpp | 23 ++++++--- indra/newview/llviewerobject.h | 2 +- indra/newview/llvoavatar.cpp | 104 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 118 insertions(+), 12 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') 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 -- cgit v1.3 From 513d1728c3417d1d6fdf7046bc792ecdcbb25440 Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Wed, 28 Mar 2018 17:21:03 -0700 Subject: MAINT-8438,8446: fix bakes on child prims --- indra/newview/lltexturectrl.cpp | 2 +- indra/newview/llviewerobject.cpp | 33 ++++++++++--- indra/newview/llviewerobject.h | 1 + indra/newview/llvoavatar.cpp | 102 +++++++-------------------------------- 4 files changed, 47 insertions(+), 91 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index d9170dd832..97876dd60a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1011,7 +1011,7 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data else { self->setCanApply(true, true); - self->setImageID(self->mOriginalImageAssetID); + self->setImageID(self->mDefaultImageAssetID); self->commitIfImmediateSet(); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 15d7ac7ad4..37e6fa080a 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4368,11 +4368,6 @@ void LLViewerObject::sendTEUpdate() const LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) { - if (!isAttachment()) - { - return NULL; - } - if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) { return NULL; @@ -4382,7 +4377,19 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) if (avatar) { LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); - return avatar->getBakedTextureImage(texIndex, avatar->getTE(texIndex)->getID()); + LLViewerTexture* bakedTexture = avatar->getBakedTextureImage(texIndex, avatar->getTE(texIndex)->getID()); + if (bakedTexture == NULL || bakedTexture->isMissingAsset()) + { + return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + } + else + { + return bakedTexture; + } + } + else + { + return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } return NULL; @@ -4434,6 +4441,20 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) } } +void LLViewerObject::refreshBakeTexture() +{ + for (int face_index = 0; face_index < getNumTEs(); face_index++) + { + LLTextureEntry* tex_entry = getTE(face_index); + if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID())) + { + const LLUUID& image_id = tex_entry->getID(); + LLViewerTexture* bakedTexture = getBakedTextureForMagicId(image_id); + changeTEImage(face_index, bakedTexture); + } + } +} + void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) { if (mTEImages[te] != imagep) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index e6ed7d2fd5..a9035c71e1 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -571,6 +571,7 @@ public: public: LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id); void updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id); + void refreshBakeTexture(); 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 f61f0b7cc6..c6a8afe92d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6430,22 +6430,8 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o LLSelectMgr::getInstance()->updatePointAt(); } - const U32 MAX_TES = 32; + viewer_object->refreshBakeTexture(); - 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(); @@ -6454,18 +6440,10 @@ const LLViewerJointAttachment *LLVOAvatar::attachObject(LLViewerObject *viewer_o 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())); - } - } + objectp->refreshBakeTexture(); } } - updateMeshVisibility(); return attachment; @@ -6619,39 +6597,16 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) 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)); - } - } - } - + viewer_object->refreshBakeTexture(); + 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) + for (LLViewerObject::child_list_t::const_iterator iter1 = child_list.begin(); + iter1 != child_list.end(); ++iter1) { - LLViewerObject* objectp = *iter; + LLViewerObject* objectp = *iter1; 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)); - } - } + objectp->refreshBakeTexture(); } } @@ -7309,15 +7264,15 @@ void LLVOAvatar::updateMeshVisibility() } 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) + for (LLViewerObject::child_list_t::const_iterator iter1 = child_list.begin(); + iter1 != child_list.end(); ++iter1) { - LLViewerObject* objectp = *iter; - if (objectp) + LLViewerObject* objectchild = *iter1; + if (objectchild) { - for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++) + for (int face_index = 0; face_index < objectchild->getNumTEs(); face_index++) { - LLTextureEntry* tex_entry = objectp->getTE(face_index); + LLTextureEntry* tex_entry = objectchild->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); @@ -7331,6 +7286,8 @@ void LLVOAvatar::updateMeshVisibility() } } + LL_INFOS() << "head " << bake_flag[BAKED_HEAD] << "eyes " << bake_flag[BAKED_EYES] << "hair " << bake_flag[BAKED_HAIR] << "lower " << bake_flag[BAKED_LOWER] << "upper " << bake_flag[BAKED_UPPER] << "skirt " << bake_flag[BAKED_SKIRT] << LL_ENDL; + for (S32 i = 0; i < mMeshLOD.size(); i++) { LLAvatarJoint* joint = mMeshLOD[i]; @@ -8378,23 +8335,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte ++attachment_iter) { LLViewerObject* attached_object = (*attachment_iter); - - const U32 MAX_TES = 32; - - S32 last_face_index = llmin((U32)attached_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 = attached_object->getTE(face_index); - if (texEntry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(texEntry->getID())) - { - attached_object->setTEImage(face_index, LLViewerTextureManager::getFetchedTexture(texEntry->getID(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); - } - } - } + attached_object->refreshBakeTexture(); LLViewerObject::const_child_list_t& child_list = attached_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); @@ -8403,14 +8344,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte LLViewerObject* objectp = *iter; if (objectp) { - for (int face_index = 0; face_index < objectp->getNumTEs(); face_index++) - { - LLTextureEntry* texEntry = objectp->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)); - } - } + objectp->refreshBakeTexture(); } } } -- cgit v1.3 From 69b2add00a9d371f6148d3102f1a54b3b6ce3175 Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Wed, 27 Jun 2018 01:45:01 +0530 Subject: [MAINT-8513] - fix "Edit My Outfit" Changes Don't Update --- indra/newview/llviewerobject.cpp | 4 +- indra/newview/llvoavatar.cpp | 91 ++++++++++++++++++++++++++++++---------- indra/newview/llvoavatar.h | 1 + 3 files changed, 71 insertions(+), 25 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 3cc44638b1..5a502b61ab 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4376,8 +4376,8 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) LLVOAvatar* avatar = getAvatar(); if (avatar) { - LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); - LLViewerTexture* bakedTexture = avatar->getBakedTextureImage(texIndex, avatar->getTE(texIndex)->getID()); + LLAvatarAppearanceDefines::EBakedTextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id); + LLViewerTexture* bakedTexture = avatar->getBakedTexture(texIndex); if (bakedTexture == NULL || bakedTexture->isMissingAsset()) { return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9e2a69ae65..6e49a92e97 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7558,6 +7558,33 @@ void LLVOAvatar::updateMeshTextures() call_remove_missing = true; } + //refresh bakes on any attached objects + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + attached_object->refreshBakeTexture(); + + LLViewerObject::const_child_list_t& child_list = attached_object->getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + LLViewerObject* objectp = *iter; + if (objectp) + { + objectp->refreshBakeTexture(); + } + } + } + } + } @@ -8336,36 +8363,54 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte } updateMeshTextures(); + updateMeshVisibility(); - //refresh bakes on any attached objects - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) +} + +LLViewerTexture* LLVOAvatar::getBakedTexture(const U8 te) +{ + if (te < 0 || te >= BAKED_NUM_INDICES) { - LLViewerJointAttachment* attachment = iter->second; + return NULL; + } - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject* attached_object = (*attachment_iter); - attached_object->refreshBakeTexture(); + BOOL is_layer_baked = isTextureDefined(mBakedTextureDatas[te].mTextureIndex); + BOOL use_lkg_baked_layer; // lkg = "last known good" + + LLViewerTexLayerSet* layerset = NULL; + layerset = getTexLayerSet(te); + BOOL layerset_invalid = layerset && (!layerset->getViewerComposite()->isInitialized() || !layerset->isLocalTextureDataAvailable()); + use_lkg_baked_layer = (!is_layer_baked && (mBakedTextureDatas[te].mLastTextureID != IMG_DEFAULT_AVATAR) && layerset_invalid); + if (use_lkg_baked_layer) + { + layerset->setUpdatesEnabled(TRUE); + } + else + { + use_lkg_baked_layer = (!is_layer_baked && mBakedTextureDatas[te].mLastTextureID != IMG_DEFAULT_AVATAR); + } - LLViewerObject::const_child_list_t& child_list = attached_object->getChildren(); - for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); ++iter) - { - LLViewerObject* objectp = *iter; - if (objectp) - { - objectp->refreshBakeTexture(); - } - } - } + if (use_lkg_baked_layer && !isUsingLocalAppearance()) + { + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[te].mLastTextureID); + return baked_img; } + else if (!isUsingLocalAppearance() && is_layer_baked) + { + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage(mBakedTextureDatas[te].mTextureIndex, 0), TRUE); + return baked_img; + } + else if (layerset && isUsingLocalAppearance()) + { + layerset->createComposite(); + layerset->setUpdatesEnabled(TRUE); - updateMeshVisibility(); + return layerset->getViewerComposite(); + } + + return NULL; + } // static diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1b0044201f..8d45877a9d 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -655,6 +655,7 @@ public: virtual void dirtyMesh(); // Dirty the avatar mesh void updateMeshData(); void updateMeshVisibility(); + LLViewerTexture* getBakedTexture(const U8 te); protected: void releaseMeshData(); -- cgit v1.3 From a0beacf007b9e99b7d92647ebb31307d77eec51f Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Wed, 27 Jun 2018 05:57:21 +0530 Subject: [MAINT-8513] - use IMG_DEFAULT in case of no server bakes --- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llvoavatar.cpp | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 5a502b61ab..5b4cc0980e 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4380,7 +4380,7 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) LLViewerTexture* bakedTexture = avatar->getBakedTexture(texIndex); if (bakedTexture == NULL || bakedTexture->isMissingAsset()) { - return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } else { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 81d114d7ba..cba1fae758 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8375,27 +8375,12 @@ LLViewerTexture* LLVOAvatar::getBakedTexture(const U8 te) } BOOL is_layer_baked = isTextureDefined(mBakedTextureDatas[te].mTextureIndex); - BOOL use_lkg_baked_layer; // lkg = "last known good" LLViewerTexLayerSet* layerset = NULL; layerset = getTexLayerSet(te); - BOOL layerset_invalid = layerset && (!layerset->getViewerComposite()->isInitialized() || !layerset->isLocalTextureDataAvailable()); - use_lkg_baked_layer = (!is_layer_baked && (mBakedTextureDatas[te].mLastTextureID != IMG_DEFAULT_AVATAR) && layerset_invalid); - if (use_lkg_baked_layer) - { - layerset->setUpdatesEnabled(TRUE); - } - else - { - use_lkg_baked_layer = (!is_layer_baked && mBakedTextureDatas[te].mLastTextureID != IMG_DEFAULT_AVATAR); - } + - if (use_lkg_baked_layer && !isUsingLocalAppearance()) - { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[te].mLastTextureID); - return baked_img; - } - else if (!isUsingLocalAppearance() && is_layer_baked) + if (!isUsingLocalAppearance() && is_layer_baked) { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage(mBakedTextureDatas[te].mTextureIndex, 0), TRUE); return baked_img; @@ -8646,6 +8631,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) } } } + dirtyMesh(); } -- cgit v1.3 From dcbf57ab2d3ec86d9e2b3ec7d3c627f37fe24392 Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Sun, 15 Jul 2018 21:33:02 +0530 Subject: [MAINT-8846] - fixing duplicate id in avatar_lad.xml fixrs character test female crash. code cleanup. --- indra/llappearance/llavatarappearance.cpp | 6 +++--- indra/newview/character/avatar_lad.xml | 6 +++--- indra/newview/lltexturectrl.cpp | 19 ++++++------------- indra/newview/llviewerobject.cpp | 1 - 4 files changed, 12 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index b1dd4a4cb1..2952a21948 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -1491,9 +1491,9 @@ BOOL LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name ) case TEX_AUX1_TATTOO: case TEX_AUX2_TATTOO: case TEX_AUX3_TATTOO: - param_name[0] = 1029; //"tattoo_universal_red"; - param_name[1] = 1030; //"tattoo_universal_green"; - param_name[2] = 1031; //"tattoo_universal_blue"; + param_name[0] = 1238; //"tattoo_universal_red"; + param_name[1] = 1239; //"tattoo_universal_green"; + param_name[2] = 1240; //"tattoo_universal_blue"; break; default: diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index e19fe9b785..8f4ba2bd32 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -16633,7 +16633,7 @@ render_pass="bump"> setDirty(); // *TODO: shouldn't we be using setValue() here? mImageAssetID = image_id; - if (isBakedImageID(mImageAssetID)) + if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID)) { if ( mBakeTextureEnabled && mModeSelector->getSelectedIndex() != 2) { @@ -517,8 +512,7 @@ void LLFloaterTexturePicker::draw() { LLPointer texture = NULL; - if ((mImageAssetID == IMG_USE_BAKED_EYES) || (mImageAssetID == IMG_USE_BAKED_HAIR) || (mImageAssetID == IMG_USE_BAKED_HEAD) || (mImageAssetID == IMG_USE_BAKED_LOWER) || (mImageAssetID == IMG_USE_BAKED_SKIRT) || (mImageAssetID == IMG_USE_BAKED_UPPER) - || (mImageAssetID == IMG_USE_BAKED_LEFTARM) || (mImageAssetID == IMG_USE_BAKED_LEFTLEG) || (mImageAssetID == IMG_USE_BAKED_AUX1) || (mImageAssetID == IMG_USE_BAKED_AUX2) || (mImageAssetID == IMG_USE_BAKED_AUX3)) + if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID)) { LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); if (obj) @@ -1157,7 +1151,7 @@ void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled) mModeSelector->setSelectedIndex(0, 0); } - if (changed && mBakeTextureEnabled && isBakedImageID(mImageAssetID)) + if (changed && mBakeTextureEnabled && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID)) { if (mModeSelector->getSelectedIndex() != 2) { @@ -1654,8 +1648,7 @@ void LLTextureCtrl::draw() { LLPointer texture = NULL; - if ((mImageAssetID == IMG_USE_BAKED_EYES) || (mImageAssetID == IMG_USE_BAKED_HAIR) || (mImageAssetID == IMG_USE_BAKED_HEAD) || (mImageAssetID == IMG_USE_BAKED_LOWER) || (mImageAssetID == IMG_USE_BAKED_SKIRT) || (mImageAssetID == IMG_USE_BAKED_UPPER) - || (mImageAssetID == IMG_USE_BAKED_LEFTARM) || (mImageAssetID == IMG_USE_BAKED_LEFTLEG) || (mImageAssetID == IMG_USE_BAKED_AUX1) || (mImageAssetID == IMG_USE_BAKED_AUX2) || (mImageAssetID == IMG_USE_BAKED_AUX3)) + if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID)) { LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); if (obj) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 4f64ee94c1..ace2504fbd 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4408,7 +4408,6 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } - return NULL; } void LLViewerObject::updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id) -- cgit v1.3 From 9b364bf7037bed2c85251458b00e34088deda197 Mon Sep 17 00:00:00 2001 From: Anchor Date: Wed, 28 Nov 2018 16:01:36 -0800 Subject: [SL-10079] - Bom handling for animated objects --- indra/newview/llviewerobject.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e9b0316393..1539f47ca7 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1,4 +1,4 @@ -/** +is_a/** * @file llviewerobject.cpp * @brief Base class for viewer objects * @@ -4682,6 +4682,12 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) return NULL; } + LLViewerObject *root = getRootEdit(); + if (root && root->isAnimatedObject()) + { + return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + } + LLVOAvatar* avatar = getAvatar(); if (avatar) { -- cgit v1.3 From d4abdf3560810b6bf0d08661abf592b4bb366e23 Mon Sep 17 00:00:00 2001 From: Anchor Date: Thu, 29 Nov 2018 23:19:31 -0800 Subject: fix typo --- indra/newview/llviewerobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1539f47ca7..262a2550ec 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1,4 +1,4 @@ -is_a/** +/** * @file llviewerobject.cpp * @brief Base class for viewer objects * -- cgit v1.3