summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rwxr-xr-xindra/newview/llpanelface.cpp79
1 files changed, 52 insertions, 27 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index c446132289..911af9df04 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -171,6 +171,8 @@ BOOL LLPanelFace::postBuild()
mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) );
mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
+ mTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
mTextureCtrl->setFollowsTop();
mTextureCtrl->setFollowsLeft();
mTextureCtrl->setImmediateFilterPermMask(PERM_NONE);
@@ -184,6 +186,8 @@ BOOL LLPanelFace::postBuild()
mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) );
mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) );
mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) );
+ mShinyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
mShinyTextureCtrl->setFollowsTop();
@@ -200,6 +204,8 @@ BOOL LLPanelFace::postBuild()
mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) );
mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) );
mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) );
+ mBumpyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) );
+
mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2));
mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1));
mBumpyTextureCtrl->setFollowsTop();
@@ -321,16 +327,25 @@ void LLPanelFace::sendBump(U32 bumpiness)
{
LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL;
bumpytexture_ctrl->clear();
- bumpytexture_ctrl->setImageAssetID(LLUUID());
+ bumpytexture_ctrl->setImageAssetID(LLUUID());
}
- U8 bump = (U8) bumpiness & TEM_BUMP_MASK;
- LLSelectMgr::getInstance()->selectionSetBumpmap( bump );
-
updateBumpyControls(bumpiness == BUMPY_TEXTURE, true);
LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID();
+
+ U8 bump = (U8) bumpiness & TEM_BUMP_MASK;
+
+ // Clear legacy bump to None when using an actual normal map
+ //
+ if (!current_normal_map.isNull())
+ bump = 0;
+
+ // Set the normal map or reset it to null as appropriate
+ //
LLSelectedTEMaterial::setNormalID(this, current_normal_map);
+
+ LLSelectMgr::getInstance()->selectionSetBumpmap( bump );
}
void LLPanelFace::sendTexGen()
@@ -348,13 +363,21 @@ void LLPanelFace::sendShiny(U32 shininess)
if (shininess < SHINY_TEXTURE)
{
texture_ctrl->clear();
- texture_ctrl->setImageAssetID(LLUUID());
-
- U8 shiny = (U8) shininess & TEM_SHINY_MASK;
- LLSelectMgr::getInstance()->selectionSetShiny( shiny );
+ texture_ctrl->setImageAssetID(LLUUID());
}
- updateShinyControls(!texture_ctrl->getImageAssetID().isNull(), true);
- LLSelectedTEMaterial::setSpecularID(this, texture_ctrl->getImageAssetID());
+
+ LLUUID specmap = getCurrentSpecularMap();
+
+ U8 shiny = (U8) shininess & TEM_SHINY_MASK;
+ if (!specmap.isNull())
+ shiny = 0;
+
+ LLSelectedTEMaterial::setSpecularID(this, specmap);
+
+ LLSelectMgr::getInstance()->selectionSetShiny( shiny );
+
+ updateShinyControls(!specmap.isNull(), true);
+
}
void LLPanelFace::sendFullbright()
@@ -746,21 +769,18 @@ void LLPanelFace::updateUI()
LLUUID norm_map_id = getCurrentNormalMap();
LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness");
+
+ bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE;
+
if (combobox_bumpiness)
{
- if ((bumpy == BUMPY_TEXTURE) && !norm_map_id.isNull())
- {
- combobox_bumpiness->selectNthItem((S32)BUMPY_TEXTURE);
- }
- else
- {
- combobox_bumpiness->selectNthItem((S32)((bumpy < BUMPY_TEXTURE) ? bumpy : 0));
- }
+ combobox_bumpiness->selectNthItem((S32)bumpy);
}
else
{
llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl;
}
+
getChildView("combobox bumpiness")->setEnabled(editable);
getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical_bumpy);
getChildView("label bumpiness")->setEnabled(editable);
@@ -832,7 +852,7 @@ void LLPanelFace::updateUI()
updateAlphaControls();
- if(texture_ctrl && !texture_ctrl->isPickerShown())
+ if(texture_ctrl)
{
if (identical_diffuse)
{
@@ -870,8 +890,6 @@ void LLPanelFace::updateUI()
if (shinytexture_ctrl)
{
- // Can't use this test as we can't actually store SHINY_TEXTURE in the TEs *sigh*
- //
if (identical_spec && (shiny == SHINY_TEXTURE))
{
shinytexture_ctrl->setTentative( FALSE );
@@ -892,7 +910,7 @@ void LLPanelFace::updateUI()
}
}
- if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown())
+ if (bumpytexture_ctrl)
{
if (identical_norm && (bumpy == BUMPY_TEXTURE))
{
@@ -1796,6 +1814,12 @@ void LLPanelFace::onSelectTexture(const LLSD& data)
LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode());
}
+void LLPanelFace::onCloseTexturePicker(const LLSD& data)
+{
+ LL_DEBUGS("Materials") << data << LL_ENDL;
+ updateUI();
+}
+
void LLPanelFace::onCommitSpecularTexture( const LLSD& data )
{
LL_DEBUGS("Materials") << data << LL_ENDL;
@@ -1805,7 +1829,8 @@ void LLPanelFace::onCommitSpecularTexture( const LLSD& data )
void LLPanelFace::onCommitNormalTexture( const LLSD& data )
{
LL_DEBUGS("Materials") << data << LL_ENDL;
- sendBump(getCurrentNormalMap().isNull() ? 0 : BUMPY_TEXTURE);
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
}
void LLPanelFace::onCancelSpecularTexture(const LLSD& data)
@@ -1835,7 +1860,8 @@ void LLPanelFace::onSelectSpecularTexture(const LLSD& data)
void LLPanelFace::onSelectNormalTexture(const LLSD& data)
{
LL_DEBUGS("Materials") << data << LL_ENDL;
- sendBump(BUMPY_TEXTURE);
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
}
//static
@@ -1927,7 +1953,7 @@ void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
llassert_always(self);
- LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot());
+ LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot() * DEG_TO_RAD);
}
//static
@@ -1935,7 +1961,7 @@ void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
llassert_always(self);
- LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot());
+ LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot() * DEG_TO_RAD);
}
//static
@@ -2300,7 +2326,6 @@ void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_a
if (tep)
{
LLMaterial* mat = tep->getMaterialParams().get();
- mat = (tep->getMaterialID().isNull() ? NULL : mat);
if (mat)
{
diffuse_mode = mat->getDiffuseAlphaMode();