summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llmaterialmgr.cpp61
-rw-r--r--indra/newview/llmaterialmgr.h22
-rwxr-xr-xindra/newview/llpanelface.cpp241
-rwxr-xr-xindra/newview/llpanelface.h52
-rwxr-xr-xindra/newview/llselectmgr.cpp2
-rwxr-xr-xindra/newview/llviewerobject.cpp17
-rwxr-xr-xindra/newview/llvovolume.cpp8
-rw-r--r--indra/newview/skins/default/xui/en/panel_tools_texture.xml2
8 files changed, 237 insertions, 168 deletions
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index f217ff160e..59e5d05736 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -217,6 +217,51 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL
return connection;
}
+boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb)
+{
+ boost::signals2::connection connection;
+
+ material_map_t::const_iterator itMaterial = mMaterials.find(material_id);
+ if (itMaterial != mMaterials.end())
+ {
+ LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL;
+ get_callback_te_t signal;
+ signal.connect(cb);
+ signal(material_id, itMaterial->second, te);
+ connection = boost::signals2::connection();
+ }
+ else
+ {
+ if (!isGetPending(region_id, material_id))
+ {
+ get_queue_t::iterator itQueue = mGetQueue.find(region_id);
+ if (mGetQueue.end() == itQueue)
+ {
+ LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id << LL_ENDL;
+ std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t()));
+ itQueue = ret.first;
+ }
+ LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL;
+ itQueue->second.insert(material_id);
+ markGetPending(region_id, material_id);
+ }
+
+ TEMaterialPair te_mat_pair;
+ te_mat_pair.te = te;
+ te_mat_pair.materialID = material_id;
+
+ get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair);
+ if (itCallback == mGetTECallbacks.end())
+ {
+ std::pair<get_callback_te_map_t::iterator, bool> ret = mGetTECallbacks.insert(std::pair<TEMaterialPair, get_callback_te_t*>(te_mat_pair, new get_callback_te_t()));
+ itCallback = ret.first;
+ }
+ connection = itCallback->second->connect(cb);
+ }
+
+ return connection;
+}
+
bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const
{
getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id);
@@ -301,6 +346,22 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
mGetCallbacks.erase(itCallback);
}
+ TEMaterialPair te_mat_pair;
+ te_mat_pair.materialID = material_id;
+
+ U32 i = 0;
+ while (i < LLTEContents::MAX_TES)
+ {
+ te_mat_pair.te = i++;
+ get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair);
+ if (itCallbackTE != mGetTECallbacks.end())
+ {
+ (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te);
+ delete itCallbackTE->second;
+ mGetTECallbacks.erase(itCallbackTE);
+ }
+ }
+
return itMaterial->second;
}
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h
index a6a7a5d1d7..922b16f1cf 100644
--- a/indra/newview/llmaterialmgr.h
+++ b/indra/newview/llmaterialmgr.h
@@ -44,9 +44,11 @@ public:
typedef std::map<LLMaterialID, LLMaterialPtr> material_map_t;
typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr)> get_callback_t;
+ typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t;
const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id);
boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb);
+ boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb);
typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t;
void getAll(const LLUUID& region_id);
@@ -80,6 +82,26 @@ protected:
typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
get_callback_map_t mGetCallbacks;
+ // struct for TE-specific material ID query
+ struct TEMaterialPair
+ {
+ U32 te;
+ LLMaterialID materialID;
+ };
+
+ // needed for std::map compliance only
+ //
+ friend inline bool operator<(
+ const struct LLMaterialMgr::TEMaterialPair& lhs,
+ const struct LLMaterialMgr::TEMaterialPair& rhs)
+ {
+ return (lhs.materialID < rhs.materialID) ? TRUE :
+ (lhs.te < rhs.te) ? TRUE : FALSE;
+ }
+
+ typedef std::map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t;
+ get_callback_te_map_t mGetTECallbacks;
+
typedef std::set<LLUUID> getall_queue_t;
getall_queue_t mGetAllQueue;
getall_queue_t mGetAllRequested;
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index d108a260bc..b2f76e2114 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -596,6 +596,11 @@ void LLPanelFace::sendTextureInfo()
}
void LLPanelFace::getState()
+{
+ updateUI();
+}
+
+void LLPanelFace::updateUI()
{ //set state of UI to match state of texture entry(ies) (calls setEnabled, setValue, etc, but NOT setVisible)
LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
@@ -636,12 +641,12 @@ void LLPanelFace::getState()
}
getChildView("combobox mattype")->setEnabled(editable);
- onCommitMaterialsMedia(NULL, this);
+ updateVisibility();
bool identical;
- bool identical_diffuse;
- bool identical_norm;
- bool identical_spec;
+ bool identical_diffuse;
+ bool identical_norm;
+ bool identical_spec;
LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
LLTextureCtrl* shinytexture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
@@ -798,7 +803,7 @@ void LLPanelFace::getState()
llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl;
}
- updateAlphaControls(getChild<LLComboBox>("combobox alphamode"),this);
+ updateAlphaControls();
}
if(texture_ctrl && !texture_ctrl->isPickerShown())
@@ -1587,7 +1592,7 @@ void LLPanelFace::getState()
llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl;
}
getChild<LLUICtrl>("maskcutoff")->setValue(material->getAlphaMaskCutoff());
- updateAlphaControls(getChild<LLComboBox>("combobox alphamode"),this);
+ updateAlphaControls();
LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT;
bool identical_texgen = true;
@@ -1607,7 +1612,7 @@ void LLPanelFace::getState()
F32 offset_x, offset_y, repeat_x, repeat_y, rot;
LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
texture_ctrl->setImageAssetID(material->getSpecularID());
- LLComboBox* combobox_shininess = getChild<LLComboBox>("combobox shininess");
+
if (!material->getSpecularID().isNull())
{
material->getSpecularOffset(offset_x,offset_y);
@@ -1628,7 +1633,7 @@ void LLPanelFace::getState()
getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent());
getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity());
}
- updateShinyControls(combobox_shininess,this, !material->getSpecularID().isNull(), true);
+ updateShinyControls(!material->getSpecularID().isNull(), true);
// Assert desired colorswatch color to match material AFTER updateShinyControls
// to avoid getting overwritten with the default on some UI state changes.
@@ -1642,7 +1647,7 @@ void LLPanelFace::getState()
// Bumpy (normal)
texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
texture_ctrl->setImageAssetID(material->getNormalID());
- LLComboBox* combobox_bumpiness = getChild<LLComboBox>("combobox bumpiness");
+
if (!material->getNormalID().isNull())
{
material->getNormalOffset(offset_x,offset_y);
@@ -1661,7 +1666,7 @@ void LLPanelFace::getState()
getChild<LLUICtrl>("bumpyOffsetU")->setValue(offset_x);
getChild<LLUICtrl>("bumpyOffsetV")->setValue(offset_y);
}
- updateBumpyControls(combobox_bumpiness,this, !material->getNormalID().isNull(), true);
+ updateBumpyControls(!material->getNormalID().isNull(), true);
}
}
@@ -1702,12 +1707,11 @@ void LLPanelFace::getState()
getChildView("tex gen")->setEnabled(FALSE);
getChildView("label shininess")->setEnabled(FALSE);
getChildView("label bumpiness")->setEnabled(FALSE);
-
getChildView("button align")->setEnabled(FALSE);
//getChildView("has media")->setEnabled(FALSE);
//getChildView("media info set")->setEnabled(FALSE);
- onCommitMaterialsMedia(NULL,this);
+ updateVisibility();
// Set variable values for numeric expressions
LLCalc* calcp = LLCalc::getInstance();
@@ -1904,10 +1908,16 @@ void LLPanelFace::onSelectColor(const LLSD& data)
void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
- LLComboBox* combo_matmedia = self->getChild<LLComboBox>("combobox matmedia");
- LLComboBox* combo_mattype = self->getChild<LLComboBox>("combobox mattype");
- LLComboBox* combo_shininess = self->getChild<LLComboBox>("combobox shininess");
- LLComboBox* combo_bumpiness = self->getChild<LLComboBox>("combobox bumpiness");
+ self->updateUI();
+}
+
+// static
+void LLPanelFace::updateVisibility()
+{
+ LLComboBox* combo_matmedia = getChild<LLComboBox>("combobox matmedia");
+ LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype");
+ LLComboBox* combo_shininess = getChild<LLComboBox>("combobox shininess");
+ LLComboBox* combo_bumpiness = getChild<LLComboBox>("combobox bumpiness");
if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness)
{
LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL;
@@ -1919,93 +1929,66 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata)
bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled()));
bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled();
bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled();
- self->getChildView("combobox mattype")->setVisible(!show_media);
- self->getChildView("rptctrl")->setVisible(true);
+ getChildView("combobox mattype")->setVisible(!show_media);
+ getChildView("rptctrl")->setVisible(true);
// Media controls
- self->getChildView("media_info")->setVisible(show_media);
- self->getChildView("add_media")->setVisible(show_media);
- self->getChildView("delete_media")->setVisible(show_media);
- self->getChildView("button align")->setVisible(show_media);
+ getChildView("media_info")->setVisible(show_media);
+ getChildView("add_media")->setVisible(show_media);
+ getChildView("delete_media")->setVisible(show_media);
+ getChildView("button align")->setVisible(show_media);
// Diffuse texture controls
- self->getChildView("texture control")->setVisible(show_texture && !show_media);
- self->getChildView("label alphamode")->setVisible(show_texture && !show_media);
- self->getChildView("combobox alphamode")->setVisible(show_texture && !show_media);
- self->getChildView("label maskcutoff")->setVisible(false);
- self->getChildView("maskcutoff")->setVisible(false);
+ getChildView("texture control")->setVisible(show_texture && !show_media);
+ getChildView("label alphamode")->setVisible(show_texture && !show_media);
+ getChildView("combobox alphamode")->setVisible(show_texture && !show_media);
+ getChildView("label maskcutoff")->setVisible(false);
+ getChildView("maskcutoff")->setVisible(false);
if (show_texture && !show_media)
{
- updateAlphaControls(ctrl, userdata);
+ updateAlphaControls();
}
- self->getChildView("TexScaleU")->setVisible(show_texture);
- self->getChildView("TexScaleV")->setVisible(show_texture);
- self->getChildView("TexRot")->setVisible(show_texture);
- self->getChildView("TexOffsetU")->setVisible(show_texture);
- self->getChildView("TexOffsetV")->setVisible(show_texture);
+ getChildView("TexScaleU")->setVisible(show_texture);
+ getChildView("TexScaleV")->setVisible(show_texture);
+ getChildView("TexRot")->setVisible(show_texture);
+ getChildView("TexOffsetU")->setVisible(show_texture);
+ getChildView("TexOffsetV")->setVisible(show_texture);
// Specular map controls
- self->getChildView("shinytexture control")->setVisible(show_shininess);
- self->getChildView("combobox shininess")->setVisible(show_shininess);
- self->getChildView("label shininess")->setVisible(show_shininess);
- self->getChildView("label glossiness")->setVisible(false);
- self->getChildView("glossiness")->setVisible(false);
- self->getChildView("label environment")->setVisible(false);
- self->getChildView("environment")->setVisible(false);
- self->getChildView("label shinycolor")->setVisible(false);
- self->getChildView("shinycolorswatch")->setVisible(false);
+ getChildView("shinytexture control")->setVisible(show_shininess);
+ getChildView("combobox shininess")->setVisible(show_shininess);
+ getChildView("label shininess")->setVisible(show_shininess);
+ getChildView("label glossiness")->setVisible(false);
+ getChildView("glossiness")->setVisible(false);
+ getChildView("label environment")->setVisible(false);
+ getChildView("environment")->setVisible(false);
+ getChildView("label shinycolor")->setVisible(false);
+ getChildView("shinycolorswatch")->setVisible(false);
if (show_shininess)
{
- updateShinyControls(ctrl, userdata);
+ updateShinyControls();
}
- self->getChildView("shinyScaleU")->setVisible(show_shininess);
- self->getChildView("shinyScaleV")->setVisible(show_shininess);
- self->getChildView("shinyRot")->setVisible(show_shininess);
- self->getChildView("shinyOffsetU")->setVisible(show_shininess);
- self->getChildView("shinyOffsetV")->setVisible(show_shininess);
+ getChildView("shinyScaleU")->setVisible(show_shininess);
+ getChildView("shinyScaleV")->setVisible(show_shininess);
+ getChildView("shinyRot")->setVisible(show_shininess);
+ getChildView("shinyOffsetU")->setVisible(show_shininess);
+ getChildView("shinyOffsetV")->setVisible(show_shininess);
// Normal map controls
if (show_bumpiness)
{
- updateBumpyControls(ctrl, userdata);
+ updateBumpyControls();
}
- self->getChildView("bumpytexture control")->setVisible(show_bumpiness);
- self->getChildView("combobox bumpiness")->setVisible(show_bumpiness);
- self->getChildView("label bumpiness")->setVisible(show_bumpiness);
- self->getChildView("bumpyScaleU")->setVisible(show_bumpiness);
- self->getChildView("bumpyScaleV")->setVisible(show_bumpiness);
- self->getChildView("bumpyRot")->setVisible(show_bumpiness);
- self->getChildView("bumpyOffsetU")->setVisible(show_bumpiness);
- self->getChildView("bumpyOffsetV")->setVisible(show_bumpiness);
-
- // Enable texture scale/rotation/offset parameters if there's one
- // present to set for
- bool texParmsEnable = show_texture ||
- (show_shininess && (combo_shininess->getCurrentIndex() == SHINY_TEXTURE)) ||
- (show_bumpiness && (combo_bumpiness->getCurrentIndex() == BUMPY_TEXTURE));
- self->getChildView("tex gen")->setEnabled(texParmsEnable);
- self->getChildView("combobox texgen")->setEnabled(texParmsEnable);
- self->getChildView("rptctrl")->setEnabled(texParmsEnable);
- self->getChildView("TexScaleU")->setEnabled(texParmsEnable);
- self->getChildView("TexScaleV")->setEnabled(texParmsEnable);
- self->getChildView("TexRot")->setEnabled(texParmsEnable);
- self->getChildView("TexOffsetU")->setEnabled(texParmsEnable);
- self->getChildView("TexOffsetV")->setEnabled(texParmsEnable);
- self->getChildView("shinyScaleU")->setEnabled(texParmsEnable);
- self->getChildView("shinyScaleV")->setEnabled(texParmsEnable);
- self->getChildView("shinyRot")->setEnabled(texParmsEnable);
- self->getChildView("shinyOffsetU")->setEnabled(texParmsEnable);
- self->getChildView("shinyOffsetV")->setEnabled(texParmsEnable);
- self->getChildView("bumpyScaleU")->setEnabled(texParmsEnable);
- self->getChildView("bumpyScaleV")->setEnabled(texParmsEnable);
- self->getChildView("bumpyRot")->setEnabled(texParmsEnable);
- self->getChildView("bumpyOffsetU")->setEnabled(texParmsEnable);
- self->getChildView("bumpyOffsetV")->setEnabled(texParmsEnable);
- self->getChildView("checkbox planar align")->setEnabled(texParmsEnable);
-
- // Needed to handle transitions to/from media mode
- // NORSPEC-84
- updateAlphaControls(ctrl,userdata);
+ getChildView("bumpytexture control")->setVisible(show_bumpiness);
+ getChildView("combobox bumpiness")->setVisible(show_bumpiness);
+ getChildView("label bumpiness")->setVisible(show_bumpiness);
+ getChildView("bumpyScaleU")->setVisible(show_bumpiness);
+ getChildView("bumpyScaleV")->setVisible(show_bumpiness);
+ getChildView("bumpyRot")->setVisible(show_bumpiness);
+ getChildView("bumpyOffsetU")->setVisible(show_bumpiness);
+ getChildView("bumpyOffsetV")->setVisible(show_bumpiness);
+
+
}
// static
@@ -2016,7 +1999,7 @@ void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata)
// like the texture ctrls for diffuse/norm/spec so that they are correct
// when switching modes
//
- self->getState();
+ self->updateUI();
}
// static
@@ -2024,10 +2007,7 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
self->sendBump();
-
- LLComboBox* combo_bumpy = self->getChild<LLComboBox>("combobox bumpiness");
-
- updateBumpyControls(combo_bumpy,self, false, true);
+ self->updateBumpyControls(false, true);
self->updateMaterial();
}
@@ -2039,13 +2019,12 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata)
}
// static
-void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_shiny_combobox)
+void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- LLTextureCtrl* texture_ctrl = self->getChild<LLTextureCtrl>("shinytexture control");
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control");
LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID();
LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL;
- LLComboBox* comboShiny = self->getChild<LLComboBox>("combobox shininess");
+ LLComboBox* comboShiny = getChild<LLComboBox>("combobox shininess");
if(mess_with_shiny_combobox)
{
@@ -2061,15 +2040,15 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool is_se
// NORSPEC-94: Set default specular color to white
//
- LLColorSwatchCtrl* mShinyColorSwatch = self->getChild<LLColorSwatchCtrl>("shinycolorswatch");
+ LLColorSwatchCtrl* mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch");
if(mShinyColorSwatch)
{
LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL;
mShinyColorSwatch->setOriginal(LLColor4::white);
mShinyColorSwatch->set(LLColor4::white, TRUE);
}
- self->getChild<LLUICtrl>("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT);
- self->getChild<LLUICtrl>("environment")->setValue(0);
+ getChild<LLUICtrl>("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT);
+ getChild<LLUICtrl>("environment")->setValue(0);
}
comboShiny->setSimple(USE_TEXTURE);
}
@@ -2084,30 +2063,29 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool is_se
}
}
- LLComboBox* combo_matmedia = self->getChild<LLComboBox>("combobox matmedia");
- LLComboBox* combo_mattype = self->getChild<LLComboBox>("combobox mattype");
+ LLComboBox* combo_matmedia = getChild<LLComboBox>("combobox matmedia");
+ LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype");
U32 materials_media = combo_matmedia->getCurrentIndex();
U32 material_type = combo_mattype->getCurrentIndex();
bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled();
bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled();
U32 shiny_value = comboShiny->getCurrentIndex();
bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture
- self->getChildView("label glossiness")->setVisible(show_shinyctrls);
- self->getChildView("glossiness")->setVisible(show_shinyctrls);
- self->getChildView("label environment")->setVisible(show_shinyctrls);
- self->getChildView("environment")->setVisible(show_shinyctrls);
- self->getChildView("label shinycolor")->setVisible(show_shinyctrls);
- self->getChildView("shinycolorswatch")->setVisible(show_shinyctrls);
+ getChildView("label glossiness")->setVisible(show_shinyctrls);
+ getChildView("glossiness")->setVisible(show_shinyctrls);
+ getChildView("label environment")->setVisible(show_shinyctrls);
+ getChildView("environment")->setVisible(show_shinyctrls);
+ getChildView("label shinycolor")->setVisible(show_shinyctrls);
+ getChildView("shinycolorswatch")->setVisible(show_shinyctrls);
}
// static
-void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_combobox)
+void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- LLTextureCtrl* texture_ctrl = self->getChild<LLTextureCtrl>("bumpytexture control");
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
- LLComboBox* comboBumpy = self->getChild<LLComboBox>("combobox bumpiness");
+ LLComboBox* comboBumpy = getChild<LLComboBox>("combobox bumpiness");
if (!comboBumpy)
{
return;
@@ -2115,7 +2093,7 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool is_se
if (mess_with_combobox)
{
- LLTextureCtrl* texture_ctrl = self->getChild<LLTextureCtrl>("bumpytexture control");
+ LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID();
LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL;
@@ -2144,19 +2122,17 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
self->sendShiny();
- LLComboBox* combo_shiny = self->getChild<LLComboBox>("combobox shininess");
// Need 'true' here to insure that the 'Use Texture' choice is removed
// when we select something other than a spec texture
//
- updateShinyControls(combo_shiny,self, false, true);
+ self->updateShinyControls(false, true);
self->updateMaterial();
}
// static
-void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata)
+void LLPanelFace::updateAlphaControls()
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- LLComboBox* comboAlphaMode = self->getChild<LLComboBox>("combobox alphamode");
+ LLComboBox* comboAlphaMode = getChild<LLComboBox>("combobox alphamode");
if (!comboAlphaMode)
{
return;
@@ -2164,14 +2140,14 @@ 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");
+ LLComboBox* combobox_matmedia = 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");
+ LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype");
U32 mat_type = MATTYPE_DIFFUSE;
if (combobox_mattype)
{
@@ -2181,15 +2157,15 @@ void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata)
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);
+ getChildView("label maskcutoff")->setVisible(show_alphactrls);
+ getChildView("maskcutoff")->setVisible(show_alphactrls);
}
// static
void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
- updateAlphaControls(ctrl,userdata);
+ self->updateAlphaControls();
self->updateMaterial();
}
@@ -2245,46 +2221,40 @@ void LLPanelFace::onSelectTexture(const LLSD& data)
void LLPanelFace::onCommitSpecularTexture( const LLSD& data )
{
LL_DEBUGS("Materials") << data << LL_ENDL;
- LLComboBox* combo_shiny = getChild<LLComboBox>("combobox shininess");
- updateShinyControls(combo_shiny,this, true, true);
+ updateShinyControls(true, true);
updateMaterial();
}
void LLPanelFace::onCommitNormalTexture( const LLSD& data )
{
LL_DEBUGS("Materials") << data << LL_ENDL;
- LLComboBox* combo_bumpy = getChild<LLComboBox>("combobox bumpiness");
- updateBumpyControls(combo_bumpy, this, true, true);
+ updateBumpyControls(true, true);
updateMaterial();
}
void LLPanelFace::onCancelSpecularTexture(const LLSD& data)
{
updateMaterial();
- LLComboBox* combo_shiny = getChild<LLComboBox>("combobox shininess");
- updateShinyControls(combo_shiny,this, false, true);
+ updateShinyControls(false, true);
}
void LLPanelFace::onCancelNormalTexture(const LLSD& data)
{
updateMaterial();
- LLComboBox* combo_bumpy = getChild<LLComboBox>("combobox bumpiness");
- updateBumpyControls(combo_bumpy,this, false, true);
+ updateBumpyControls(false, true);
}
void LLPanelFace::onSelectSpecularTexture(const LLSD& data)
{
LL_DEBUGS("Materials") << data << LL_ENDL;
updateMaterial();
- LLComboBox* combo_shiny = getChild<LLComboBox>("combobox shininess");
- updateShinyControls(combo_shiny,this, true, true);
+ updateShinyControls(true, true);
}
void LLPanelFace::onSelectNormalTexture(const LLSD& data)
{
LL_DEBUGS("Materials") << data << LL_ENDL;
- LLComboBox* combo_bumpy = getChild<LLComboBox>("combobox bumpiness");
- updateBumpyControls(combo_bumpy,this, true, true);
+ updateBumpyControls(true, true);
updateMaterial();
}
@@ -2310,9 +2280,10 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata)
gFocusMgr.setKeyboardFocus( NULL );
- //F32 repeats_per_meter = self->mCtrlRepeatsPerMeter->get();
- F32 repeats_per_meter = (F32)self->getChild<LLUICtrl>("rptctrl")->getValue().asReal();//self->mCtrlRepeatsPerMeter->get();
+ LLUICtrl* repeats_ctrl = self->getChild<LLUICtrl>("rptctrl");
+ F32 repeats_per_meter = repeats_ctrl->getValue().asReal();
+
LLComboBox* combo_mattype = self->getChild<LLComboBox>("combobox mattype");
F32 obj_scale_s = 1.0f;
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index 4e97295b84..88f32e45f8 100755
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -67,7 +67,7 @@ protected:
void sendTexGen(); // applies and sends bump map
void sendShiny(); // applies and sends shininess
void sendFullbright(); // applies and sends full bright
- void sendGlow();
+ void sendGlow();
void sendMedia();
// this function is to return TRUE if the drag should succeed.
@@ -88,29 +88,49 @@ protected:
void onCancelColor(const LLSD& data);
void onSelectColor(const LLSD& data);
- void updateMaterial();
-
- static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterial( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata);
- static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata);
- static void onCommitBump( LLUICtrl* ctrl, void* userdata);
+ // Make UI reflect state of currently selected material (refresh)
+ // and UI mode (e.g. editing normal map v diffuse map)
+ //
+ void updateUI();
+
+ // Callback funcs for individual controls
+ //
+ static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterial( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata);
+ static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata);
+ static void onCommitBump( LLUICtrl* ctrl, void* userdata);
static void onCommitTexGen( LLUICtrl* ctrl, void* userdata);
- static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false);
- static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false);
- static void onCommitShiny( LLUICtrl* ctrl, void* userdata);
- static void updateAlphaControls( LLUICtrl* ctrl, void* userdata);
+ static void onCommitShiny( LLUICtrl* ctrl, void* userdata);
static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata);
static void onCommitFullbright( LLUICtrl* ctrl, void* userdata);
- static void onCommitGlow( LLUICtrl* ctrl, void *userdata);
- static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata);
-
+ static void onCommitGlow( LLUICtrl* ctrl, void *userdata);
+ static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata);
static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo);
static void onClickAutoFix(void*);
- static F32 valueGlow(LLViewerObject* object, S32 face);
+
+ static F32 valueGlow(LLViewerObject* object, S32 face);
private:
+ // Update visibility of controls to match current UI mode
+ // (e.g. materials vs media editing)
+ //
+ // Do NOT call updateUI from within this function.
+ //
+ void updateVisibility();
+
+ // Make material reflect current state of UI (apply edit)
+ //
+ void updateMaterial();
+
+ // Update vis and enabling of specific subsets of controls based on material params
+ // (e.g. hide the spec controls if no spec texture is applied)
+ //
+ void updateShinyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
+ void updateBumpyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
+ void updateAlphaControls();
+
/*
* Checks whether the selected texture from the LLFloaterTexturePicker can be applied to the currently selected object.
* If agent selects texture which is not allowed to be applied for the currently selected object,
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index e80ad6976e..3f60b5f642 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2052,7 +2052,7 @@ void LLSelectMgr::selectionRemoveMaterial()
{
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
LLMaterialMgr::getInstance()->remove(object->getID(),face);
- object->setTEMaterialParams(face, NULL);
+ object->setTEMaterialID(face,LLMaterialID::null);
}
return true;
}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 4e233d479a..f8bc6ef4d3 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4393,18 +4393,15 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID
<< ", material " << pMaterialID
<< LL_ENDL;
retval = LLPrimitive::setTEMaterialID(te, pMaterialID);
- if (retval)
+ }
+ // Kitty would like to know if this is necessary?
+ // Since we should get a setTEMaterialParams that does it anyway?
+ //
+ setChanged(TEXTURE);
+ if (mDrawable.notNull())
{
- // Kitty would like to know if this is necessary?
- // Since we should get a setTEMaterialParams that does it anyway?
- //
- setChanged(TEXTURE);
- if (mDrawable.notNull())
- {
- gPipeline.markTextured(mDrawable);
- }
+ gPipeline.markTextured(mDrawable);
}
- }
return retval;
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 8e811527eb..1021615255 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1991,17 +1991,15 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
<< LL_ENDL;
LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
- if (res)
- {
- LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te));
+ // Use TE-specific version of boost CB hook-up to avoid cross-contaminatin'
+ LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3));
setChanged(TEXTURE);
if (!mDrawable.isNull())
{
gPipeline.markTextured(mDrawable);
}
mFaceMappingChanged = TRUE;
- }
- return res;
+ return TEM_CHANGE_TEXTURE;
}
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml
index a5425062ec..5be3ca9d9f 100644
--- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml
+++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml
@@ -567,7 +567,7 @@
layout="topleft"
label_width="205"
left="10"
- max_val="10"
+ max_val="100"
min_val="0.1"
name="rptctrl"
width="265" />