summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelface.cpp65
-rw-r--r--indra/newview/llselectmgr.cpp18
-rw-r--r--indra/newview/lltexturectrl.cpp86
-rw-r--r--indra/newview/lltexturectrl.h5
-rw-r--r--indra/newview/llviewerobject.cpp100
-rw-r--r--indra/newview/llviewerobject.h5
-rw-r--r--indra/newview/llviewertexture.h5
-rw-r--r--indra/newview/llvoavatar.cpp93
-rw-r--r--indra/newview/llvoavatar.h2
9 files changed, 242 insertions, 137 deletions
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<LLComboBox>("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this);
getChild<LLCheckBoxCtrl>("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<LLViewerFetchedTexture> 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<LLViewerFetchedTexture*>(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<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(mode == 2);
self->getChild<LLCheckBoxCtrl>("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<LLComboBox>("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<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES,LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ LLPointer<LLViewerFetchedTexture> 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<LLViewerFetchedTexture*>(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<LLViewerTexture> 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<LLViewerFetchedTexture> sMissingAssetImagep; // Texture to show for an image asset that is not in the database
static LLPointer<LLViewerFetchedTexture> 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<LLViewerFetchedTexture*>(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();