From 9e3155c368fba6cb877c55ad4e0c90258a6e9ba9 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 11:40:10 -0700 Subject: NORSPEC-82 NORSPEC-85 More UI shenanigans --- indra/newview/llpanelface.cpp | 305 +++++++++++++++++++++++++++--------------- 1 file changed, 195 insertions(+), 110 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 3853cfde9e..7e1f797471 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -638,6 +638,7 @@ void LLPanelFace::getState() llwarns << "failed getChild for 'combobox mattype'" << llendl; } getChildView("combobox mattype")->setEnabled(editable); + onCommitMaterialsMedia(NULL, this); //if ( LLMediaEngine::getInstance()->getMediaRenderer () ) @@ -879,8 +880,8 @@ void LLPanelFace::getState() } else { - shinytexture_ctrl->setTentative( TRUE ); - shinytexture_ctrl->setEnabled( editable ); + shinytexture_ctrl->setTentative( TRUE ); + shinytexture_ctrl->setEnabled( editable ); shinytexture_ctrl->setImageAssetID( specmap_id ); } } @@ -888,7 +889,7 @@ void LLPanelFace::getState() if (bumpytexture_ctrl) { if (identical_norm) - { + { bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( editable ); bumpytexture_ctrl->setImageAssetID( normmap_id ); @@ -897,16 +898,16 @@ void LLPanelFace::getState() { bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( FALSE ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); + } else { - bumpytexture_ctrl->setTentative( TRUE ); - bumpytexture_ctrl->setEnabled( editable ); + bumpytexture_ctrl->setTentative( TRUE ); + bumpytexture_ctrl->setEnabled( editable ); bumpytexture_ctrl->setImageAssetID( normmap_id ); - } } } + } // planar align bool align_planar = false; @@ -945,6 +946,26 @@ void LLPanelFace::getState() } } + // Needs to be public and before tex scale settings below to properly reflect + // behavior when in planar vs default texgen modes in the + // NORSPEC-84 et al + // + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + bool identical_texgen = true; + bool identical_planar_texgen = false; + + { + struct f11 : public LLSelectedTEGetFunctor + { + LLTextureEntry::e_texgen get(LLViewerObject* object, S32 face) + { + return (LLTextureEntry::e_texgen)(object->getTE(face)->getTexGen()); + } + } func; + identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); + identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); + } + // Texture scale { F32 scale_s = 1.f; @@ -958,7 +979,11 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - getChild("TexScaleU")->setValue(editable ? scale_s : 0); + + F32 scale_u = editable ? scale_s : 0; + scale_u *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("TexScaleU")->setValue(scale_u); getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleU")->setEnabled(editable); @@ -981,7 +1006,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - getChild("shinyScaleU")->setValue(editable ? scale_s : 0); + F32 scale_s_value = editable ? scale_s : 0; + scale_s_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("shinyScaleU")->setValue(scale_s_value); getChild("shinyScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); @@ -1004,9 +1032,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - + scale_s_value = editable ? scale_s : 0; + scale_s_value *= identical_planar_texgen ? 2.0f : 1.0f; - getChild("bumpyScaleU")->setValue(editable ? scale_s : 0); + getChild("bumpyScaleU")->setValue(scale_s_value); getChild("bumpyScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); } @@ -1023,7 +1052,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; - getChild("TexScaleV")->setValue(editable ? scale_t : 0); + F32 scale_t_value = editable ? scale_t : 0; + scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("TexScaleV")->setValue(scale_t_value); getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleV")->setEnabled(editable); @@ -1045,7 +1077,11 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; - getChild("shinyScaleV")->setValue(editable ? scale_t : 0); + + scale_t_value = editable ? scale_t : 0; + scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("shinyScaleV")->setValue(scale_t_value); getChild("shinyScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); @@ -1068,7 +1104,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; - getChild("bumpyScaleV")->setValue(editable ? scale_t : 0); + scale_t_value = editable ? scale_t : 0.0f; + scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("bumpyScaleV")->setValue(scale_t_value); getChild("bumpyScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); @@ -1096,7 +1135,7 @@ void LLPanelFace::getState() { F32 get(LLViewerObject* object, S32 face) { - F32 s = 1.f, t = 1.f; + F32 s = 0.f, t = 0.f; LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); if (mat) @@ -1118,7 +1157,7 @@ void LLPanelFace::getState() { F32 get(LLViewerObject* object, S32 face) { - F32 s = 1.f, t = 1.f; + F32 s = 0.f, t = 0.f; LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); if (mat) @@ -1318,20 +1357,20 @@ void LLPanelFace::getState() // Shiny { - F32 shinyf = 0.f; - struct f9 : public LLSelectedTEGetFunctor + U8 shiny = 0; + struct f9 : public LLSelectedTEGetFunctor { - F32 get(LLViewerObject* object, S32 face) + U8 get(LLViewerObject* object, S32 face) { - return (F32)(object->getTE(face)->getShiny()); + return (U8)(object->getTE(face)->getShiny()); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shinyf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { - combobox_shininess->selectNthItem((S32)shinyf); + combobox_shininess->selectNthItem((S32)shiny); } else { @@ -1353,20 +1392,20 @@ void LLPanelFace::getState() // Bumpy { - F32 bumpf = 0.f; - struct f10 : public LLSelectedTEGetFunctor + U8 bumpy = 0; + struct f10 : public LLSelectedTEGetFunctor { - F32 get(LLViewerObject* object, S32 face) + U8 get(LLViewerObject* object, S32 face) { - return (F32)(object->getTE(face)->getBumpmap()); + return object->getTE(face)->getBumpmap(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { - combobox_bumpiness->selectNthItem((S32)bumpf); + combobox_bumpiness->selectNthItem((S32)bumpy); } else { @@ -1377,22 +1416,12 @@ void LLPanelFace::getState() getChildView("label bumpiness")->setEnabled(editable); } - { - F32 genf = 0.f; - struct f11 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return (F32)(object->getTE(face)->getTexGen()); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, genf ); - S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT; + { LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); if (combobox_texgen) { - combobox_texgen->selectNthItem(selected_texgen); + combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); // Maps from enum to combobox entry index } else { @@ -1402,37 +1431,30 @@ void LLPanelFace::getState() getChild("combobox texgen")->setTentative(!identical); getChildView("tex gen")->setEnabled(editable); - if (selected_texgen == 1) + if (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR) { - getChild("TexScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); - getChild("TexScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); - getChild("shinyScaleU")->setValue(2.0f * getChild("shinyScaleU")->getValue().asReal() ); - getChild("shinyScaleV")->setValue(2.0f * getChild("shinyScaleV")->getValue().asReal() ); - getChild("bumpyScaleU")->setValue(2.0f * getChild("bumpScaleU")->getValue().asReal() ); - getChild("bumpyScaleV")->setValue(2.0f * getChild("bumpScaleV")->getValue().asReal() ); - // EXP-1507 (change label based on the mapping mode) getChild("rpt")->setValue(getString("string repeats per meter")); } else - if (selected_texgen == 0) // FIXME: should not be magic numbers + if (selected_texgen == LLTextureEntry::TEX_GEN_DEFAULT) { getChild("rpt")->setValue(getString("string repeats per face")); } } { - F32 fullbrightf = 0.f; - struct f12 : public LLSelectedTEGetFunctor + U8 fullbright_flag = 0; + struct f12 : public LLSelectedTEGetFunctor { - F32 get(LLViewerObject* object, S32 face) + U8 get(LLViewerObject* object, S32 face) { - return (F32)(object->getTE(face)->getFullbright()); + return object->getTE(face)->getFullbright(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbrightf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbright_flag ); - getChild("checkbox fullbright")->setValue((S32)fullbrightf); + getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); getChildView("checkbox fullbright")->setEnabled(editable); getChild("checkbox fullbright")->setTentative(!identical); } @@ -1556,7 +1578,8 @@ 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); + mMaterial = new LLMaterial(*material); + mMaterialID = material_id; // Alpha LLCtrlSelectionInterface* combobox_alphamode = @@ -1572,6 +1595,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(getChild("combobox alphamode"),this); + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + bool identical_texgen = true; + bool identical_planar_texgen = false; + + struct f44 : public LLSelectedTEGetFunctor + { + LLTextureEntry::e_texgen get(LLViewerObject* object, S32 face) + { + return (LLTextureEntry::e_texgen)(object->getTE(face)->getTexGen()); + } + } func; + identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); + identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); + // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); @@ -1581,6 +1618,13 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate { material->getSpecularOffset(offset_x,offset_y); material->getSpecularRepeat(repeat_x,repeat_y); + + if (identical_planar_texgen) + { + repeat_x *= 2.0f; + repeat_y *= 2.0f; + } + rot = material->getSpecularRotation(); getChild("shinyScaleU")->setValue(repeat_x); getChild("shinyScaleV")->setValue(repeat_y); @@ -1592,7 +1636,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); getChild("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); } - updateShinyControls(combobox_shininess,this); + updateShinyControls(combobox_shininess,this, true); // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); @@ -1602,6 +1646,13 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); + + if (identical_planar_texgen) + { + repeat_x *= 2.0f; + repeat_y *= 2.0f; + } + rot = material->getNormalRotation(); getChild("bumpyScaleU")->setValue(repeat_x); getChild("bumpyScaleV")->setValue(repeat_y); @@ -1609,11 +1660,11 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); } - updateBumpyControls(combobox_bumpiness,this); + updateBumpyControls(combobox_bumpiness,this, true); } void LLPanelFace::updateMaterial() -{ +{ // assign current state of UI to material definition for submit to sim LL_DEBUGS("Materials") << "Entered." << LL_ENDL; LLComboBox* comboAlphaMode = getChild("combobox alphamode"); LLComboBox* comboBumpiness = getChild("combobox bumpiness"); @@ -1625,6 +1676,18 @@ void LLPanelFace::updateMaterial() U32 alpha_mode = comboAlphaMode->getCurrentIndex(); U32 bumpiness = comboBumpiness->getCurrentIndex(); U32 shininess = comboShininess->getCurrentIndex(); + + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + struct f45 : public LLSelectedTEGetFunctor + { + LLTextureEntry::e_texgen get(LLViewerObject* object, S32 face) + { + return (LLTextureEntry::e_texgen)(object->getTE(face)->getTexGen()); + } + } func; + bool identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); + bool identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); + if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)) || (bumpiness == BUMPY_TEXTURE) || (shininess == SHINY_TEXTURE)) @@ -1637,17 +1700,26 @@ void LLPanelFace::updateMaterial() mMaterial = LLMaterialPtr(new LLMaterial()); } - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); if (bumpiness == BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); + + F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); + F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); + + if (identical_planar_texgen) + { + bumpy_scale_u *= 0.5f; + bumpy_scale_v *= 0.5f; + } + mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(getChild("bumpyScaleU")->getValue().asReal(), - getChild("bumpyScaleV")->getValue().asReal()); + mMaterial->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else @@ -1665,18 +1737,21 @@ void LLPanelFace::updateMaterial() mMaterial->setSpecularID(getChild("shinytexture control")->getImageAssetID()); mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); - mMaterial->setSpecularRepeat(getChild("shinyScaleU")->getValue().asReal(), - getChild("shinyScaleV")->getValue().asReal()); - mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); - //override shininess to 0.2f if this is a new material - if (new_material) + F32 shiny_scale_u = getChild("shinyScaleU")->getValue().asReal(); + F32 shiny_scale_v = getChild("shinyScaleV")->getValue().asReal(); + + if (identical_planar_texgen) { - mMaterial->setSpecularLightColor(LLColor4U::white); - mMaterial->setSpecularLightExponent((U8) (0.2f*255.f)); - mMaterial->setEnvironmentIntensity(0); + shiny_scale_u *= 0.5f; + shiny_scale_v *= 0.5f; } - else + + mMaterial->setSpecularRepeat(shiny_scale_u, shiny_scale_v); + mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); + + //override shininess to 0.2f if this is a new material + if (!new_material) { mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); @@ -1690,7 +1765,8 @@ void LLPanelFace::updateMaterial() mMaterial->setSpecularOffset(0.0f,0.0f); mMaterial->setSpecularRepeat(1.0f,1.0f); mMaterial->setSpecularRotation(0.0f); - mMaterial->setSpecularLightExponent(0); + mMaterial->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); + mMaterial->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); mMaterial->setEnvironmentIntensity(0); } @@ -1859,9 +1935,8 @@ void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* 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); } // static @@ -1879,34 +1954,39 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_shiny_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("shinytexture control"); LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; LLComboBox* comboShiny = self->getChild("combobox shininess"); - if (!comboShiny) - { - return; - } - if (!shiny_texture_ID.isNull()) + + if(mess_with_shiny_combobox) { - if (!comboShiny->itemExists(USE_TEXTURE)) + if (!comboShiny) { - comboShiny->add(USE_TEXTURE); + return; } - comboShiny->setSimple(USE_TEXTURE); - } - else - { - if (comboShiny->itemExists(USE_TEXTURE)) + if (!shiny_texture_ID.isNull()) + { + if (!comboShiny->itemExists(USE_TEXTURE)) + { + comboShiny->add(USE_TEXTURE); + } + comboShiny->setSimple(USE_TEXTURE); + } + else { - // HACK: This depends on adding the "Use texture" - // item at the end of a list of known length. - comboShiny->remove(SHINY_TEXTURE); + if (comboShiny->itemExists(USE_TEXTURE)) + { + // HACK: This depends on adding the "Use texture" + // item at the end of a list of known length. + comboShiny->remove(SHINY_TEXTURE); + } } } + LLComboBox* combo_matmedia = self->getChild("combobox matmedia"); LLComboBox* combo_mattype = self->getChild("combobox mattype"); U32 materials_media = combo_matmedia->getCurrentIndex(); @@ -1924,7 +2004,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("bumpytexture control"); @@ -1935,21 +2015,25 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata) { return; } - if (!bumpy_texture_ID.isNull()) + + if (mess_with_combobox) { - if (!comboBumpy->itemExists(USE_TEXTURE)) + if (!bumpy_texture_ID.isNull()) { - comboBumpy->add(USE_TEXTURE); + if (!comboBumpy->itemExists(USE_TEXTURE)) + { + comboBumpy->add(USE_TEXTURE); + } + comboBumpy->setSimple(USE_TEXTURE); } - comboBumpy->setSimple(USE_TEXTURE); - } - else - { - if (comboBumpy->itemExists(USE_TEXTURE)) + else { - // HACK: This depends on adding the "Use texture" - // item at the end of a list of known length. - comboBumpy->remove(BUMPY_TEXTURE); + if (comboBumpy->itemExists(USE_TEXTURE)) + { + // HACK: This depends on adding the "Use texture" + // item at the end of a list of known length. + comboBumpy->remove(BUMPY_TEXTURE); + } } } } @@ -2057,9 +2141,9 @@ void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) LL_DEBUGS("Materials") << data << LL_ENDL; updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this); + updateShinyControls(combo_shiny,this, true); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this); + updateBumpyControls(combo_bumpy,this, true); } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) @@ -2067,9 +2151,9 @@ void LLPanelFace::onCancelMaterialTexture(const LLSD& data) // not sure what to do here other than updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this); + updateShinyControls(combo_shiny,this, true); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this); + updateBumpyControls(combo_bumpy,this, true); } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) @@ -2077,9 +2161,9 @@ void LLPanelFace::onSelectMaterialTexture(const LLSD& data) LL_DEBUGS("Materials") << data << LL_ENDL; updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this); + updateShinyControls(combo_shiny,this, true); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this); + updateBumpyControls(combo_bumpy,this, true); } //static @@ -2228,3 +2312,4 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) } } } + -- cgit v1.3 From 1a4c8775f8de9eb536afb26fd4a1067059a5a9a8 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 15:42:45 -0700 Subject: NORSPEC-86 Shiny type resets when editing spec glossiness --- indra/newview/llpanelface.cpp | 72 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7e1f797471..05469058a1 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1366,11 +1366,14 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); + + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { - combobox_shininess->selectNthItem((S32)shiny); + combobox_shininess->selectNthItem(spec_map_id.isNull() ? (S32)shiny : SHINY_TEXTURE); } else { @@ -1401,11 +1404,13 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); - LLCtrlSelectionInterface* combobox_bumpiness = - childGetSelectionInterface("combobox bumpiness"); + + LLUUID norm_map_id = getChild("shinytexture control")->getImageAssetID(); + + LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { - combobox_bumpiness->selectNthItem((S32)bumpy); + combobox_bumpiness->selectNthItem(norm_map_id.isNull() ? (S32)bumpy : BUMPY_TEXTURE); } else { @@ -1703,10 +1708,11 @@ void LLPanelFace::updateMaterial() mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); if (bumpiness == BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); + mMaterial->setNormalID(norm_map_id); F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); @@ -1731,10 +1737,12 @@ void LLPanelFace::updateMaterial() mMaterial->setNormalRotation(0.0f); } + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + if (shininess == SHINY_TEXTURE) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(getChild("shinytexture control")->getImageAssetID()); + mMaterial->setSpecularID(spec_map_id); mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); @@ -1944,6 +1952,13 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; self->sendBump(); + + LLComboBox* combo_bumpy = self->getChild("combobox bumpiness"); + // Need 'true' here to insure that the 'Use Texture' choice is removed + // when we select something other than a spec texture + // + updateBumpyControls(combo_bumpy,self, true); + self->updateMaterial(); } // static @@ -2042,7 +2057,12 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->sendShiny(); + self->sendShiny(); + LLComboBox* combo_shiny = self->getChild("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, true); self->updateMaterial(); } @@ -2190,7 +2210,43 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) //F32 repeats_per_meter = self->mCtrlRepeatsPerMeter->get(); F32 repeats_per_meter = (F32)self->getChild("rptctrl")->getValue().asReal();//self->mCtrlRepeatsPerMeter->get(); - LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); + + LLComboBox* combo_mattype = self->getChild("combobox mattype"); + + U32 material_type = combo_mattype->getCurrentIndex(); + + switch (material_type) + { + case MATTYPE_DIFFUSE: + { + LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); + } + break; + + case MATTYPE_NORMAL: + { + LLUICtrl* bumpy_scale_u = self->getChild("bumpyScaleU"); + LLUICtrl* bumpy_scale_v = self->getChild("bumpyScaleV"); + bumpy_scale_u->setValue(bumpy_scale_u->getValue().asReal() * repeats_per_meter); + bumpy_scale_v->setValue(bumpy_scale_v->getValue().asReal() * repeats_per_meter); + self->updateMaterial(); + } + break; + + case MATTYPE_SPECULAR: + { + LLUICtrl* shiny_scale_u = self->getChild("shinyScaleU"); + LLUICtrl* shiny_scale_v = self->getChild("shinyScaleV"); + shiny_scale_u->setValue(shiny_scale_u->getValue().asReal() * repeats_per_meter); + shiny_scale_v->setValue(shiny_scale_v->getValue().asReal() * repeats_per_meter); + self->updateMaterial(); + } + break; + + default: + llassert(false); + break; + } } struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor -- cgit v1.3 From b2ebfbf665c0bab8dc6697c389248236f168fa14 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 16:48:24 -0700 Subject: NORSPEC-83 repts per meter active with bumpy none --- indra/newview/llpanelface.cpp | 84 ++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 41 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 05469058a1..b20360ff4b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -820,43 +820,28 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - shinytexture_ctrl->setTentative( FALSE ); - shinytexture_ctrl->setEnabled( editable ); - if (!editable) - { - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } - bumpytexture_ctrl->setTentative( FALSE ); - bumpytexture_ctrl->setEnabled( editable ); 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 (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); - getChildView("label maskcutoff")->setEnabled( FALSE ); - } - else - { - // Tentative: multiple selected with different textures - texture_ctrl->setTentative( TRUE ); - texture_ctrl->setEnabled( editable ); - texture_ctrl->setImageAssetID( id ); + { + // 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); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -1355,9 +1340,10 @@ void LLPanelFace::getState() } + U8 shiny = 0; + // Shiny - { - U8 shiny = 0; + { struct f9 : public LLSelectedTEGetFunctor { U8 get(LLViewerObject* object, S32 face) @@ -1393,9 +1379,10 @@ void LLPanelFace::getState() getChildView("label shinycolor")->setEnabled(editable); } + U8 bumpy = 0; + // Bumpy - { - U8 bumpy = 0; + { struct f10 : public LLSelectedTEGetFunctor { U8 get(LLViewerObject* object, S32 face) @@ -1405,12 +1392,14 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); - LLUUID norm_map_id = getChild("shinytexture control")->getImageAssetID(); + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + + bumpy = norm_map_id.isNull() ? (S32)bumpy : BUMPY_TEXTURE; LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) - { - combobox_bumpiness->selectNthItem(norm_map_id.isNull() ? (S32)bumpy : BUMPY_TEXTURE); + { + combobox_bumpiness->selectNthItem(bumpy); } else { @@ -1476,17 +1465,30 @@ void LLPanelFace::getState() // BUG: Only repeats along S axis // BUG: Only works for boxes. LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); - return object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; + F32 repeats_s = object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; + F32 repeats_t = object->getTE(face)->mScaleT / object->getScale().mV[t_axis]; + return llmax(repeats_s, repeats_t); } - } func; + + } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); getChild("rptctrl")->setValue(editable ? repeats : 0); getChild("rptctrl")->setTentative(!identical); + LLComboBox* mComboTexGen = getChild("combobox texgen"); if (mComboTexGen) { - BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1); + S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; + BOOL enabled = editable && (index != 1); + U32 material_type = combobox_mattype->getCurrentIndex(); + switch (material_type) + { + default: + case MATTYPE_DIFFUSE: enabled = (editable && !id.isNull()); break; + case MATTYPE_SPECULAR: enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); break; + case MATTYPE_NORMAL: enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); break; + } getChildView("rptctrl")->setEnabled(enabled); } } -- cgit v1.3 From af44715f9014b56c3f8abe63edcb67e7248f1cd4 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Tue, 9 Apr 2013 09:24:58 -0700 Subject: NORSPEC-87 NORSPEC-88 fix interaction between norm/spec scale (aka repeats) and repeats per meter control --- indra/newview/llpanelface.cpp | 85 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b20360ff4b..7a9087333c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1455,7 +1455,10 @@ void LLPanelFace::getState() // Repeats per meter { - F32 repeats = 1.f; + F32 repeats_diff = 1.f; + F32 repeats_norm = 1.f; + F32 repeats_spec = 1.f; + struct f13 : public LLSelectedTEGetFunctor { F32 get(LLViewerObject* object, S32 face) @@ -1470,26 +1473,92 @@ void LLPanelFace::getState() return llmax(repeats_s, repeats_t); } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); + } func_diff; + bool identical_diff_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_diff, repeats_diff ); + + struct f14 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + U32 s_axis = VX; + U32 t_axis = VY; + F32 repeats_s = 1.0f; + F32 repeats_t = 1.0f; + if (mat) + { + mat->getNormalRepeat(repeats_s, repeats_t); + repeats_s /= object->getScale().mV[s_axis]; + repeats_t /= object->getScale().mV[t_axis]; + } + return llmax(repeats_s, repeats_t); + } + + } func_norm; + BOOL identical_norm_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_norm, repeats_norm ); + + struct f15 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + U32 s_axis = VX; + U32 t_axis = VY; + F32 repeats_s = 1.0f; + F32 repeats_t = 1.0f; + if (mat) + { + mat->getSpecularRepeat(repeats_s, repeats_t); + repeats_s /= object->getScale().mV[s_axis]; + repeats_t /= object->getScale().mV[t_axis]; + } + return llmax(repeats_s, repeats_t); + } + + } func_spec; + BOOL identical_spec_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_spec, repeats_spec ); - getChild("rptctrl")->setValue(editable ? repeats : 0); - getChild("rptctrl")->setTentative(!identical); LLComboBox* mComboTexGen = getChild("combobox texgen"); if (mComboTexGen) { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; BOOL enabled = editable && (index != 1); + BOOL identical = true; + F32 repeats = 1.0f; + U32 material_type = combobox_mattype->getCurrentIndex(); switch (material_type) { default: - case MATTYPE_DIFFUSE: enabled = (editable && !id.isNull()); break; - case MATTYPE_SPECULAR: enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); break; - case MATTYPE_NORMAL: enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); break; + case MATTYPE_DIFFUSE: + { + enabled = editable && !id.isNull(); + identical = identical_diff_repeats; + repeats = repeats_diff; + } + break; + + case MATTYPE_SPECULAR: + { + enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); + identical = identical_spec_repeats; + repeats = repeats_spec; + } + break; + + case MATTYPE_NORMAL: + { + enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); + identical = identical_norm_repeats; + repeats = repeats_norm; + } + break; } + getChildView("rptctrl")->setEnabled(enabled); + getChild("rptctrl")->setValue(editable ? repeats : 1.0f); + getChild("rptctrl")->setTentative(!identical); } } -- cgit v1.3 From 74712b47dfec67e014a4f7e0aca1bebcd15ea4e7 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Tue, 9 Apr 2013 09:39:57 -0700 Subject: NORSPEC-84 fix alpha mode UI appearing when coming back from media mode --- indra/newview/llpanelface.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7a9087333c..9af4bed918 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2005,6 +2005,10 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) 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); } // static -- cgit v1.3 From 6a417acd63d576271a8b752e42a79156dd8bdc27 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 10 Apr 2013 10:23:03 -0700 Subject: NORSPEC-92 More UI fixes --- indra/newview/llpanelface.cpp | 27 ++++++++++++++++++++++----- indra/newview/llselectmgr.cpp | 4 +--- indra/newview/llselectmgr.h | 2 ++ indra/newview/llvoavatar.cpp | 2 -- 4 files changed, 25 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9af4bed918..b404fbb9d5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1780,7 +1780,7 @@ void LLPanelFace::updateMaterial() mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); - if (bumpiness == BUMPY_TEXTURE) + if (!norm_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; mMaterial->setNormalID(norm_map_id); @@ -1810,7 +1810,7 @@ void LLPanelFace::updateMaterial() LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); - if (shininess == SHINY_TEXTURE) + if (!spec_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; mMaterial->setSpecularID(spec_map_id); @@ -1850,7 +1850,24 @@ void LLPanelFace::updateMaterial() } LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; - LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); + + LLMaterialPtr material_to_set = mMaterial; + + // If we're editing a single face and not the entire material for an object, + // we need to clone the material so that our changes to the material's settings + // don't automatically propagate to the non-selected faces + // NORSPEC-92 + // + LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = sel->getFirstNode(); + if (node) + { + if (node->getTESelectMask() != TE_SELECT_MASK_ALL) + { + material_to_set = new LLMaterial(*mMaterial); + } + } + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); } else { @@ -2030,7 +2047,7 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) LLComboBox* combo_bumpy = self->getChild("combobox bumpiness"); // Need 'true' here to insure that the 'Use Texture' choice is removed - // when we select something other than a spec texture + // when we select something other than a normmap texture // updateBumpyControls(combo_bumpy,self, true); self->updateMaterial(); @@ -2084,7 +2101,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ 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 + bool show_shinyctrls = (shiny_value != 0) && show_shininess; // Use texture self->getChildView("label glossiness")->setVisible(show_shinyctrls); self->getChildView("glossiness")->setVisible(show_shinyctrls); self->getChildView("label environment")->setVisible(show_shinyctrls); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 5089570319..4f58d09db3 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -104,7 +104,6 @@ const F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; const S32 MAX_ACTION_QUEUE_SIZE = 20; const S32 MAX_SILS_PER_FRAME = 50; const S32 MAX_OBJECTS_PER_PACKET = 254; -const S32 TE_SELECT_MASK_ALL = 0xFFFFFFFF; // // Globals @@ -1181,7 +1180,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount()) { //LLViewerObject* root = getSelectedParentObject(mSelectedObjects->getFirstObject()); - LLBBox bbox = mSavedSelectionBBox; mGridOrigin = mSavedSelectionBBox.getCenterAgent(); mGridScale = mSavedSelectionBBox.getExtentLocal() * 0.5f; @@ -1200,7 +1198,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & { mGridRotation = first_grid_object->getRenderRotation(); LLVector3 first_grid_obj_pos = first_grid_object->getRenderPosition(); - + (void)first_grid_obj_pos; LLVector4a min_extents(F32_MAX); LLVector4a max_extents(-F32_MAX); BOOL grid_changed = FALSE; diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 9d187f6272..1991b5581b 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -123,6 +123,8 @@ typedef enum e_selection_type SELECT_TYPE_HUD }ESelectType; +const S32 TE_SELECT_MASK_ALL = 0xFFFFFFFF; + // Contains information about a selected object, particularly which TEs are selected. class LLSelectNode { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9d16c28e2f..f861f49296 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4336,7 +4336,6 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } -#if !LL_DARWIN if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) @@ -4363,7 +4362,6 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } } -#endif return num_indices; } -- cgit v1.3 From 81781bf0d85eb7d37f6b4d1a9abebab4c9b0af0e Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 11 Apr 2013 10:21:33 -0500 Subject: NORSPEC-94: Set default specular color to white. --- indra/newview/llpanelface.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9af4bed918..a0f2fb702e 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1374,10 +1374,21 @@ void LLPanelFace::getState() getChildView("environment")->setEnabled(editable); getChild("environment")->setTentative(!identical); getChildView("label environment")->setEnabled(editable); - getChildView("shinycolorswatch")->setEnabled(editable); getChild("shinycolorswatch")->setTentative(!identical); getChildView("label shinycolor")->setEnabled(editable); } + // NORSPEC-94: Set default specular color to white (will get + // overwritten from material when loaded) + LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); + color = LLColor4::white; + if(mShinyColorSwatch) + { + mShinyColorSwatch->setOriginal(color); + mShinyColorSwatch->set(color, TRUE); + mShinyColorSwatch->setValid(editable); + mShinyColorSwatch->setEnabled( editable ); + mShinyColorSwatch->setCanApplyImmediately( editable ); + } U8 bumpy = 0; -- cgit v1.3 From 35400fb415d296ab0fde9e2775a98f15041985e0 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Thu, 11 Apr 2013 10:24:27 -0700 Subject: NORSPEC-96 less insane repeats per meter behavior in planar mode for norm/spec maps --- indra/newview/llpanelface.cpp | 44 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b404fbb9d5..c55923599f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1543,7 +1543,7 @@ void LLPanelFace::getState() { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); identical = identical_spec_repeats; - repeats = repeats_spec; + repeats = repeats_spec * (identical_planar_texgen ? 2.0f : 1.0f); } break; @@ -1551,11 +1551,11 @@ void LLPanelFace::getState() { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); identical = identical_norm_repeats; - repeats = repeats_norm; + repeats = repeats_norm * (identical_planar_texgen ? 2.0f : 1.0f); } break; } - + getChildView("rptctrl")->setEnabled(enabled); getChild("rptctrl")->setValue(editable ? repeats : 1.0f); getChild("rptctrl")->setTentative(!identical); @@ -2305,8 +2305,38 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) LLComboBox* combo_mattype = self->getChild("combobox mattype"); + F32 obj_scale_s = 1.0f; + F32 obj_scale_t = 1.0f; + U32 material_type = combo_mattype->getCurrentIndex(); + struct f_objscale_s : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + U32 s_axis = VX; + U32 t_axis = VY; + LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); + return object->getScale().mV[s_axis]; + } + + } scale_s_func; + + struct f_objscale_t : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + U32 s_axis = VX; + U32 t_axis = VY; + LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); + return object->getScale().mV[t_axis]; + } + + } scale_t_func; + + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_s_func, obj_scale_s ); + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_t_func, obj_scale_t ); + switch (material_type) { case MATTYPE_DIFFUSE: @@ -2319,8 +2349,8 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { LLUICtrl* bumpy_scale_u = self->getChild("bumpyScaleU"); LLUICtrl* bumpy_scale_v = self->getChild("bumpyScaleV"); - bumpy_scale_u->setValue(bumpy_scale_u->getValue().asReal() * repeats_per_meter); - bumpy_scale_v->setValue(bumpy_scale_v->getValue().asReal() * repeats_per_meter); + bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); + bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); self->updateMaterial(); } break; @@ -2329,8 +2359,8 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { LLUICtrl* shiny_scale_u = self->getChild("shinyScaleU"); LLUICtrl* shiny_scale_v = self->getChild("shinyScaleV"); - shiny_scale_u->setValue(shiny_scale_u->getValue().asReal() * repeats_per_meter); - shiny_scale_v->setValue(shiny_scale_v->getValue().asReal() * repeats_per_meter); + shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); + shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); self->updateMaterial(); } break; -- cgit v1.3 From f4becc0e1b0239d349b0d00c8bf4709f2a0c1163 Mon Sep 17 00:00:00 2001 From: g Date: Fri, 12 Apr 2013 13:42:52 -0700 Subject: NORSPEC-91 default to alpha blend when a material is present and a diff tex with alpha is applied --- indra/newview/llpanelface.cpp | 84 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 15 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index be88cb6ab6..f91f1f7d3a 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -291,10 +291,55 @@ void LLPanelFace::sendTexture() } LLSelectMgr::getInstance()->selectionSetImage(id); } + + mIsAlpha = FALSE; + LLGLenum image_format; + struct f2 : public LLSelectedTEGetFunctor + { + LLGLenum get(LLViewerObject* object, S32 te_index) + { + LLGLenum image_format = GL_RGB; + + LLViewerTexture* image = object->getTEImage(te_index); + if (image) image_format = image->getPrimaryFormat(); + return image_format; + } + } func2; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); + + mIsAlpha = FALSE; + switch (image_format) + { + case GL_RGBA: + case GL_ALPHA: + { + mIsAlpha = TRUE; + } + break; + + case GL_RGB: break; + default: + { + llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; + } + break; + } + + LLComboBox* comboAlphaMode = getChild("combobox alphamode"); + if (comboAlphaMode) + { + U32 alpha_mode = comboAlphaMode->getCurrentIndex(); + if (mIsAlpha && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE)) + { + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + comboAlphaMode->selectNthItem(alpha_mode); + } + } void LLPanelFace::sendBump() -{ +{ LLComboBox* mComboBumpiness = getChild("combobox bumpiness"); if(!mComboBumpiness)return; U32 bumpiness = mComboBumpiness->getCurrentIndex(); @@ -789,7 +834,7 @@ void LLPanelFace::getState() } } alpha_get_func; - U8 alpha_mode = 1; + U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &alpha_get_func, alpha_mode); { @@ -798,10 +843,13 @@ void LLPanelFace::getState() if (combobox_alphamode) { - if (!mIsAlpha) - { - alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - } + // Should never want to reflect something other than the correct state + // if it's supposed to be set to NONE, that should be enforced elsewhere + // + //if (!mIsAlpha) + //{ + // alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + //} combobox_alphamode->selectNthItem(alpha_mode); } @@ -1775,9 +1823,18 @@ void LLPanelFace::updateMaterial() bool identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); bool identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); - if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)) - || (bumpiness == BUMPY_TEXTURE) - || (shininess == SHINY_TEXTURE)) + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + + bool doing_diffuse_alpha = (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + bool doing_bumps = (bumpiness == BUMPY_TEXTURE) || !norm_map_id.isNull(); + bool doing_shiny = (shininess == SHINY_TEXTURE) || !spec_map_id.isNull(); + + doing_diffuse_alpha = doing_diffuse_alpha && mIsAlpha; + + if (doing_diffuse_alpha + || doing_bumps + || doing_shiny) { // The user's specified something that needs a material. bool new_material = false; @@ -1786,11 +1843,10 @@ void LLPanelFace::updateMaterial() new_material = true; mMaterial = LLMaterialPtr(new LLMaterial()); } - - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + + mMaterial->setDiffuseAlphaMode(alpha_mode); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); - - LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + if (!norm_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; @@ -1818,8 +1874,6 @@ void LLPanelFace::updateMaterial() mMaterial->setNormalRepeat(1.0f,1.0f); mMaterial->setNormalRotation(0.0f); } - - LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); if (!spec_map_id.isNull()) { -- cgit v1.3