summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorIgor Borovkov <iborovkov@productengine.com>2010-05-27 14:22:49 +0300
committerIgor Borovkov <iborovkov@productengine.com>2010-05-27 14:22:49 +0300
commit423398081b5c4402ebc162c43eaf29acdeb9f423 (patch)
treebf63eebed9dfcc3727e15221b5431b2f926d4339 /indra
parent07dba9ae377d216e049aa9c3019bc51571b48488 (diff)
EXT-7392 FIXED hooked up alpha mask checkboxes to the alpha mask wearable
Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/434/ --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpaneleditwearable.cpp106
-rw-r--r--indra/newview/llpaneleditwearable.h15
-rw-r--r--indra/newview/llsidepanelappearance.cpp2
-rw-r--r--indra/newview/llvoavatar.cpp23
-rw-r--r--indra/newview/llvoavatar.h14
-rw-r--r--indra/newview/llvoavatarself.cpp26
-rw-r--r--indra/newview/llvoavatarself.h3
7 files changed, 173 insertions, 16 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 8e9b164c09..b5b21584aa 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -645,6 +645,12 @@ BOOL LLPanelEditWearable::postBuild()
mWearablePtr = NULL;
+ configureAlphaCheckbox(LLVOAvatarDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
+ configureAlphaCheckbox(LLVOAvatarDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
+ configureAlphaCheckbox(LLVOAvatarDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
+ configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
+ configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
+
return TRUE;
}
@@ -667,11 +673,10 @@ BOOL LLPanelEditWearable::isDirty() const
void LLPanelEditWearable::draw()
{
updateVerbs();
- if (getWearable())
+ if (getWearable() && getWearable()->getType() == LLWearableType::WT_SHAPE)
{
- LLWearableType::EType type = getWearable()->getType();
- updatePanelPickerControls(type);
- updateTypeSpecificControls(type);
+ //updating avatar height
+ updateTypeSpecificControls(LLWearableType::WT_SHAPE);
}
LLPanel::draw();
@@ -970,6 +975,13 @@ void LLPanelEditWearable::initializePanel()
for_each_picker_ctrl_entry <LLTextureCtrl> (getPanel(type), type, boost::bind(init_texture_ctrl, this, _1, _2));
updateVerbs();
+
+ if (getWearable())
+ {
+ LLWearableType::EType type = getWearable()->getType();
+ updatePanelPickerControls(type);
+ updateTypeSpecificControls(type);
+ }
}
void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type)
@@ -992,6 +1004,13 @@ void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
std::string avatar_height_str = llformat("%.2f", gAgentAvatarp->mBodySize.mV[VZ]);
mTxtAvatarHeight->setTextArg("[HEIGHT]", avatar_height_str);
}
+
+ if (LLWearableType::WT_ALPHA == type)
+ {
+ updateAlphaCheckboxes();
+
+ initPreviousAlphaTextures();
+ }
}
void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index)
@@ -1217,4 +1236,83 @@ void LLPanelEditWearable::updateVerbs()
}
+void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name)
+{
+ LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild<LLCheckBoxCtrl>(name);
+ checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te));
+
+ mAlphaCheckbox2Index[name] = te;
+}
+
+void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te)
+{
+ if (!checkbox_ctrl) return;
+ if (!getWearable()) return;
+
+ llinfos << "onInvisibilityCommit, self " << this << " checkbox_ctrl " << checkbox_ctrl << llendl;
+
+ bool new_invis_state = checkbox_ctrl->get();
+ if (new_invis_state)
+ {
+ LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
+ mPreviousAlphaTexture[te] = lto->getID();
+
+ LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE );
+ U32 index = gAgentWearables.getWearableIndex(getWearable());
+ gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
+ gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
+ }
+ else
+ {
+ // Try to restore previous texture, if any.
+ LLUUID prev_id = mPreviousAlphaTexture[te];
+ if (prev_id.isNull() || (prev_id == IMG_INVISIBLE))
+ {
+ prev_id = LLUUID( gSavedSettings.getString( "UIImgDefaultAlphaUUID" ) );
+ }
+ if (prev_id.isNull()) return;
+
+ LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(prev_id);
+ if (!image) return;
+
+ U32 index = gAgentWearables.getWearableIndex(getWearable());
+ gAgentAvatarp->setLocalTexture(te, image, FALSE, index);
+ gAgentAvatarp->wearableUpdated(getWearable()->getType(), FALSE);
+ }
+
+ updatePanelPickerControls(getWearable()->getType());
+}
+
+void LLPanelEditWearable::updateAlphaCheckboxes()
+{
+ for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
+ iter != mAlphaCheckbox2Index.end(); ++iter )
+ {
+ LLVOAvatarDefines::ETextureIndex te = (LLVOAvatarDefines::ETextureIndex)iter->second;
+ LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild<LLCheckBoxCtrl>(iter->first);
+ if (ctrl)
+ {
+ ctrl->set(!gAgentAvatarp->isTextureVisible(te, mWearablePtr));
+ }
+ }
+}
+
+void LLPanelEditWearable::initPreviousAlphaTextures()
+{
+ initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
+ initPreviousAlphaTextureEntry(TEX_UPPER_ALPHA);
+ initPreviousAlphaTextureEntry(TEX_HEAD_ALPHA);
+ initPreviousAlphaTextureEntry(TEX_EYES_ALPHA);
+ initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
+}
+
+void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te)
+{
+ LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
+ if (lto)
+ {
+ mPreviousAlphaTexture[te] = lto->getID();
+ }
+}
+
// EOF
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 6f9ac82407..0953f09b6c 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -36,8 +36,10 @@
#include "llpanel.h"
#include "llscrollingpanellist.h"
#include "llmodaldialog.h"
+#include "llvoavatardefines.h"
#include "llwearabletype.h"
+class LLCheckBoxCtrl;
class LLWearable;
class LLTextEditor;
class LLTextBox;
@@ -86,6 +88,13 @@ private:
void toggleTypeSpecificControls(LLWearableType::EType type);
void updateTypeSpecificControls(LLWearableType::EType type);
+ //alpha mask checkboxes
+ void configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name);
+ void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te);
+ void updateAlphaCheckboxes();
+ void initPreviousAlphaTextures();
+ void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te);
+
// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
LLWearable *mWearablePtr;
LLViewerInventoryItem* mWearableItem;
@@ -122,6 +131,12 @@ private:
LLPanel *mPanelSkirt;
LLPanel *mPanelAlpha;
LLPanel *mPanelTattoo;
+
+ typedef std::map<std::string, LLVOAvatarDefines::ETextureIndex> string_texture_index_map_t;
+ string_texture_index_map_t mAlphaCheckbox2Index;
+
+ typedef std::map<LLVOAvatarDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
+ s32_uuid_map_t mPreviousAlphaTexture;
};
#endif
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 010d593b27..707fc1555a 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -344,10 +344,10 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
// Toggle panel visibility.
mEditWearable->setVisible(visible);
- mEditWearable->setWearable(wearable);
if (visible)
{
+ mEditWearable->setWearable(wearable);
mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency
if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 4371396629..a72d7f9227 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7887,3 +7887,26 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index
getImage(te, index)->getID() != IMG_DEFAULT);
}
+//virtual
+BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+{
+ if (isIndexLocalTexture(type))
+ {
+ return isTextureDefined(type, index);
+ }
+ else
+ {
+ // baked textures can use TE images directly
+ return ((isTextureDefined(type) || isSelf())
+ && (getTEImage(type)->getID() != IMG_INVISIBLE
+ || LLDrawPoolAlpha::sShowDebugAlpha));
+ }
+}
+
+//virtual
+BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
+{
+ // non-self avatars don't have wearables
+ return FALSE;
+}
+
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 86a7cdae02..df47e9ba1d 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -462,7 +462,9 @@ public:
//--------------------------------------------------------------------
public:
virtual BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
- BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex index) const;
+ virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
+ virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const;
+
protected:
BOOL isFullyBaked();
static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
@@ -1039,14 +1041,4 @@ protected: // Shared with LLVOAvatarSelf
}; // LLVOAvatar
-//------------------------------------------------------------------------
-// Inlines
-//------------------------------------------------------------------------
-inline BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex te) const
-{
- return ((isTextureDefined(te) || isSelf())
- && (getTEImage(te)->getID() != IMG_INVISIBLE
- || LLDrawPoolAlpha::sShowDebugAlpha));
-}
-
#endif // LL_VO_AVATAR_H
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index cf3fb01b5a..a8e2f446c2 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1332,6 +1332,32 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32
return isDefined;
}
+//virtual
+BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+{
+ if (isIndexBakedTexture(type))
+ {
+ return LLVOAvatar::isTextureVisible(type);
+ }
+
+ LLUUID tex_id = getLocalTextureID(type,index);
+ return (tex_id != IMG_INVISIBLE)
+ || (LLDrawPoolAlpha::sShowDebugAlpha);
+}
+
+//virtual
+BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
+{
+ if (isIndexBakedTexture(type))
+ {
+ return LLVOAvatar::isTextureVisible(type);
+ }
+
+ U32 index = gAgentWearables.getWearableIndex(wearable);
+ return isTextureVisible(type,index);
+}
+
+
//-----------------------------------------------------------------------------
// requestLayerSetUploads()
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 8e6d9698f2..189c1ac808 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -179,6 +179,9 @@ public:
BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const;
// If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index
/*virtual*/ BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
+ /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
+ /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const;
+
//--------------------------------------------------------------------
// Local Textures