summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelface.cpp182
-rw-r--r--indra/newview/llvovolume.cpp50
2 files changed, 132 insertions, 100 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 43001e7d2c..3853cfde9e 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -650,6 +650,10 @@ void LLPanelFace::getState()
// }
bool identical;
+ bool identical_diffuse;
+ bool identical_norm;
+ bool identical_spec;
+
LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
LLTextureCtrl* shinytexture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
@@ -688,7 +692,7 @@ void LLPanelFace::getState()
return id;
}
} func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id );
+ identical_diffuse = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id );
// Normal map
struct norm_get : public LLSelectedTEGetFunctor<LLUUID>
@@ -707,7 +711,7 @@ void LLPanelFace::getState()
return id;
}
} norm_get_func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &norm_get_func, normmap_id ) && identical;
+ identical_norm = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &norm_get_func, normmap_id );
// Specular map
struct spec_get : public LLSelectedTEGetFunctor<LLUUID>
@@ -726,8 +730,7 @@ void LLPanelFace::getState()
return id;
}
} spec_get_func;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ) && identical;
-
+ identical_spec = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id );
mIsAlpha = FALSE;
LLGLenum image_format;
@@ -742,7 +745,7 @@ void LLPanelFace::getState()
return image_format;
}
} func2;
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ) && identical;
+ LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format );
mIsAlpha = FALSE;
switch (image_format)
@@ -771,15 +774,15 @@ void LLPanelFace::getState()
struct alpha_get : public LLSelectedTEGetFunctor<U8>
{
U8 get(LLViewerObject* object, S32 te_index)
- {
+ {
U8 ret = 1;
LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get();
if (mat)
- {
+ {
ret = mat->getDiffuseAlphaMode();
- }
+ }
return ret;
}
@@ -790,7 +793,7 @@ void LLPanelFace::getState()
{
LLCtrlSelectionInterface* combobox_alphamode =
- childGetSelectionInterface("combobox alphamode");
+ childGetSelectionInterface("combobox alphamode");
if (combobox_alphamode)
{
@@ -809,46 +812,39 @@ void LLPanelFace::getState()
updateAlphaControls(getChild<LLComboBox>("combobox alphamode"),this);
}
- if (identical)
+ if(texture_ctrl)
{
- // All selected have the same texture
- if(texture_ctrl)
+ if (identical_diffuse)
{
texture_ctrl->setTentative( FALSE );
texture_ctrl->setEnabled( editable );
texture_ctrl->setImageAssetID( id );
- }
-
- if (shinytexture_ctrl)
- {
shinytexture_ctrl->setTentative( FALSE );
shinytexture_ctrl->setEnabled( editable );
- shinytexture_ctrl->setImageAssetID(specmap_id);
- }
-
- if (bumpytexture_ctrl)
- {
+ if (!editable)
+ {
+ shinytexture_ctrl->setImageAssetID( LLUUID::null );
+ bumpytexture_ctrl->setImageAssetID( LLUUID::null );
+ }
bumpytexture_ctrl->setTentative( FALSE );
bumpytexture_ctrl->setEnabled( editable );
- bumpytexture_ctrl->setImageAssetID(normmap_id);
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
+ getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
}
-
- getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
- getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
- getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
- getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
-
- }
- else
- {
- if(texture_ctrl)
- {
- if( id.isNull() )
+ else if (id.isNull())
{
// None selected
texture_ctrl->setTentative( FALSE );
texture_ctrl->setEnabled( FALSE );
texture_ctrl->setImageAssetID( LLUUID::null );
+ shinytexture_ctrl->setTentative( FALSE );
+ shinytexture_ctrl->setEnabled( FALSE );
+ shinytexture_ctrl->setImageAssetID( LLUUID::null );
+ bumpytexture_ctrl->setTentative( FALSE );
+ bumpytexture_ctrl->setEnabled( FALSE );
+ bumpytexture_ctrl->setImageAssetID( LLUUID::null );
getChildView("combobox alphamode")->setEnabled( FALSE );
getChildView("label alphamode")->setEnabled( FALSE );
getChildView("maskcutoff")->setEnabled( FALSE);
@@ -860,47 +856,58 @@ void LLPanelFace::getState()
texture_ctrl->setTentative( TRUE );
texture_ctrl->setEnabled( editable );
texture_ctrl->setImageAssetID( id );
- getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
- getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
- getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
- getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
- }
- }
-
- if (shinytexture_ctrl)
- {
- if (specmap_id.isNull())
- {
- shinytexture_ctrl->setTentative( FALSE );
- shinytexture_ctrl->setEnabled( FALSE );
- shinytexture_ctrl->setImageAssetID( LLUUID::null );
- }
- else
- {
- shinytexture_ctrl->setTentative( FALSE );
- shinytexture_ctrl->setEnabled( FALSE );
- shinytexture_ctrl->setImageAssetID( specmap_id );
- }
- }
-
- if (bumpytexture_ctrl)
- {
- if (normmap_id.isNull())
- {
- bumpytexture_ctrl->setTentative( FALSE );
- bumpytexture_ctrl->setEnabled( FALSE );
- bumpytexture_ctrl->setImageAssetID( LLUUID::null );
- }
- else
- {
+ getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("label alphamode")->setEnabled(editable && mIsAlpha);
+ getChildView("maskcutoff")->setEnabled(editable && mIsAlpha);
+ getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha);
+ }
+ }
+
+ if (shinytexture_ctrl)
+ {
+ if (identical_spec)
+ {
+ shinytexture_ctrl->setTentative( FALSE );
+ shinytexture_ctrl->setEnabled( editable );
+ shinytexture_ctrl->setImageAssetID( specmap_id );
+ }
+ else if (specmap_id.isNull())
+ {
+ shinytexture_ctrl->setTentative( FALSE );
+ shinytexture_ctrl->setEnabled( FALSE );
+ shinytexture_ctrl->setImageAssetID( LLUUID::null );
+ }
+ else
+ {
shinytexture_ctrl->setTentative( TRUE );
- shinytexture_ctrl->setEnabled( FALSE );
- shinytexture_ctrl->setImageAssetID( normmap_id);
+ shinytexture_ctrl->setEnabled( editable );
+ shinytexture_ctrl->setImageAssetID( specmap_id );
+ }
+ }
+
+ if (bumpytexture_ctrl)
+ {
+ if (identical_norm)
+ {
+ bumpytexture_ctrl->setTentative( FALSE );
+ bumpytexture_ctrl->setEnabled( editable );
+ bumpytexture_ctrl->setImageAssetID( normmap_id );
+ }
+ else if (normmap_id.isNull())
+ {
+ bumpytexture_ctrl->setTentative( FALSE );
+ bumpytexture_ctrl->setEnabled( FALSE );
+ bumpytexture_ctrl->setImageAssetID( LLUUID::null );
+ }
+ else
+ {
+ bumpytexture_ctrl->setTentative( TRUE );
+ bumpytexture_ctrl->setEnabled( editable );
+ bumpytexture_ctrl->setImageAssetID( normmap_id );
}
}
}
- }
-
+
// planar align
bool align_planar = false;
bool identical_planar_aligned = false;
@@ -1550,7 +1557,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate
//make a local copy of the material for editing
// (prevents local edits from overwriting client state on shared materials)
mMaterial = new LLMaterial(*material);
-
+
// Alpha
LLCtrlSelectionInterface* combobox_alphamode =
childGetSelectionInterface("combobox alphamode");
@@ -1630,9 +1637,9 @@ void LLPanelFace::updateMaterial()
mMaterial = LLMaterialPtr(new LLMaterial());
}
- mMaterial->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex());
- mMaterial->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger()));
-
+ mMaterial->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex());
+ mMaterial->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger()));
+
if (bumpiness == BUMPY_TEXTURE)
{
LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL;
@@ -1651,6 +1658,7 @@ void LLPanelFace::updateMaterial()
mMaterial->setNormalRepeat(1.0f,1.0f);
mMaterial->setNormalRotation(0.0f);
}
+
if (shininess == SHINY_TEXTURE)
{
LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL;
@@ -1847,6 +1855,12 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata)
// static
void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata)
{
+ LLPanelFace* self = (LLPanelFace*) userdata;
+ // This is here to insure that we properly update shared UI elements
+ // like the texture ctrls for diffuse/norm/spec so that they are correct
+ // when switching modes
+ //
+ self->getState();
onCommitMaterialsMedia(ctrl, userdata);
}
@@ -1959,6 +1973,24 @@ void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata)
}
U32 alpha_value = comboAlphaMode->getCurrentIndex();
bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking
+
+ LLComboBox* combobox_matmedia = self->getChild<LLComboBox>("combobox matmedia");
+ U32 mat_media = MATMEDIA_MATERIAL;
+ if (combobox_matmedia)
+ {
+ mat_media = combobox_matmedia->getCurrentIndex();
+ }
+
+ LLComboBox* combobox_mattype = self->getChild<LLComboBox>("combobox mattype");
+ U32 mat_type = MATTYPE_DIFFUSE;
+ if (combobox_mattype)
+ {
+ mat_type = combobox_mattype->getCurrentIndex();
+ }
+
+ show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL);
+ show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE);
+
self->getChildView("label maskcutoff")->setVisible(show_alphactrls);
self->getChildView("maskcutoff")->setVisible(show_alphactrls);
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 43c57602f5..b46f4d7351 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1977,7 +1977,7 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co
{
for (U8 i = 0; i < getNumTEs(); i++)
{
- if (getTE(i)->getMaterialID() == pMaterialID)
+ if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID)))
{
setTEMaterialParams(i, pMaterialParams);
}
@@ -1986,16 +1986,16 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co
S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
{
- S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID);
- if (res)
- {
- LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
- LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2));
- gPipeline.markTextured(mDrawable);
- mFaceMappingChanged = TRUE;
+ S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID);
+ if (res)
+ {
+ LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
+ LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2));
+ gPipeline.markTextured(mDrawable);
+ mFaceMappingChanged = TRUE;
+ }
+ return res;
}
- return res;
-}
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
@@ -4132,21 +4132,21 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
if (facep->getTextureEntry()->getMaterialParams().notNull())
- {
- // We have a material. Update our draw info accordingly.
- draw_info->mMaterialID = matid;
- LLVector4 specColor;
- specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f);
- specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f);
- specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f);
- specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f);
- draw_info->mSpecColor = specColor;
- draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f);
- draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f);
- draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode();
- draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
- draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset());
- }
+ {
+ // We have a material. Update our draw info accordingly.
+ draw_info->mMaterialID = matid;
+ LLVector4 specColor;
+ specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f);
+ specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f);
+ specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f);
+ specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f);
+ draw_info->mSpecColor = specColor;
+ draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f);
+ draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f);
+ draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode();
+ draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
+ draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset());
+ }
else
{
U8 shiny = facep->getTextureEntry()->getShiny();