From ad6959619f154bbe984d33aa7e6c60333cbb4438 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 15 Nov 2012 18:25:34 -0600 Subject: Initial texture panel rework: moved controls, new labels, eliminated flip checkboxes and apply button, added selection dropdowns. --- indra/newview/llpanelface.cpp | 110 +++++++++++++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 27 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 202be9671b..e74c8509ce 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -71,14 +71,14 @@ BOOL LLPanelFace::postBuild() { + childSetCommitCallback("combobox matmedia",&LLPanelFace::onCommitMaterialsMedia,this); + childSetCommitCallback("combobox mattype",&LLPanelFace::onCommitMaterialType,this); childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); - childSetCommitCallback("checkbox flip s",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); - childSetCommitCallback("checkbox flip t",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this); - childSetAction("button apply",&LLPanelFace::onClickApply,this); + childSetCommitCallback("rptctrl",&LLPanelFace::onCommitRepeatsPerMeter, this); childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); @@ -98,6 +98,7 @@ BOOL LLPanelFace::postBuild() LLSpinCtrl* mCtrlGlow; setMouseOpaque(FALSE); + mTextureCtrl = getChild("texture control"); if(mTextureCtrl) { @@ -269,22 +270,20 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild("TexOffsetU"); LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild("TexOffsetV"); LLSpinCtrl* ctrlTexRotation = mPanel->getChild("TexRot"); - LLCheckBoxCtrl* checkFlipScaleS = mPanel->getChild("checkbox flip s"); - LLCheckBoxCtrl* checkFlipScaleT = mPanel->getChild("checkbox flip t"); LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); llassert(comboTexGen); llassert(object); if (ctrlTexScaleS) { - valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative(); + valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); if (valid) { value = ctrlTexScaleS->get(); - if( checkFlipScaleS->get() ) - { - value = -value; - } + //if( checkFlipScaleS->get() ) + //{ + // value = -value; + //} if (comboTexGen && comboTexGen->getCurrentIndex() == 1) { @@ -296,14 +295,14 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexScaleT) { - valid = !ctrlTexScaleT->getTentative() || !checkFlipScaleT->getTentative(); + valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); if (valid) { value = ctrlTexScaleT->get(); - if( checkFlipScaleT->get() ) - { - value = -value; - } + //if( checkFlipScaleT->get() ) + //{ + // value = -value; + //} if (comboTexGen && comboTexGen->getCurrentIndex() == 1) { @@ -495,6 +494,31 @@ void LLPanelFace::getState() // only turn on auto-adjust button if there is a media renderer and the media is loaded getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); + + LLCtrlSelectionInterface* combobox_matmedia = + childGetSelectionInterface("combobox matmedia"); + if (combobox_matmedia) + { + combobox_matmedia->selectNthItem(0); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox matmedia'" << llendl; + } + getChildView("combobox matmedia")->setEnabled(editable); + + LLCtrlSelectionInterface* combobox_mattype = + childGetSelectionInterface("combobox mattype"); + if (combobox_mattype) + { + combobox_mattype->selectNthItem(0); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox mattype'" << llendl; + } + getChildView("combobox mattype")->setEnabled(editable); + onCommitMaterialsMedia(NULL, this); //if ( LLMediaEngine::getInstance()->getMediaRenderer () ) // if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () ) @@ -504,7 +528,6 @@ void LLPanelFace::getState() // // //mBtnAutoFix->setEnabled ( editable ); // } - getChildView("button apply")->setEnabled(editable); bool identical; LLTextureCtrl* texture_ctrl = getChild("texture control"); @@ -630,12 +653,9 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - getChild("TexScaleU")->setValue(editable ? llabs(scale_s) : 0); + getChild("TexScaleU")->setValue(editable ? scale_s : 0); getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleU")->setEnabled(editable); - getChild("checkbox flip s")->setValue(LLSD((BOOL)(scale_s < 0 ? TRUE : FALSE ))); - getChild("checkbox flip s")->setTentative(LLSD((BOOL)((!identical) ? TRUE : FALSE ))); - getChildView("checkbox flip s")->setEnabled(editable); } { @@ -650,12 +670,9 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; - getChild("TexScaleV")->setValue(llabs(editable ? llabs(scale_t) : 0)); + getChild("TexScaleV")->setValue(editable ? scale_t : 0); getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleV")->setEnabled(editable); - getChild("checkbox flip t")->setValue(LLSD((BOOL)(scale_t< 0 ? TRUE : FALSE ))); - getChild("checkbox flip t")->setTentative(LLSD((BOOL)((!identical) ? TRUE : FALSE ))); - getChildView("checkbox flip t")->setEnabled(editable); } // Texture offset @@ -710,6 +727,9 @@ void LLPanelFace::getState() } // Color swatch + { + getChildView("color label")->setEnabled(editable); + } LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); LLColor4 color = LLColor4::white; if(mColorSwatch) @@ -895,7 +915,6 @@ void LLPanelFace::getState() { BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1); getChildView("rptctrl")->setEnabled(enabled); - getChildView("button apply")->setEnabled(enabled); } } @@ -939,7 +958,6 @@ void LLPanelFace::getState() getChildView("textbox autofix")->setEnabled(FALSE); getChildView("button align")->setEnabled(FALSE); - getChildView("button apply")->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); @@ -994,6 +1012,44 @@ void LLPanelFace::onSelectColor(const LLSD& data) sendColor(); } +// static +void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + LLComboBox* mComboMaterialsMedia = self->getChild("combobox matmedia"); + if (!mComboMaterialsMedia) + { + return; + } + U32 materials_media = mComboMaterialsMedia->getCurrentIndex(); + LLComboBox* mComboMaterialType = self->getChild("combobox mattype"); + if (!mComboMaterialType) + { + return; + } + U32 material_type = mComboMaterialType->getCurrentIndex(); + bool show_media = (materials_media == 1); + bool show_texture = (!show_media) && (material_type == 0); + bool show_bumpiness = (!show_media) && (material_type == 1); + bool show_shininess = (!show_media) && (material_type == 2); + self->getChildView("combobox mattype")->setVisible(!show_media); + 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); + self->getChildView("texture control")->setVisible(show_texture); + self->getChildView("combobox shininess")->setVisible(show_shininess); + self->getChildView("label shininess")->setVisible(show_shininess); + self->getChildView("combobox bumpiness")->setVisible(show_bumpiness); + self->getChildView("label bumpiness")->setVisible(show_bumpiness); +} + +// static +void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) +{ + onCommitMaterialsMedia(ctrl, userdata); +} + // static void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) { @@ -1074,7 +1130,7 @@ void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata ) // Commit the number of repeats per meter // static -void LLPanelFace::onClickApply(void* userdata) +void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; -- cgit v1.2.3 From f4663e098c1f338259b46085188be19f8fad7543 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 10 Jan 2013 18:05:39 -0600 Subject: New controls for editing media. --- indra/newview/llpanelface.cpp | 159 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 136 insertions(+), 23 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e74c8509ce..0dedfae7da 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -65,6 +65,20 @@ #include "llpluginclassmedia.h" #include "llviewertexturelist.h" +// +// Constant definitions for comboboxes +// Must match the commbobox definitions in panel_tools_texture.xml +// +const U32 MATMEDIA_MATERIAL = 0; // Material +const U32 MATMEDIA_MEDIA = 1; // Media +const U32 MATTYPE_DIFFUSE = 0; // Diffuse material texture +const U32 MATTYPE_NORMAL = 1; // Normal map +const U32 MATTYPE_SPECULAR = 2; // Specular map +const U32 ALPHAMODE_NONE = 0; // No alpha mask applied +const U32 ALPHAMODE_MASK = 2; // Alpha masking mode +const U32 BUMPY_TEXTURE = 18; // use supplied normal map +const U32 SHINY_TEXTURE = 4; // use supplied specular map + // // Methods // @@ -75,6 +89,7 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("combobox mattype",&LLPanelFace::onCommitMaterialType,this); childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); + childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this); childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this); @@ -492,30 +507,33 @@ void LLPanelFace::getState() BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); // only turn on auto-adjust button if there is a media renderer and the media is loaded - getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); - LLCtrlSelectionInterface* combobox_matmedia = - childGetSelectionInterface("combobox matmedia"); + LLComboBox* combobox_matmedia = getChild("combobox matmedia"); if (combobox_matmedia) { - combobox_matmedia->selectNthItem(0); + if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL) + { + combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL); + } } else { - llwarns << "failed childGetSelectionInterface for 'combobox matmedia'" << llendl; + llwarns << "failed getChild for 'combobox matmedia'" << llendl; } getChildView("combobox matmedia")->setEnabled(editable); - LLCtrlSelectionInterface* combobox_mattype = - childGetSelectionInterface("combobox mattype"); + LLComboBox* combobox_mattype = getChild("combobox mattype"); if (combobox_mattype) { - combobox_mattype->selectNthItem(0); + if (combobox_mattype->getCurrentIndex() < MATTYPE_DIFFUSE) + { + combobox_mattype->selectNthItem(MATTYPE_DIFFUSE); + } } else { - llwarns << "failed childGetSelectionInterface for 'combobox mattype'" << llendl; + llwarns << "failed getChild for 'combobox mattype'" << llendl; } getChildView("combobox mattype")->setEnabled(editable); onCommitMaterialsMedia(NULL, this); @@ -565,12 +583,41 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); + BOOL is_alpha = FALSE; + struct f2 : public LLSelectedTEGetFunctor + { + BOOL get(LLViewerObject* object, S32 te_index) + { + BOOL is_alpha = FALSE; + + LLViewerTexture* image = object->getTEImage(te_index); + if (image) is_alpha = image->getIsAlphaMask(); + return is_alpha; + } + } func2; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, is_alpha ); + if(LLViewerMedia::textureHasMedia(id)) { - getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); } + if (!is_alpha) + { + // Selected texture has no alpha, force alpha mode None + LLCtrlSelectionInterface* combobox_alphamode = + childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) + { + combobox_alphamode->selectNthItem(ALPHAMODE_NONE); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; + } + onCommitAlphaMode(getChild("combobox alpha"),this); + } + if (identical) { // All selected have the same texture @@ -579,6 +626,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + getChildView("combobox alphamode")->setEnabled(editable && is_alpha); + getChildView("label alphamode")->setEnabled(editable && is_alpha); + getChildView("maskcutoff")->setEnabled(editable && is_alpha); + getChildView("label maskcutoff")->setEnabled(editable && is_alpha); } } else @@ -591,6 +642,10 @@ void LLPanelFace::getState() 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 { @@ -598,6 +653,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + getChildView("combobox alphamode")->setEnabled(editable && is_alpha); + getChildView("label alphamode")->setEnabled(editable && is_alpha); + getChildView("maskcutoff")->setEnabled(editable && is_alpha); + getChildView("label maskcutoff")->setEnabled(editable && is_alpha); } } } @@ -803,6 +862,15 @@ void LLPanelFace::getState() getChildView("combobox shininess")->setEnabled(editable); getChild("combobox shininess")->setTentative(!identical); getChildView("label shininess")->setEnabled(editable); + getChildView("glossiness")->setEnabled(editable); + getChild("glossiness")->setTentative(!identical); + getChildView("label glossiness")->setEnabled(editable); + 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); } { @@ -955,12 +1023,9 @@ void LLPanelFace::getState() getChildView("label shininess")->setEnabled(FALSE); getChildView("label bumpiness")->setEnabled(FALSE); - getChildView("textbox autofix")->setEnabled(FALSE); - getChildView("button align")->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); - // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); @@ -1016,30 +1081,50 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLComboBox* mComboMaterialsMedia = self->getChild("combobox matmedia"); - if (!mComboMaterialsMedia) + LLComboBox* comboMaterialsMedia = self->getChild("combobox matmedia"); + if (!comboMaterialsMedia) { return; } - U32 materials_media = mComboMaterialsMedia->getCurrentIndex(); - LLComboBox* mComboMaterialType = self->getChild("combobox mattype"); - if (!mComboMaterialType) + U32 materials_media = comboMaterialsMedia->getCurrentIndex(); + LLComboBox* comboMaterialType = self->getChild("combobox mattype"); + if (!comboMaterialType) { return; } - U32 material_type = mComboMaterialType->getCurrentIndex(); - bool show_media = (materials_media == 1); - bool show_texture = (!show_media) && (material_type == 0); - bool show_bumpiness = (!show_media) && (material_type == 1); - bool show_shininess = (!show_media) && (material_type == 2); + U32 material_type = comboMaterialType->getCurrentIndex(); + bool show_media = (materials_media == MATMEDIA_MEDIA); + bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE); + bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL); + bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR); self->getChildView("combobox mattype")->setVisible(!show_media); 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); self->getChildView("texture control")->setVisible(show_texture); + self->getChildView("label alphamode")->setVisible(show_texture); + self->getChildView("combobox alphamode")->setVisible(show_texture); + self->getChildView("label maskcutoff")->setVisible(false); + self->getChildView("maskcutoff")->setVisible(false); + if (show_texture) + { + onCommitAlphaMode(ctrl, userdata); + } + 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); + if (show_shininess) + { + onCommitShiny(ctrl, userdata); + } + self->getChildView("bumpytexture control")->setVisible(show_bumpiness); self->getChildView("combobox bumpiness")->setVisible(show_bumpiness); self->getChildView("label bumpiness")->setVisible(show_bumpiness); } @@ -1068,9 +1153,37 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; + LLComboBox* comboShiny = self->getChild("combobox shininess"); + if (!comboShiny) + { + return; + } + U32 shiny_value = comboShiny->getCurrentIndex(); + bool show_shinyctrls = (shiny_value == SHINY_TEXTURE); // 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); self->sendShiny(); } +// static +void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + LLComboBox* comboAlphaMode = self->getChild("combobox alphamode"); + if (!comboAlphaMode) + { + return; + } + U32 alpha_value = comboAlphaMode->getCurrentIndex(); + bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking + self->getChildView("label maskcutoff")->setVisible(show_alphactrls); + self->getChildView("maskcutoff")->setVisible(show_alphactrls); +} + // static void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata) { -- cgit v1.2.3 From ca1f57307a76af2f7c381269e05af74307f9468a Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Fri, 11 Jan 2013 22:12:18 -0600 Subject: Initialize correctly for new objects. --- indra/newview/llpanelface.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 0dedfae7da..51bda4141d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -69,15 +69,15 @@ // Constant definitions for comboboxes // Must match the commbobox definitions in panel_tools_texture.xml // -const U32 MATMEDIA_MATERIAL = 0; // Material -const U32 MATMEDIA_MEDIA = 1; // Media -const U32 MATTYPE_DIFFUSE = 0; // Diffuse material texture -const U32 MATTYPE_NORMAL = 1; // Normal map -const U32 MATTYPE_SPECULAR = 2; // Specular map -const U32 ALPHAMODE_NONE = 0; // No alpha mask applied -const U32 ALPHAMODE_MASK = 2; // Alpha masking mode -const U32 BUMPY_TEXTURE = 18; // use supplied normal map -const U32 SHINY_TEXTURE = 4; // use supplied specular map +const S32 MATMEDIA_MATERIAL = 0; // Material +const S32 MATMEDIA_MEDIA = 1; // Media +const S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture +const S32 MATTYPE_NORMAL = 1; // Normal map +const S32 MATTYPE_SPECULAR = 2; // Specular map +const S32 ALPHAMODE_NONE = 0; // No alpha mask applied +const S32 ALPHAMODE_MASK = 2; // Alpha masking mode +const S32 BUMPY_TEXTURE = 18; // use supplied normal map +const S32 SHINY_TEXTURE = 4; // use supplied specular map // // Methods @@ -85,8 +85,6 @@ const U32 SHINY_TEXTURE = 4; // use supplied specular map BOOL LLPanelFace::postBuild() { - childSetCommitCallback("combobox matmedia",&LLPanelFace::onCommitMaterialsMedia,this); - childSetCommitCallback("combobox mattype",&LLPanelFace::onCommitMaterialType,this); childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this); @@ -104,6 +102,8 @@ BOOL LLPanelFace::postBuild() LLColorSwatchCtrl* mColorSwatch; LLComboBox* mComboTexGen; + LLComboBox* mComboMatMedia; + LLComboBox* mComboMatType; LLCheckBoxCtrl *mCheckFullbright; @@ -169,6 +169,20 @@ BOOL LLPanelFace::postBuild() mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } + mComboMatMedia = getChild("combobox matmedia"); + if(mComboMatMedia) + { + mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + } + + mComboMatType = getChild("combobox mattype"); + if(mComboMatType) + { + mComboMatType->setCommitCallback(LLPanelFace::onCommitMaterialType, this); + mComboMatType->selectNthItem(MATTYPE_DIFFUSE); + } + mCtrlGlow = getChild("glow"); if(mCtrlGlow) { -- cgit v1.2.3 From 1751c965ba1ffd1a89a3b94542624e70cbde1060 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Tue, 29 Jan 2013 21:19:58 -0600 Subject: Editing interface for normal and specular maps and other parameters. --- indra/newview/llpanelface.cpp | 430 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 399 insertions(+), 31 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 51bda4141d..f0daa96e19 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -46,6 +46,7 @@ #include "lldrawpoolbump.h" #include "llface.h" #include "lllineeditor.h" +#include "llmaterialmgr.h" #include "llmediaentry.h" #include "llnotificationsutil.h" #include "llresmgr.h" @@ -59,6 +60,7 @@ #include "llviewercontrol.h" #include "llviewermedia.h" #include "llviewerobject.h" +#include "llviewerregion.h" #include "llviewerstats.h" #include "llvovolume.h" #include "lluictrlfactory.h" @@ -75,6 +77,7 @@ const S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture const S32 MATTYPE_NORMAL = 1; // Normal map const S32 MATTYPE_SPECULAR = 2; // Specular map const S32 ALPHAMODE_NONE = 0; // No alpha mask applied +const S32 ALPHAMODE_BLEND = 1; // Alpha blending mode const S32 ALPHAMODE_MASK = 2; // Alpha masking mode const S32 BUMPY_TEXTURE = 18; // use supplied normal map const S32 SHINY_TEXTURE = 4; // use supplied specular map @@ -95,11 +98,27 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); + childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("environment",&LLPanelFace::onCommitMaterial, this); + childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterial, this); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); LLRect rect = this->getRect(); LLTextureCtrl* mTextureCtrl; + LLTextureCtrl* mShinyTextureCtrl; + LLTextureCtrl* mBumpyTextureCtrl; LLColorSwatchCtrl* mColorSwatch; + LLColorSwatchCtrl* mShinyColorSwatch; LLComboBox* mComboTexGen; LLComboBox* mComboMatMedia; @@ -129,6 +148,36 @@ BOOL LLPanelFace::postBuild() mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); } + mShinyTextureCtrl = getChild("shinytexture control"); + if(mShinyTextureCtrl) + { + mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); + mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); + mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); + mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); + mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); + mShinyTextureCtrl->setFollowsTop(); + mShinyTextureCtrl->setFollowsLeft(); + mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); + } + + mBumpyTextureCtrl = getChild("bumpytexture control"); + if(mBumpyTextureCtrl) + { + mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); + mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); + mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); + mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); + mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); + mBumpyTextureCtrl->setFollowsTop(); + mBumpyTextureCtrl->setFollowsLeft(); + mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); + } + mColorSwatch = getChild("colorswatch"); if(mColorSwatch) { @@ -140,6 +189,15 @@ BOOL LLPanelFace::postBuild() mColorSwatch->setCanApplyImmediately(TRUE); } + mShinyColorSwatch = getChild("shinycolorswatch"); + if(mShinyColorSwatch) + { + mShinyColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitShinyColor, this, _2)); + mShinyColorSwatch->setFollowsTop(); + mShinyColorSwatch->setFollowsLeft(); + mShinyColorSwatch->setCanApplyImmediately(TRUE); + } + mLabelColorTransp = getChild("color trans"); if(mLabelColorTransp) { @@ -196,7 +254,10 @@ BOOL LLPanelFace::postBuild() } LLPanelFace::LLPanelFace() -: LLPanel() +: LLPanel(), + mMaterialID(LLMaterialID::null), + mMaterial(LLMaterialPtr()), + mIsAlpha(FALSE) { } @@ -563,6 +624,8 @@ void LLPanelFace::getState() bool identical; LLTextureCtrl* texture_ctrl = getChild("texture control"); + LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); + LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); // Texture { @@ -597,39 +660,46 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); - BOOL is_alpha = FALSE; - struct f2 : public LLSelectedTEGetFunctor + mIsAlpha = FALSE; + LLGLenum image_format; + struct f2 : public LLSelectedTEGetFunctor { - BOOL get(LLViewerObject* object, S32 te_index) + LLGLenum get(LLViewerObject* object, S32 te_index) { - BOOL is_alpha = FALSE; + LLGLenum image_format; LLViewerTexture* image = object->getTEImage(te_index); - if (image) is_alpha = image->getIsAlphaMask(); - return is_alpha; + if (image) image_format = image->getPrimaryFormat(); + return image_format; } } func2; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, is_alpha ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); + mIsAlpha = image_format != GL_RGB; if(LLViewerMedia::textureHasMedia(id)) { getChildView("button align")->setEnabled(editable); } - if (!is_alpha) { - // Selected texture has no alpha, force alpha mode None + // Default alpha mode to None if texture has no alpha, or Alpha Blending if present + // Will be overridden later if a material is present for this face + S32 default_alpha = ALPHAMODE_NONE; + if (mIsAlpha) + { + default_alpha = ALPHAMODE_BLEND; + } LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) { - combobox_alphamode->selectNthItem(ALPHAMODE_NONE); + combobox_alphamode->selectNthItem(default_alpha); } else { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } - onCommitAlphaMode(getChild("combobox alpha"),this); + onCommitAlphaMode(getChild("combobox alphamode"),this); } if (identical) @@ -640,10 +710,16 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - getChildView("combobox alphamode")->setEnabled(editable && is_alpha); - getChildView("label alphamode")->setEnabled(editable && is_alpha); - getChildView("maskcutoff")->setEnabled(editable && is_alpha); - getChildView("label maskcutoff")->setEnabled(editable && is_alpha); + shinytexture_ctrl->setTentative( FALSE ); + shinytexture_ctrl->setEnabled( editable ); + shinytexture_ctrl->setImageAssetID( id ); + bumpytexture_ctrl->setTentative( FALSE ); + bumpytexture_ctrl->setEnabled( editable ); + bumpytexture_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); } } else @@ -656,6 +732,12 @@ void LLPanelFace::getState() 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); @@ -667,10 +749,16 @@ void LLPanelFace::getState() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - getChildView("combobox alphamode")->setEnabled(editable && is_alpha); - getChildView("label alphamode")->setEnabled(editable && is_alpha); - getChildView("maskcutoff")->setEnabled(editable && is_alpha); - getChildView("label maskcutoff")->setEnabled(editable && is_alpha); + shinytexture_ctrl->setTentative( TRUE ); + shinytexture_ctrl->setEnabled( editable ); + shinytexture_ctrl->setImageAssetID( id ); + bumpytexture_ctrl->setTentative( TRUE ); + bumpytexture_ctrl->setEnabled( editable ); + bumpytexture_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); } } } @@ -729,6 +817,12 @@ void LLPanelFace::getState() getChild("TexScaleU")->setValue(editable ? scale_s : 0); getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleU")->setEnabled(editable); + getChild("shinyScaleU")->setValue(editable ? scale_s : 0); + getChild("shinyScaleU")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyScaleU")->setEnabled(FALSE); + getChild("bumpyScaleU")->setValue(editable ? scale_s : 0); + getChild("bumpyScaleU")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyScaleU")->setEnabled(FALSE); } { @@ -746,6 +840,12 @@ void LLPanelFace::getState() getChild("TexScaleV")->setValue(editable ? scale_t : 0); getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleV")->setEnabled(editable); + getChild("shinyScaleV")->setValue(editable ? scale_t : 0); + getChild("shinyScaleV")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyScaleV")->setEnabled(FALSE); + getChild("bumpyScaleV")->setValue(editable ? scale_t : 0); + getChild("bumpyScaleV")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyScaleV")->setEnabled(FALSE); } // Texture offset @@ -764,6 +864,12 @@ void LLPanelFace::getState() getChild("TexOffsetU")->setValue(editable ? offset_s : 0); getChild("TexOffsetU")->setTentative(!identical); getChildView("TexOffsetU")->setEnabled(editable); + getChild("shinyOffsetU")->setValue(editable ? offset_s : 0); + getChild("shinyOffsetU")->setTentative(!identical); + getChildView("shinyOffsetU")->setEnabled(FALSE); + getChild("bumpyOffsetU")->setValue(editable ? offset_s : 0); + getChild("bumpyOffsetU")->setTentative(!identical); + getChildView("bumpyOffsetU")->setEnabled(FALSE); } { @@ -780,6 +886,12 @@ void LLPanelFace::getState() getChild("TexOffsetV")->setValue(editable ? offset_t : 0); getChild("TexOffsetV")->setTentative(!identical); getChildView("TexOffsetV")->setEnabled(editable); + getChild("shinyOffsetV")->setValue(editable ? offset_t : 0); + getChild("shinyOffsetV")->setTentative(!identical); + getChildView("shinyOffsetV")->setEnabled(FALSE); + getChild("bumpyOffsetV")->setValue(editable ? offset_t : 0); + getChild("bumpyOffsetV")->setTentative(!identical); + getChildView("bumpyOffsetV")->setEnabled(FALSE); } // Texture rotation @@ -797,6 +909,12 @@ void LLPanelFace::getState() getChild("TexRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); getChild("TexRot")->setTentative(!identical); getChildView("TexRot")->setEnabled(editable); + getChild("shinyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); + getChild("shinyRot")->setTentative(!identical); + getChildView("shinyRot")->setEnabled(FALSE); + getChild("bumpyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); + getChild("bumpyRot")->setTentative(!identical); + getChildView("bumpyRot")->setEnabled(FALSE); } // Color swatch @@ -852,7 +970,7 @@ void LLPanelFace::getState() } - // Bump + // Shiny { F32 shinyf = 0.f; struct f9 : public LLSelectedTEGetFunctor @@ -887,6 +1005,7 @@ void LLPanelFace::getState() getChildView("label shinycolor")->setEnabled(editable); } + // Bumpy { F32 bumpf = 0.f; struct f10 : public LLSelectedTEGetFunctor @@ -941,6 +1060,10 @@ void LLPanelFace::getState() { getChild("TexScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); getChild("TexScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); + getChild("shinyScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); + getChild("shinyScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); + getChild("bumpyScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); + getChild("bumpyScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); // EXP-1507 (change label based on the mapping mode) getChild("rpt")->setValue(getString("string repeats per meter")); @@ -1000,6 +1123,29 @@ void LLPanelFace::getState() } } + // Materials + { + mMaterialID = LLMaterialID::null; + //mMaterial = LLMaterialPtr(); + struct f1 : public LLSelectedTEGetFunctor + { + LLMaterialID get(LLViewerObject* object, S32 te_index) + { + LLMaterialID material_id; + + return object->getTE(te_index)->getMaterialID(); + } + } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, mMaterialID ); + llinfos << "Material ID returned: '" + << mMaterialID.asString() << "', isNull? " + << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + if (!mMaterialID.isNull() && editable) + { + LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); + } + } + // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal()); @@ -1041,6 +1187,8 @@ void LLPanelFace::getState() //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); + onCommitMaterialsMedia(NULL,this); + // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); calcp->clearVar(LLCalc::TEX_U_SCALE); @@ -1059,6 +1207,126 @@ void LLPanelFace::refresh() getState(); } +void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) +{ + llinfos << "Material loaded: " << material_id.asString() + << ", LLSD: " << material->asLLSD() << llendl; + mMaterial = material; + getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); + getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + getChild("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); + getChild("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); + LLCtrlSelectionInterface* combobox_alphamode = + childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) + { + combobox_alphamode->selectNthItem(material->getDiffuseAlphaMode()); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; + } + onCommitAlphaMode(getChild("combobox alphamode"),this); + LLComboBox* comboMaterialType = getChild("combobox mattype"); + F32 offset_x, offset_y, repeat_x, repeat_y, rot; + if ((comboMaterialType->getCurrentIndex() == MATTYPE_SPECULAR) && + !material->getSpecularID().isNull()) + { + material->getSpecularOffset(offset_x,offset_y); + material->getSpecularRepeat(repeat_x,repeat_y); + rot = material->getSpecularRotation(); + LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + texture_ctrl->setImageAssetID(material->getSpecularID()); + LLCtrlSelectionInterface* combobox_shininess = + childGetSelectionInterface("combobox shininess"); + if (combobox_shininess) + { + combobox_shininess->selectNthItem(SHINY_TEXTURE); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; + } + getChild("shinyScaleU")->setValue(repeat_x); + getChild("shinyScaleV")->setValue(repeat_y); + getChild("shinyRot")->setValue(rot); + getChild("shinyOffsetU")->setValue(offset_x); + getChild("shinyOffsetV")->setValue(offset_y); + } + if ((comboMaterialType->getCurrentIndex() == MATTYPE_NORMAL) && + !material->getNormalID().isNull()) + { + material->getNormalOffset(offset_x,offset_y); + material->getNormalRepeat(repeat_x,repeat_y); + rot = material->getNormalRotation(); + LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); + texture_ctrl->setImageAssetID(material->getNormalID()); + LLCtrlSelectionInterface* combobox_bumpiness = + childGetSelectionInterface("combobox bumpiness"); + if (combobox_bumpiness) + { + combobox_bumpiness->selectNthItem(BUMPY_TEXTURE); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; + } + getChild("bumpyScaleU")->setValue(repeat_x); + getChild("bumpyScaleV")->setValue(repeat_y); + getChild("bumpyRot")->setValue(rot); + getChild("bumpyOffsetU")->setValue(offset_x); + getChild("bumpyOffsetV")->setValue(offset_y); + } +} + +void LLPanelFace::updateMaterial() +{ + LLComboBox* comboAlphaMode = getChild("combobox alphamode"); + LLComboBox* comboBumpiness = getChild("combobox bumpiness"); + LLComboBox* comboShininess = getChild("combobox shininess"); + if (!comboAlphaMode || !comboBumpiness || !comboShininess) + { + return; + } + if ((mIsAlpha && (comboAlphaMode->getCurrentIndex() != ALPHAMODE_BLEND)) + || (comboBumpiness->getCurrentIndex() != BUMPY_TEXTURE) + || (comboShininess->getCurrentIndex() != SHINY_TEXTURE)) + { + // The user's specified something that needs a material. + if (!mMaterial) + { + mMaterial = LLMaterialPtr(new LLMaterial()); + } + mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); + mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), + getChild("bumpyOffsetV")->getValue().asReal()); + mMaterial->setNormalRepeat(getChild("bumpyScaleU")->getValue().asReal(), + getChild("bumpyScaleV")->getValue().asReal()); + mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()); + 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()); + mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); + mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); + mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); + mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + } + else + { + // The user has specified settings that don't need a material. + if (mMaterial) + { + mMaterial.reset(); + } + } + LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); +} + // // Static functions // @@ -1075,6 +1343,11 @@ void LLPanelFace::onCommitColor(const LLSD& data) sendColor(); } +void LLPanelFace::onCommitShinyColor(const LLSD& data) +{ + updateMaterial(); +} + void LLPanelFace::onCommitAlpha(const LLSD& data) { sendAlpha(); @@ -1095,27 +1368,33 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLComboBox* comboMaterialsMedia = self->getChild("combobox matmedia"); - if (!comboMaterialsMedia) + // Get material info so we can use it later + if (self->mMaterial) { - return; + self->onMaterialLoaded(self->mMaterialID,self->mMaterial); } - U32 materials_media = comboMaterialsMedia->getCurrentIndex(); + LLComboBox* comboMaterialsMedia = self->getChild("combobox matmedia"); LLComboBox* comboMaterialType = self->getChild("combobox mattype"); - if (!comboMaterialType) + if (!comboMaterialType || !comboMaterialsMedia) { return; } + U32 materials_media = comboMaterialsMedia->getCurrentIndex(); U32 material_type = comboMaterialType->getCurrentIndex(); - bool show_media = (materials_media == MATMEDIA_MEDIA); - bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE); - bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL); - bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR); + bool show_media = (materials_media == MATMEDIA_MEDIA) && comboMaterialsMedia->getEnabled(); + bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE) && comboMaterialsMedia->getEnabled(); + bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && comboMaterialsMedia->getEnabled(); + bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && comboMaterialsMedia->getEnabled(); self->getChildView("combobox mattype")->setVisible(!show_media); + self->getChildView("rptctrl")->setVisible(!show_media); + + // 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); + + // Diffuse texture controls self->getChildView("texture control")->setVisible(show_texture); self->getChildView("label alphamode")->setVisible(show_texture); self->getChildView("combobox alphamode")->setVisible(show_texture); @@ -1125,6 +1404,13 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { onCommitAlphaMode(ctrl, userdata); } + 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); + + // Specular map controls self->getChildView("shinytexture control")->setVisible(show_shininess); self->getChildView("combobox shininess")->setVisible(show_shininess); self->getChildView("label shininess")->setVisible(show_shininess); @@ -1138,9 +1424,50 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { onCommitShiny(ctrl, userdata); } + 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); + + // Normal map controls 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; + if (self->mMaterial) + { + texParmsEnable = texParmsEnable || + (!self->mMaterial->getNormalID().isNull() && show_bumpiness) || + (!self->mMaterial->getSpecularID().isNull() && show_shininess); + } + 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); } // static @@ -1196,6 +1523,7 @@ void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking self->getChildView("label maskcutoff")->setVisible(show_alphactrls); self->getChildView("maskcutoff")->setVisible(show_alphactrls); + self->updateMaterial(); } // static @@ -1247,6 +1575,28 @@ void LLPanelFace::onSelectTexture(const LLSD& data) sendTexture(); } +void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) +{ + updateMaterial(); +} + +void LLPanelFace::onCancelMaterialTexture(const LLSD& data) +{ + // not sure what to do here other than + updateMaterial(); +} + +void LLPanelFace::onSelectMaterialTexture(const LLSD& data) +{ + updateMaterial(); +} + +//static +void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + self->updateMaterial(); +} // static void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata ) @@ -1339,7 +1689,25 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { - LLTextureCtrl* texture_ctrl = getChild("texture control"); + LLComboBox* combo_mattype = getChild("combobox mattype"); + if (!combo_mattype) + { + return; + } + U32 mattype = combo_mattype->getCurrentIndex(); + std::string which_control="texture control"; + switch (mattype) + { + case MATTYPE_SPECULAR: + which_control = "shinytexture_control"; + break; + case MATTYPE_NORMAL: + which_control = "bumpytexture_control"; + break; + // no default needed + } + + LLTextureCtrl* texture_ctrl = getChild(which_control); if (texture_ctrl) { LLUUID obj_owner_id; -- cgit v1.2.3 From ada2d07572ca51159004eec82721d3dabe735bb8 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Tue, 29 Jan 2013 22:12:20 -0600 Subject: Compile fix for potentially uninitialized variable. --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f0daa96e19..024265b377 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -666,7 +666,7 @@ void LLPanelFace::getState() { LLGLenum get(LLViewerObject* object, S32 te_index) { - LLGLenum image_format; + LLGLenum image_format = GL_RGB; LLViewerTexture* image = object->getTEImage(te_index); if (image) image_format = image->getPrimaryFormat(); -- cgit v1.2.3 From d53f69b67f2aed05fd763932f25cc8b5c40ec774 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 31 Jan 2013 00:36:23 -0600 Subject: Control reorganization and bugfixes. --- indra/newview/llpanelface.cpp | 215 ++++++++++++++++++++++++++---------------- 1 file changed, 136 insertions(+), 79 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 024265b377..4f61d5bbb6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -699,7 +699,7 @@ void LLPanelFace::getState() { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } - onCommitAlphaMode(getChild("combobox alphamode"),this); + updateAlphaControls(getChild("combobox alphamode"),this); } if (identical) @@ -712,10 +712,10 @@ void LLPanelFace::getState() texture_ctrl->setImageAssetID( id ); shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( id ); + shinytexture_ctrl->setImageAssetID( LLUUID::null ); bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( id ); + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -751,10 +751,10 @@ void LLPanelFace::getState() texture_ctrl->setImageAssetID( id ); shinytexture_ctrl->setTentative( TRUE ); shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( id ); + shinytexture_ctrl->setImageAssetID( LLUUID::null ); bumpytexture_ctrl->setTentative( TRUE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( id ); + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -1091,11 +1091,6 @@ void LLPanelFace::getState() getChild("checkbox fullbright")->setTentative(!identical); } - // Repeats per meter label - { - getChildView("rpt")->setEnabled(editable); - } - // Repeats per meter { F32 repeats = 1.f; @@ -1126,7 +1121,7 @@ void LLPanelFace::getState() // Materials { mMaterialID = LLMaterialID::null; - //mMaterial = LLMaterialPtr(); + mMaterial.reset(); struct f1 : public LLSelectedTEGetFunctor { LLMaterialID get(LLViewerObject* object, S32 te_index) @@ -1142,6 +1137,7 @@ void LLPanelFace::getState() << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; if (!mMaterialID.isNull() && editable) { + llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } } @@ -1209,14 +1205,25 @@ void LLPanelFace::refresh() void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { - llinfos << "Material loaded: " << material_id.asString() - << ", LLSD: " << material->asLLSD() << llendl; mMaterial = material; - getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); - getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); - getChild("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); - getChild("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); +#if 0 + static LLMaterialID old_material_id = LLMaterialID::null; + if (material_id == old_material_id) + { + llinfos << "Material ID " << material_id.asString() + << " unchanged, not updating" << llendl; + return; + } + else + { + llinfos << "Material ID changed, old " << old_material_id.asString() + << ", new " << material_id.asString() + << ", updating controls: " << material->asLLSD() + << llendl; + } + old_material_id = material_id; +#endif + // Alpha LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) @@ -1227,17 +1234,18 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } - onCommitAlphaMode(getChild("combobox alphamode"),this); - LLComboBox* comboMaterialType = getChild("combobox mattype"); + getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); + updateAlphaControls(getChild("combobox alphamode"),this); + + // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; - if ((comboMaterialType->getCurrentIndex() == MATTYPE_SPECULAR) && - !material->getSpecularID().isNull()) + LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + texture_ctrl->setImageAssetID(material->getSpecularID()); + if (!material->getSpecularID().isNull()) { material->getSpecularOffset(offset_x,offset_y); material->getSpecularRepeat(repeat_x,repeat_y); rot = material->getSpecularRotation(); - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); - texture_ctrl->setImageAssetID(material->getSpecularID()); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) @@ -1253,15 +1261,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("shinyRot")->setValue(rot); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); + getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + getChild("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); + getChild("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); } - if ((comboMaterialType->getCurrentIndex() == MATTYPE_NORMAL) && - !material->getNormalID().isNull()) + + // Bumpy (normal) + texture_ctrl = getChild("bumpytexture control"); + texture_ctrl->setImageAssetID(material->getNormalID()); + if (!material->getNormalID().isNull()) { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); rot = material->getNormalRotation(); - LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); - texture_ctrl->setImageAssetID(material->getNormalID()); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) @@ -1289,42 +1302,69 @@ void LLPanelFace::updateMaterial() { return; } - if ((mIsAlpha && (comboAlphaMode->getCurrentIndex() != ALPHAMODE_BLEND)) - || (comboBumpiness->getCurrentIndex() != BUMPY_TEXTURE) - || (comboShininess->getCurrentIndex() != SHINY_TEXTURE)) + U32 alpha_mode = comboAlphaMode->getCurrentIndex(); + U32 bumpiness = comboBumpiness->getCurrentIndex(); + U32 shininess = comboShininess->getCurrentIndex(); + if ((mIsAlpha && (alpha_mode != ALPHAMODE_BLEND)) + || (bumpiness == BUMPY_TEXTURE) + || (shininess == SHINY_TEXTURE)) { // The user's specified something that needs a material. if (!mMaterial) { mMaterial = LLMaterialPtr(new LLMaterial()); } - mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); - mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), - getChild("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(getChild("bumpyScaleU")->getValue().asReal(), - getChild("bumpyScaleV")->getValue().asReal()); - mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()); - 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()); + if (bumpiness == BUMPY_TEXTURE) + { + mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); + mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), + getChild("bumpyOffsetV")->getValue().asReal()); + mMaterial->setNormalRepeat(getChild("bumpyScaleU")->getValue().asReal(), + getChild("bumpyScaleV")->getValue().asReal()); + mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()); + } + else + { + mMaterial->setNormalID(LLUUID()); + mMaterial->setNormalOffset(0.0f,0.0f); + mMaterial->setNormalRepeat(1.0f,1.0f); + mMaterial->setNormalRotation(0.0f); + } + if (shininess == SHINY_TEXTURE) + { + 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()); + } + else + { + mMaterial->setSpecularID(LLUUID()); + mMaterial->setSpecularOffset(0.0f,0.0f); + mMaterial->setSpecularRepeat(1.0f,1.0f); + mMaterial->setSpecularRotation(0.0f); + } mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + llinfos << "Updating material: " << mMaterial->asLLSD() << llendl; + LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); } else { // The user has specified settings that don't need a material. - if (mMaterial) + if (mMaterial || !mMaterialID.isNull()) { + llinfos << "Resetting material entry" << llendl; mMaterial.reset(); + mMaterialID = LLMaterialID::null; + // Delete existing material entry... } } - LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); } // @@ -1345,7 +1385,8 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -1368,23 +1409,21 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - // Get material info so we can use it later - if (self->mMaterial) - { - self->onMaterialLoaded(self->mMaterialID,self->mMaterial); - } - LLComboBox* comboMaterialsMedia = self->getChild("combobox matmedia"); - LLComboBox* comboMaterialType = self->getChild("combobox mattype"); - if (!comboMaterialType || !comboMaterialsMedia) + LLComboBox* combo_matmedia = self->getChild("combobox matmedia"); + LLComboBox* combo_mattype = self->getChild("combobox mattype"); + LLComboBox* combo_shininess = self->getChild("combobox shininess"); + LLComboBox* combo_bumpiness = self->getChild("combobox bumpiness"); + if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness) { + llwarns << "Combo box not found...exiting." << llendl; return; } - U32 materials_media = comboMaterialsMedia->getCurrentIndex(); - U32 material_type = comboMaterialType->getCurrentIndex(); - bool show_media = (materials_media == MATMEDIA_MEDIA) && comboMaterialsMedia->getEnabled(); - bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE) && comboMaterialsMedia->getEnabled(); - bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && comboMaterialsMedia->getEnabled(); - bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && comboMaterialsMedia->getEnabled(); + U32 materials_media = combo_matmedia->getCurrentIndex(); + U32 material_type = combo_mattype->getCurrentIndex(); + bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); + 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(!show_media); @@ -1402,7 +1441,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("maskcutoff")->setVisible(false); if (show_texture) { - onCommitAlphaMode(ctrl, userdata); + updateAlphaControls(ctrl, userdata); } self->getChildView("TexScaleU")->setVisible(show_texture); self->getChildView("TexScaleV")->setVisible(show_texture); @@ -1422,7 +1461,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("shinycolorswatch")->setVisible(false); if (show_shininess) { - onCommitShiny(ctrl, userdata); + updateShinyControls(ctrl, userdata); } self->getChildView("shinyScaleU")->setVisible(show_shininess); self->getChildView("shinyScaleV")->setVisible(show_shininess); @@ -1442,13 +1481,9 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) // Enable texture scale/rotation/offset parameters if there's one // present to set for - bool texParmsEnable = show_texture; - if (self->mMaterial) - { - texParmsEnable = texParmsEnable || - (!self->mMaterial->getNormalID().isNull() && show_bumpiness) || - (!self->mMaterial->getSpecularID().isNull() && show_shininess); - } + 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); @@ -1491,8 +1526,9 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) { + llinfos << "Entered." << llendl; LLPanelFace* self = (LLPanelFace*) userdata; LLComboBox* comboShiny = self->getChild("combobox shininess"); if (!comboShiny) @@ -1507,12 +1543,21 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) self->getChildView("environment")->setVisible(show_shinyctrls); self->getChildView("label shinycolor")->setVisible(show_shinyctrls); self->getChildView("shinycolorswatch")->setVisible(show_shinyctrls); +} + +// static +void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; self->sendShiny(); + llinfos << "updating material" << llendl; + //self->updateMaterial(); } // static -void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata) { + llinfos << "Entered." << llendl; LLPanelFace* self = (LLPanelFace*) userdata; LLComboBox* comboAlphaMode = self->getChild("combobox alphamode"); if (!comboAlphaMode) @@ -1523,7 +1568,15 @@ void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking self->getChildView("label maskcutoff")->setVisible(show_alphactrls); self->getChildView("maskcutoff")->setVisible(show_alphactrls); - self->updateMaterial(); +} + +// static +void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + self->updateAlphaControls(ctrl,userdata); + llinfos << "updating material" << llendl; + //self->updateMaterial(); } // static @@ -1577,25 +1630,29 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) { - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) { // not sure what to do here other than - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) { - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } //static void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) { - LLPanelFace* self = (LLPanelFace*) userdata; - self->updateMaterial(); + llinfos << "updating material" << llendl; + //LLPanelFace* self = (LLPanelFace*) userdata; + //self->updateMaterial(); } // static @@ -1699,10 +1756,10 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) switch (mattype) { case MATTYPE_SPECULAR: - which_control = "shinytexture_control"; + which_control = "shinytexture control"; break; case MATTYPE_NORMAL: - which_control = "bumpytexture_control"; + which_control = "bumpytexture control"; break; // no default needed } -- cgit v1.2.3 From 132db13fb6bb6dd802d3ee000a10e91127403547 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 31 Jan 2013 14:49:11 -0600 Subject: Fixing VC++ compile error: calling a static routine doesn't need the "this" pointer --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 4f61d5bbb6..474fa9d58e 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1573,8 +1573,8 @@ void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata) // static void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) { - LLPanelFace* self = (LLPanelFace*) userdata; - self->updateAlphaControls(ctrl,userdata); + //LLPanelFace* self = (LLPanelFace*) userdata; + updateAlphaControls(ctrl,userdata); llinfos << "updating material" << llendl; //self->updateMaterial(); } -- cgit v1.2.3 From da82358116606a76c84379fe8877ec7339c169e2 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Sun, 3 Feb 2013 23:00:37 -0600 Subject: Enable sending material updates. --- indra/newview/llpanelface.cpp | 44 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 474fa9d58e..e0f9ec9b99 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1206,23 +1206,6 @@ void LLPanelFace::refresh() void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { mMaterial = material; -#if 0 - static LLMaterialID old_material_id = LLMaterialID::null; - if (material_id == old_material_id) - { - llinfos << "Material ID " << material_id.asString() - << " unchanged, not updating" << llendl; - return; - } - else - { - llinfos << "Material ID changed, old " << old_material_id.asString() - << ", new " << material_id.asString() - << ", updating controls: " << material->asLLSD() - << llendl; - } - old_material_id = material_id; -#endif // Alpha LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); @@ -1385,8 +1368,7 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - llinfos << "updating material" << llendl; - //updateMaterial(); + updateMaterial(); } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -1528,7 +1510,6 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) // static void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) { - llinfos << "Entered." << llendl; LLPanelFace* self = (LLPanelFace*) userdata; LLComboBox* comboShiny = self->getChild("combobox shininess"); if (!comboShiny) @@ -1550,14 +1531,12 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; self->sendShiny(); - llinfos << "updating material" << llendl; - //self->updateMaterial(); + self->updateMaterial(); } // static void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata) { - llinfos << "Entered." << llendl; LLPanelFace* self = (LLPanelFace*) userdata; LLComboBox* comboAlphaMode = self->getChild("combobox alphamode"); if (!comboAlphaMode) @@ -1573,10 +1552,9 @@ void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata) // static void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) { - //LLPanelFace* self = (LLPanelFace*) userdata; + LLPanelFace* self = (LLPanelFace*) userdata; updateAlphaControls(ctrl,userdata); - llinfos << "updating material" << llendl; - //self->updateMaterial(); + self->updateMaterial(); } // static @@ -1630,29 +1608,25 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) { - llinfos << "updating material" << llendl; - //updateMaterial(); + updateMaterial(); } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) { // not sure what to do here other than - llinfos << "updating material" << llendl; - //updateMaterial(); + updateMaterial(); } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) { - llinfos << "updating material" << llendl; - //updateMaterial(); + updateMaterial(); } //static void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) { - llinfos << "updating material" << llendl; - //LLPanelFace* self = (LLPanelFace*) userdata; - //self->updateMaterial(); + LLPanelFace* self = (LLPanelFace*) userdata; + self->updateMaterial(); } // static -- cgit v1.2.3 From f2b026138d5abe5464de6db349b3431c262de53a Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Tue, 5 Feb 2013 03:30:56 -0600 Subject: Don't send a materials update to the sim until the previous one has been acknowledged. --- indra/newview/llpanelface.cpp | 93 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e0f9ec9b99..7b3bbf8b3b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -257,7 +257,9 @@ LLPanelFace::LLPanelFace() : LLPanel(), mMaterialID(LLMaterialID::null), mMaterial(LLMaterialPtr()), - mIsAlpha(FALSE) + mIsAlpha(false), + mUpdateInFlight(false), + mUpdatePending(false) { } @@ -1140,6 +1142,13 @@ void LLPanelFace::getState() llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } + if (mUpdatePending && !mUpdateInFlight) + { + // One or more updates are pending, and the + // previous one has been acknowledged. Send + // the pending updates. + updateMaterial(); + } } // Set variable values for numeric expressions @@ -1206,6 +1215,9 @@ void LLPanelFace::refresh() void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { mMaterial = material; + // We've gotten a materials update, so the sim's ready for another. + mUpdateInFlight = false; + // Alpha LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); @@ -1278,6 +1290,11 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate void LLPanelFace::updateMaterial() { + if (mUpdateInFlight) + { + LL_WARNS("Materials") << "Attempt to update material while a previous update is pending ignored." << LL_ENDL; + return; + } LLComboBox* comboAlphaMode = getChild("combobox alphamode"); LLComboBox* comboBumpiness = getChild("combobox bumpiness"); LLComboBox* comboShininess = getChild("combobox shininess"); @@ -1336,6 +1353,10 @@ void LLPanelFace::updateMaterial() mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); llinfos << "Updating material: " << mMaterial->asLLSD() << llendl; LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); + + // We've sent an update. Need to hold off on any more until + // the sim acknowledges this one. + mUpdateInFlight = true; } else { @@ -1346,8 +1367,15 @@ void LLPanelFace::updateMaterial() mMaterial.reset(); mMaterialID = LLMaterialID::null; // Delete existing material entry... + + // Hold off any further updates till this one's + // acknowledged. + //mUpdateInFlight = true; } } + + // We've taken care of the update, so clear the update pending flag. + mUpdatePending = false; } // @@ -1368,7 +1396,14 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -1531,7 +1566,14 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; self->sendShiny(); - self->updateMaterial(); + if (!self->mUpdateInFlight) + { + self->updateMaterial(); + } + else + { + self->mUpdatePending = true; + } } // static @@ -1554,7 +1596,14 @@ void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; updateAlphaControls(ctrl,userdata); - self->updateMaterial(); + if (!self->mUpdateInFlight) + { + self->updateMaterial(); + } + else + { + self->mUpdatePending = true; + } } // static @@ -1608,25 +1657,53 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) { - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) { // not sure what to do here other than - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) { - updateMaterial(); + if (!mUpdateInFlight) + { + updateMaterial(); + } + else + { + mUpdatePending = true; + } } //static void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->updateMaterial(); + if (!self->mUpdateInFlight) + { + self->updateMaterial(); + } + else + { + self->mUpdatePending = true; + } } // static -- cgit v1.2.3 From 3422f75cf749df10c7bb7711b9a7fa870655818f Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Wed, 6 Feb 2013 21:38:05 -0600 Subject: Tell the renderer to use the updated material immediately on editing it. --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7b3bbf8b3b..7e9fe212dd 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1352,7 +1352,7 @@ void LLPanelFace::updateMaterial() mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); llinfos << "Updating material: " << mMaterial->asLLSD() << llendl; - LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); + LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); // We've sent an update. Need to hold off on any more until // the sim acknowledges this one. -- cgit v1.2.3 From 64a4a13397ea7b895ebbeb707bdba72e2d97ff6b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 15 Feb 2013 15:40:43 -0500 Subject: fix crasher in setNumTEs --- indra/newview/llpanelface.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7e9fe212dd..5c4c2693f8 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1290,6 +1290,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate void LLPanelFace::updateMaterial() { + LL_WARNS("Materials") << LL_ENDL; if (mUpdateInFlight) { LL_WARNS("Materials") << "Attempt to update material while a previous update is pending ignored." << LL_ENDL; @@ -1351,7 +1352,7 @@ void LLPanelFace::updateMaterial() mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); - llinfos << "Updating material: " << mMaterial->asLLSD() << llendl; + LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); // We've sent an update. Need to hold off on any more until @@ -1363,7 +1364,7 @@ void LLPanelFace::updateMaterial() // The user has specified settings that don't need a material. if (mMaterial || !mMaterialID.isNull()) { - llinfos << "Resetting material entry" << llendl; + LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; mMaterial.reset(); mMaterialID = LLMaterialID::null; // Delete existing material entry... @@ -1657,6 +1658,7 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) { + LL_DEBUGS("Materials") << data << "\n" << (mUpdateInFlight ? "In Flight" : "Now Pending" ) << LL_ENDL; if (!mUpdateInFlight) { updateMaterial(); @@ -1682,6 +1684,7 @@ void LLPanelFace::onCancelMaterialTexture(const LLSD& data) void LLPanelFace::onSelectMaterialTexture(const LLSD& data) { + LL_DEBUGS("Materials") << data << LL_ENDL; if (!mUpdateInFlight) { updateMaterial(); -- cgit v1.2.3 From fa7dd433088963a101252884f35fda8094f4a76b Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Wed, 27 Feb 2013 19:27:46 -0600 Subject: Wire up LLMaterialMgr::remove() to edit panel. --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 5c4c2693f8..ca161a8654 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1368,10 +1368,10 @@ void LLPanelFace::updateMaterial() mMaterial.reset(); mMaterialID = LLMaterialID::null; // Delete existing material entry... - + LLSelectMgr::getInstance()->selectionRemoveMaterial(); // Hold off any further updates till this one's // acknowledged. - //mUpdateInFlight = true; + mUpdateInFlight = true; } } -- cgit v1.2.3 From 8b24857f6ae7f4d719697f17e664f095a8aa2753 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Sat, 9 Mar 2013 16:11:55 -0600 Subject: Dynamically add and remove "Use texture" normal/specular setting. --- indra/newview/llpanelface.cpp | 216 ++++++++++++++++++++++-------------------- 1 file changed, 111 insertions(+), 105 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ca161a8654..b205997615 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -56,6 +56,7 @@ #include "lltexturectrl.h" #include "lltextureentry.h" #include "lltooldraganddrop.h" +#include "lltrans.h" #include "llui.h" #include "llviewercontrol.h" #include "llviewermedia.h" @@ -82,6 +83,12 @@ const S32 ALPHAMODE_MASK = 2; // Alpha masking mode const S32 BUMPY_TEXTURE = 18; // use supplied normal map const S32 SHINY_TEXTURE = 4; // use supplied specular map +// +// "Use texture" label for normal/specular type comboboxes +// Filled in at initialization from translated strings +// +std::string USE_TEXTURE; + // // Methods // @@ -257,10 +264,9 @@ LLPanelFace::LLPanelFace() : LLPanel(), mMaterialID(LLMaterialID::null), mMaterial(LLMaterialPtr()), - mIsAlpha(false), - mUpdateInFlight(false), - mUpdatePending(false) + mIsAlpha(false) { + USE_TEXTURE = LLTrans::getString("use_texture"); } @@ -291,7 +297,13 @@ void LLPanelFace::sendBump() { LLComboBox* mComboBumpiness = getChild("combobox bumpiness"); if(!mComboBumpiness)return; - U8 bump = (U8) mComboBumpiness->getCurrentIndex() & TEM_BUMP_MASK; + U32 bumpiness = mComboBumpiness->getCurrentIndex(); + if (bumpiness < BUMPY_TEXTURE) + { + LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); + texture_ctrl->setImageAssetID(LLUUID()); + } + U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); } @@ -307,7 +319,13 @@ void LLPanelFace::sendShiny() { LLComboBox* mComboShininess = getChild("combobox shininess"); if(!mComboShininess)return; - U8 shiny = (U8) mComboShininess->getCurrentIndex() & TEM_SHINY_MASK; + U32 shininess = mComboShininess->getCurrentIndex(); + if (shininess < SHINY_TEXTURE) + { + LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + texture_ctrl->setImageAssetID(LLUUID()); + } + U8 shiny = (U8) shininess & TEM_SHINY_MASK; LLSelectMgr::getInstance()->selectionSetShiny( shiny ); } @@ -1142,13 +1160,6 @@ void LLPanelFace::getState() llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } - if (mUpdatePending && !mUpdateInFlight) - { - // One or more updates are pending, and the - // previous one has been acknowledged. Send - // the pending updates. - updateMaterial(); - } } // Set variable values for numeric expressions @@ -1215,8 +1226,6 @@ void LLPanelFace::refresh() void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { mMaterial = material; - // We've gotten a materials update, so the sim's ready for another. - mUpdateInFlight = false; // Alpha LLCtrlSelectionInterface* combobox_alphamode = @@ -1236,21 +1245,12 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate F32 offset_x, offset_y, repeat_x, repeat_y, rot; LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); texture_ctrl->setImageAssetID(material->getSpecularID()); + LLComboBox* combobox_shininess = getChild("combobox shininess"); if (!material->getSpecularID().isNull()) { material->getSpecularOffset(offset_x,offset_y); material->getSpecularRepeat(repeat_x,repeat_y); rot = material->getSpecularRotation(); - LLCtrlSelectionInterface* combobox_shininess = - childGetSelectionInterface("combobox shininess"); - if (combobox_shininess) - { - combobox_shininess->selectNthItem(SHINY_TEXTURE); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; - } getChild("shinyScaleU")->setValue(repeat_x); getChild("shinyScaleV")->setValue(repeat_y); getChild("shinyRot")->setValue(rot); @@ -1261,41 +1261,29 @@ 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); // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); + LLComboBox* combobox_bumpiness = getChild("combobox bumpiness"); if (!material->getNormalID().isNull()) { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); rot = material->getNormalRotation(); - LLCtrlSelectionInterface* combobox_bumpiness = - childGetSelectionInterface("combobox bumpiness"); - if (combobox_bumpiness) - { - combobox_bumpiness->selectNthItem(BUMPY_TEXTURE); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; - } getChild("bumpyScaleU")->setValue(repeat_x); getChild("bumpyScaleV")->setValue(repeat_y); getChild("bumpyRot")->setValue(rot); getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); } + updateBumpyControls(combobox_bumpiness,this); } void LLPanelFace::updateMaterial() { - LL_WARNS("Materials") << LL_ENDL; - if (mUpdateInFlight) - { - LL_WARNS("Materials") << "Attempt to update material while a previous update is pending ignored." << LL_ENDL; - return; - } + LL_WARNS("Materials") << "Entered." << LL_ENDL; LLComboBox* comboAlphaMode = getChild("combobox alphamode"); LLComboBox* comboBumpiness = getChild("combobox bumpiness"); LLComboBox* comboShininess = getChild("combobox shininess"); @@ -1317,6 +1305,7 @@ void LLPanelFace::updateMaterial() } if (bumpiness == BUMPY_TEXTURE) { + LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); @@ -1326,6 +1315,7 @@ void LLPanelFace::updateMaterial() } else { + LL_DEBUGS("Materials") << "Removing bumpy texture, bumpiness = " << bumpiness << LL_ENDL; mMaterial->setNormalID(LLUUID()); mMaterial->setNormalOffset(0.0f,0.0f); mMaterial->setNormalRepeat(1.0f,1.0f); @@ -1333,6 +1323,7 @@ void LLPanelFace::updateMaterial() } if (shininess == SHINY_TEXTURE) { + LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; mMaterial->setSpecularID(getChild("shinytexture control")->getImageAssetID()); mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); @@ -1342,6 +1333,7 @@ void LLPanelFace::updateMaterial() } else { + LL_DEBUGS("Materials") << "Removing shiny texture, shininess = " << shininess << LL_ENDL; mMaterial->setSpecularID(LLUUID()); mMaterial->setSpecularOffset(0.0f,0.0f); mMaterial->setSpecularRepeat(1.0f,1.0f); @@ -1354,10 +1346,6 @@ void LLPanelFace::updateMaterial() mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); - - // We've sent an update. Need to hold off on any more until - // the sim acknowledges this one. - mUpdateInFlight = true; } else { @@ -1369,14 +1357,8 @@ void LLPanelFace::updateMaterial() mMaterialID = LLMaterialID::null; // Delete existing material entry... LLSelectMgr::getInstance()->selectionRemoveMaterial(); - // Hold off any further updates till this one's - // acknowledged. - mUpdateInFlight = true; } } - - // We've taken care of the update, so clear the update pending flag. - mUpdatePending = false; } // @@ -1397,14 +1379,7 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - if (!mUpdateInFlight) - { - updateMaterial(); - } - else - { - mUpdatePending = true; - } + updateMaterial(); } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -1488,6 +1463,10 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("shinyOffsetV")->setVisible(show_shininess); // Normal map controls + if (show_bumpiness) + { + updateBumpyControls(ctrl, userdata); + } self->getChildView("bumpytexture control")->setVisible(show_bumpiness); self->getChildView("combobox bumpiness")->setVisible(show_bumpiness); self->getChildView("label bumpiness")->setVisible(show_bumpiness); @@ -1547,13 +1526,39 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) { 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 (!comboShiny->itemExists(USE_TEXTURE)) + { + comboShiny->add(USE_TEXTURE); + } + comboShiny->setSimple(USE_TEXTURE); + } + else + { + 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(); + 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); // Use texture + 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); @@ -1563,20 +1568,44 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->sendShiny(); - if (!self->mUpdateInFlight) + LLTextureCtrl* texture_ctrl = self->getChild("bumpytexture control"); + LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); + LL_DEBUGS("Materials") << "Bumpy texture selected: " << bumpy_texture_ID << LL_ENDL; + LLComboBox* comboBumpy = self->getChild("combobox bumpiness"); + if (!comboBumpy) { - self->updateMaterial(); + return; + } + if (!bumpy_texture_ID.isNull()) + { + if (!comboBumpy->itemExists(USE_TEXTURE)) + { + comboBumpy->add(USE_TEXTURE); + } + comboBumpy->setSimple(USE_TEXTURE); } else { - self->mUpdatePending = true; + 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); + } } } +// static +void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + self->sendShiny(); + self->updateMaterial(); +} + // static void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata) { @@ -1597,14 +1626,7 @@ void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; updateAlphaControls(ctrl,userdata); - if (!self->mUpdateInFlight) - { - self->updateMaterial(); - } - else - { - self->mUpdatePending = true; - } + self->updateMaterial(); } // static @@ -1658,55 +1680,39 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) { - LL_DEBUGS("Materials") << data << "\n" << (mUpdateInFlight ? "In Flight" : "Now Pending" ) << LL_ENDL; - if (!mUpdateInFlight) - { - updateMaterial(); - } - else - { - mUpdatePending = true; - } + LL_DEBUGS("Materials") << data << LL_ENDL; + updateMaterial(); + LLComboBox* combo_shiny = getChild("combobox shininess"); + updateShinyControls(combo_shiny,this); + LLComboBox* combo_bumpy = getChild("combobox bumpiness"); + updateBumpyControls(combo_bumpy,this); } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) { // not sure what to do here other than - if (!mUpdateInFlight) - { - updateMaterial(); - } - else - { - mUpdatePending = true; - } + updateMaterial(); + LLComboBox* combo_shiny = getChild("combobox shininess"); + updateShinyControls(combo_shiny,this); + LLComboBox* combo_bumpy = getChild("combobox bumpiness"); + updateBumpyControls(combo_bumpy,this); } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; - if (!mUpdateInFlight) - { - updateMaterial(); - } - else - { - mUpdatePending = true; - } + updateMaterial(); + LLComboBox* combo_shiny = getChild("combobox shininess"); + updateShinyControls(combo_shiny,this); + LLComboBox* combo_bumpy = getChild("combobox bumpiness"); + updateBumpyControls(combo_bumpy,this); } //static void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - if (!self->mUpdateInFlight) - { - self->updateMaterial(); - } - else - { - self->mUpdatePending = true; - } + self->updateMaterial(); } // static -- cgit v1.2.3 From 6620c1f824f2034d432662a84174019a26ed9a78 Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 14 Mar 2013 11:44:09 -0500 Subject: Don't set shiny/bumpy texture pickers to NULL unless not editable. --- indra/newview/llpanelface.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b205997615..210b1e9dca 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -732,10 +732,13 @@ void LLPanelFace::getState() texture_ctrl->setImageAssetID( id ); shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( LLUUID::null ); + if (!editable) + { + shinytexture_ctrl->setImageAssetID( LLUUID::null ); + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); + } bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -771,10 +774,13 @@ void LLPanelFace::getState() texture_ctrl->setImageAssetID( id ); shinytexture_ctrl->setTentative( TRUE ); shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( LLUUID::null ); + if (!editable) + { + shinytexture_ctrl->setImageAssetID( LLUUID::null ); + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); + } bumpytexture_ctrl->setTentative( TRUE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -1225,6 +1231,7 @@ void LLPanelFace::refresh() void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { + LL_DEBUGS("Materials") << "Loaded material " << material_id.asString() << material->asLLSD() << LL_ENDL; mMaterial = material; // Alpha @@ -1283,7 +1290,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate void LLPanelFace::updateMaterial() { - LL_WARNS("Materials") << "Entered." << LL_ENDL; + LL_DEBUGS("Materials") << "Entered." << LL_ENDL; LLComboBox* comboAlphaMode = getChild("combobox alphamode"); LLComboBox* comboBumpiness = getChild("combobox bumpiness"); LLComboBox* comboShininess = getChild("combobox shininess"); -- cgit v1.2.3 From adcf2d98e39bc8cc4b480bcf8d88a037d9b4140d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 30 Mar 2013 15:51:16 -0500 Subject: NORSPEC-72 Set default value of glossiness to 0.2 --- indra/newview/llpanelface.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 210b1e9dca..7b99d5897e 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1309,7 +1309,22 @@ void LLPanelFace::updateMaterial() if (!mMaterial) { mMaterial = LLMaterialPtr(new LLMaterial()); + //set defaults according to UI spec + mMaterial->setSpecularLightColor(LLColor4U::white); + mMaterial->setSpecularLightExponent((U8) (255*0.2f)); + mMaterial->setEnvironmentIntensity(0); + mMaterial->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + mMaterial->setAlphaMaskCutoff(0); } + else + { + mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); + mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); + mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); + 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; @@ -1346,11 +1361,7 @@ void LLPanelFace::updateMaterial() mMaterial->setSpecularRepeat(1.0f,1.0f); mMaterial->setSpecularRotation(0.0f); } - mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); - mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); - mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); } -- cgit v1.2.3 From 4a6dde3b36c7a9bd7ed6602e291b8436fdbd4378 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 30 Mar 2013 16:06:03 -0500 Subject: NORSPEC-69 Fix for bump and specular map rotation values showing up as radians instead of degrees. --- indra/newview/llpanelface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7b99d5897e..754a13dd4c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1260,7 +1260,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate rot = material->getSpecularRotation(); getChild("shinyScaleU")->setValue(repeat_x); getChild("shinyScaleV")->setValue(repeat_y); - getChild("shinyRot")->setValue(rot); + getChild("shinyRot")->setValue(rot*RAD_TO_DEG); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); @@ -1281,7 +1281,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate rot = material->getNormalRotation(); getChild("bumpyScaleU")->setValue(repeat_x); getChild("bumpyScaleV")->setValue(repeat_y); - getChild("bumpyRot")->setValue(rot); + getChild("bumpyRot")->setValue(rot*RAD_TO_DEG); getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); } @@ -1333,7 +1333,7 @@ void LLPanelFace::updateMaterial() getChild("bumpyOffsetV")->getValue().asReal()); mMaterial->setNormalRepeat(getChild("bumpyScaleU")->getValue().asReal(), getChild("bumpyScaleV")->getValue().asReal()); - mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()); + mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else { @@ -1351,7 +1351,7 @@ void LLPanelFace::updateMaterial() getChild("shinyOffsetV")->getValue().asReal()); mMaterial->setSpecularRepeat(getChild("shinyScaleU")->getValue().asReal(), getChild("shinyScaleV")->getValue().asReal()); - mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()); + mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); } else { -- cgit v1.2.3 From 961d52fbd3d8f5cc14aad2da93455e9e21873793 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Mon, 1 Apr 2013 12:31:20 -0700 Subject: NORSPEC-47 alpha mode enabled for textures without alpha channels --- indra/newview/llpanelface.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 754a13dd4c..0d7b4b88c9 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -694,7 +694,24 @@ void LLPanelFace::getState() } } func2; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); - mIsAlpha = image_format != GL_RGB; + + 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; + } if(LLViewerMedia::textureHasMedia(id)) { -- cgit v1.2.3 From 4bbb21ec2d8143064887365a43e1b9fbb0800fd3 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Mon, 1 Apr 2013 12:58:14 -0700 Subject: NORSPEC-23 tex box fails to indicate multiple textures in use --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 0d7b4b88c9..38a45ff4ce 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -693,7 +693,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) -- cgit v1.2.3 From a1a6699684d3f80bd0c3fbb9e845ac9ff0986cec Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Tue, 2 Apr 2013 09:41:57 -0700 Subject: NORSPEC-23 and NORSPEC-47 fix llpanelface issues with reflecting default alpha blend state and presence of multiple textures when editing at face level --- indra/newview/llpanelface.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 754a13dd4c..44f45e9995 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -693,8 +693,25 @@ void LLPanelFace::getState() return image_format; } } func2; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); - mIsAlpha = image_format != GL_RGB; + identical &= 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: + { + llinfos << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; + } + break; + } if(LLViewerMedia::textureHasMedia(id)) { -- cgit v1.2.3 From 6fcec6b47d5bef94c66bd9b01382c2ea6c94e45b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Apr 2013 18:23:22 -0500 Subject: NORSPEC-70 Hook up material texture parameters to build UI in a way that isn't infuriating to the user. --- indra/newview/llpanelface.cpp | 364 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 316 insertions(+), 48 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 38a45ff4ce..4dad363eb8 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -647,9 +647,12 @@ void LLPanelFace::getState() LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + LLUUID id; + LLUUID normmap_id; + LLUUID specmap_id; + // Texture { - LLUUID id; struct f1 : public LLSelectedTEGetFunctor { LLUUID get(LLViewerObject* object, S32 te_index) @@ -680,6 +683,45 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); + // Normal map + struct norm_get : public LLSelectedTEGetFunctor + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + LLUUID id; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + id = mat->getNormalID(); + } + + return id; + } + } norm_get_func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &norm_get_func, normmap_id ) && identical; + + // Specular map + struct spec_get : public LLSelectedTEGetFunctor + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + LLUUID id; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + id = mat->getSpecularID(); + } + + return id; + } + } spec_get_func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ) && identical; + + mIsAlpha = FALSE; LLGLenum image_format; struct f2 : public LLSelectedTEGetFunctor @@ -693,7 +735,7 @@ void LLPanelFace::getState() return image_format; } } func2; - identical &= LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ) && identical; mIsAlpha = FALSE; switch (image_format) @@ -747,20 +789,27 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + } + + if (shinytexture_ctrl) + { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); - if (!editable) - { - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } + shinytexture_ctrl->setImageAssetID(specmap_id); + } + + if (bumpytexture_ctrl) + { 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); + 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); + } else { @@ -772,12 +821,6 @@ void LLPanelFace::getState() 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); @@ -789,25 +832,47 @@ void LLPanelFace::getState() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - shinytexture_ctrl->setTentative( TRUE ); - shinytexture_ctrl->setEnabled( editable ); - if (!editable) - { - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } - bumpytexture_ctrl->setTentative( TRUE ); - 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); } } + + 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 + { + shinytexture_ctrl->setTentative( TRUE ); + shinytexture_ctrl->setEnabled( FALSE ); + shinytexture_ctrl->setImageAssetID( normmap_id); + } + } } } - - + // planar align bool align_planar = false; bool identical_planar_aligned = false; @@ -855,17 +920,60 @@ void LLPanelFace::getState() return object->getTE(face)->mScaleS; } } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; getChild("TexScaleU")->setValue(editable ? scale_s : 0); getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleU")->setEnabled(editable); + + scale_s = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularRepeat(s, t); + } + return s; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_s ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("shinyScaleU")->setValue(editable ? scale_s : 0); getChild("shinyScaleU")->setTentative(LLSD((BOOL)(!identical))); - getChildView("shinyScaleU")->setEnabled(FALSE); + getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); + + scale_s = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalRepeat(s, t); + } + return s; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_s ); + identical = align_planar ? identical_planar_aligned : identical; + + + getChild("bumpyScaleU")->setValue(editable ? scale_s : 0); getChild("bumpyScaleU")->setTentative(LLSD((BOOL)(!identical))); - getChildView("bumpyScaleU")->setEnabled(FALSE); + getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); } { @@ -883,12 +991,52 @@ void LLPanelFace::getState() getChild("TexScaleV")->setValue(editable ? scale_t : 0); getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleV")->setEnabled(editable); + + scale_t = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularRepeat(s, t); + } + return t; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_t ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyScaleV")->setValue(editable ? scale_t : 0); getChild("shinyScaleV")->setTentative(LLSD((BOOL)(!identical))); - getChildView("shinyScaleV")->setEnabled(FALSE); + getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); + + scale_t = 1.f; + struct f5 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalRepeat(s, t); + } + return t; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_t ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyScaleV")->setValue(editable ? scale_t : 0); getChild("bumpyScaleV")->setTentative(LLSD((BOOL)(!identical))); - getChildView("bumpyScaleV")->setEnabled(FALSE); + getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); + } // Texture offset @@ -907,12 +1055,51 @@ void LLPanelFace::getState() getChild("TexOffsetU")->setValue(editable ? offset_s : 0); getChild("TexOffsetU")->setTentative(!identical); getChildView("TexOffsetU")->setEnabled(editable); + + offset_s = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularOffset(s, t); + } + return s; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_s ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyOffsetU")->setValue(editable ? offset_s : 0); - getChild("shinyOffsetU")->setTentative(!identical); - getChildView("shinyOffsetU")->setEnabled(FALSE); + getChild("shinyOffsetU")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); + + offset_s = 1.f; + struct f5 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalOffset(s, t); + } + return s; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_s ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyOffsetU")->setValue(editable ? offset_s : 0); - getChild("bumpyOffsetU")->setTentative(!identical); - getChildView("bumpyOffsetU")->setEnabled(FALSE); + getChild("bumpyOffsetU")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()); } { @@ -929,12 +1116,52 @@ void LLPanelFace::getState() getChild("TexOffsetV")->setValue(editable ? offset_t : 0); getChild("TexOffsetV")->setTentative(!identical); getChildView("TexOffsetV")->setEnabled(editable); + + + offset_t = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularOffset(s, t); + } + return t; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_t ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyOffsetV")->setValue(editable ? offset_t : 0); - getChild("shinyOffsetV")->setTentative(!identical); - getChildView("shinyOffsetV")->setEnabled(FALSE); + getChild("shinyOffsetV")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); + + offset_t = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalOffset(s, t); + } + return t; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_t ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyOffsetV")->setValue(editable ? offset_t : 0); - getChild("bumpyOffsetV")->setTentative(!identical); - getChildView("bumpyOffsetV")->setEnabled(FALSE); + getChild("bumpyOffsetV")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()); } // Texture rotation @@ -952,12 +1179,53 @@ void LLPanelFace::getState() getChild("TexRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); getChild("TexRot")->setTentative(!identical); getChildView("TexRot")->setEnabled(editable); + + + + rotation = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 ret = 0.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + ret = mat->getSpecularRotation(); + } + return ret; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, rotation ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); - getChild("shinyRot")->setTentative(!identical); - getChildView("shinyRot")->setEnabled(FALSE); + getChild("shinyRot")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); + + rotation = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 ret = 0.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + ret = mat->getNormalRotation(); + } + return ret; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, rotation ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); - getChild("bumpyRot")->setTentative(!identical); - getChildView("bumpyRot")->setEnabled(FALSE); + getChild("bumpyRot")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); } // Color swatch @@ -1103,10 +1371,10 @@ void LLPanelFace::getState() { getChild("TexScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); getChild("TexScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); - getChild("shinyScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); - getChild("shinyScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); - getChild("bumpyScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); - getChild("bumpyScaleV")->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")); -- cgit v1.2.3 From d0b12d0af50d55d16328ec70833204094adb8bcb Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Apr 2013 18:23:22 -0500 Subject: NORSPEC-70 Hook up material texture parameters to build UI in a way that isn't infuriating to the user. --- indra/newview/llpanelface.cpp | 364 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 316 insertions(+), 48 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 44f45e9995..5f9ddb4e9b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -647,9 +647,12 @@ void LLPanelFace::getState() LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + LLUUID id; + LLUUID normmap_id; + LLUUID specmap_id; + // Texture { - LLUUID id; struct f1 : public LLSelectedTEGetFunctor { LLUUID get(LLViewerObject* object, S32 te_index) @@ -680,6 +683,45 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); + // Normal map + struct norm_get : public LLSelectedTEGetFunctor + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + LLUUID id; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + id = mat->getNormalID(); + } + + return id; + } + } norm_get_func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &norm_get_func, normmap_id ) && identical; + + // Specular map + struct spec_get : public LLSelectedTEGetFunctor + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + LLUUID id; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + id = mat->getSpecularID(); + } + + return id; + } + } spec_get_func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ) && identical; + + mIsAlpha = FALSE; LLGLenum image_format; struct f2 : public LLSelectedTEGetFunctor @@ -693,7 +735,7 @@ void LLPanelFace::getState() return image_format; } } func2; - identical &= LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ) && identical; mIsAlpha = FALSE; switch (image_format) @@ -747,20 +789,27 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + } + + if (shinytexture_ctrl) + { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); - if (!editable) - { - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } + shinytexture_ctrl->setImageAssetID(specmap_id); + } + + if (bumpytexture_ctrl) + { 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); + 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); + } else { @@ -772,12 +821,6 @@ void LLPanelFace::getState() 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); @@ -789,25 +832,47 @@ void LLPanelFace::getState() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - shinytexture_ctrl->setTentative( TRUE ); - shinytexture_ctrl->setEnabled( editable ); - if (!editable) - { - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } - bumpytexture_ctrl->setTentative( TRUE ); - 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); } } + + 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 + { + shinytexture_ctrl->setTentative( TRUE ); + shinytexture_ctrl->setEnabled( FALSE ); + shinytexture_ctrl->setImageAssetID( normmap_id); + } + } } } - - + // planar align bool align_planar = false; bool identical_planar_aligned = false; @@ -855,17 +920,60 @@ void LLPanelFace::getState() return object->getTE(face)->mScaleS; } } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; getChild("TexScaleU")->setValue(editable ? scale_s : 0); getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleU")->setEnabled(editable); + + scale_s = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularRepeat(s, t); + } + return s; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_s ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("shinyScaleU")->setValue(editable ? scale_s : 0); getChild("shinyScaleU")->setTentative(LLSD((BOOL)(!identical))); - getChildView("shinyScaleU")->setEnabled(FALSE); + getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); + + scale_s = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalRepeat(s, t); + } + return s; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_s ); + identical = align_planar ? identical_planar_aligned : identical; + + + getChild("bumpyScaleU")->setValue(editable ? scale_s : 0); getChild("bumpyScaleU")->setTentative(LLSD((BOOL)(!identical))); - getChildView("bumpyScaleU")->setEnabled(FALSE); + getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); } { @@ -883,12 +991,52 @@ void LLPanelFace::getState() getChild("TexScaleV")->setValue(editable ? scale_t : 0); getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleV")->setEnabled(editable); + + scale_t = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularRepeat(s, t); + } + return t; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_t ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyScaleV")->setValue(editable ? scale_t : 0); getChild("shinyScaleV")->setTentative(LLSD((BOOL)(!identical))); - getChildView("shinyScaleV")->setEnabled(FALSE); + getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); + + scale_t = 1.f; + struct f5 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalRepeat(s, t); + } + return t; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_t ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyScaleV")->setValue(editable ? scale_t : 0); getChild("bumpyScaleV")->setTentative(LLSD((BOOL)(!identical))); - getChildView("bumpyScaleV")->setEnabled(FALSE); + getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); + } // Texture offset @@ -907,12 +1055,51 @@ void LLPanelFace::getState() getChild("TexOffsetU")->setValue(editable ? offset_s : 0); getChild("TexOffsetU")->setTentative(!identical); getChildView("TexOffsetU")->setEnabled(editable); + + offset_s = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularOffset(s, t); + } + return s; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_s ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyOffsetU")->setValue(editable ? offset_s : 0); - getChild("shinyOffsetU")->setTentative(!identical); - getChildView("shinyOffsetU")->setEnabled(FALSE); + getChild("shinyOffsetU")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); + + offset_s = 1.f; + struct f5 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalOffset(s, t); + } + return s; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_s ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyOffsetU")->setValue(editable ? offset_s : 0); - getChild("bumpyOffsetU")->setTentative(!identical); - getChildView("bumpyOffsetU")->setEnabled(FALSE); + getChild("bumpyOffsetU")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()); } { @@ -929,12 +1116,52 @@ void LLPanelFace::getState() getChild("TexOffsetV")->setValue(editable ? offset_t : 0); getChild("TexOffsetV")->setTentative(!identical); getChildView("TexOffsetV")->setEnabled(editable); + + + offset_t = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getSpecularOffset(s, t); + } + return t; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_t ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyOffsetV")->setValue(editable ? offset_t : 0); - getChild("shinyOffsetV")->setTentative(!identical); - getChildView("shinyOffsetV")->setEnabled(FALSE); + getChild("shinyOffsetV")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); + + offset_t = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 s = 1.f, t = 1.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + mat->getNormalOffset(s, t); + } + return t; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_t ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyOffsetV")->setValue(editable ? offset_t : 0); - getChild("bumpyOffsetV")->setTentative(!identical); - getChildView("bumpyOffsetV")->setEnabled(FALSE); + getChild("bumpyOffsetV")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()); } // Texture rotation @@ -952,12 +1179,53 @@ void LLPanelFace::getState() getChild("TexRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); getChild("TexRot")->setTentative(!identical); getChildView("TexRot")->setEnabled(editable); + + + + rotation = 1.f; + struct f3 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 ret = 0.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + ret = mat->getSpecularRotation(); + } + return ret; + } + } shiny_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, rotation ); + identical = align_planar ? identical_planar_aligned : identical; getChild("shinyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); - getChild("shinyRot")->setTentative(!identical); - getChildView("shinyRot")->setEnabled(FALSE); + getChild("shinyRot")->setTentative(LLSD((BOOL)(!identical))); + getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); + + rotation = 1.f; + struct f4 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + F32 ret = 0.f; + + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + if (mat) + { + ret = mat->getNormalRotation(); + } + return ret; + } + } bump_func; + + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, rotation ); + identical = align_planar ? identical_planar_aligned : identical; + getChild("bumpyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); - getChild("bumpyRot")->setTentative(!identical); - getChildView("bumpyRot")->setEnabled(FALSE); + getChild("bumpyRot")->setTentative(LLSD((BOOL)(!identical))); + getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); } // Color swatch @@ -1103,10 +1371,10 @@ void LLPanelFace::getState() { getChild("TexScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); getChild("TexScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); - getChild("shinyScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); - getChild("shinyScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); - getChild("bumpyScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); - getChild("bumpyScaleV")->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")); -- cgit v1.2.3 From f189ba4a3d927fe0ecfb83b36b60a47c88525fdd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Apr 2013 16:56:59 -0500 Subject: NORSPEC-71 Lots more UI hookups Written with and Reviewed By Graham --- indra/newview/llpanelface.cpp | 97 ++++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 29 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 4dad363eb8..43001e7d2c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -301,10 +301,17 @@ void LLPanelFace::sendBump() if (bumpiness < BUMPY_TEXTURE) { LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); - texture_ctrl->setImageAssetID(LLUUID()); + //texture_ctrl->setImageAssetID(LLUUID()); + texture_ctrl->clear(); + LLSD dummy_data; + onSelectMaterialTexture(dummy_data); } U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); + + //refresh material state (in case this change impacts material params) + LLSD dummy_data; + onCommitMaterialTexture(dummy_data); } void LLPanelFace::sendTexGen() @@ -592,7 +599,7 @@ void LLPanelFace::sendTextureInfo() } void LLPanelFace::getState() -{ +{ //set state of UI to match state of texture entry(ies) (calls setEnabled, setValue, etc, but NOT setVisible) LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); if( objectp @@ -760,24 +767,45 @@ void LLPanelFace::getState() getChildView("button align")->setEnabled(editable); } + // Specular map + struct alpha_get : public LLSelectedTEGetFunctor { - // Default alpha mode to None if texture has no alpha, or Alpha Blending if present - // Will be overridden later if a material is present for this face - S32 default_alpha = ALPHAMODE_NONE; - if (mIsAlpha) + U8 get(LLViewerObject* object, S32 te_index) { - default_alpha = ALPHAMODE_BLEND; + U8 ret = 1; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + ret = mat->getDiffuseAlphaMode(); + } + + return ret; } + } alpha_get_func; + + U8 alpha_mode = 1; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &alpha_get_func, alpha_mode); + + { LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); + childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) { - combobox_alphamode->selectNthItem(default_alpha); + if (!mIsAlpha) + { + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + } + + combobox_alphamode->selectNthItem(alpha_mode); } else { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } + updateAlphaControls(getChild("combobox alphamode"),this); } @@ -1432,7 +1460,8 @@ void LLPanelFace::getState() // Materials { mMaterialID = LLMaterialID::null; - mMaterial.reset(); + mMaterial = NULL; + struct f1 : public LLSelectedTEGetFunctor { LLMaterialID get(LLViewerObject* object, S32 te_index) @@ -1515,10 +1544,13 @@ void LLPanelFace::refresh() } void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) -{ +{ //laying out UI based on material parameters (calls setVisible on various components) LL_DEBUGS("Materials") << "Loaded material " << material_id.asString() << material->asLLSD() << LL_ENDL; - mMaterial = material; - + + //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"); @@ -1586,30 +1618,21 @@ void LLPanelFace::updateMaterial() U32 alpha_mode = comboAlphaMode->getCurrentIndex(); U32 bumpiness = comboBumpiness->getCurrentIndex(); U32 shininess = comboShininess->getCurrentIndex(); - if ((mIsAlpha && (alpha_mode != ALPHAMODE_BLEND)) + if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)) || (bumpiness == BUMPY_TEXTURE) || (shininess == SHINY_TEXTURE)) { // The user's specified something that needs a material. + bool new_material = false; if (!mMaterial) { + new_material = true; mMaterial = LLMaterialPtr(new LLMaterial()); - //set defaults according to UI spec - mMaterial->setSpecularLightColor(LLColor4U::white); - mMaterial->setSpecularLightExponent((U8) (255*0.2f)); - mMaterial->setEnvironmentIntensity(0); - mMaterial->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); - mMaterial->setAlphaMaskCutoff(0); - } - else - { - mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); - mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); - mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); - 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; @@ -1637,6 +1660,20 @@ void LLPanelFace::updateMaterial() 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) + { + mMaterial->setSpecularLightColor(LLColor4U::white); + mMaterial->setSpecularLightExponent((U8) (0.2f*255.f)); + mMaterial->setEnvironmentIntensity(0); + } + else + { + mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); + mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); + mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); + } } else { @@ -1645,6 +1682,8 @@ void LLPanelFace::updateMaterial() mMaterial->setSpecularOffset(0.0f,0.0f); mMaterial->setSpecularRepeat(1.0f,1.0f); mMaterial->setSpecularRotation(0.0f); + mMaterial->setSpecularLightExponent(0); + mMaterial->setEnvironmentIntensity(0); } LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; @@ -1656,7 +1695,7 @@ void LLPanelFace::updateMaterial() if (mMaterial || !mMaterialID.isNull()) { LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; - mMaterial.reset(); + mMaterial = NULL; mMaterialID = LLMaterialID::null; // Delete existing material entry... LLSelectMgr::getInstance()->selectionRemoveMaterial(); -- cgit v1.2.3 From 7a820b88fc45a4a16573387782e1c3f7e412da68 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Apr 2013 16:56:59 -0500 Subject: NORSPEC-71 Lots more UI hookups Written with and Reviewed By Graham --- indra/newview/llpanelface.cpp | 97 ++++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 29 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 5f9ddb4e9b..c0aed0f63b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -301,10 +301,17 @@ void LLPanelFace::sendBump() if (bumpiness < BUMPY_TEXTURE) { LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); - texture_ctrl->setImageAssetID(LLUUID()); + //texture_ctrl->setImageAssetID(LLUUID()); + texture_ctrl->clear(); + LLSD dummy_data; + onSelectMaterialTexture(dummy_data); } U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); + + //refresh material state (in case this change impacts material params) + LLSD dummy_data; + onCommitMaterialTexture(dummy_data); } void LLPanelFace::sendTexGen() @@ -592,7 +599,7 @@ void LLPanelFace::sendTextureInfo() } void LLPanelFace::getState() -{ +{ //set state of UI to match state of texture entry(ies) (calls setEnabled, setValue, etc, but NOT setVisible) LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); if( objectp @@ -760,24 +767,45 @@ void LLPanelFace::getState() getChildView("button align")->setEnabled(editable); } + // Specular map + struct alpha_get : public LLSelectedTEGetFunctor { - // Default alpha mode to None if texture has no alpha, or Alpha Blending if present - // Will be overridden later if a material is present for this face - S32 default_alpha = ALPHAMODE_NONE; - if (mIsAlpha) + U8 get(LLViewerObject* object, S32 te_index) { - default_alpha = ALPHAMODE_BLEND; + U8 ret = 1; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + ret = mat->getDiffuseAlphaMode(); + } + + return ret; } + } alpha_get_func; + + U8 alpha_mode = 1; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &alpha_get_func, alpha_mode); + + { LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); + childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) { - combobox_alphamode->selectNthItem(default_alpha); + if (!mIsAlpha) + { + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + } + + combobox_alphamode->selectNthItem(alpha_mode); } else { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } + updateAlphaControls(getChild("combobox alphamode"),this); } @@ -1432,7 +1460,8 @@ void LLPanelFace::getState() // Materials { mMaterialID = LLMaterialID::null; - mMaterial.reset(); + mMaterial = NULL; + struct f1 : public LLSelectedTEGetFunctor { LLMaterialID get(LLViewerObject* object, S32 te_index) @@ -1515,10 +1544,13 @@ void LLPanelFace::refresh() } void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) -{ +{ //laying out UI based on material parameters (calls setVisible on various components) LL_DEBUGS("Materials") << "Loaded material " << material_id.asString() << material->asLLSD() << LL_ENDL; - mMaterial = material; - + + //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"); @@ -1586,30 +1618,21 @@ void LLPanelFace::updateMaterial() U32 alpha_mode = comboAlphaMode->getCurrentIndex(); U32 bumpiness = comboBumpiness->getCurrentIndex(); U32 shininess = comboShininess->getCurrentIndex(); - if ((mIsAlpha && (alpha_mode != ALPHAMODE_BLEND)) + if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)) || (bumpiness == BUMPY_TEXTURE) || (shininess == SHINY_TEXTURE)) { // The user's specified something that needs a material. + bool new_material = false; if (!mMaterial) { + new_material = true; mMaterial = LLMaterialPtr(new LLMaterial()); - //set defaults according to UI spec - mMaterial->setSpecularLightColor(LLColor4U::white); - mMaterial->setSpecularLightExponent((U8) (255*0.2f)); - mMaterial->setEnvironmentIntensity(0); - mMaterial->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); - mMaterial->setAlphaMaskCutoff(0); - } - else - { - mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); - mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); - mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); - 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; @@ -1637,6 +1660,20 @@ void LLPanelFace::updateMaterial() 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) + { + mMaterial->setSpecularLightColor(LLColor4U::white); + mMaterial->setSpecularLightExponent((U8) (0.2f*255.f)); + mMaterial->setEnvironmentIntensity(0); + } + else + { + mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); + mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); + mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); + } } else { @@ -1645,6 +1682,8 @@ void LLPanelFace::updateMaterial() mMaterial->setSpecularOffset(0.0f,0.0f); mMaterial->setSpecularRepeat(1.0f,1.0f); mMaterial->setSpecularRotation(0.0f); + mMaterial->setSpecularLightExponent(0); + mMaterial->setEnvironmentIntensity(0); } LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; @@ -1656,7 +1695,7 @@ void LLPanelFace::updateMaterial() if (mMaterial || !mMaterialID.isNull()) { LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; - mMaterial.reset(); + mMaterial = NULL; mMaterialID = LLMaterialID::null; // Delete existing material entry... LLSelectMgr::getInstance()->selectionRemoveMaterial(); -- cgit v1.2.3 From 7bd15e59175fcb11ea620459db600ca018707d38 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 3 Apr 2013 20:49:26 -0700 Subject: NORSPEC-23 NORSPEC-76 NORSPEC-37 and other stability improvements --- indra/newview/llpanelface.cpp | 199 +++++++++++++++++++++++------------------- 1 file changed, 108 insertions(+), 91 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 43001e7d2c..c0c2370ee9 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("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); LLTextureCtrl* bumpytexture_ctrl = getChild("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 @@ -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 @@ -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) @@ -808,97 +811,86 @@ void LLPanelFace::getState() updateAlphaControls(getChild("combobox alphamode"),this); } - - if (identical) - { - // All selected have the same texture - if(texture_ctrl) - { + + if(texture_ctrl) + { + if (identical_diffuse) + { texture_ctrl->setTentative( FALSE ); 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); } + else if (id.isNull()) + { + // 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); + 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( editable ); + shinytexture_ctrl->setImageAssetID( specmap_id ); + } + } - if (shinytexture_ctrl) - { - shinytexture_ctrl->setTentative( FALSE ); - shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID(specmap_id); - } - - if (bumpytexture_ctrl) - { - 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); - - } - else - { - if(texture_ctrl) - { - if( id.isNull() ) - { - // 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); - 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 - { - shinytexture_ctrl->setTentative( TRUE ); - shinytexture_ctrl->setEnabled( FALSE ); - shinytexture_ctrl->setImageAssetID( normmap_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 @@ -1651,6 +1643,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 +1840,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 +1958,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("combobox matmedia"); + U32 mat_media = MATMEDIA_MATERIAL; + if (combobox_matmedia) + { + mat_media = combobox_matmedia->getCurrentIndex(); + } + + LLComboBox* combobox_mattype = self->getChild("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); } -- cgit v1.2.3 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.2.3 From bd3716b7758ab27f929da1608260eafd4212c5d8 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.2.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.2.3 From 7fa137ab1d58d3b6a89d31fd6ff97b12f6e00ef9 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.2.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.2.3 From ffc4981bb91d2b15fe577cf847187b96f253a0bb 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.2.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.2.3 From f7b7f4a5fb35b1d04a975ddd91c62062dee075cc 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.2.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.2.3 From 2a220ca9eb22f953073c6396167dbd48648fe5f9 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.2.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 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 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); -- cgit v1.2.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.2.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.2.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.2.3 From 0b4d76ce7856b060d4682955548ff047326c0aee Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 16 Apr 2013 08:27:30 -0700 Subject: NORSPEC-123 et al...roll back NSPEC 91 fix to avoid knock-on and set correct default env intensity --- indra/newview/llpanelface.cpp | 84 ++++++++----------------------------------- 1 file changed, 15 insertions(+), 69 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f91f1f7d3a..be88cb6ab6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -291,55 +291,10 @@ 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(); @@ -834,7 +789,7 @@ void LLPanelFace::getState() } } alpha_get_func; - U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + U8 alpha_mode = 1; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &alpha_get_func, alpha_mode); { @@ -843,13 +798,10 @@ void LLPanelFace::getState() if (combobox_alphamode) { - // 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; - //} + if (!mIsAlpha) + { + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + } combobox_alphamode->selectNthItem(alpha_mode); } @@ -1823,18 +1775,9 @@ 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)); - 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) + if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)) + || (bumpiness == BUMPY_TEXTURE) + || (shininess == SHINY_TEXTURE)) { // The user's specified something that needs a material. bool new_material = false; @@ -1843,10 +1786,11 @@ void LLPanelFace::updateMaterial() new_material = true; mMaterial = LLMaterialPtr(new LLMaterial()); } - - mMaterial->setDiffuseAlphaMode(alpha_mode); + + mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); 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; @@ -1874,6 +1818,8 @@ 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.2.3 From 35ede26097161ec9ab02dd0228ae9c95fce941ee Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 17 Apr 2013 16:46:32 -0500 Subject: NORSPEC-128 Edit glossiness and environment as U8's from [0,255], as they are stored --- indra/newview/llpanelface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index be88cb6ab6..2d2a0d6d0c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1720,8 +1720,8 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("shinyOffsetV")->setValue(offset_y); getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); - getChild("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); - getChild("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); + getChild("glossiness")->setValue(material->getSpecularLightExponent()); + getChild("environment")->setValue(material->getEnvironmentIntensity()); } updateShinyControls(combobox_shininess,this, true); @@ -1844,8 +1844,8 @@ void LLPanelFace::updateMaterial() if (!new_material) { mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); - mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); - mMaterial->setEnvironmentIntensity((U8)(255*getChild("environment")->getValue().asReal())); + mMaterial->setSpecularLightExponent(getChild("glossiness")->getValue().asInteger()); + mMaterial->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); } } else -- cgit v1.2.3 From b1d608ee99824fde13f3f16e0947ec5b54299fca Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 25 Apr 2013 10:38:35 -0700 Subject: Diagnostic message for debugging adv lighting enable fail on MB Air 2k11 --- indra/newview/llpanelface.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 2d2a0d6d0c..6b50a97e8d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1878,6 +1878,7 @@ void LLPanelFace::updateMaterial() material_to_set = new LLMaterial(*mMaterial); } } + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); } else -- cgit v1.2.3 From d7136bac52dc36cca1f5b89fdc26fd323be468c5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 25 Apr 2013 16:50:02 -0400 Subject: NORSPEC-67: fix update problem by not updating texture pickers when they are open --- indra/newview/llpanelface.cpp | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 2d2a0d6d0c..685614a8c4 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -300,9 +300,9 @@ void LLPanelFace::sendBump() U32 bumpiness = mComboBumpiness->getCurrentIndex(); if (bumpiness < BUMPY_TEXTURE) { - LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); - //texture_ctrl->setImageAssetID(LLUUID()); - texture_ctrl->clear(); + LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; + LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + bumpytexture_ctrl->clear(); LLSD dummy_data; onSelectMaterialTexture(dummy_data); } @@ -397,10 +397,6 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (valid) { value = ctrlTexScaleS->get(); - //if( checkFlipScaleS->get() ) - //{ - // value = -value; - //} if (comboTexGen && comboTexGen->getCurrentIndex() == 1) { @@ -635,20 +631,11 @@ void LLPanelFace::getState() } else { - llwarns << "failed getChild for 'combobox mattype'" << llendl; + LL_WARNS("Materials") << "failed getChild for 'combobox mattype'" << LL_ENDL; } getChildView("combobox mattype")->setEnabled(editable); onCommitMaterialsMedia(NULL, this); - - //if ( LLMediaEngine::getInstance()->getMediaRenderer () ) - // if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () ) - // { - // - // //mLabelTexAutoFix->setEnabled ( editable ); - // - // //mBtnAutoFix->setEnabled ( editable ); - // } bool identical; bool identical_diffuse; @@ -813,7 +800,7 @@ void LLPanelFace::getState() updateAlphaControls(getChild("combobox alphamode"),this); } - if(texture_ctrl) + if(texture_ctrl && !texture_ctrl->isPickerShown()) { if (identical_diffuse) { @@ -849,7 +836,7 @@ void LLPanelFace::getState() } } - if (shinytexture_ctrl) + if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) { if (identical_spec) { @@ -871,7 +858,7 @@ void LLPanelFace::getState() } } - if (bumpytexture_ctrl) + if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) { if (identical_norm) { @@ -1656,12 +1643,13 @@ void LLPanelFace::getState() void LLPanelFace::refresh() { + LL_DEBUGS("Materials") << LL_ENDL; getState(); } void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { //laying out UI based on material parameters (calls setVisible on various components) - LL_DEBUGS("Materials") << "Loaded material " << material_id.asString() << material->asLLSD() << LL_ENDL; + LL_DEBUGS("Materials") << "material id " << material_id.asString() << " data " << material->asLLSD() << LL_ENDL; //make a local copy of the material for editing // (prevents local edits from overwriting client state on shared materials) @@ -1941,7 +1929,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) LLComboBox* combo_bumpiness = self->getChild("combobox bumpiness"); if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness) { - llwarns << "Combo box not found...exiting." << llendl; + LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; } U32 materials_media = combo_matmedia->getCurrentIndex(); @@ -2127,7 +2115,7 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_ LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("bumpytexture control"); LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); - LL_DEBUGS("Materials") << "Bumpy texture selected: " << bumpy_texture_ID << LL_ENDL; + LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; LLComboBox* comboBumpy = self->getChild("combobox bumpiness"); if (!comboBumpy) { @@ -2453,6 +2441,7 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { + LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; LLComboBox* combo_mattype = getChild("combobox mattype"); if (!combo_mattype) { @@ -2470,7 +2459,7 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) break; // no default needed } - + LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL; LLTextureCtrl* texture_ctrl = getChild(which_control); if (texture_ctrl) { -- cgit v1.2.3 From 3834cb6f8ae768a58b3b718eff5ae670a0c299f5 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 26 Apr 2013 09:02:31 -0700 Subject: Fix linux breakage from sunshine merge --- indra/newview/llpanelface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index a82232101e..d106de3d73 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -120,7 +120,6 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterial, this); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); - LLRect rect = this->getRect(); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; LLTextureCtrl* mBumpyTextureCtrl; -- cgit v1.2.3 From d659b29f6ca180cac774e4576bba9da791510633 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 30 Apr 2013 13:44:35 -0700 Subject: Fix vwr-dev-mat merge bugs in llpanelface (missing Oz fix) and XML --- indra/newview/llpanelface.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index d106de3d73..be1561d9a0 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -812,7 +812,7 @@ void LLPanelFace::getState() updateAlphaControls(getChild("combobox alphamode"),this); } - if(texture_ctrl) + if(texture_ctrl && !texture_ctrl->isPickerShown()) { if (identical_diffuse) { @@ -848,7 +848,7 @@ void LLPanelFace::getState() } } - if (shinytexture_ctrl) + if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) { if (identical_spec) { @@ -870,7 +870,7 @@ void LLPanelFace::getState() } } - if (bumpytexture_ctrl) + if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) { if (identical_norm) { @@ -1655,12 +1655,13 @@ void LLPanelFace::getState() void LLPanelFace::refresh() { + LL_DEBUGS("Materials") << LL_ENDL; getState(); } void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { //laying out UI based on material parameters (calls setVisible on various components) - LL_DEBUGS("Materials") << "Loaded material " << material_id.asString() << material->asLLSD() << LL_ENDL; + LL_DEBUGS("Materials") << "material id " << material_id.asString() << " data " << material->asLLSD() << LL_ENDL; //make a local copy of the material for editing // (prevents local edits from overwriting client state on shared materials) @@ -1940,7 +1941,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) LLComboBox* combo_bumpiness = self->getChild("combobox bumpiness"); if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness) { - llwarns << "Combo box not found...exiting." << llendl; + LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; } U32 materials_media = combo_matmedia->getCurrentIndex(); @@ -2126,7 +2127,7 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_ LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("bumpytexture control"); LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); - LL_DEBUGS("Materials") << "Bumpy texture selected: " << bumpy_texture_ID << LL_ENDL; + LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; LLComboBox* comboBumpy = self->getChild("combobox bumpiness"); if (!comboBumpy) { @@ -2452,6 +2453,7 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { + LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; LLComboBox* combo_mattype = getChild("combobox mattype"); if (!combo_mattype) { @@ -2469,7 +2471,7 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) break; // no default needed } - + LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL; LLTextureCtrl* texture_ctrl = getChild(which_control); if (texture_ctrl) { -- cgit v1.2.3 From 806d09b1143894ad66cea2c228f467e8c39a8adf Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 30 Apr 2013 19:50:05 -0700 Subject: Merge 3.5.1 into Materials --- indra/newview/llpanelface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 685614a8c4..67ef072508 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -120,7 +120,6 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterial, this); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); - LLRect rect = this->getRect(); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; LLTextureCtrl* mBumpyTextureCtrl; -- cgit v1.2.3 From 91c618c8cdfdb57d18eeca4da7f7e986e6adb828 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 1 May 2013 19:03:09 -0700 Subject: NORSPEC-119 redux : fix getState to find the material ID of individually selected faces correctly --- indra/newview/llpanelface.cpp | 117 ++++++++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 49 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 67ef072508..79673fa868 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1569,19 +1569,30 @@ void LLPanelFace::getState() LLMaterialID get(LLViewerObject* object, S32 te_index) { LLMaterialID material_id; - + return object->getTE(te_index)->getMaterialID(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, mMaterialID ); - llinfos << "Material ID returned: '" - << mMaterialID.asString() << "', isNull? " - << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + + LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = sel->getFirstNode(); + if (node) + { + int selected_te = node->getLastSelectedTE(); + if (selected_te >= 0) + { + mMaterialID = node->getObject()->getTE(selected_te)->getMaterialID(); + } + } + + llinfos << "Material ID returned: '" << mMaterialID.asString() << "', isNull? " << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + if (!mMaterialID.isNull() && editable) { llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; - LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); + LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } + } // Set variable values for numeric expressions @@ -1774,14 +1785,38 @@ void LLPanelFace::updateMaterial() mMaterial = LLMaterialPtr(new LLMaterial()); } - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + 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) + { + llinfos << "Cloning material to apply to subselection." << llendl; + material_to_set = new LLMaterial(mMaterial->asLLSD()); + } + else + { + llinfos << "Apply material change to whole selection." << llendl; + } + } + + llassert(!material_to_set.isNull()); + + material_to_set->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + material_to_set->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; - mMaterial->setNormalID(norm_map_id); + material_to_set->setNormalID(norm_map_id); F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); @@ -1792,18 +1827,18 @@ void LLPanelFace::updateMaterial() bumpy_scale_v *= 0.5f; } - mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), + material_to_set->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); - mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); + material_to_set->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); + material_to_set->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else { LL_DEBUGS("Materials") << "Removing bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(LLUUID()); - mMaterial->setNormalOffset(0.0f,0.0f); - mMaterial->setNormalRepeat(1.0f,1.0f); - mMaterial->setNormalRotation(0.0f); + material_to_set->setNormalID(LLUUID()); + material_to_set->setNormalOffset(0.0f,0.0f); + material_to_set->setNormalRepeat(1.0f,1.0f); + material_to_set->setNormalRotation(0.0f); } LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); @@ -1811,8 +1846,8 @@ void LLPanelFace::updateMaterial() if (!spec_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(spec_map_id); - mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), + material_to_set->setSpecularID(spec_map_id); + material_to_set->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); F32 shiny_scale_u = getChild("shinyScaleU")->getValue().asReal(); @@ -1824,48 +1859,32 @@ void LLPanelFace::updateMaterial() shiny_scale_v *= 0.5f; } - mMaterial->setSpecularRepeat(shiny_scale_u, shiny_scale_v); - mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); + material_to_set->setSpecularRepeat(shiny_scale_u, shiny_scale_v); + material_to_set->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(getChild("glossiness")->getValue().asInteger()); - mMaterial->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); + material_to_set->setSpecularLightColor(getChild("shinycolorswatch")->get()); + material_to_set->setSpecularLightExponent(getChild("glossiness")->getValue().asInteger()); + material_to_set->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); } } else { LL_DEBUGS("Materials") << "Removing shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(LLUUID()); - mMaterial->setSpecularOffset(0.0f,0.0f); - mMaterial->setSpecularRepeat(1.0f,1.0f); - mMaterial->setSpecularRotation(0.0f); - mMaterial->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); - mMaterial->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - mMaterial->setEnvironmentIntensity(0); + material_to_set->setSpecularID(LLUUID()); + material_to_set->setSpecularOffset(0.0f,0.0f); + material_to_set->setSpecularRepeat(1.0f,1.0f); + material_to_set->setSpecularRotation(0.0f); + material_to_set->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); + material_to_set->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + material_to_set->setEnvironmentIntensity(0); } - LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; - - 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 ); + LL_DEBUGS("Materials") << "Updating material: " << material_to_set->asLLSD() << LL_ENDL; + + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); } else { -- cgit v1.2.3 From 1a880b47ab7176a78f39a1681f00e2e6a32321ad Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 1 May 2013 19:03:09 -0700 Subject: NORSPEC-119 redux : fix getState to find the material ID of individually selected faces correctly --- indra/newview/llpanelface.cpp | 117 ++++++++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 49 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 67ef072508..79673fa868 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1569,19 +1569,30 @@ void LLPanelFace::getState() LLMaterialID get(LLViewerObject* object, S32 te_index) { LLMaterialID material_id; - + return object->getTE(te_index)->getMaterialID(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, mMaterialID ); - llinfos << "Material ID returned: '" - << mMaterialID.asString() << "', isNull? " - << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + + LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = sel->getFirstNode(); + if (node) + { + int selected_te = node->getLastSelectedTE(); + if (selected_te >= 0) + { + mMaterialID = node->getObject()->getTE(selected_te)->getMaterialID(); + } + } + + llinfos << "Material ID returned: '" << mMaterialID.asString() << "', isNull? " << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + if (!mMaterialID.isNull() && editable) { llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; - LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); + LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } + } // Set variable values for numeric expressions @@ -1774,14 +1785,38 @@ void LLPanelFace::updateMaterial() mMaterial = LLMaterialPtr(new LLMaterial()); } - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + 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) + { + llinfos << "Cloning material to apply to subselection." << llendl; + material_to_set = new LLMaterial(mMaterial->asLLSD()); + } + else + { + llinfos << "Apply material change to whole selection." << llendl; + } + } + + llassert(!material_to_set.isNull()); + + material_to_set->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + material_to_set->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; - mMaterial->setNormalID(norm_map_id); + material_to_set->setNormalID(norm_map_id); F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); @@ -1792,18 +1827,18 @@ void LLPanelFace::updateMaterial() bumpy_scale_v *= 0.5f; } - mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), + material_to_set->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); - mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); + material_to_set->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); + material_to_set->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else { LL_DEBUGS("Materials") << "Removing bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(LLUUID()); - mMaterial->setNormalOffset(0.0f,0.0f); - mMaterial->setNormalRepeat(1.0f,1.0f); - mMaterial->setNormalRotation(0.0f); + material_to_set->setNormalID(LLUUID()); + material_to_set->setNormalOffset(0.0f,0.0f); + material_to_set->setNormalRepeat(1.0f,1.0f); + material_to_set->setNormalRotation(0.0f); } LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); @@ -1811,8 +1846,8 @@ void LLPanelFace::updateMaterial() if (!spec_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(spec_map_id); - mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), + material_to_set->setSpecularID(spec_map_id); + material_to_set->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); F32 shiny_scale_u = getChild("shinyScaleU")->getValue().asReal(); @@ -1824,48 +1859,32 @@ void LLPanelFace::updateMaterial() shiny_scale_v *= 0.5f; } - mMaterial->setSpecularRepeat(shiny_scale_u, shiny_scale_v); - mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); + material_to_set->setSpecularRepeat(shiny_scale_u, shiny_scale_v); + material_to_set->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(getChild("glossiness")->getValue().asInteger()); - mMaterial->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); + material_to_set->setSpecularLightColor(getChild("shinycolorswatch")->get()); + material_to_set->setSpecularLightExponent(getChild("glossiness")->getValue().asInteger()); + material_to_set->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); } } else { LL_DEBUGS("Materials") << "Removing shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(LLUUID()); - mMaterial->setSpecularOffset(0.0f,0.0f); - mMaterial->setSpecularRepeat(1.0f,1.0f); - mMaterial->setSpecularRotation(0.0f); - mMaterial->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); - mMaterial->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - mMaterial->setEnvironmentIntensity(0); + material_to_set->setSpecularID(LLUUID()); + material_to_set->setSpecularOffset(0.0f,0.0f); + material_to_set->setSpecularRepeat(1.0f,1.0f); + material_to_set->setSpecularRotation(0.0f); + material_to_set->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); + material_to_set->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + material_to_set->setEnvironmentIntensity(0); } - LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; - - 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 ); + LL_DEBUGS("Materials") << "Updating material: " << material_to_set->asLLSD() << LL_ENDL; + + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); } else { -- cgit v1.2.3 From dd06eb40213d8429b34b5ee90cdb682924e976dc Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 2 May 2013 13:05:25 -0700 Subject: NORSPEC-157 make texture repeats/offsets controls display in media mode --- indra/newview/llpanelface.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 79673fa868..1a3f4832fd 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1953,11 +1953,11 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) U32 materials_media = combo_matmedia->getCurrentIndex(); U32 material_type = combo_mattype->getCurrentIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); - bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled(); + 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(!show_media); + self->getChildView("rptctrl")->setVisible(show_texture); // Media controls self->getChildView("media_info")->setVisible(show_media); @@ -1966,12 +1966,12 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("button align")->setVisible(show_media); // Diffuse texture controls - self->getChildView("texture control")->setVisible(show_texture); - self->getChildView("label alphamode")->setVisible(show_texture); - self->getChildView("combobox alphamode")->setVisible(show_texture); + 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); - if (show_texture) + if (show_texture && !show_media) { updateAlphaControls(ctrl, userdata); } -- cgit v1.2.3 From 735d19eeae4a818ddeeb061e6622070d5ec94e0d Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 2 May 2013 13:05:25 -0700 Subject: NORSPEC-157 make texture repeats/offsets controls display in media mode --- indra/newview/llpanelface.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 79673fa868..1a3f4832fd 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1953,11 +1953,11 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) U32 materials_media = combo_matmedia->getCurrentIndex(); U32 material_type = combo_mattype->getCurrentIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); - bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled(); + 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(!show_media); + self->getChildView("rptctrl")->setVisible(show_texture); // Media controls self->getChildView("media_info")->setVisible(show_media); @@ -1966,12 +1966,12 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("button align")->setVisible(show_media); // Diffuse texture controls - self->getChildView("texture control")->setVisible(show_texture); - self->getChildView("label alphamode")->setVisible(show_texture); - self->getChildView("combobox alphamode")->setVisible(show_texture); + 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); - if (show_texture) + if (show_texture && !show_media) { updateAlphaControls(ctrl, userdata); } -- cgit v1.2.3 From d3c1fdeb34b91bb87e75932e2269f46234303335 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 3 May 2013 15:59:43 -0700 Subject: NORSPEC-160 fix trashing of spec map from sunshine integration snafu --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1a3f4832fd..74b1915cac 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2118,7 +2118,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 != 0) && show_shininess; // Use texture + 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); -- cgit v1.2.3 From 930dfc4f17e7a8b2dba9f58a2d9a4f0a46fae408 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 3 May 2013 15:59:43 -0700 Subject: NORSPEC-160 fix trashing of spec map from sunshine integration snafu --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1a3f4832fd..74b1915cac 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2118,7 +2118,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 != 0) && show_shininess; // Use texture + 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); -- cgit v1.2.3 From 1a39876c64be99456291724bb539e71344962ab5 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 10:19:55 -0700 Subject: NORSPEC-94 fix this without setting in getState causing round-trip wierdness with spec color picker --- indra/newview/llpanelface.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 74b1915cac..1fbf4a39e6 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1297,6 +1297,7 @@ void LLPanelFace::getState() mColorSwatch->setEnabled( editable ); mColorSwatch->setCanApplyImmediately( editable ); } + // Color transparency { getChildView("color trans")->setEnabled(editable); @@ -1363,14 +1364,10 @@ void LLPanelFace::getState() 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 ); @@ -1716,13 +1713,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("shinyRot")->setValue(rot*RAD_TO_DEG); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); - getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("environment")->setValue(material->getEnvironmentIntensity()); } updateShinyControls(combobox_shininess,this, true); + // Assert desired colorswatch color to match material AFTER updateShinyControls + // to avoid getting overwritten with the default on some UI state changes. + // + if (!material->getSpecularID().isNull()) + { + getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + } + // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); @@ -2097,6 +2101,18 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ if (!comboShiny->itemExists(USE_TEXTURE)) { comboShiny->add(USE_TEXTURE); + + // NORSPEC-94: Set default specular color to white + // + LLColorSwatchCtrl* mShinyColorSwatch = self->getChild("shinycolorswatch"); + if(mShinyColorSwatch) + { + // Doing sets in a getState func causes the 'blinking updates' of swatch colors....DON'T. + // + LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL; + mShinyColorSwatch->setOriginal(LLColor4::white); + mShinyColorSwatch->set(LLColor4::white, TRUE); + } } comboShiny->setSimple(USE_TEXTURE); } -- cgit v1.2.3 From cd50679da26925b33fbf75992ab122062b222c04 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 10:19:55 -0700 Subject: NORSPEC-94 fix this without setting in getState causing round-trip wierdness with spec color picker --- indra/newview/llpanelface.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 74b1915cac..1fbf4a39e6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1297,6 +1297,7 @@ void LLPanelFace::getState() mColorSwatch->setEnabled( editable ); mColorSwatch->setCanApplyImmediately( editable ); } + // Color transparency { getChildView("color trans")->setEnabled(editable); @@ -1363,14 +1364,10 @@ void LLPanelFace::getState() 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 ); @@ -1716,13 +1713,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("shinyRot")->setValue(rot*RAD_TO_DEG); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); - getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("environment")->setValue(material->getEnvironmentIntensity()); } updateShinyControls(combobox_shininess,this, true); + // Assert desired colorswatch color to match material AFTER updateShinyControls + // to avoid getting overwritten with the default on some UI state changes. + // + if (!material->getSpecularID().isNull()) + { + getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + } + // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); @@ -2097,6 +2101,18 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ if (!comboShiny->itemExists(USE_TEXTURE)) { comboShiny->add(USE_TEXTURE); + + // NORSPEC-94: Set default specular color to white + // + LLColorSwatchCtrl* mShinyColorSwatch = self->getChild("shinycolorswatch"); + if(mShinyColorSwatch) + { + // Doing sets in a getState func causes the 'blinking updates' of swatch colors....DON'T. + // + LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL; + mShinyColorSwatch->setOriginal(LLColor4::white); + mShinyColorSwatch->set(LLColor4::white, TRUE); + } } comboShiny->setSimple(USE_TEXTURE); } -- cgit v1.2.3 From 2de72023cf698a9eb412b12aade9a84e02f23ea3 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 7 May 2013 12:43:15 -0700 Subject: NORSPEC-119 another attempt at individual faces edits without side-effects --- indra/newview/llpanelface.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1fbf4a39e6..f55d53fa29 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1791,6 +1791,8 @@ void LLPanelFace::updateMaterial() LLMaterialPtr material_to_set = mMaterial; + bool subselection = false; + // 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 @@ -1804,6 +1806,7 @@ void LLPanelFace::updateMaterial() { llinfos << "Cloning material to apply to subselection." << llendl; material_to_set = new LLMaterial(mMaterial->asLLSD()); + subselection = true; } else { @@ -1888,7 +1891,21 @@ void LLPanelFace::updateMaterial() LL_DEBUGS("Materials") << "Updating material: " << material_to_set->asLLSD() << LL_ENDL; - LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); + + if (node && node->getObject() && node->getObject()->permModify() && subselection) + { + int selected_te = node->getLastSelectedTE(); + if (selected_te >= 0) + { + LLMaterialMgr::getInstance()->put(node->getObject()->getID(),selected_te,*material_to_set); + node->getObject()->getTE(selected_te)->setMaterialParams(material_to_set); + node->getObject()->sendTEUpdate(); + } + } + else + { + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); + } } else { -- cgit v1.2.3 From 080981ae8b14b71c5832de11fb968a31a4b5810c Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 7 May 2013 12:43:15 -0700 Subject: NORSPEC-119 another attempt at individual faces edits without side-effects --- indra/newview/llpanelface.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1fbf4a39e6..f55d53fa29 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1791,6 +1791,8 @@ void LLPanelFace::updateMaterial() LLMaterialPtr material_to_set = mMaterial; + bool subselection = false; + // 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 @@ -1804,6 +1806,7 @@ void LLPanelFace::updateMaterial() { llinfos << "Cloning material to apply to subselection." << llendl; material_to_set = new LLMaterial(mMaterial->asLLSD()); + subselection = true; } else { @@ -1888,7 +1891,21 @@ void LLPanelFace::updateMaterial() LL_DEBUGS("Materials") << "Updating material: " << material_to_set->asLLSD() << LL_ENDL; - LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); + + if (node && node->getObject() && node->getObject()->permModify() && subselection) + { + int selected_te = node->getLastSelectedTE(); + if (selected_te >= 0) + { + LLMaterialMgr::getInstance()->put(node->getObject()->getID(),selected_te,*material_to_set); + node->getObject()->getTE(selected_te)->setMaterialParams(material_to_set); + node->getObject()->sendTEUpdate(); + } + } + else + { + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); + } } else { -- cgit v1.2.3 From 19c755b8512bb2e7ce36924b30c1ed380397a8f4 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 7 May 2013 15:21:49 -0700 Subject: NORSPEC-147 make repeats per meter disabled when in planar mode and make UI reps consistent across layers --- indra/newview/llpanelface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f55d53fa29..877c7743fa 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1537,7 +1537,7 @@ void LLPanelFace::getState() { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); identical = identical_spec_repeats; - repeats = repeats_spec * (identical_planar_texgen ? 2.0f : 1.0f); + repeats = repeats_spec; } break; @@ -1545,12 +1545,12 @@ void LLPanelFace::getState() { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); identical = identical_norm_repeats; - repeats = repeats_norm * (identical_planar_texgen ? 2.0f : 1.0f); + repeats = repeats_norm; } break; } - getChildView("rptctrl")->setEnabled(enabled); + getChildView("rptctrl")->setEnabled(identical_planar_texgen ? FALSE : enabled); getChild("rptctrl")->setValue(editable ? repeats : 1.0f); getChild("rptctrl")->setTentative(!identical); } @@ -1978,7 +1978,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) 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(show_texture); + self->getChildView("rptctrl")->setVisible(true); // Media controls self->getChildView("media_info")->setVisible(show_media); -- cgit v1.2.3 From 0ee77e86deefdcee39a472b50178009a2ed99036 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 7 May 2013 15:21:49 -0700 Subject: NORSPEC-147 make repeats per meter disabled when in planar mode and make UI reps consistent across layers --- indra/newview/llpanelface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f55d53fa29..877c7743fa 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1537,7 +1537,7 @@ void LLPanelFace::getState() { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); identical = identical_spec_repeats; - repeats = repeats_spec * (identical_planar_texgen ? 2.0f : 1.0f); + repeats = repeats_spec; } break; @@ -1545,12 +1545,12 @@ void LLPanelFace::getState() { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); identical = identical_norm_repeats; - repeats = repeats_norm * (identical_planar_texgen ? 2.0f : 1.0f); + repeats = repeats_norm; } break; } - getChildView("rptctrl")->setEnabled(enabled); + getChildView("rptctrl")->setEnabled(identical_planar_texgen ? FALSE : enabled); getChild("rptctrl")->setValue(editable ? repeats : 1.0f); getChild("rptctrl")->setTentative(!identical); } @@ -1978,7 +1978,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) 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(show_texture); + self->getChildView("rptctrl")->setVisible(true); // Media controls self->getChildView("media_info")->setVisible(show_media); -- cgit v1.2.3 From 76c2a85661389469df77547e1732620755a1a729 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 9 May 2013 15:04:07 -0700 Subject: NORSPEC-168 separate UI handlers for spec and normal textures to avoid cross-talk and fix handling of bumpy/shiny menu items --- indra/newview/llpanelface.cpp | 90 +++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 34 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 877c7743fa..9c40ff06cc 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -158,9 +158,9 @@ BOOL LLPanelFace::postBuild() if(mShinyTextureCtrl) { mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); - mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); - mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); - mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mShinyTextureCtrl->setFollowsTop(); @@ -173,9 +173,9 @@ BOOL LLPanelFace::postBuild() if(mBumpyTextureCtrl) { mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); - mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); - mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); - mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mBumpyTextureCtrl->setFollowsTop(); @@ -303,14 +303,14 @@ void LLPanelFace::sendBump() LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); bumpytexture_ctrl->clear(); LLSD dummy_data; - onSelectMaterialTexture(dummy_data); + onSelectNormalTexture(dummy_data); } U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); //refresh material state (in case this change impacts material params) LLSD dummy_data; - onCommitMaterialTexture(dummy_data); + onCommitNormalTexture(dummy_data); } void LLPanelFace::sendTexGen() @@ -333,6 +333,10 @@ void LLPanelFace::sendShiny() } U8 shiny = (U8) shininess & TEM_SHINY_MASK; LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + + //refresh material state (in case this change impacts material params) + LLSD dummy_data; + onCommitSpecularTexture(dummy_data); } void LLPanelFace::sendFullbright() @@ -1716,7 +1720,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("environment")->setValue(material->getEnvironmentIntensity()); } - updateShinyControls(combobox_shininess,this, true); + updateShinyControls(combobox_shininess,this, !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. @@ -1749,7 +1753,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); } - updateBumpyControls(combobox_bumpiness,this, true); + updateBumpyControls(combobox_bumpiness,this, !material->getNormalID().isNull(), true); } void LLPanelFace::updateMaterial() @@ -1820,7 +1824,7 @@ void LLPanelFace::updateMaterial() material_to_set->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); - if (!norm_map_id.isNull()) + if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; material_to_set->setNormalID(norm_map_id); @@ -1850,7 +1854,7 @@ void LLPanelFace::updateMaterial() LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); - if (!spec_map_id.isNull()) + if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; material_to_set->setSpecularID(spec_map_id); @@ -2084,10 +2088,8 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* 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 normmap texture - // - updateBumpyControls(combo_bumpy,self, true); + + updateBumpyControls(combo_bumpy,self, false, true); self->updateMaterial(); } @@ -2099,7 +2101,7 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_shiny_combobox) +void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_shiny_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("shinytexture control"); @@ -2113,7 +2115,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ { return; } - if (!shiny_texture_ID.isNull()) + if (!shiny_texture_ID.isNull() && is_setting_texture) { if (!comboShiny->itemExists(USE_TEXTURE)) { @@ -2124,12 +2126,12 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ LLColorSwatchCtrl* mShinyColorSwatch = self->getChild("shinycolorswatch"); if(mShinyColorSwatch) { - // Doing sets in a getState func causes the 'blinking updates' of swatch colors....DON'T. - // LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL; mShinyColorSwatch->setOriginal(LLColor4::white); mShinyColorSwatch->set(LLColor4::white, TRUE); } + self->getChild("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + self->getChild("environment")->setValue(0); } comboShiny->setSimple(USE_TEXTURE); } @@ -2161,7 +2163,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ } // static -void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_combobox) +void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("bumpytexture control"); @@ -2175,7 +2177,11 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_ if (mess_with_combobox) { - if (!bumpy_texture_ID.isNull()) + LLTextureCtrl* texture_ctrl = self->getChild("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; + + if (!bumpy_texture_ID.isNull() && is_setting_texture) { if (!comboBumpy->itemExists(USE_TEXTURE)) { @@ -2204,7 +2210,7 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) // 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); + updateShinyControls(combo_shiny,self, false, true); self->updateMaterial(); } @@ -2298,34 +2304,50 @@ void LLPanelFace::onSelectTexture(const LLSD& data) sendTexture(); } -void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) +void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, true, true); + updateMaterial(); +} + +void LLPanelFace::onCommitNormalTexture( const LLSD& data ) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy, this, true, true); + updateMaterial(); } -void LLPanelFace::onCancelMaterialTexture(const LLSD& data) +void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { - // not sure what to do here other than updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, false, true); +} + +void LLPanelFace::onCancelNormalTexture(const LLSD& data) +{ + updateMaterial(); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy,this, false, true); } -void LLPanelFace::onSelectMaterialTexture(const LLSD& data) +void LLPanelFace::onSelectSpecularTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, true, true); +} + +void LLPanelFace::onSelectNormalTexture(const LLSD& data) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy,this, true, true); + updateMaterial(); } //static -- cgit v1.2.3 From 8ba1b1f797948ee8b082f045ed444fbcd96c3412 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 9 May 2013 15:04:07 -0700 Subject: NORSPEC-168 separate UI handlers for spec and normal textures to avoid cross-talk and fix handling of bumpy/shiny menu items --- indra/newview/llpanelface.cpp | 90 +++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 34 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 877c7743fa..9c40ff06cc 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -158,9 +158,9 @@ BOOL LLPanelFace::postBuild() if(mShinyTextureCtrl) { mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); - mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); - mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); - mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mShinyTextureCtrl->setFollowsTop(); @@ -173,9 +173,9 @@ BOOL LLPanelFace::postBuild() if(mBumpyTextureCtrl) { mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); - mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); - mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); - mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mBumpyTextureCtrl->setFollowsTop(); @@ -303,14 +303,14 @@ void LLPanelFace::sendBump() LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); bumpytexture_ctrl->clear(); LLSD dummy_data; - onSelectMaterialTexture(dummy_data); + onSelectNormalTexture(dummy_data); } U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); //refresh material state (in case this change impacts material params) LLSD dummy_data; - onCommitMaterialTexture(dummy_data); + onCommitNormalTexture(dummy_data); } void LLPanelFace::sendTexGen() @@ -333,6 +333,10 @@ void LLPanelFace::sendShiny() } U8 shiny = (U8) shininess & TEM_SHINY_MASK; LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + + //refresh material state (in case this change impacts material params) + LLSD dummy_data; + onCommitSpecularTexture(dummy_data); } void LLPanelFace::sendFullbright() @@ -1716,7 +1720,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("environment")->setValue(material->getEnvironmentIntensity()); } - updateShinyControls(combobox_shininess,this, true); + updateShinyControls(combobox_shininess,this, !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. @@ -1749,7 +1753,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); } - updateBumpyControls(combobox_bumpiness,this, true); + updateBumpyControls(combobox_bumpiness,this, !material->getNormalID().isNull(), true); } void LLPanelFace::updateMaterial() @@ -1820,7 +1824,7 @@ void LLPanelFace::updateMaterial() material_to_set->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); - if (!norm_map_id.isNull()) + if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; material_to_set->setNormalID(norm_map_id); @@ -1850,7 +1854,7 @@ void LLPanelFace::updateMaterial() LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); - if (!spec_map_id.isNull()) + if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; material_to_set->setSpecularID(spec_map_id); @@ -2084,10 +2088,8 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* 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 normmap texture - // - updateBumpyControls(combo_bumpy,self, true); + + updateBumpyControls(combo_bumpy,self, false, true); self->updateMaterial(); } @@ -2099,7 +2101,7 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_shiny_combobox) +void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_shiny_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("shinytexture control"); @@ -2113,7 +2115,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ { return; } - if (!shiny_texture_ID.isNull()) + if (!shiny_texture_ID.isNull() && is_setting_texture) { if (!comboShiny->itemExists(USE_TEXTURE)) { @@ -2124,12 +2126,12 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ LLColorSwatchCtrl* mShinyColorSwatch = self->getChild("shinycolorswatch"); if(mShinyColorSwatch) { - // Doing sets in a getState func causes the 'blinking updates' of swatch colors....DON'T. - // LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL; mShinyColorSwatch->setOriginal(LLColor4::white); mShinyColorSwatch->set(LLColor4::white, TRUE); } + self->getChild("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + self->getChild("environment")->setValue(0); } comboShiny->setSimple(USE_TEXTURE); } @@ -2161,7 +2163,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ } // static -void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_combobox) +void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("bumpytexture control"); @@ -2175,7 +2177,11 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_ if (mess_with_combobox) { - if (!bumpy_texture_ID.isNull()) + LLTextureCtrl* texture_ctrl = self->getChild("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; + + if (!bumpy_texture_ID.isNull() && is_setting_texture) { if (!comboBumpy->itemExists(USE_TEXTURE)) { @@ -2204,7 +2210,7 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) // 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); + updateShinyControls(combo_shiny,self, false, true); self->updateMaterial(); } @@ -2298,34 +2304,50 @@ void LLPanelFace::onSelectTexture(const LLSD& data) sendTexture(); } -void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) +void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, true, true); + updateMaterial(); +} + +void LLPanelFace::onCommitNormalTexture( const LLSD& data ) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy, this, true, true); + updateMaterial(); } -void LLPanelFace::onCancelMaterialTexture(const LLSD& data) +void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { - // not sure what to do here other than updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, false, true); +} + +void LLPanelFace::onCancelNormalTexture(const LLSD& data) +{ + updateMaterial(); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy,this, false, true); } -void LLPanelFace::onSelectMaterialTexture(const LLSD& data) +void LLPanelFace::onSelectSpecularTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, true, true); +} + +void LLPanelFace::onSelectNormalTexture(const LLSD& data) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy,this, true, true); + updateMaterial(); } //static -- cgit v1.2.3 From f356d7eb9fd730f5f6f5a29fb0706e20876ad3bd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 11 May 2013 19:58:56 -0700 Subject: Fix many issues with selection misapplication and rendering not matching applied materials --- indra/newview/llpanelface.cpp | 318 ++++++++++++++++++------------------------ 1 file changed, 132 insertions(+), 186 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9c40ff06cc..837b8687e8 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1562,36 +1562,108 @@ void LLPanelFace::getState() // Materials { - mMaterialID = LLMaterialID::null; - mMaterial = NULL; + struct f1 : public LLSelectedTEGetFunctor + { + LLMaterialPtr get(LLViewerObject* object, S32 te_index) + { + return object->getTE(te_index)->getMaterialParams(); + } + } func; - struct f1 : public LLSelectedTEGetFunctor + LLMaterialPtr material; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, mMaterial ); + + if (mMaterial && editable) { - LLMaterialID get(LLViewerObject* object, S32 te_index) + LL_DEBUGS("Materials: OnMatererialsLoaded:") << material->asLLSD() << LL_ENDL; + + // Alpha + LLCtrlSelectionInterface* combobox_alphamode = + childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) { - LLMaterialID material_id; + combobox_alphamode->selectNthItem(mMaterial->getDiffuseAlphaMode()); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; + } + getChild("maskcutoff")->setValue(mMaterial->getAlphaMaskCutoff()); + updateAlphaControls(getChild("combobox alphamode"),this); + + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + bool identical_texgen = true; + bool identical_planar_texgen = false; - return object->getTE(te_index)->getMaterialID(); + 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"); + texture_ctrl->setImageAssetID(material->getSpecularID()); + LLComboBox* combobox_shininess = getChild("combobox shininess"); + if (!material->getSpecularID().isNull()) + { + mMaterial->getSpecularOffset(offset_x,offset_y); + mMaterial->getSpecularRepeat(repeat_x,repeat_y); + + if (identical_planar_texgen) + { + repeat_x *= 2.0f; + repeat_y *= 2.0f; + } + + rot = mMaterial->getSpecularRotation(); + getChild("shinyScaleU")->setValue(repeat_x); + getChild("shinyScaleV")->setValue(repeat_y); + getChild("shinyRot")->setValue(rot*RAD_TO_DEG); + getChild("shinyOffsetU")->setValue(offset_x); + getChild("shinyOffsetV")->setValue(offset_y); + getChild("glossiness")->setValue(mMaterial->getSpecularLightExponent()); + getChild("environment")->setValue(mMaterial->getEnvironmentIntensity()); } - } func; + updateShinyControls(combobox_shininess,this, !mMaterial->getSpecularID().isNull(), true); - LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); - LLSelectNode* node = sel->getFirstNode(); - if (node) - { - int selected_te = node->getLastSelectedTE(); - if (selected_te >= 0) + // Assert desired colorswatch color to match material AFTER updateShinyControls + // to avoid getting overwritten with the default on some UI state changes. + // + if (!material->getSpecularID().isNull()) { - mMaterialID = node->getObject()->getTE(selected_te)->getMaterialID(); + getChild("shinycolorswatch")->setOriginal(mMaterial->getSpecularLightColor()); + getChild("shinycolorswatch")->set(mMaterial->getSpecularLightColor(),TRUE); } - } - llinfos << "Material ID returned: '" << mMaterialID.asString() << "', isNull? " << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; + // Bumpy (normal) + texture_ctrl = getChild("bumpytexture control"); + texture_ctrl->setImageAssetID(mMaterial->getNormalID()); + LLComboBox* combobox_bumpiness = getChild("combobox bumpiness"); + if (!mMaterial->getNormalID().isNull()) + { + mMaterial->getNormalOffset(offset_x,offset_y); + mMaterial->getNormalRepeat(repeat_x,repeat_y); - if (!mMaterialID.isNull() && editable) - { - llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; - LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); + 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); + getChild("bumpyRot")->setValue(rot*RAD_TO_DEG); + getChild("bumpyOffsetU")->setValue(offset_x); + getChild("bumpyOffsetV")->setValue(offset_y); + } + updateBumpyControls(combobox_bumpiness,this, !mMaterial->getNormalID().isNull(), true); } } @@ -1658,104 +1730,6 @@ void LLPanelFace::refresh() getState(); } -void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) -{ //laying out UI based on material parameters (calls setVisible on various components) - LL_DEBUGS("Materials") << "material id " << material_id.asString() << " data " << material->asLLSD() << LL_ENDL; - - //make a local copy of the material for editing - // (prevents local edits from overwriting client state on shared materials) - mMaterial = new LLMaterial(*material); - mMaterialID = material_id; - - // Alpha - LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); - if (combobox_alphamode) - { - combobox_alphamode->selectNthItem(material->getDiffuseAlphaMode()); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; - } - 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"); - texture_ctrl->setImageAssetID(material->getSpecularID()); - LLComboBox* combobox_shininess = getChild("combobox shininess"); - if (!material->getSpecularID().isNull()) - { - 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); - getChild("shinyRot")->setValue(rot*RAD_TO_DEG); - getChild("shinyOffsetU")->setValue(offset_x); - getChild("shinyOffsetV")->setValue(offset_y); - getChild("glossiness")->setValue(material->getSpecularLightExponent()); - getChild("environment")->setValue(material->getEnvironmentIntensity()); - } - updateShinyControls(combobox_shininess,this, !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. - // - if (!material->getSpecularID().isNull()) - { - getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); - } - - // Bumpy (normal) - texture_ctrl = getChild("bumpytexture control"); - texture_ctrl->setImageAssetID(material->getNormalID()); - LLComboBox* combobox_bumpiness = getChild("combobox bumpiness"); - if (!material->getNormalID().isNull()) - { - 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); - getChild("bumpyRot")->setValue(rot*RAD_TO_DEG); - getChild("bumpyOffsetU")->setValue(offset_x); - getChild("bumpyOffsetV")->setValue(offset_y); - } - updateBumpyControls(combobox_bumpiness,this, !material->getNormalID().isNull(), true); -} - void LLPanelFace::updateMaterial() { // assign current state of UI to material definition for submit to sim LL_DEBUGS("Materials") << "Entered." << LL_ENDL; @@ -1781,53 +1755,38 @@ 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)) + bool is_default_blend_mode = mIsAlpha ? (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + : (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + + if ( !is_default_blend_mode || (bumpiness == BUMPY_TEXTURE) || (shininess == SHINY_TEXTURE)) { // The user's specified something that needs a material. bool new_material = false; - if (!mMaterial) + + // Create new or clone material + // + if (mMaterial.isNull()) { - new_material = true; mMaterial = LLMaterialPtr(new LLMaterial()); + new_material = true; } - - LLMaterialPtr material_to_set = mMaterial; - - bool subselection = false; - - // 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) + else { - if (node->getTESelectMask() != TE_SELECT_MASK_ALL) - { - llinfos << "Cloning material to apply to subselection." << llendl; - material_to_set = new LLMaterial(mMaterial->asLLSD()); - subselection = true; - } - else - { - llinfos << "Apply material change to whole selection." << llendl; - } + mMaterial = LLMaterialPtr(new LLMaterial(mMaterial->asLLSD())); } - llassert(!material_to_set.isNull()); + llassert_always(mMaterial); - material_to_set->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - material_to_set->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - material_to_set->setNormalID(norm_map_id); + mMaterial->setNormalID(norm_map_id); F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); @@ -1838,18 +1797,18 @@ void LLPanelFace::updateMaterial() bumpy_scale_v *= 0.5f; } - material_to_set->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), + mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); - material_to_set->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); - material_to_set->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); + mMaterial->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); + mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else { LL_DEBUGS("Materials") << "Removing bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - material_to_set->setNormalID(LLUUID()); - material_to_set->setNormalOffset(0.0f,0.0f); - material_to_set->setNormalRepeat(1.0f,1.0f); - material_to_set->setNormalRotation(0.0f); + mMaterial->setNormalID(LLUUID()); + mMaterial->setNormalOffset(0.0f,0.0f); + mMaterial->setNormalRepeat(1.0f,1.0f); + mMaterial->setNormalRotation(0.0f); } LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); @@ -1857,8 +1816,8 @@ void LLPanelFace::updateMaterial() if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - material_to_set->setSpecularID(spec_map_id); - material_to_set->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), + mMaterial->setSpecularID(spec_map_id); + mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); F32 shiny_scale_u = getChild("shinyScaleU")->getValue().asReal(); @@ -1870,55 +1829,42 @@ void LLPanelFace::updateMaterial() shiny_scale_v *= 0.5f; } - material_to_set->setSpecularRepeat(shiny_scale_u, shiny_scale_v); - material_to_set->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); + 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) { - material_to_set->setSpecularLightColor(getChild("shinycolorswatch")->get()); - material_to_set->setSpecularLightExponent(getChild("glossiness")->getValue().asInteger()); - material_to_set->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); + mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); + mMaterial->setSpecularLightExponent(getChild("glossiness")->getValue().asInteger()); + mMaterial->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); } } else { LL_DEBUGS("Materials") << "Removing shiny texture, shininess = " << shininess << LL_ENDL; - material_to_set->setSpecularID(LLUUID()); - material_to_set->setSpecularOffset(0.0f,0.0f); - material_to_set->setSpecularRepeat(1.0f,1.0f); - material_to_set->setSpecularRotation(0.0f); - material_to_set->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); - material_to_set->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - material_to_set->setEnvironmentIntensity(0); + mMaterial->setSpecularID(LLUUID()); + mMaterial->setSpecularOffset(0.0f,0.0f); + mMaterial->setSpecularRepeat(1.0f,1.0f); + mMaterial->setSpecularRotation(0.0f); + mMaterial->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); + mMaterial->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + mMaterial->setEnvironmentIntensity(0); } - LL_DEBUGS("Materials") << "Updating material: " << material_to_set->asLLSD() << LL_ENDL; - + LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; - if (node && node->getObject() && node->getObject()->permModify() && subselection) - { - int selected_te = node->getLastSelectedTE(); - if (selected_te >= 0) - { - LLMaterialMgr::getInstance()->put(node->getObject()->getID(),selected_te,*material_to_set); - node->getObject()->getTE(selected_te)->setMaterialParams(material_to_set); - node->getObject()->sendTEUpdate(); - } - } - else - { - LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); - } + LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); } else { // The user has specified settings that don't need a material. - if (mMaterial || !mMaterialID.isNull()) + //if (mMaterial || !mMaterialID.isNull()) { LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; mMaterial = NULL; mMaterialID = LLMaterialID::null; + // Delete existing material entry... LLSelectMgr::getInstance()->selectionRemoveMaterial(); } -- cgit v1.2.3 From c486d9498b8274e0fd9c7cba616df10f6a7d8977 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 12 May 2013 12:58:46 +0200 Subject: Refactor LLPanelFace to make it clearer that the material is a property of the face(s) and never the panel --- indra/newview/llpanelface.cpp | 134 ++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 71 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b3b4932b65..d108a260bc 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -261,8 +261,6 @@ BOOL LLPanelFace::postBuild() LLPanelFace::LLPanelFace() : LLPanel(), - mMaterialID(LLMaterialID::null), - mMaterial(LLMaterialPtr()), mIsAlpha(false) { USE_TEXTURE = LLTrans::getString("use_texture"); @@ -1571,9 +1569,9 @@ void LLPanelFace::getState() } func; LLMaterialPtr material; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, mMaterial ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material ); - if (mMaterial && editable) + if (material && editable) { LL_DEBUGS("Materials: OnMatererialsLoaded:") << material->asLLSD() << LL_ENDL; @@ -1582,13 +1580,13 @@ void LLPanelFace::getState() childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) { - combobox_alphamode->selectNthItem(mMaterial->getDiffuseAlphaMode()); + combobox_alphamode->selectNthItem(material->getDiffuseAlphaMode()); } else { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } - getChild("maskcutoff")->setValue(mMaterial->getAlphaMaskCutoff()); + getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(getChild("combobox alphamode"),this); LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; @@ -1608,12 +1606,12 @@ void LLPanelFace::getState() // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); - texture_ctrl->setImageAssetID(mMaterial->getSpecularID()); + texture_ctrl->setImageAssetID(material->getSpecularID()); LLComboBox* combobox_shininess = getChild("combobox shininess"); - if (!mMaterial->getSpecularID().isNull()) + if (!material->getSpecularID().isNull()) { - mMaterial->getSpecularOffset(offset_x,offset_y); - mMaterial->getSpecularRepeat(repeat_x,repeat_y); + material->getSpecularOffset(offset_x,offset_y); + material->getSpecularRepeat(repeat_x,repeat_y); if (identical_planar_texgen) { @@ -1621,34 +1619,34 @@ void LLPanelFace::getState() repeat_y *= 2.0f; } - rot = mMaterial->getSpecularRotation(); + rot = material->getSpecularRotation(); getChild("shinyScaleU")->setValue(repeat_x); getChild("shinyScaleV")->setValue(repeat_y); getChild("shinyRot")->setValue(rot*RAD_TO_DEG); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); - getChild("glossiness")->setValue(mMaterial->getSpecularLightExponent()); - getChild("environment")->setValue(mMaterial->getEnvironmentIntensity()); + getChild("glossiness")->setValue(material->getSpecularLightExponent()); + getChild("environment")->setValue(material->getEnvironmentIntensity()); } - updateShinyControls(combobox_shininess,this, !mMaterial->getSpecularID().isNull(), true); + updateShinyControls(combobox_shininess,this, !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. // - if (!mMaterial->getSpecularID().isNull()) + if (!material->getSpecularID().isNull()) { - getChild("shinycolorswatch")->setOriginal(mMaterial->getSpecularLightColor()); - getChild("shinycolorswatch")->set(mMaterial->getSpecularLightColor(),TRUE); + getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); } // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); - texture_ctrl->setImageAssetID(mMaterial->getNormalID()); + texture_ctrl->setImageAssetID(material->getNormalID()); LLComboBox* combobox_bumpiness = getChild("combobox bumpiness"); - if (!mMaterial->getNormalID().isNull()) + if (!material->getNormalID().isNull()) { - mMaterial->getNormalOffset(offset_x,offset_y); - mMaterial->getNormalRepeat(repeat_x,repeat_y); + material->getNormalOffset(offset_x,offset_y); + material->getNormalRepeat(repeat_x,repeat_y); if (identical_planar_texgen) { @@ -1656,14 +1654,14 @@ void LLPanelFace::getState() repeat_y *= 2.0f; } - rot = mMaterial->getNormalRotation(); + rot = material->getNormalRotation(); getChild("bumpyScaleU")->setValue(repeat_x); getChild("bumpyScaleV")->setValue(repeat_y); getChild("bumpyRot")->setValue(rot*RAD_TO_DEG); getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); } - updateBumpyControls(combobox_bumpiness,this, !mMaterial->getNormalID().isNull(), true); + updateBumpyControls(combobox_bumpiness,this, !material->getNormalID().isNull(), true); } } @@ -1762,31 +1760,30 @@ void LLPanelFace::updateMaterial() || (bumpiness == BUMPY_TEXTURE) || (shininess == SHINY_TEXTURE)) { - // The user's specified something that needs a material. - bool new_material = false; - - // Create new or clone material - // - if (mMaterial.isNull()) - { - mMaterial = LLMaterialPtr(new LLMaterial()); - new_material = true; - } - else + // This should match getState() + struct f1 : public LLSelectedTEGetFunctor { - mMaterial = LLMaterialPtr(new LLMaterial(mMaterial->asLLSD())); - } + LLMaterialPtr get(LLViewerObject* object, S32 te_index) + { + return object->getTE(te_index)->getMaterialParams(); + } + } func; + LLMaterialPtr cur_material; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, cur_material); + + bool new_material = cur_material.isNull(); - llassert_always(mMaterial); + LLMaterialPtr material( (!new_material) ? new LLMaterial(cur_material->asLLSD()) : new LLMaterial()); + llassert_always(material); - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + material->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + material->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(norm_map_id); + material->setNormalID(norm_map_id); F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); @@ -1797,18 +1794,18 @@ void LLPanelFace::updateMaterial() bumpy_scale_v *= 0.5f; } - mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), + material->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); - mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); + material->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); + material->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else { LL_DEBUGS("Materials") << "Removing bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(LLUUID()); - mMaterial->setNormalOffset(0.0f,0.0f); - mMaterial->setNormalRepeat(1.0f,1.0f); - mMaterial->setNormalRotation(0.0f); + material->setNormalID(LLUUID()); + material->setNormalOffset(0.0f,0.0f); + material->setNormalRepeat(1.0f,1.0f); + material->setNormalRotation(0.0f); } LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); @@ -1816,8 +1813,8 @@ void LLPanelFace::updateMaterial() if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(spec_map_id); - mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), + material->setSpecularID(spec_map_id); + material->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); F32 shiny_scale_u = getChild("shinyScaleU")->getValue().asReal(); @@ -1829,45 +1826,40 @@ void LLPanelFace::updateMaterial() shiny_scale_v *= 0.5f; } - mMaterial->setSpecularRepeat(shiny_scale_u, shiny_scale_v); - mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); + material->setSpecularRepeat(shiny_scale_u, shiny_scale_v); + material->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(getChild("glossiness")->getValue().asInteger()); - mMaterial->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); + material->setSpecularLightColor(getChild("shinycolorswatch")->get()); + material->setSpecularLightExponent(getChild("glossiness")->getValue().asInteger()); + material->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); } } else { LL_DEBUGS("Materials") << "Removing shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(LLUUID()); - mMaterial->setSpecularOffset(0.0f,0.0f); - mMaterial->setSpecularRepeat(1.0f,1.0f); - mMaterial->setSpecularRotation(0.0f); - mMaterial->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); - mMaterial->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - mMaterial->setEnvironmentIntensity(0); + material->setSpecularID(LLUUID()); + material->setSpecularOffset(0.0f,0.0f); + material->setSpecularRepeat(1.0f,1.0f); + material->setSpecularRotation(0.0f); + material->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); + material->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + material->setEnvironmentIntensity(0); } - LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; + LL_DEBUGS("Materials") << "Updating material: " << material->asLLSD() << LL_ENDL; - LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); + LLSelectMgr::getInstance()->selectionSetMaterial( material ); } else { // The user has specified settings that don't need a material. - //if (mMaterial || !mMaterialID.isNull()) - { - LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; - mMaterial = NULL; - mMaterialID = LLMaterialID::null; + LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; - // Delete existing material entry... - LLSelectMgr::getInstance()->selectionRemoveMaterial(); - } + // Delete existing material entry... + LLSelectMgr::getInstance()->selectionRemoveMaterial(); } } -- cgit v1.2.3 From d9e8ee7cfd323872145c23e4032989f9b7770f55 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 13 May 2013 13:02:53 -0700 Subject: NORSPEC-178 NORSPEC-179 NORSPEC-180 made enable/disable handling more consistent and increased max range on repeats per meter --- indra/newview/llpanelface.cpp | 241 +++++++++++++++++++----------------------- 1 file changed, 106 insertions(+), 135 deletions(-) (limited to 'indra/newview/llpanelface.cpp') 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("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); @@ -798,7 +803,7 @@ void LLPanelFace::getState() llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } - updateAlphaControls(getChild("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("maskcutoff")->setValue(material->getAlphaMaskCutoff()); - updateAlphaControls(getChild("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("shinytexture control"); texture_ctrl->setImageAssetID(material->getSpecularID()); - LLComboBox* combobox_shininess = getChild("combobox shininess"); + if (!material->getSpecularID().isNull()) { material->getSpecularOffset(offset_x,offset_y); @@ -1628,7 +1633,7 @@ void LLPanelFace::getState() getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("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("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); - LLComboBox* combobox_bumpiness = getChild("combobox bumpiness"); + if (!material->getNormalID().isNull()) { material->getNormalOffset(offset_x,offset_y); @@ -1661,7 +1666,7 @@ void LLPanelFace::getState() getChild("bumpyOffsetU")->setValue(offset_x); getChild("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("combobox matmedia"); - LLComboBox* combo_mattype = self->getChild("combobox mattype"); - LLComboBox* combo_shininess = self->getChild("combobox shininess"); - LLComboBox* combo_bumpiness = self->getChild("combobox bumpiness"); + self->updateUI(); +} + +// static +void LLPanelFace::updateVisibility() +{ + LLComboBox* combo_matmedia = getChild("combobox matmedia"); + LLComboBox* combo_mattype = getChild("combobox mattype"); + LLComboBox* combo_shininess = getChild("combobox shininess"); + LLComboBox* combo_bumpiness = getChild("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("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("shinytexture control"); + LLTextureCtrl* texture_ctrl = 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"); + LLComboBox* comboShiny = getChild("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("shinycolorswatch"); + LLColorSwatchCtrl* mShinyColorSwatch = getChild("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("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - self->getChild("environment")->setValue(0); + getChild("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + getChild("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("combobox matmedia"); - LLComboBox* combo_mattype = self->getChild("combobox mattype"); + LLComboBox* combo_matmedia = getChild("combobox matmedia"); + LLComboBox* combo_mattype = getChild("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("bumpytexture control"); + LLTextureCtrl* texture_ctrl = getChild("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("combobox bumpiness"); + LLComboBox* comboBumpy = getChild("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("bumpytexture control"); + LLTextureCtrl* texture_ctrl = getChild("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("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("combobox alphamode"); + LLComboBox* comboAlphaMode = getChild("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("combobox matmedia"); + LLComboBox* combobox_matmedia = getChild("combobox matmedia"); U32 mat_media = MATMEDIA_MATERIAL; if (combobox_matmedia) { mat_media = combobox_matmedia->getCurrentIndex(); } - LLComboBox* combobox_mattype = self->getChild("combobox mattype"); + LLComboBox* combobox_mattype = getChild("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("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("combobox bumpiness"); - updateBumpyControls(combo_bumpy, this, true, true); + updateBumpyControls(true, true); updateMaterial(); } void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { updateMaterial(); - LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this, false, true); + updateShinyControls(false, true); } void LLPanelFace::onCancelNormalTexture(const LLSD& data) { updateMaterial(); - LLComboBox* combo_bumpy = getChild("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("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("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("rptctrl")->getValue().asReal();//self->mCtrlRepeatsPerMeter->get(); + LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); + F32 repeats_per_meter = repeats_ctrl->getValue().asReal(); + LLComboBox* combo_mattype = self->getChild("combobox mattype"); F32 obj_scale_s = 1.0f; -- cgit v1.2.3 From c334a185f331a3392c2d0ccaf8241166ef9d8049 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 14 May 2013 05:59:48 -0700 Subject: NORSPEC-151 NORSPEC-152 fix handling of disable of bumpy and shiny in graphics panel to also disable deferred properly and add hooks for default norm and spec textures in texture picker --- indra/newview/llpanelface.cpp | 126 +++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 62 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b2f76e2114..c9029bfcb0 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -157,7 +157,8 @@ BOOL LLPanelFace::postBuild() mShinyTextureCtrl = getChild("shinytexture control"); if(mShinyTextureCtrl) { - mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); + mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectSpecularTexture" ))); + mShinyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankSpecularTexture" ))); mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); @@ -172,7 +173,8 @@ BOOL LLPanelFace::postBuild() mBumpyTextureCtrl = getChild("bumpytexture control"); if(mBumpyTextureCtrl) { - mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); + mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectNormalTexture" ))); + mBumpyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankNormalTexture" ))); mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); @@ -741,23 +743,23 @@ void LLPanelFace::updateUI() } 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; - } + 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; + } if(LLViewerMedia::textureHasMedia(id)) { @@ -768,15 +770,15 @@ void LLPanelFace::updateUI() struct alpha_get : public LLSelectedTEGetFunctor { 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; } @@ -808,7 +810,7 @@ void LLPanelFace::updateUI() if(texture_ctrl && !texture_ctrl->isPickerShown()) { - if (identical_diffuse) + if (identical_diffuse) { texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); @@ -818,7 +820,7 @@ void LLPanelFace::updateUI() getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); } - else if (id.isNull()) + else if (id.isNull()) { // None selected texture_ctrl->setTentative( FALSE ); @@ -835,54 +837,54 @@ void LLPanelFace::updateUI() 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); - } - } + 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 && !shinytexture_ctrl->isPickerShown()) + if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) + { + 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 { - 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( editable ); - shinytexture_ctrl->setImageAssetID( specmap_id ); - } - } + shinytexture_ctrl->setImageAssetID( specmap_id ); + } + } - if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) - { - if (identical_norm) + if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) + { + 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( editable ); - bumpytexture_ctrl->setImageAssetID( normmap_id ); - } - else if (normmap_id.isNull()) - { - bumpytexture_ctrl->setTentative( FALSE ); - bumpytexture_ctrl->setEnabled( FALSE ); + bumpytexture_ctrl->setTentative( FALSE ); + bumpytexture_ctrl->setEnabled( FALSE ); bumpytexture_ctrl->setImageAssetID( LLUUID::null ); } - else - { + else + { bumpytexture_ctrl->setTentative( TRUE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( normmap_id ); + bumpytexture_ctrl->setImageAssetID( normmap_id ); } } } -- cgit v1.2.3 From 8b6be5c667230c61d0de590de122fdef956150b7 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 14 May 2013 08:25:42 -0700 Subject: NORSPEC-85 fix default normal vert offset --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c9029bfcb0..9d0b9d0cac 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1177,7 +1177,7 @@ void LLPanelFace::updateUI() { 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) @@ -1199,7 +1199,7 @@ void LLPanelFace::updateUI() { 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) -- cgit v1.2.3 From a37bff8bf1add5afe154b25156d7ebe38ff9af31 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 14 May 2013 15:26:43 -0700 Subject: NORSPEC-103 reflect normal/spec UVs in face edit overlay display --- indra/newview/llpanelface.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9d0b9d0cac..f8c05bd007 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1646,6 +1646,18 @@ void LLPanelFace::updateUI() getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); } + // Update sel manager as to which channel we're editing so it can reflect the correct overlay UI + // NORSPEC-103 + LLRender::eTexIndex channel_to_edit = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? (LLRender::eTexIndex)combobox_mattype->getCurrentIndex() : LLRender::DIFFUSE_MAP; + + if ( ((channel_to_edit == LLRender::NORMAL_MAP) && material->getNormalID().isNull()) + ||((channel_to_edit == LLRender::SPECULAR_MAP) && material->getSpecularID().isNull())) + { + channel_to_edit = LLRender::DIFFUSE_MAP; + } + + LLSelectMgr::getInstance()->setTextureChannel(channel_to_edit); + // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); @@ -1670,7 +1682,10 @@ void LLPanelFace::updateUI() } updateBumpyControls(!material->getNormalID().isNull(), true); } - + else + { + LLSelectMgr::getInstance()->setTextureChannel(LLRender::DIFFUSE_MAP); + } } // Set variable values for numeric expressions @@ -1856,7 +1871,7 @@ void LLPanelFace::updateMaterial() } LL_DEBUGS("Materials") << "Updating material: " << material->asLLSD() << LL_ENDL; - + LLSelectMgr::getInstance()->selectionSetMaterial( material ); } else -- cgit v1.2.3 From da6022e9b48f645dce0f528d8edd2c9dd25056d5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 15 May 2013 15:30:00 -0500 Subject: NORSPEC-175 Force "alpha mode" to blend in UI when transparency is above zero --- indra/newview/llpanelface.cpp | 99 ++++++++++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 40 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c9029bfcb0..c71ec62bcd 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -658,6 +658,42 @@ void LLPanelFace::updateUI() LLUUID normmap_id; LLUUID specmap_id; + // Color swatch + { + getChildView("color label")->setEnabled(editable); + } + LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); + LLColor4 color = LLColor4::white; + if(mColorSwatch) + { + struct f7 : public LLSelectedTEGetFunctor + { + LLColor4 get(LLViewerObject* object, S32 face) + { + return object->getTE(face)->getColor(); + } + } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color ); + + mColorSwatch->setOriginal(color); + mColorSwatch->set(color, TRUE); + + mColorSwatch->setValid(editable); + mColorSwatch->setEnabled( editable ); + mColorSwatch->setCanApplyImmediately( editable ); + } + + // Color transparency + { + getChildView("color trans")->setEnabled(editable); + } + + F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; + { + getChild("ColorTrans")->setValue(editable ? transparency : 0); + getChildView("ColorTrans")->setEnabled(editable); + } + // Texture { struct f1 : public LLSelectedTEGetFunctor @@ -793,10 +829,17 @@ void LLPanelFace::updateUI() if (combobox_alphamode) { + + if (transparency > 0.f) + { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ... + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + if (!mIsAlpha) - { + { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; } + combobox_alphamode->selectNthItem(alpha_mode); } @@ -815,7 +858,7 @@ void LLPanelFace::updateUI() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); + getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); @@ -837,7 +880,7 @@ void LLPanelFace::updateUI() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); + getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); @@ -1282,42 +1325,6 @@ void LLPanelFace::updateUI() getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); } - // Color swatch - { - getChildView("color label")->setEnabled(editable); - } - LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); - LLColor4 color = LLColor4::white; - if(mColorSwatch) - { - struct f7 : public LLSelectedTEGetFunctor - { - LLColor4 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->getColor(); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color ); - - mColorSwatch->setOriginal(color); - mColorSwatch->set(color, TRUE); - - mColorSwatch->setValid(editable); - mColorSwatch->setEnabled( editable ); - mColorSwatch->setCanApplyImmediately( editable ); - } - - // Color transparency - { - getChildView("color trans")->setEnabled(editable); - } - - F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; - { - getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable); - } - { F32 glow = 0.f; struct f8 : public LLSelectedTEGetFunctor @@ -1587,7 +1594,19 @@ void LLPanelFace::updateUI() childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) { - combobox_alphamode->selectNthItem(material->getDiffuseAlphaMode()); + U32 alpha_mode = material->getDiffuseAlphaMode(); + + if (transparency > 0.f) + { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ... + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + + if (!mIsAlpha) + { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + } + + combobox_alphamode->selectNthItem(alpha_mode); } else { -- cgit v1.2.3 From f58b17cb29ec85ef15465e3ede27cae9ae3b203f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 15 May 2013 15:03:39 -0700 Subject: NORSPEC-152 better default norm/spec textures which read better in the UI and provide better default spec feedback --- indra/newview/llpanelface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f8c05bd007..302a4294e4 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -158,7 +158,6 @@ BOOL LLPanelFace::postBuild() if(mShinyTextureCtrl) { mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectSpecularTexture" ))); - mShinyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankSpecularTexture" ))); mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); -- cgit v1.2.3 From 5acb0b3a32ebac89a4c6347ee88278f580fdd458 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 20 May 2013 11:56:48 -0700 Subject: NORSPEC-168 fix UI update to not re-add the 'Use Texture' item when selecting legacy bump settings --- indra/newview/llpanelface.cpp | 176 +++++++++++++++++++++--------------------- 1 file changed, 88 insertions(+), 88 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1d99e9d162..a5e33f3dd5 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -300,16 +300,13 @@ void LLPanelFace::sendBump() { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); - bumpytexture_ctrl->clear(); - LLSD dummy_data; - onSelectNormalTexture(dummy_data); + bumpytexture_ctrl->setImageAssetID(LLUUID()); } U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); - //refresh material state (in case this change impacts material params) - LLSD dummy_data; - onCommitNormalTexture(dummy_data); + updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); + updateMaterial(); } void LLPanelFace::sendTexGen() @@ -333,9 +330,8 @@ void LLPanelFace::sendShiny() U8 shiny = (U8) shininess & TEM_SHINY_MASK; LLSelectMgr::getInstance()->selectionSetShiny( shiny ); - //refresh material state (in case this change impacts material params) - LLSD dummy_data; - onCommitSpecularTexture(dummy_data); + updateShinyControls(shininess == SHINY_TEXTURE, true); + updateMaterial(); } void LLPanelFace::sendFullbright() @@ -693,6 +689,79 @@ void LLPanelFace::updateUI() getChildView("ColorTrans")->setEnabled(editable); } + U8 shiny = 0; + + // Shiny + { + struct f9 : public LLSelectedTEGetFunctor + { + U8 get(LLViewerObject* object, S32 face) + { + return (U8)(object->getTE(face)->getShiny()); + } + } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); + + LLCtrlSelectionInterface* combobox_shininess = + childGetSelectionInterface("combobox shininess"); + if (combobox_shininess) + { + combobox_shininess->selectNthItem((S32)shiny); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; + } + getChildView("combobox shininess")->setEnabled(editable); + getChild("combobox shininess")->setTentative(!identical); + getChildView("label shininess")->setEnabled(editable); + getChildView("glossiness")->setEnabled(editable); + getChild("glossiness")->setTentative(!identical); + getChildView("label glossiness")->setEnabled(editable); + getChildView("environment")->setEnabled(editable); + getChild("environment")->setTentative(!identical); + getChildView("label environment")->setEnabled(editable); + getChild("shinycolorswatch")->setTentative(!identical); + getChildView("label shinycolor")->setEnabled(editable); + } + + LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); + if(mShinyColorSwatch) + { + mShinyColorSwatch->setValid(editable); + mShinyColorSwatch->setEnabled( editable ); + mShinyColorSwatch->setCanApplyImmediately( editable ); + } + + U8 bumpy = 0; + + // Bumpy + { + struct f10 : public LLSelectedTEGetFunctor + { + U8 get(LLViewerObject* object, S32 face) + { + return object->getTE(face)->getBumpmap(); + } + } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); + + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + + LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); + if (combobox_bumpiness) + { + combobox_bumpiness->selectNthItem((S32)bumpy); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; + } + getChildView("combobox bumpiness")->setEnabled(editable); + getChild("combobox bumpiness")->setTentative(!identical); + getChildView("label bumpiness")->setEnabled(editable); + } + // Texture { struct f1 : public LLSelectedTEGetFunctor @@ -744,6 +813,9 @@ void LLPanelFace::updateUI() } norm_get_func; identical_norm = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &norm_get_func, normmap_id ); + if (bumpy != BUMPY_TEXTURE) + normmap_id = LLUUID::null; + // Specular map struct spec_get : public LLSelectedTEGetFunctor { @@ -763,6 +835,9 @@ void LLPanelFace::updateUI() } spec_get_func; identical_spec = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ); + if (shiny != SHINY_TEXTURE) + specmap_id = LLUUID::null; + mIsAlpha = FALSE; LLGLenum image_format; struct f2 : public LLSelectedTEGetFunctor @@ -801,7 +876,7 @@ void LLPanelFace::updateUI() getChildView("button align")->setEnabled(editable); } - // Specular map + // Diffuse Alpha Mode struct alpha_get : public LLSelectedTEGetFunctor { U8 get(LLViewerObject* object, S32 te_index) @@ -897,7 +972,7 @@ void LLPanelFace::updateUI() else if (specmap_id.isNull()) { shinytexture_ctrl->setTentative( FALSE ); - shinytexture_ctrl->setEnabled( FALSE ); + shinytexture_ctrl->setEnabled( editable ); shinytexture_ctrl->setImageAssetID( LLUUID::null ); } else @@ -919,7 +994,7 @@ void LLPanelFace::updateUI() else if (normmap_id.isNull()) { bumpytexture_ctrl->setTentative( FALSE ); - bumpytexture_ctrl->setEnabled( FALSE ); + bumpytexture_ctrl->setEnabled( editable ); bumpytexture_ctrl->setImageAssetID( LLUUID::null ); } else @@ -1342,82 +1417,7 @@ void LLPanelFace::updateUI() } - U8 shiny = 0; - - // Shiny - { - struct f9 : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 face) - { - return (U8)(object->getTE(face)->getShiny()); - } - } 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(spec_map_id.isNull() ? (S32)shiny : SHINY_TEXTURE); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; - } - getChildView("combobox shininess")->setEnabled(editable); - getChild("combobox shininess")->setTentative(!identical); - getChildView("label shininess")->setEnabled(editable); - getChildView("glossiness")->setEnabled(editable); - getChild("glossiness")->setTentative(!identical); - getChildView("label glossiness")->setEnabled(editable); - getChildView("environment")->setEnabled(editable); - getChild("environment")->setTentative(!identical); - getChildView("label environment")->setEnabled(editable); - getChild("shinycolorswatch")->setTentative(!identical); - getChildView("label shinycolor")->setEnabled(editable); - } - - LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); - if(mShinyColorSwatch) - { - mShinyColorSwatch->setValid(editable); - mShinyColorSwatch->setEnabled( editable ); - mShinyColorSwatch->setCanApplyImmediately( editable ); - } - - U8 bumpy = 0; - - // Bumpy - { - struct f10 : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->getBumpmap(); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); - - 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(bumpy); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; - } - getChildView("combobox bumpiness")->setEnabled(editable); - getChild("combobox bumpiness")->setTentative(!identical); - getChildView("label bumpiness")->setEnabled(editable); - } + { LLCtrlSelectionInterface* combobox_texgen = -- cgit v1.2.3 From a1a8048d3e1494d50f23bc1b6c66a238128fe82b Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 20 May 2013 16:24:58 -0700 Subject: NORSPEC-188 avoid removing 'Use Texture' item when cancelling from picker back to having prev texture --- indra/newview/llpanelface.cpp | 90 ++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 35 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index a5e33f3dd5..ff362a5c6b 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -291,17 +291,16 @@ void LLPanelFace::sendTexture() } } -void LLPanelFace::sendBump() +void LLPanelFace::sendBump(U32 bumpiness) { - LLComboBox* mComboBumpiness = getChild("combobox bumpiness"); - if(!mComboBumpiness)return; - U32 bumpiness = mComboBumpiness->getCurrentIndex(); if (bumpiness < BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + bumpytexture_ctrl->clear(); bumpytexture_ctrl->setImageAssetID(LLUUID()); } + U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); @@ -317,14 +316,12 @@ void LLPanelFace::sendTexGen() LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen ); } -void LLPanelFace::sendShiny() +void LLPanelFace::sendShiny(U32 shininess) { - LLComboBox* mComboShininess = getChild("combobox shininess"); - if(!mComboShininess)return; - U32 shininess = mComboShininess->getCurrentIndex(); if (shininess < SHINY_TEXTURE) { LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + texture_ctrl->clear(); texture_ctrl->setImageAssetID(LLUUID()); } U8 shiny = (U8) shininess & TEM_SHINY_MASK; @@ -963,7 +960,7 @@ void LLPanelFace::updateUI() if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) { - if (identical_spec) + if (identical_spec && (shiny == SHINY_TEXTURE)) { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); @@ -985,7 +982,7 @@ void LLPanelFace::updateUI() if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) { - if (identical_norm) + if (identical_norm && (bumpy == BUMPY_TEXTURE)) { bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( editable ); @@ -1633,7 +1630,7 @@ void LLPanelFace::updateUI() LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); texture_ctrl->setImageAssetID(material->getSpecularID()); - if (!material->getSpecularID().isNull()) + if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) { material->getSpecularOffset(offset_x,offset_y); material->getSpecularRepeat(repeat_x,repeat_y); @@ -1652,8 +1649,9 @@ void LLPanelFace::updateUI() getChild("shinyOffsetV")->setValue(offset_y); getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("environment")->setValue(material->getEnvironmentIntensity()); + + updateShinyControls(!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. @@ -1680,7 +1678,7 @@ void LLPanelFace::updateUI() texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); - if (!material->getNormalID().isNull()) + if (!material->getNormalID().isNull() && (bumpy == BUMPY_TEXTURE)) { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); @@ -1697,8 +1695,9 @@ void LLPanelFace::updateUI() getChild("bumpyRot")->setValue(rot*RAD_TO_DEG); getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); + + updateBumpyControls(!material->getNormalID().isNull(), true); } - updateBumpyControls(!material->getNormalID().isNull(), true); } else { @@ -2041,9 +2040,14 @@ void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->sendBump(); - self->updateBumpyControls(false, true); - self->updateMaterial(); + + LLComboBox* mComboBumpiness = self->getChild("combobox bumpiness"); + if(!mComboBumpiness) + return; + + U32 bumpiness = mComboBumpiness->getCurrentIndex(); + + self->sendBump(bumpiness); } // static @@ -2156,12 +2160,15 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->sendShiny(); - // Need 'true' here to insure that the 'Use Texture' choice is removed - // when we select something other than a spec texture - // - self->updateShinyControls(false, true); - self->updateMaterial(); + + + LLComboBox* mComboShininess = self->getChild("combobox shininess"); + if(!mComboShininess) + return; + + U32 shininess = mComboShininess->getCurrentIndex(); + + self->sendShiny(shininess); } // static @@ -2256,41 +2263,54 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - updateShinyControls(true, true); - updateMaterial(); + sendShiny(SHINY_TEXTURE); } void LLPanelFace::onCommitNormalTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - updateBumpyControls(true, true); - updateMaterial(); + sendBump(BUMPY_TEXTURE); } void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { - updateMaterial(); - updateShinyControls(false, true); + U8 shiny = 0; + struct get_shiny : public LLSelectedTEGetFunctor + { + U8 get(LLViewerObject* object, S32 face) + { + return (U8)(object->getTE(face)->getShiny()); + } + } func; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); + sendShiny(shiny); } void LLPanelFace::onCancelNormalTexture(const LLSD& data) { - updateMaterial(); - updateBumpyControls(false, true); + U8 bumpy = 0; + struct get_bumpy : public LLSelectedTEGetFunctor + { + U8 get(LLViewerObject* object, S32 face) + { + return (U8)(object->getTE(face)->getBumpmap()); + } + + } func; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); + sendBump(bumpy); } void LLPanelFace::onSelectSpecularTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; - updateMaterial(); - updateShinyControls(true, true); + sendShiny(SHINY_TEXTURE); } void LLPanelFace::onSelectNormalTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; - updateBumpyControls(true, true); - updateMaterial(); + sendBump(BUMPY_TEXTURE); } //static -- cgit v1.2.3 From eaff189b45a09b4abb4bb4be15c17ff501995141 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 20 May 2013 16:38:10 -0700 Subject: Merge --- indra/newview/llpanelface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ff362a5c6b..d0eea6eb9b 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1391,7 +1391,8 @@ void LLPanelFace::updateUI() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, rotation ); identical = align_planar ? identical_planar_aligned : identical; - getChild("bumpyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); + F32 normal_rot_deg = rotation * RAD_TO_DEG; + getChild("bumpyRot")->setValue(editable ? normal_rot_deg : 0.0f); getChild("bumpyRot")->setTentative(LLSD((BOOL)(!identical))); getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); } @@ -1835,7 +1836,8 @@ void LLPanelFace::updateMaterial() material->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); material->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); - material->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); + F32 normal_rot_rads = getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD; + material->setNormalRotation(normal_rot_rads); } else { -- cgit v1.2.3 From 06b3879acc2f0a306cace145f3772433e5fff5c9 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 21 May 2013 15:27:52 -0700 Subject: NORSPEC-200 fix regression from 188 fix caused by not having enough bits to store SHINY_TEXTURE in the TEs bitfield --- indra/newview/llpanelface.cpp | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index d0eea6eb9b..31e67960bd 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -686,6 +686,25 @@ void LLPanelFace::updateUI() getChildView("ColorTrans")->setEnabled(editable); } + // Specular map + struct spec_get : public LLSelectedTEGetFunctor + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + LLUUID id; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + id = mat->getSpecularID(); + } + + return id; + } + } spec_get_func; + identical_spec = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ); + U8 shiny = 0; // Shiny @@ -701,9 +720,10 @@ void LLPanelFace::updateUI() LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); + if (combobox_shininess) { - combobox_shininess->selectNthItem((S32)shiny); + combobox_shininess->selectNthItem(specmap_id.isNull() ? (S32)shiny : SHINY_TEXTURE); } else { @@ -813,28 +833,6 @@ void LLPanelFace::updateUI() if (bumpy != BUMPY_TEXTURE) normmap_id = LLUUID::null; - // Specular map - struct spec_get : public LLSelectedTEGetFunctor - { - LLUUID get(LLViewerObject* object, S32 te_index) - { - LLUUID id; - - LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); - - if (mat) - { - id = mat->getSpecularID(); - } - - return id; - } - } spec_get_func; - identical_spec = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ); - - if (shiny != SHINY_TEXTURE) - specmap_id = LLUUID::null; - mIsAlpha = FALSE; LLGLenum image_format; struct f2 : public LLSelectedTEGetFunctor @@ -960,7 +958,9 @@ void LLPanelFace::updateUI() if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) { - if (identical_spec && (shiny == SHINY_TEXTURE)) + // Can't use this test as we can't actually store SHINY_TEXTURE in the TEs *sigh* + // + if (identical_spec /*&& (shiny == SHINY_TEXTURE)*/) { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); @@ -1850,7 +1850,7 @@ void LLPanelFace::updateMaterial() LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); - if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) + if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; material->setSpecularID(spec_map_id); -- cgit v1.2.3 From 69ad1f62363f228c397fe5a8a327436f73898876 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Wed, 22 May 2013 09:54:11 -0700 Subject: NORSPEC-205 more dueling spec controls --- indra/newview/llpanelface.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 31e67960bd..8d77aae9ec 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -318,16 +318,18 @@ void LLPanelFace::sendTexGen() void LLPanelFace::sendShiny(U32 shininess) { + LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + if (shininess < SHINY_TEXTURE) - { - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + { texture_ctrl->clear(); texture_ctrl->setImageAssetID(LLUUID()); + + U8 shiny = (U8) shininess & TEM_SHINY_MASK; + LLSelectMgr::getInstance()->selectionSetShiny( shiny ); } - U8 shiny = (U8) shininess & TEM_SHINY_MASK; - LLSelectMgr::getInstance()->selectionSetShiny( shiny ); - updateShinyControls(shininess == SHINY_TEXTURE, true); + updateShinyControls(!texture_ctrl->getImageAssetID().isNull(), true); updateMaterial(); } @@ -721,9 +723,11 @@ void LLPanelFace::updateUI() LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); + shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; + if (combobox_shininess) { - combobox_shininess->selectNthItem(specmap_id.isNull() ? (S32)shiny : SHINY_TEXTURE); + combobox_shininess->selectNthItem((S32)shiny); } else { @@ -2276,6 +2280,7 @@ void LLPanelFace::onCommitNormalTexture( const LLSD& data ) void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { + U8 shiny = 0; struct get_shiny : public LLSelectedTEGetFunctor { @@ -2285,6 +2290,9 @@ void LLPanelFace::onCancelSpecularTexture(const LLSD& data) } } func; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); + + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE; sendShiny(shiny); } -- cgit v1.2.3 From 5c6da1c8ee60667f365571aba48c4ac61f42a14c Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 22 May 2013 15:23:10 -0700 Subject: NORSPEC-204 make tex controls act like diffuse map when in media mode --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 8d77aae9ec..49750c8c19 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1538,7 +1538,7 @@ void LLPanelFace::updateUI() BOOL identical = true; F32 repeats = 1.0f; - U32 material_type = combobox_mattype->getCurrentIndex(); + U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? combobox_mattype->getCurrentIndex() : MATTYPE_DIFFUSE; switch (material_type) { default: -- cgit v1.2.3 From 9ef98bece29b6740e4f779ab6a3534b5b1e7f974 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 23 May 2013 10:42:32 -0700 Subject: NORSPEC-193 NORSPEC-161 make legacy shiny a batch breaker when materials are in play --- indra/newview/llpanelface.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 49750c8c19..33c77ed98f 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1799,9 +1799,12 @@ void LLPanelFace::updateMaterial() bool is_default_blend_mode = mIsAlpha ? (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) : (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + if ( !is_default_blend_mode - || (bumpiness == BUMPY_TEXTURE) - || (shininess == SHINY_TEXTURE)) + || !norm_map_id.isNull() + || !spec_map_id.isNull()) { // This should match getState() struct f1 : public LLSelectedTEGetFunctor @@ -1822,7 +1825,7 @@ void LLPanelFace::updateMaterial() material->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); material->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); - LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; @@ -1852,7 +1855,7 @@ void LLPanelFace::updateMaterial() material->setNormalRotation(0.0f); } - LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { -- cgit v1.2.3 From 260afbcece7db436af411abcba28495bf99fa08b Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 23 May 2013 16:24:34 -0700 Subject: NORSPEC-192 fix more incorrect batching, fix bug in reflecting normal map state in build tool, and protect against callback crashes when switching regions --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 33c77ed98f..27ca13fcf1 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1683,7 +1683,7 @@ void LLPanelFace::updateUI() texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); - if (!material->getNormalID().isNull() && (bumpy == BUMPY_TEXTURE)) + if (!material->getNormalID().isNull()) { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); -- cgit v1.2.3 From 50158987faa96f7cb879e8dbc7ff48a1240c53a0 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 28 May 2013 12:28:47 -0700 Subject: NORSPEC-211 better handling of diff alpha mode --- indra/newview/llpanelface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 27ca13fcf1..81243484c1 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1822,10 +1822,12 @@ void LLPanelFace::updateMaterial() LLMaterialPtr material( (!new_material) ? new LLMaterial(cur_material->asLLSD()) : new LLMaterial()); llassert_always(material); - material->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + if (!is_default_blend_mode) + { + material->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + } material->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); - if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; -- cgit v1.2.3 From 287b631d9a959399822076c5bbb415d51cf080cd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 28 May 2013 15:57:01 -0700 Subject: NORSPEC-211 less intrusive version of this fix --- indra/newview/llpanelface.cpp | 47 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 81243484c1..b7dc838601 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1822,10 +1822,7 @@ void LLPanelFace::updateMaterial() LLMaterialPtr material( (!new_material) ? new LLMaterial(cur_material->asLLSD()) : new LLMaterial()); llassert_always(material); - if (!is_default_blend_mode) - { - material->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - } + material->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); material->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) @@ -2269,6 +2266,48 @@ void LLPanelFace::onSelectTexture(const LLSD& data) { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); sendTexture(); + + 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 ); + + LLCtrlSelectionInterface* combobox_alphamode = + childGetSelectionInterface("combobox alphamode"); + + U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + if (combobox_alphamode) + { + switch (image_format) + { + case GL_RGBA: + case GL_ALPHA: + { + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + break; + + case GL_RGB: break; + default: + { + llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; + } + break; + } + + combobox_alphamode->selectNthItem(alpha_mode); + } + + updateMaterial(); } void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) -- cgit v1.2.3 From 12307cd47305d26bb969e9c954f9ec1054b88735 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 30 May 2013 18:01:14 -0700 Subject: NORSPEC-214 fix dropdown handling of 'Use Texture' item across objects --- indra/newview/llpanelface.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b7dc838601..2691b4fd5d 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -960,11 +960,11 @@ void LLPanelFace::updateUI() } } - if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) + if (shinytexture_ctrl) { // Can't use this test as we can't actually store SHINY_TEXTURE in the TEs *sigh* // - if (identical_spec /*&& (shiny == SHINY_TEXTURE)*/) + if (identical_spec && (shiny == SHINY_TEXTURE)) { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); @@ -2041,6 +2041,17 @@ void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) // like the texture ctrls for diffuse/norm/spec so that they are correct // when switching modes // + + LLTextureCtrl* texture_ctrl = self->getChild("shinytexture control"); + if (texture_ctrl) + texture_ctrl->clear(); + + texture_ctrl = self->getChild("bumpytexture control"); + if (texture_ctrl) + texture_ctrl->clear(); + + self->updateShinyControls(false,true); + self->updateBumpyControls(false,true); self->updateUI(); } -- cgit v1.2.3 From da6a4ac62ec5b2725bbca647c5d04f2e51967c42 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 31 May 2013 15:55:56 -0700 Subject: Revert NORSPEC-214 fix causing knock-on in spec exp controls --- indra/newview/llpanelface.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 2691b4fd5d..dcedbba81b 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2041,17 +2041,6 @@ void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) // like the texture ctrls for diffuse/norm/spec so that they are correct // when switching modes // - - LLTextureCtrl* texture_ctrl = self->getChild("shinytexture control"); - if (texture_ctrl) - texture_ctrl->clear(); - - texture_ctrl = self->getChild("bumpytexture control"); - if (texture_ctrl) - texture_ctrl->clear(); - - self->updateShinyControls(false,true); - self->updateBumpyControls(false,true); self->updateUI(); } -- cgit v1.2.3 From d40acfb05a475c0e59bccacdde259fe53ecdb203 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 5 Jun 2013 14:18:29 -0700 Subject: NORSPEC-237 nix resetting the keyboard focus to cripple the repeats per meter control --- indra/newview/llpanelface.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index dcedbba81b..01ed6e84b8 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2387,8 +2387,6 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - gFocusMgr.setKeyboardFocus( NULL ); - LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); F32 repeats_per_meter = repeats_ctrl->getValue().asReal(); -- cgit v1.2.3 From 7e4e59470f36ae7a0e01b8d2613af4c8fb6b0101 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 08:58:15 -0700 Subject: NORSPEC-233 WIP for individual material param edits across hetero object selections --- indra/newview/llpanelface.cpp | 1427 ++++++++++++++++++----------------------- 1 file changed, 628 insertions(+), 799 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 01ed6e84b8..a26b9ed237 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -89,6 +89,27 @@ const S32 SHINY_TEXTURE = 4; // use supplied specular map // std::string USE_TEXTURE; +// Things the UI provides... +// +LLUUID LLPanelFace::getCurrentNormalMap() { return getChild("bumpytexture control")->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentSpecularMap() { return getChild("shinytexture control")->getImageAssetID(); } +U32 LLPanelFace::getCurrentShininess() { return getChild("combobox shininess")->getCurrentIndex(); } +U32 LLPanelFace::getCurrentBumpiness() { return getChild("combobox bumpiness")->getCurrentIndex(); } +U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)getChild("combobox alphamode")->getCurrentIndex(); } +U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)getChild("maskcutoff")->getValue().asInteger(); } +U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)getChild("environment")->getValue().asInteger(); } +U8 LLPanelFace::getCurrentGlossiness() { return (U8)getChild("glossiness")->getValue().asInteger(); } +F32 LLPanelFace::getCurrentBumpyRot() { return getChild("bumpyRot")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleU() { return getChild("bumpyScaleU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleV() { return getChild("bumpyScaleV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetU() { return getChild("bumpyOffsetU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetV() { return getChild("bumpyOffsetV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyRot() { return getChild("shinyRot")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleU() { return getChild("shinyScaleU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleV() { return getChild("shinyScaleV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild("shinyOffsetU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild("shinyOffsetV")->getValue().asReal(); } + // // Methods // @@ -105,19 +126,21 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); - childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("environment",&LLPanelFace::onCommitMaterial, this); - childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterial, this); + + childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterialBumpyScaleX, this); + childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterialBumpyScaleY, this); + childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterialBumpyRot, this); + childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterialBumpyOffsetX, this); + childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterialBumpyOffsetY, this); + childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterialShinyScaleX, this); + childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterialShinyScaleY, this); + childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterialShinyRot, this); + childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterialShinyOffsetX, this); + childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterialShinyOffsetY, this); + childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this); + childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this); + childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this); + childSetAction("button align",&LLPanelFace::onClickAutoFix,this); LLTextureCtrl* mTextureCtrl; @@ -293,10 +316,11 @@ void LLPanelFace::sendTexture() void LLPanelFace::sendBump(U32 bumpiness) { + LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + if (bumpiness < BUMPY_TEXTURE) { - LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; - LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; bumpytexture_ctrl->clear(); bumpytexture_ctrl->setImageAssetID(LLUUID()); } @@ -305,7 +329,7 @@ void LLPanelFace::sendBump(U32 bumpiness) LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); - updateMaterial(); + LLSelectedTEMaterial::setNormalID(this, bumpytexture_ctrl->getImageAssetID()); } void LLPanelFace::sendTexGen() @@ -328,9 +352,8 @@ void LLPanelFace::sendShiny(U32 shininess) U8 shiny = (U8) shininess & TEM_SHINY_MASK; LLSelectMgr::getInstance()->selectionSetShiny( shiny ); } - updateShinyControls(!texture_ctrl->getImageAssetID().isNull(), true); - updateMaterial(); + LLSelectedTEMaterial::setSpecularID(this, texture_ctrl->getImageAssetID()); } void LLPanelFace::sendFullbright() @@ -568,16 +591,9 @@ void LLPanelFace::sendTextureInfo() { if ((bool)childGetValue("checkbox planar align").asBoolean()) { - struct f1 : public LLSelectedTEGetFunctor - { - LLFace* get(LLViewerObject* object, S32 te) - { - return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; - } - } get_last_face_func; - LLFace* last_face; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_last_face_func, last_face); - + LLFace* last_face = NULL; + bool identical_face =false; + LLSelectedTE::getFace(last_face, identical_face); LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); } @@ -639,12 +655,12 @@ void LLPanelFace::updateUI() updateVisibility(); - bool identical; - bool identical_diffuse; - bool identical_norm; - bool identical_spec; + bool identical = true; // true because it is anded below + bool identical_diffuse = false; + bool identical_norm = false; + bool identical_spec = false; - LLTextureCtrl* texture_ctrl = getChild("texture control"); + LLTextureCtrl* texture_ctrl = getChild("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); @@ -657,18 +673,14 @@ void LLPanelFace::updateUI() getChildView("color label")->setEnabled(editable); } LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); - LLColor4 color = LLColor4::white; + + LLColor4 color = LLColor4::white; + bool identical_color = false; + if(mColorSwatch) { - struct f7 : public LLSelectedTEGetFunctor - { - LLColor4 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->getColor(); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, color ); - + LLSelectedTE::getColor(color, identical_color); + mColorSwatch->setOriginal(color); mColorSwatch->set(color, TRUE); @@ -689,42 +701,19 @@ void LLPanelFace::updateUI() } // Specular map - struct spec_get : public LLSelectedTEGetFunctor - { - LLUUID get(LLViewerObject* object, S32 te_index) - { - LLUUID id; - - LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); - - if (mat) - { - id = mat->getSpecularID(); - } - - return id; - } - } spec_get_func; - identical_spec = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ); - + LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); + U8 shiny = 0; + bool identical_shiny = false; // Shiny { - struct f9 : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 face) - { - return (U8)(object->getTE(face)->getShiny()); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); - - LLCtrlSelectionInterface* combobox_shininess = - childGetSelectionInterface("combobox shininess"); + LLSelectedTE::getShiny(shiny, identical_shiny); + identical = identical && identical_shiny; shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; + LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { combobox_shininess->selectNthItem((S32)shiny); @@ -733,17 +722,22 @@ void LLPanelFace::updateUI() { llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; } - getChildView("combobox shininess")->setEnabled(editable); - getChild("combobox shininess")->setTentative(!identical); + + getChildView("label shininess")->setEnabled(editable); + getChildView("combobox shininess")->setEnabled(editable); + + getChildView("label glossiness")->setEnabled(editable); getChildView("glossiness")->setEnabled(editable); - getChild("glossiness")->setTentative(!identical); - getChildView("label glossiness")->setEnabled(editable); - getChildView("environment")->setEnabled(editable); - getChild("environment")->setTentative(!identical); + getChildView("label environment")->setEnabled(editable); - getChild("shinycolorswatch")->setTentative(!identical); + getChildView("environment")->setEnabled(editable); getChildView("label shinycolor")->setEnabled(editable); + + getChild("combobox shininess")->setTentative(!identical); + getChild("glossiness")->setTentative(!identical); + getChild("environment")->setTentative(!identical); + getChild("shinycolorswatch")->setTentative(!identical); } LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); @@ -757,17 +751,11 @@ void LLPanelFace::updateUI() U8 bumpy = 0; // Bumpy - { - struct f10 : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->getBumpmap(); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); + { + U8 bumpy; + LLSelectedTE::getBumpmap(bumpy,identical); - LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + LLUUID norm_map_id = getCurrentNormalMap(); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) @@ -785,72 +773,18 @@ void LLPanelFace::updateUI() // Texture { - struct f1 : public LLSelectedTEGetFunctor - { - LLUUID get(LLViewerObject* object, S32 te_index) - { - LLUUID id; - - LLViewerTexture* image = object->getTEImage(te_index); - if (image) id = image->getID(); - - if (!id.isNull() && LLViewerMedia::textureHasMedia(id)) - { - LLTextureEntry *te = object->getTE(te_index); - if (te) - { - LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL ; - if(!tex) - { - tex = LLViewerFetchedTexture::sDefaultImagep; - } - if (tex) - { - id = tex->getID(); - } - } - } - return id; - } - } func; - identical_diffuse = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); + LLSelectedTE::getTexId(id,identical_diffuse); // Normal map - struct norm_get : public LLSelectedTEGetFunctor - { - LLUUID get(LLViewerObject* object, S32 te_index) - { - LLUUID id; - - LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); - - if (mat) - { - id = mat->getNormalID(); - } - - return id; - } - } norm_get_func; - identical_norm = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &norm_get_func, normmap_id ); - + LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm); + if (bumpy != BUMPY_TEXTURE) normmap_id = LLUUID::null; 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 ); + bool identical_image_format = false; + LLSelectedTE::getImageFormat(image_format, identical_image_format); mIsAlpha = FALSE; switch (image_format) @@ -876,53 +810,27 @@ void LLPanelFace::updateUI() } // Diffuse Alpha Mode - struct alpha_get : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 te_index) - { - U8 ret = 1; - - LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + bool identical_alpha_mode = false; + LLSelectedTEMaterial::getDiffuseAlphaMode(alpha_mode, identical_alpha_mode); - if (mat) - { - ret = mat->getDiffuseAlphaMode(); - } - - return ret; - } - } alpha_get_func; - - U8 alpha_mode = 1; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &alpha_get_func, alpha_mode); - + LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) { - LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); + //it is invalid to have any alpha mode other than blend if transparency is greater than zero ... + alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode; - if (combobox_alphamode) - { - - if (transparency > 0.f) - { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ... - alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; - } - - if (!mIsAlpha) - { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none - alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - } - - - combobox_alphamode->selectNthItem(alpha_mode); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; - } + // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none + alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - updateAlphaControls(); + combobox_alphamode->selectNthItem(alpha_mode); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } + + updateAlphaControls(); if(texture_ctrl && !texture_ctrl->isPickerShown()) { @@ -1010,34 +918,20 @@ void LLPanelFace::updateUI() // planar align bool align_planar = false; bool identical_planar_aligned = false; - bool is_planar = false; { LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align"); align_planar = (cb_planar_align && cb_planar_align->get()); - struct f1 : public LLSelectedTEGetFunctor - { - bool get(LLViewerObject* object, S32 face) - { - return (object->getTE(face)->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR); - } - } func; - - bool texgens_identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, is_planar ); - bool enabled = (editable && texgens_identical && is_planar); + + bool enabled = (editable && isIdenticalPlanarTexgen()); childSetValue("checkbox planar align", align_planar && enabled); childSetEnabled("checkbox planar align", enabled); if (align_planar && enabled) { - struct f2 : public LLSelectedTEGetFunctor - { - LLFace* get(LLViewerObject* object, S32 te) - { - return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; - } - } get_te_face_func; - LLFace* last_face; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, last_face); + LLFace* last_face = NULL; + bool identical_face = false; + LLSelectedTE::getFace(last_face, identical_face); + LLPanelFaceGetIsAlignedTEFunctor get_is_aligend_func(last_face); // this will determine if the texture param controls are tentative: identical_planar_aligned = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&get_is_aligend_func); @@ -1052,386 +946,214 @@ void LLPanelFace::updateUI() 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 ); + { + LLSelectedTE::getTexGen(selected_texgen, identical_texgen); identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); } // Texture scale { - F32 scale_s = 1.f; - struct f2 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->mScaleS; - } - } func; + bool identical_diff_scale_s = false; + bool identical_spec_scale_s = false; + bool identical_norm_scale_s = false; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - F32 scale_u = editable ? scale_s : 0; - scale_u *= identical_planar_texgen ? 2.0f : 1.0f; + F32 diff_scale_s = 1.f; + F32 spec_scale_s = 1.f; + F32 norm_scale_s = 1.f; - getChild("TexScaleU")->setValue(scale_u); - getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); - getChildView("TexScaleU")->setEnabled(editable); - - scale_s = 1.f; - struct f3 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 1.f, t = 1.f; + LLSelectedTE::getOffsetS( diff_scale_s, identical_diff_scale_s); + LLSelectedTEMaterial::getSpecularRepeatX( spec_scale_s, identical_spec_scale_s); + LLSelectedTEMaterial::getNormalRepeatX( norm_scale_s, identical_norm_scale_s); - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getSpecularRepeat(s, t); - } - return s; - } - } shiny_func; + diff_scale_s = editable ? diff_scale_s : 1.0f; + diff_scale_s *= identical_planar_texgen ? 2.0f : 1.0f; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_s ); - identical = align_planar ? identical_planar_aligned : identical; - - F32 scale_s_value = editable ? scale_s : 0; - scale_s_value *= identical_planar_texgen ? 2.0f : 1.0f; + norm_scale_s = editable ? norm_scale_s : 1.0f; + norm_scale_s *= 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()); + spec_scale_s = editable ? spec_scale_s : 1.0f; + spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f; - scale_s = 1.f; - struct f4 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 1.f, t = 1.f; + getChild("TexScaleU")->setValue(diff_scale_s); + getChild("shinyScaleU")->setValue(spec_scale_s); + getChild("bumpyScaleU")->setValue(norm_scale_s); - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getNormalRepeat(s, t); - } - return s; - } - } bump_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_s ); - identical = align_planar ? identical_planar_aligned : identical; + getChildView("TexScaleU")->setEnabled(editable); + getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); + getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); - scale_s_value = editable ? scale_s : 0; - scale_s_value *= identical_planar_texgen ? 2.0f : 1.0f; + BOOL diff_scale_tentative = !(identical && identical_diff_scale_s); + BOOL norm_scale_tentative = !(identical && identical_norm_scale_s); + BOOL spec_scale_tentative = !(identical && identical_spec_scale_s); - getChild("bumpyScaleU")->setValue(scale_s_value); - getChild("bumpyScaleU")->setTentative(LLSD((BOOL)(!identical))); - getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); + getChild("TexScaleU")->setTentative( LLSD(diff_scale_tentative)); + getChild("shinyScaleU")->setTentative(LLSD(spec_scale_tentative)); + getChild("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative)); } { - F32 scale_t = 1.f; - struct f3 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->mScaleT; - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); - identical = align_planar ? identical_planar_aligned : identical; + bool identical_diff_scale_t = false; + bool identical_spec_scale_t = false; + bool identical_norm_scale_t = false; - F32 scale_t_value = editable ? scale_t : 0; - scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + F32 diff_scale_t = 1.f; + F32 spec_scale_t = 1.f; + F32 norm_scale_t = 1.f; - getChild("TexScaleV")->setValue(scale_t_value); - getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); - getChildView("TexScaleV")->setEnabled(editable); - - scale_t = 1.f; - struct f4 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 1.f, t = 1.f; + LLSelectedTE::getOffsetT(diff_scale_t, identical_diff_scale_t); + LLSelectedTEMaterial::getSpecularRepeatY(spec_scale_t, identical_spec_scale_t); + LLSelectedTEMaterial::getNormalRepeatY(norm_scale_t, identical_norm_scale_t); - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getSpecularRepeat(s, t); - } - return t; - } - } shiny_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_t ); - identical = align_planar ? identical_planar_aligned : identical; + diff_scale_t = editable ? diff_scale_t : 1.0f; + diff_scale_t *= identical_planar_texgen ? 2.0f : 1.0f; - scale_t_value = editable ? scale_t : 0; - scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + norm_scale_t = editable ? norm_scale_t : 1.0f; + norm_scale_t *= 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()); + spec_scale_t = editable ? spec_scale_t : 1.0f; + spec_scale_t *= identical_planar_texgen ? 2.0f : 1.0f; - scale_t = 1.f; - struct f5 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 1.f, t = 1.f; + BOOL diff_scale_tentative = !(identical && identical_diff_scale_t); + BOOL norm_scale_tentative = !(identical && identical_norm_scale_t); + BOOL spec_scale_tentative = !(identical && identical_spec_scale_t); - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getNormalRepeat(s, t); - } - return t; - } - } bump_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_t ); - identical = align_planar ? identical_planar_aligned : identical; + getChildView("TexScaleV")->setEnabled(editable); + getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); + getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); - scale_t_value = editable ? scale_t : 0.0f; - scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + getChild("TexScaleV")->setValue(diff_scale_t); + getChild("shinyScaleV")->setValue(norm_scale_t); + getChild("bumpyScaleV")->setValue(spec_scale_t); - getChild("bumpyScaleV")->setValue(scale_t_value); - getChild("bumpyScaleV")->setTentative(LLSD((BOOL)(!identical))); - getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); - + getChild("TexScaleV")->setTentative(LLSD(diff_scale_tentative)); + getChild("shinyScaleV")->setTentative(LLSD(norm_scale_tentative)); + getChild("bumpyScaleV")->setTentative(LLSD(spec_scale_tentative)); } // Texture offset { - getChildView("tex offset")->setEnabled(editable); - F32 offset_s = 0.f; - struct f4 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->mOffsetS; - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_s ); - identical = align_planar ? identical_planar_aligned : identical; - getChild("TexOffsetU")->setValue(editable ? offset_s : 0); - getChild("TexOffsetU")->setTentative(!identical); - getChildView("TexOffsetU")->setEnabled(editable); + bool identical_diff_offset_s = false; + bool identical_norm_offset_s = false; + bool identical_spec_offset_s = false; - offset_s = 1.f; - struct f3 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 0.f, t = 0.f; + F32 diff_offset_s = 0.0f; + F32 norm_offset_s = 0.0f; + F32 spec_offset_s = 0.0f; - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getSpecularOffset(s, t); - } - return s; - } - } shiny_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_s ); - identical = align_planar ? identical_planar_aligned : identical; - getChild("shinyOffsetU")->setValue(editable ? offset_s : 0); - getChild("shinyOffsetU")->setTentative(LLSD((BOOL)(!identical))); - getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); + LLSelectedTE::getOffsetS(diff_offset_s, identical_diff_offset_s); + LLSelectedTEMaterial::getNormalOffsetX(norm_offset_s, identical_norm_offset_s); + LLSelectedTEMaterial::getSpecularOffsetX(spec_offset_s, identical_spec_offset_s); - offset_s = 1.f; - struct f5 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 0.f, t = 0.f; + BOOL diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s); + BOOL norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s); + BOOL spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s); - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getNormalOffset(s, t); - } - return s; - } - } bump_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_s ); - identical = align_planar ? identical_planar_aligned : identical; + getChild("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f); + getChild("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f); + getChild("shinyOffsetU")->setValue(editable ? spec_offset_s : 0.0f); + + getChild("TexOffsetU")->setTentative(LLSD(diff_offset_u_tentative)); + getChild("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative)); + getChild("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative)); - getChild("bumpyOffsetU")->setValue(editable ? offset_s : 0); - getChild("bumpyOffsetU")->setTentative(LLSD((BOOL)(!identical))); + getChildView("TexOffsetU")->setEnabled(editable); + getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()); } { - F32 offset_t = 0.f; - struct f5 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->mOffsetT; - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, offset_t ); - identical = align_planar ? identical_planar_aligned : identical; - getChild("TexOffsetV")->setValue(editable ? offset_t : 0); - getChild("TexOffsetV")->setTentative(!identical); - getChildView("TexOffsetV")->setEnabled(editable); - - - offset_t = 1.f; - struct f3 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 0.f, t = 0.f; + bool identical_diff_offset_t = false; + bool identical_norm_offset_t = false; + bool identical_spec_offset_t = false; - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getSpecularOffset(s, t); - } - return t; - } - } shiny_func; + F32 diff_offset_t = 0.0f; + F32 norm_offset_t = 0.0f; + F32 spec_offset_t = 0.0f; + + LLSelectedTE::getOffsetT(diff_offset_t, identical_diff_offset_t); + LLSelectedTEMaterial::getNormalOffsetY(norm_offset_t, identical_norm_offset_t); + LLSelectedTEMaterial::getSpecularOffsetY(spec_offset_t, identical_spec_offset_t); - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, offset_t ); - identical = align_planar ? identical_planar_aligned : identical; - getChild("shinyOffsetV")->setValue(editable ? offset_t : 0); - getChild("shinyOffsetV")->setTentative(LLSD((BOOL)(!identical))); - getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); + BOOL diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t); + BOOL norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t); + BOOL spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t); - offset_t = 1.f; - struct f4 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 s = 0.f, t = 0.f; + getChild("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f); + getChild("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f); + getChild("shinyOffsetV")->setValue(editable ? spec_offset_t : 0.0f); - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - mat->getNormalOffset(s, t); - } - return t; - } - } bump_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, offset_t ); - identical = align_planar ? identical_planar_aligned : identical; + getChild("TexOffsetV")->setTentative(LLSD(diff_offset_v_tentative)); + getChild("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative)); + getChild("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); - getChild("bumpyOffsetV")->setValue(editable ? offset_t : 0); - getChild("bumpyOffsetV")->setTentative(LLSD((BOOL)(!identical))); + getChildView("TexOffsetV")->setEnabled(editable); + getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()); } // Texture rotation { - F32 rotation = 0.f; - struct f6 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->mRotation; - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, rotation ); - identical = align_planar ? identical_planar_aligned : identical; - getChild("TexRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); - getChild("TexRot")->setTentative(!identical); - getChildView("TexRot")->setEnabled(editable); + bool identical_diff_rotation = false; + bool identical_norm_rotation = false; + bool identical_spec_rotation = false; + F32 diff_rotation = 0.f; + F32 norm_rotation = 0.f; + F32 spec_rotation = 0.f; - - rotation = 1.f; - struct f3 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 ret = 0.f; + LLSelectedTE::getRotation(diff_rotation,identical_diff_rotation); + LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation); + LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation); - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - ret = mat->getSpecularRotation(); - } - return ret; - } - } shiny_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, rotation ); - identical = align_planar ? identical_planar_aligned : identical; - getChild("shinyRot")->setValue(editable ? rotation * RAD_TO_DEG : 0); - getChild("shinyRot")->setTentative(LLSD((BOOL)(!identical))); - getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); + BOOL diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation); + BOOL norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation); + BOOL spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation); - rotation = 1.f; - struct f4 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - F32 ret = 0.f; + F32 diff_rot_deg = diff_rotation * RAD_TO_DEG; + F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; + F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); - if (mat) - { - ret = mat->getNormalRotation(); - } - return ret; - } - } bump_func; - - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, rotation ); - identical = align_planar ? identical_planar_aligned : identical; - - F32 normal_rot_deg = rotation * RAD_TO_DEG; - getChild("bumpyRot")->setValue(editable ? normal_rot_deg : 0.0f); - getChild("bumpyRot")->setTentative(LLSD((BOOL)(!identical))); + getChildView("TexRot")->setEnabled(editable); + getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); + + getChild("TexRot")->setTentative(diff_rot_tentative); + getChild("shinyRot")->setTentative(LLSD(norm_rot_tentative)); + getChild("bumpyRot")->setTentative(LLSD(spec_rot_tentative)); + + getChild("TexRot")->setValue( editable ? diff_rot_deg : 0.0f); + getChild("shinyRot")->setValue(editable ? spec_rot_deg : 0.0f); + getChild("bumpyRot")->setValue(editable ? norm_rot_deg : 0.0f); } { F32 glow = 0.f; - struct f8 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->getGlow(); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, glow ); + bool identical_glow = false; + + LLSelectedTE::getGlow(glow,identical_glow); + + identical = identical && identical_glow; getChild("glow")->setValue(glow); getChildView("glow")->setEnabled(editable); getChild("glow")->setTentative(!identical); getChildView("glow label")->setEnabled(editable); - } - - { - LLCtrlSelectionInterface* combobox_texgen = - childGetSelectionInterface("combobox texgen"); + LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); if (combobox_texgen) { - combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); // Maps from enum to combobox entry index + // Maps from enum to combobox entry index + combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); } else { llwarns << "failed childGetSelectionInterface for 'combobox texgen'" << llendl; } + getChildView("combobox texgen")->setEnabled(editable); getChild("combobox texgen")->setTentative(!identical); getChildView("tex gen")->setEnabled(editable); @@ -1450,14 +1172,11 @@ void LLPanelFace::updateUI() { U8 fullbright_flag = 0; - struct f12 : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 face) - { - return object->getTE(face)->getFullbright(); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbright_flag ); + bool identical_fullbright = false; + + LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); + + identical = identical && identical_fullbright; getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); getChildView("checkbox fullbright")->setEnabled(editable); @@ -1470,65 +1189,13 @@ void LLPanelFace::updateUI() F32 repeats_norm = 1.f; F32 repeats_spec = 1.f; - struct f13 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - U32 s_axis = VX; - U32 t_axis = VY; - // BUG: Only repeats along S axis - // BUG: Only works for boxes. - LLPrimitive::getTESTAxes(face, &s_axis, &t_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_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 ); + bool identical_diff_repeats = false; + bool identical_norm_repeats = false; + bool identical_spec_repeats = false; - 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 ); - + LLSelectedTE::getMaxDiffuseRepeats(repeats_spec, identical_spec_repeats); + LLSelectedTEMaterial::getMaxNormalRepeats(repeats_spec, identical_spec_repeats); + LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); LLComboBox* mComboTexGen = getChild("combobox texgen"); if (mComboTexGen) @@ -1575,16 +1242,8 @@ void LLPanelFace::updateUI() // Materials { - struct f1 : public LLSelectedTEGetFunctor - { - LLMaterialPtr get(LLViewerObject* object, S32 te_index) - { - return object->getTE(te_index)->getMaterialParams(); - } - } func; - LLMaterialPtr material; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material ); + LLSelectedTEMaterial::getCurrent(material, identical); if (material && editable) { @@ -1616,19 +1275,7 @@ void LLPanelFace::updateUI() getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(); - 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)); + identical_planar_texgen = isIdenticalPlanarTexgen(); // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; @@ -1771,143 +1418,75 @@ void LLPanelFace::refresh() getState(); } -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"); - LLComboBox* comboShininess = getChild("combobox shininess"); - if (!comboAlphaMode || !comboBumpiness || !comboShininess) - { +/* +void LLPanelFace::updateMaterialParams(LLMaterialEditFunctorBase* edit_func) +{ + if (!edit_func) return; - } - 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)); - - bool is_default_blend_mode = mIsAlpha ? (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) - : (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE); - - LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); - LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); - if ( !is_default_blend_mode - || !norm_map_id.isNull() - || !spec_map_id.isNull()) + struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor { - // This should match getState() - struct f1 : public LLSelectedTEGetFunctor + LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctorBase* edit) : _panel(panel), _edit(edit) {}; + virtual ~LLSelectedTEEditMaterial() {}; + virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) { - LLMaterialPtr get(LLViewerObject* object, S32 te_index) + if (_edit) { - return object->getTE(te_index)->getMaterialParams(); - } - } func; - LLMaterialPtr cur_material; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, cur_material); - - bool new_material = cur_material.isNull(); - - LLMaterialPtr material( (!new_material) ? new LLMaterial(cur_material->asLLSD()) : new LLMaterial()); - llassert_always(material); - - material->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - material->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); - - if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) - { - LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - material->setNormalID(norm_map_id); + // Yesterday's news... + // + //U32 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); + //LLUUID old_normal_map_id = _panel->getCurrentNormalMap(); + //LLUUID old_spec_map_id = _panel->getCurrentSpecularMap(); + //bool was_default_blend_mode = (current_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); + //bool was_need_material = !was_default_blend_mode || !old_normal_map_id.isNull() || !old_spec_map_id.isNull(); - F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); - F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); + LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial()); + llassert_always(new_material); - if (identical_planar_texgen) - { - bumpy_scale_u *= 0.5f; - bumpy_scale_v *= 0.5f; - } + // Do "It"! + // + _edit->apply(new_material); - material->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), - getChild("bumpyOffsetV")->getValue().asReal()); - material->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); - F32 normal_rot_rads = getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD; - material->setNormalRotation(normal_rot_rads); - } - else - { - LL_DEBUGS("Materials") << "Removing bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - material->setNormalID(LLUUID()); - material->setNormalOffset(0.0f,0.0f); - material->setNormalRepeat(1.0f,1.0f); - material->setNormalRotation(0.0f); - } - - + U32 new_alpha_mode = new_material->getDiffuseAlphaMode(); + LLUUID new_normal_map_id = new_material->getNormalID(); + LLUUID new_spec_map_id = new_material->getSpecularID(); - if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) - { - LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - material->setSpecularID(spec_map_id); - material->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), - getChild("shinyOffsetV")->getValue().asReal()); + bool is_default_blend_mode = (new_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); + bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull(); - F32 shiny_scale_u = getChild("shinyScaleU")->getValue().asReal(); - F32 shiny_scale_v = getChild("shinyScaleV")->getValue().asReal(); + if (!current_material.isNull() && !is_need_material) + { + LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; + LLMaterialMgr::getInstance()->remove(object->getID(),face); + } + else + { + // Replicate old init behavior + // + if (current_material.isNull()) + { + U8 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); + U8 current_alpha_mask_cutoff = _panel->getCurrentAlphaMaskCutoff(); - if (identical_planar_texgen) - { - shiny_scale_u *= 0.5f; - shiny_scale_v *= 0.5f; - } + new_material->setDiffuseAlphaMode(current_alpha_mode); + new_material->setAlphaMaskCutoff(current_alpha_mask_cutoff); + } - material->setSpecularRepeat(shiny_scale_u, shiny_scale_v); - material->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); + LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL; + LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material); + } - //override shininess to 0.2f if this is a new material - if (!new_material) - { - material->setSpecularLightColor(getChild("shinycolorswatch")->get()); - material->setSpecularLightExponent(getChild("glossiness")->getValue().asInteger()); - material->setEnvironmentIntensity(getChild("environment")->getValue().asInteger()); + object->setTEMaterialParams(face, new_material); + return new_material; } + return NULL; } - else - { - LL_DEBUGS("Materials") << "Removing shiny texture, shininess = " << shininess << LL_ENDL; - material->setSpecularID(LLUUID()); - material->setSpecularOffset(0.0f,0.0f); - material->setSpecularRepeat(1.0f,1.0f); - material->setSpecularRotation(0.0f); - material->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); - material->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - material->setEnvironmentIntensity(0); - } - - LL_DEBUGS("Materials") << "Updating material: " << material->asLLSD() << LL_ENDL; - - LLSelectMgr::getInstance()->selectionSetMaterial( material ); - } - else - { - // The user has specified settings that don't need a material. - LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; - - // Delete existing material entry... - LLSelectMgr::getInstance()->selectionRemoveMaterial(); - } + LLMaterialEditFunctorBase* _edit; + LLPanelFace* _panel; + } editor(this, edit_func); + LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor); } +*/ // // Static functions @@ -1927,7 +1506,7 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - updateMaterial(); + LLSelectedTEMaterial::setSpecularLightColor(this, getChild("shinycolorswatch")->get()); } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -2216,7 +1795,7 @@ void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; self->updateAlphaControls(); - self->updateMaterial(); + LLSelectedTEMaterial::setDiffuseAlphaMode(self,self->getCurrentDiffuseAlphaMode()); } // static @@ -2268,18 +1847,8 @@ void LLPanelFace::onSelectTexture(const LLSD& data) sendTexture(); 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 ); + bool identical_image_format = false; + LLSelectedTE::getImageFormat(image_format, identical_image_format); LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); @@ -2306,8 +1875,7 @@ void LLPanelFace::onSelectTexture(const LLSD& data) combobox_alphamode->selectNthItem(alpha_mode); } - - updateMaterial(); + LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) @@ -2324,17 +1892,9 @@ void LLPanelFace::onCommitNormalTexture( const LLSD& data ) void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { - - U8 shiny = 0; - struct get_shiny : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 face) - { - return (U8)(object->getTE(face)->getShiny()); - } - } func; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); - + U8 shiny = 0; + bool identical_shiny = false; + LLSelectedTE::getShiny(shiny, identical_shiny); LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE; sendShiny(shiny); @@ -2342,16 +1902,9 @@ void LLPanelFace::onCancelSpecularTexture(const LLSD& data) void LLPanelFace::onCancelNormalTexture(const LLSD& data) { - U8 bumpy = 0; - struct get_bumpy : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 face) - { - return (U8)(object->getTE(face)->getBumpmap()); - } - - } func; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); + U8 bumpy = 0; + bool identical_bumpy = false; + LLSelectedTE::getBumpmap(bumpy, identical_bumpy); sendBump(bumpy); } @@ -2368,10 +1921,126 @@ void LLPanelFace::onSelectNormalTexture(const LLSD& data) } //static -void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyOffsetX(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setNormalOffsetX(self,self->getCurrentBumpyOffsetU()); +} + +//static +void LLPanelFace::onCommitMaterialBumpyOffsetY(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setNormalOffsetY(self,self->getCurrentBumpyOffsetV()); +} + +//static +void LLPanelFace::onCommitMaterialShinyOffsetX(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setSpecularOffsetX(self,self->getCurrentShinyOffsetU()); +} + +//static +void LLPanelFace::onCommitMaterialShinyOffsetY(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setSpecularOffsetY(self,self->getCurrentShinyOffsetV()); +} + +//static +void LLPanelFace::onCommitMaterialBumpyScaleX(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + F32 bumpy_scale_u = self->getCurrentBumpyScaleU(); + if (self->isIdenticalPlanarTexgen()) + { + bumpy_scale_u *= 0.5f; + } + LLSelectedTEMaterial::setNormalRepeatX(self,bumpy_scale_u); +} + +//static +void LLPanelFace::onCommitMaterialBumpyScaleY(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + F32 bumpy_scale_v = self->getCurrentBumpyScaleV(); + if (self->isIdenticalPlanarTexgen()) + { + bumpy_scale_v *= 0.5f; + } + LLSelectedTEMaterial::setNormalRepeatY(self,bumpy_scale_v); +} + +//static +void LLPanelFace::onCommitMaterialShinyScaleX(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + F32 shiny_scale_u = self->getCurrentShinyScaleU(); + if (self->isIdenticalPlanarTexgen()) + { + shiny_scale_u *= 0.5f; + } + LLSelectedTEMaterial::setSpecularRepeatX(self,shiny_scale_u); +} + +//static +void LLPanelFace::onCommitMaterialShinyScaleY(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + F32 shiny_scale_v = self->getCurrentShinyScaleV(); + if (self->isIdenticalPlanarTexgen()) + { + shiny_scale_v *= 0.5f; + } + LLSelectedTEMaterial::setSpecularRepeatY(self,shiny_scale_v); +} + +//static +void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot()); +} + +//static +void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot()); +} + +//static +void LLPanelFace::onCommitMaterialGloss(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setSpecularLightExponent(self,self->getCurrentGlossiness()); +} + +//static +void LLPanelFace::onCommitMaterialEnv(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + llassert_always(self); + LLSelectedTEMaterial::setEnvironmentIntensity(self,self->getCurrentEnvIntensity()); +} + +//static +void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->updateMaterial(); + LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff()); } // static @@ -2387,44 +2056,21 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); + LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); + LLComboBox* combo_mattype = self->getChild("combobox mattype"); - F32 repeats_per_meter = repeats_ctrl->getValue().asReal(); - - LLComboBox* combo_mattype = self->getChild("combobox mattype"); + U32 material_type = combo_mattype->getCurrentIndex(); + F32 repeats_per_meter = repeats_ctrl->getValue().asReal(); - F32 obj_scale_s = 1.0f; - F32 obj_scale_t = 1.0f; - - U32 material_type = combo_mattype->getCurrentIndex(); + F32 obj_scale_s = 1.0f; + F32 obj_scale_t = 1.0f; - 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 ); - + bool identical_scale_s = false; + bool identical_scale_t = false; + + LLSelectedTE::getObjectScaleS(obj_scale_s, identical_scale_s); + LLSelectedTE::getObjectScaleS(obj_scale_t, identical_scale_t); + switch (material_type) { case MATTYPE_DIFFUSE: @@ -2437,9 +2083,12 @@ 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(obj_scale_s * repeats_per_meter); bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); - self->updateMaterial(); + + LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter); } break; @@ -2447,9 +2096,12 @@ 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(obj_scale_s * repeats_per_meter); shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); - self->updateMaterial(); + + LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter); } break; @@ -2580,3 +2232,180 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) } } +bool LLPanelFace::isIdenticalPlanarTexgen() +{ + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + bool identical_texgen = false; + LLSelectedTE::getTexGen(selected_texgen, identical_texgen); + return (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); +} + +void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical_face) +{ + struct LLSelectedTEGetFace : public LLSelectedTEGetFunctor + { + LLFace* get(LLViewerObject* object, S32 te) + { + return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; + } + } get_te_face_func; + identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return); +} + +void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face) +{ + struct LLSelectedTEGetImageFormat : public LLSelectedTEGetFunctor + { + LLGLenum get(LLViewerObject* object, S32 te_index) + { + LLViewerTexture* image = object->getTEImage(te_index); + return image ? image->getPrimaryFormat() : GL_RGB; + } + } get_glenum; + identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format_to_return); +} + +void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) +{ + struct LLSelectedTEGetTexId : public LLSelectedTEGetFunctor + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + LLUUID id; + LLViewerTexture* image = object->getTEImage(te_index); + if (image) + { + id = image->getID(); + } + + if (!id.isNull() && LLViewerMedia::textureHasMedia(id)) + { + LLTextureEntry *te = object->getTE(te_index); + if (te) + { + LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL; + if(!tex) + { + tex = LLViewerFetchedTexture::sDefaultImagep; + } + if (tex) + { + id = tex->getID(); + } + } + } + return id; + } + } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); +} + +void LLPanelFace::LLSelectedTEMaterial::getCurrent(LLMaterialPtr& material_ptr, bool& identical_material) +{ + struct MaterialFunctor : public LLSelectedTEGetFunctor + { + LLMaterialPtr get(LLViewerObject* object, S32 te_index) + { + return object->getTE(te_index)->getMaterialParams(); + } + } func; + identical_material = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_ptr); +} + +void LLPanelFace::LLSelectedTEMaterial::getMaxSpecularRepeats(F32& repeats, bool& identical) +{ + struct LLSelectedTEGetMaxSpecRepeats : 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); + } + + } max_spec_repeats_func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_spec_repeats_func, repeats); +} + +void LLPanelFace::LLSelectedTEMaterial::getMaxNormalRepeats(F32& repeats, bool& identical) +{ + struct LLSelectedTEGetMaxNormRepeats : 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); + } + + } max_norm_repeats_func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_norm_repeats_func, repeats); +} + +void LLPanelFace::LLSelectedTE::getObjectScaleS(F32& scale_s, bool& identical) +{ + struct LLSelectedTEGetObjectScaleS : 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; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_s_func, scale_s ); +} + +void LLPanelFace::LLSelectedTE::getObjectScaleT(F32& scale_t, bool& identical) +{ + struct LLSelectedTEGetObjectScaleS : 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; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_t_func, scale_t ); +} + +void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identical) +{ + struct LLSelectedTEGetMaxDiffuseRepeats : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + U32 s_axis = VX; + U32 t_axis = VY; + LLPrimitive::getTESTAxes(face, &s_axis, &t_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); + } + + } max_diff_repeats_func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats ); +} \ No newline at end of file -- cgit v1.2.3 From 3541b4c61330fc79771b77409e3d77bd2b57fe06 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 10:41:08 -0700 Subject: NORSPEC-233 WIP clean up regressions in enable/tentative logic from rework --- indra/newview/llpanelface.cpp | 96 ++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 56 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index a26b9ed237..2f6c285a80 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -690,15 +690,11 @@ void LLPanelFace::updateUI() } // Color transparency - { - getChildView("color trans")->setEnabled(editable); - } + getChildView("color trans")->setEnabled(editable); F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; - { - getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable); - } + getChild("ColorTrans")->setValue(editable ? transparency : 0); + getChildView("ColorTrans")->setEnabled(editable); // Specular map LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); @@ -707,38 +703,31 @@ void LLPanelFace::updateUI() bool identical_shiny = false; // Shiny - { - LLSelectedTE::getShiny(shiny, identical_shiny); - identical = identical && identical_shiny; + LLSelectedTE::getShiny(shiny, identical_shiny); + identical = identical && identical_shiny; - shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; + shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; - LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); - if (combobox_shininess) - { - combobox_shininess->selectNthItem((S32)shiny); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox shininess'" << llendl; - } + LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); + if (combobox_shininess) + { + combobox_shininess->selectNthItem((S32)shiny); + } - - getChildView("label shininess")->setEnabled(editable); - getChildView("combobox shininess")->setEnabled(editable); + getChildView("label shininess")->setEnabled(editable); + getChildView("combobox shininess")->setEnabled(editable); - getChildView("label glossiness")->setEnabled(editable); - getChildView("glossiness")->setEnabled(editable); + getChildView("label glossiness")->setEnabled(editable); + getChildView("glossiness")->setEnabled(editable); - getChildView("label environment")->setEnabled(editable); - getChildView("environment")->setEnabled(editable); - getChildView("label shinycolor")->setEnabled(editable); + getChildView("label environment")->setEnabled(editable); + getChildView("environment")->setEnabled(editable); + getChildView("label shinycolor")->setEnabled(editable); - getChild("combobox shininess")->setTentative(!identical); - getChild("glossiness")->setTentative(!identical); - getChild("environment")->setTentative(!identical); - getChild("shinycolorswatch")->setTentative(!identical); - } + getChild("combobox shininess")->setTentative(!identical_spec); + getChild("glossiness")->setTentative(!identical_spec); + getChild("environment")->setTentative(!identical_spec); + getChild("shinycolorswatch")->setTentative(!identical_spec); LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); if(mShinyColorSwatch) @@ -749,14 +738,12 @@ void LLPanelFace::updateUI() } U8 bumpy = 0; - // Bumpy { - U8 bumpy; - LLSelectedTE::getBumpmap(bumpy,identical); + bool identical_bumpy = false; + LLSelectedTE::getBumpmap(bumpy,identical_bumpy); LLUUID norm_map_id = getCurrentNormalMap(); - LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { @@ -767,7 +754,7 @@ void LLPanelFace::updateUI() llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; } getChildView("combobox bumpiness")->setEnabled(editable); - getChild("combobox bumpiness")->setTentative(!identical); + getChild("combobox bumpiness")->setTentative(!identical_bumpy); getChildView("label bumpiness")->setEnabled(editable); } @@ -777,9 +764,10 @@ void LLPanelFace::updateUI() // Normal map LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm); - if (bumpy != BUMPY_TEXTURE) + { normmap_id = LLUUID::null; + } mIsAlpha = FALSE; LLGLenum image_format; @@ -1015,9 +1003,9 @@ void LLPanelFace::updateUI() spec_scale_t = editable ? spec_scale_t : 1.0f; spec_scale_t *= identical_planar_texgen ? 2.0f : 1.0f; - BOOL diff_scale_tentative = !(identical && identical_diff_scale_t); - BOOL norm_scale_tentative = !(identical && identical_norm_scale_t); - BOOL spec_scale_tentative = !(identical && identical_spec_scale_t); + BOOL diff_scale_tentative = !identical_diff_scale_t; + BOOL norm_scale_tentative = !identical_norm_scale_t; + BOOL spec_scale_tentative = !identical_spec_scale_t; getChildView("TexScaleV")->setEnabled(editable); getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); @@ -1131,15 +1119,11 @@ void LLPanelFace::updateUI() { F32 glow = 0.f; bool identical_glow = false; - LLSelectedTE::getGlow(glow,identical_glow); - - identical = identical && identical_glow; - getChild("glow")->setValue(glow); + getChild("glow")->setTentative(!identical_glow); getChildView("glow")->setEnabled(editable); - getChild("glow")->setTentative(!identical); - getChildView("glow label")->setEnabled(editable); + getChildView("glow label")->setEnabled(editable); } { @@ -1176,11 +1160,9 @@ void LLPanelFace::updateUI() LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); - identical = identical && identical_fullbright; - getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); getChildView("checkbox fullbright")->setEnabled(editable); - getChild("checkbox fullbright")->setTentative(!identical); + getChild("checkbox fullbright")->setTentative(!identical_fullbright); } // Repeats per meter @@ -1202,7 +1184,7 @@ void LLPanelFace::updateUI() { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; BOOL enabled = editable && (index != 1); - BOOL identical = true; + BOOL identical_repeats = true; F32 repeats = 1.0f; U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? combobox_mattype->getCurrentIndex() : MATTYPE_DIFFUSE; @@ -1212,7 +1194,7 @@ void LLPanelFace::updateUI() case MATTYPE_DIFFUSE: { enabled = editable && !id.isNull(); - identical = identical_diff_repeats; + identical_repeats = identical_diff_repeats; repeats = repeats_diff; } break; @@ -1220,7 +1202,7 @@ void LLPanelFace::updateUI() case MATTYPE_SPECULAR: { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); - identical = identical_spec_repeats; + identical_repeats = identical_spec_repeats; repeats = repeats_spec; } break; @@ -1228,15 +1210,17 @@ void LLPanelFace::updateUI() case MATTYPE_NORMAL: { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); - identical = identical_norm_repeats; + identical_repeats = identical_norm_repeats; repeats = repeats_norm; } break; } + BOOL repeats_tentative = !identical_repeats; + getChildView("rptctrl")->setEnabled(identical_planar_texgen ? FALSE : enabled); getChild("rptctrl")->setValue(editable ? repeats : 1.0f); - getChild("rptctrl")->setTentative(!identical); + getChild("rptctrl")->setTentative(LLSD(repeats_tentative)); } } -- cgit v1.2.3 From b15cdc828ea188f278b3ffec4e6442cb4688901d Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 13:10:36 -0700 Subject: Fix busted WIP check-in --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index d873cab59a..7ab9b4cb38 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1513,8 +1513,8 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLUUID specmap = getCurrentSpecularMap(); - LLUUID normmap = getCurrentNormalMap(); + LLUUID specmap = self->getCurrentSpecularMap(); + LLUUID normmap = self->getCurrentNormalMap(); self->updateShinyControls(!specmap.isNull(), true); self->updateBumpyControls(!normmap.isNull(), true); self->updateUI(); -- cgit v1.2.3 From af0cc77199f22c223fcdfb8b46241fb6b81e8e27 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 14:17:13 -0700 Subject: NORSPEC-233 WIP cleanup and fix crasher in templated material get driver func --- indra/newview/llpanelface.cpp | 74 ------------------------------------------- 1 file changed, 74 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7ab9b4cb38..51d1f82603 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1402,76 +1402,6 @@ void LLPanelFace::refresh() getState(); } -/* -void LLPanelFace::updateMaterialParams(LLMaterialEditFunctorBase* edit_func) -{ - if (!edit_func) - return; - - struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor - { - LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctorBase* edit) : _panel(panel), _edit(edit) {}; - virtual ~LLSelectedTEEditMaterial() {}; - virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) - { - if (_edit) - { - // Yesterday's news... - // - //U32 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); - //LLUUID old_normal_map_id = _panel->getCurrentNormalMap(); - //LLUUID old_spec_map_id = _panel->getCurrentSpecularMap(); - //bool was_default_blend_mode = (current_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); - //bool was_need_material = !was_default_blend_mode || !old_normal_map_id.isNull() || !old_spec_map_id.isNull(); - - LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial()); - llassert_always(new_material); - - // Do "It"! - // - _edit->apply(new_material); - - U32 new_alpha_mode = new_material->getDiffuseAlphaMode(); - LLUUID new_normal_map_id = new_material->getNormalID(); - LLUUID new_spec_map_id = new_material->getSpecularID(); - - bool is_default_blend_mode = (new_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); - bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull(); - - if (!current_material.isNull() && !is_need_material) - { - LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; - LLMaterialMgr::getInstance()->remove(object->getID(),face); - } - else - { - // Replicate old init behavior - // - if (current_material.isNull()) - { - U8 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); - U8 current_alpha_mask_cutoff = _panel->getCurrentAlphaMaskCutoff(); - - new_material->setDiffuseAlphaMode(current_alpha_mode); - new_material->setAlphaMaskCutoff(current_alpha_mask_cutoff); - } - - LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL; - LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material); - } - - object->setTEMaterialParams(face, new_material); - return new_material; - } - return NULL; - } - LLMaterialEditFunctorBase* _edit; - LLPanelFace* _panel; - } editor(this, edit_func); - LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor); -} -*/ - // // Static functions // @@ -1513,10 +1443,6 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLUUID specmap = self->getCurrentSpecularMap(); - LLUUID normmap = self->getCurrentNormalMap(); - self->updateShinyControls(!specmap.isNull(), true); - self->updateBumpyControls(!normmap.isNull(), true); self->updateUI(); } -- cgit v1.2.3 From c78cd1aae63a7c7c0bf6a9c21380818aa9cd47b7 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 7 Jun 2013 14:37:39 -0700 Subject: NORSPEC-233 WIP fix completely bogus substitution of offsets for scales and make scale accessors get with the program --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 51d1f82603..afc9d5b123 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -951,7 +951,7 @@ void LLPanelFace::updateUI() F32 spec_scale_s = 1.f; F32 norm_scale_s = 1.f; - LLSelectedTE::getOffsetS( diff_scale_s, identical_diff_scale_s); + LLSelectedTE::getScaleS( diff_scale_s, identical_diff_scale_s); LLSelectedTEMaterial::getSpecularRepeatX( spec_scale_s, identical_spec_scale_s); LLSelectedTEMaterial::getNormalRepeatX( norm_scale_s, identical_norm_scale_s); @@ -990,7 +990,7 @@ void LLPanelFace::updateUI() F32 spec_scale_t = 1.f; F32 norm_scale_t = 1.f; - LLSelectedTE::getOffsetT(diff_scale_t, identical_diff_scale_t); + LLSelectedTE::getScaleT(diff_scale_t, identical_diff_scale_t); LLSelectedTEMaterial::getSpecularRepeatY(spec_scale_t, identical_spec_scale_t); LLSelectedTEMaterial::getNormalRepeatY(norm_scale_t, identical_norm_scale_t); -- cgit v1.2.3 From fba40dc4f72ce2aa2dead5c46c1c9dbc18c13866 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 8 Jun 2013 07:25:47 -0700 Subject: NORSPEC-226 NORSPEC-222 fix menu content bugs and alpha mask stomp when editing multiple objects --- indra/newview/llpanelface.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index afc9d5b123..c6d52a0661 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -317,6 +317,7 @@ void LLPanelFace::sendTexture() void LLPanelFace::sendBump(U32 bumpiness) { LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID(); if (bumpiness < BUMPY_TEXTURE) { @@ -329,7 +330,7 @@ void LLPanelFace::sendBump(U32 bumpiness) LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); - LLSelectedTEMaterial::setNormalID(this, bumpytexture_ctrl->getImageAssetID()); + LLSelectedTEMaterial::setNormalID(this, current_normal_map); } void LLPanelFace::sendTexGen() @@ -1443,6 +1444,11 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; + // Force to default states to side-step problems with menu contents + // and generally reflecting old state when switching tabs or objects + // + self->updateShinyControls(false,true); + self->updateBumpyControls(false,true); self->updateUI(); } @@ -1530,10 +1536,11 @@ void LLPanelFace::updateVisibility() 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 - // + // Force to default states to side-step problems with menu contents + // and generally reflecting old state when switching tabs or objects + // + self->updateShinyControls(false,true); + self->updateBumpyControls(false,true); self->updateUI(); } @@ -1801,7 +1808,7 @@ void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) void LLPanelFace::onCommitNormalTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - sendBump(BUMPY_TEXTURE); + sendBump(getCurrentNormalMap().isNull() ? 0 : BUMPY_TEXTURE); } void LLPanelFace::onCancelSpecularTexture(const LLSD& data) -- cgit v1.2.3 From 045634f89eb8368697ec3acb01ff77ad85ce906c Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 8 Jun 2013 07:43:26 -0700 Subject: NORSPEC-233 fix regressions in default spec parameters --- indra/newview/llpanelface.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c6d52a0661..01b809ec90 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1584,18 +1584,6 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh if (!comboShiny->itemExists(USE_TEXTURE)) { comboShiny->add(USE_TEXTURE); - - // NORSPEC-94: Set default specular color to white - // - LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); - if(mShinyColorSwatch) - { - LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL; - mShinyColorSwatch->setOriginal(LLColor4::white); - mShinyColorSwatch->set(LLColor4::white, TRUE); - } - getChild("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); - getChild("environment")->setValue(0); } comboShiny->setSimple(USE_TEXTURE); } @@ -1603,8 +1591,6 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh { 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); } } -- cgit v1.2.3 From 8ff9786c81d8561040da23a32e317b3047c1f387 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 07:52:39 -0700 Subject: NORSPEC-87 fix regression from NSPEC 233 fix typo which is breaking norm repeats display --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 01b809ec90..1bf655debb 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1177,7 +1177,7 @@ void LLPanelFace::updateUI() bool identical_spec_repeats = false; LLSelectedTE::getMaxDiffuseRepeats(repeats_spec, identical_spec_repeats); - LLSelectedTEMaterial::getMaxNormalRepeats(repeats_spec, identical_spec_repeats); + LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats); LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); LLComboBox* mComboTexGen = getChild("combobox texgen"); -- cgit v1.2.3 From bc2a6adb5ad25bb93aa6ba73ff984176840a45c8 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 08:10:59 -0700 Subject: NORSPEC-87 fix diffuse repeats display as well --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1bf655debb..92d8eed1a3 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1176,7 +1176,7 @@ void LLPanelFace::updateUI() bool identical_norm_repeats = false; bool identical_spec_repeats = false; - LLSelectedTE::getMaxDiffuseRepeats(repeats_spec, identical_spec_repeats); + LLSelectedTE::getMaxDiffuseRepeats(repeats_diff, identical_diff_repeats); LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats); LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); -- cgit v1.2.3 From 4cd133fe00ae952cd24f6be4493ecadbc425757e Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 09:13:59 -0700 Subject: NORSPEC-248 fix broken repeats handling in media mode --- indra/newview/llpanelface.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 92d8eed1a3..30ccbeb917 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1964,9 +1964,13 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) LLPanelFace* self = (LLPanelFace*) userdata; LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); + LLComboBox* combo_matmedia = self->getChild("combobox matmedia"); LLComboBox* combo_mattype = self->getChild("combobox mattype"); + + U32 materials_media = combo_matmedia->getCurrentIndex(); + - U32 material_type = combo_mattype->getCurrentIndex(); + U32 material_type = (materials_media == MATMEDIA_MATERIAL) ? combo_mattype->getCurrentIndex() : 0; F32 repeats_per_meter = repeats_ctrl->getValue().asReal(); F32 obj_scale_s = 1.0f; -- cgit v1.2.3 From 9d73f625ab72e38db707570171da0e6499eaa6aa Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 15:17:45 -0700 Subject: NORSPEC-252 fix reverting normal maps to none --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 30ccbeb917..f40ff30f51 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -317,8 +317,6 @@ void LLPanelFace::sendTexture() void LLPanelFace::sendBump(U32 bumpiness) { LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); - LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID(); - if (bumpiness < BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; @@ -330,6 +328,8 @@ void LLPanelFace::sendBump(U32 bumpiness) LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); + + LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID(); LLSelectedTEMaterial::setNormalID(this, current_normal_map); } -- cgit v1.2.3 From e666725f9d71d8a72db3321cb6c88713c31d8430 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 18:49:50 -0700 Subject: NORSPEC-257 fix alpha mode display incorrect default when alpha is present in tex --- indra/newview/llpanelface.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f40ff30f51..cfb505b620 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -771,7 +771,7 @@ void LLPanelFace::updateUI() } mIsAlpha = FALSE; - LLGLenum image_format; + LLGLenum image_format = GL_RGB; bool identical_image_format = false; LLSelectedTE::getImageFormat(image_format, identical_image_format); @@ -799,17 +799,25 @@ void LLPanelFace::updateUI() } // Diffuse Alpha Mode - U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + + // Init to the default that is appropriate for the alpha content of the asset + // + U8 alpha_mode = mIsAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + bool identical_alpha_mode = false; + + // See if that's been overridden by a material setting for same... + // LLSelectedTEMaterial::getDiffuseAlphaMode(alpha_mode, identical_alpha_mode); LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ... + // Want masking? Want emissive? Tough! You get BLEND! alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode; - // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none + // ... unless there is no alpha channel in the texture, in which case alpha mode MUST be none alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; combobox_alphamode->selectNthItem(alpha_mode); @@ -2164,7 +2172,8 @@ void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical } void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face) -{ +{ + LLGLenum image_format; struct LLSelectedTEGetImageFormat : public LLSelectedTEGetFunctor { LLGLenum get(LLViewerObject* object, S32 te_index) @@ -2173,7 +2182,8 @@ void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, return image ? image->getPrimaryFormat() : GL_RGB; } } get_glenum; - identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format_to_return); + identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format); + image_format_to_return = image_format; } void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) -- cgit v1.2.3 From 5c1144c48b8183140ed414e455bcbc4f952747e7 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 19:06:19 -0700 Subject: NORSPEC-222 fix issues with removing the use texture item selecting weave when the TE was BUMPY_TEXTURE, but no normal map was applied --- indra/newview/llpanelface.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cfb505b620..4fd55e1cf2 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -747,8 +747,15 @@ void LLPanelFace::updateUI() LLUUID norm_map_id = getCurrentNormalMap(); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) - { - combobox_bumpiness->selectNthItem((S32)bumpy); + { + if ((bumpy == BUMPY_TEXTURE) && !norm_map_id.isNull()) + { + combobox_bumpiness->selectNthItem((S32)BUMPY_TEXTURE); + } + else + { + combobox_bumpiness->selectNthItem((S32)((bumpy < BUMPY_TEXTURE) ? bumpy : 0)); + } } else { @@ -1600,6 +1607,7 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh if (comboShiny->itemExists(USE_TEXTURE)) { comboShiny->remove(SHINY_TEXTURE); + comboShiny->selectFirstItem(); } } } @@ -1650,9 +1658,8 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co { 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); + comboBumpy->selectFirstItem(); } } } -- cgit v1.2.3 From 87946113cc2a6f0d60c11275bf4aa168c2ea19d6 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 11 Jun 2013 12:48:59 -0700 Subject: NORSPEC-257 can't use automated TEMaterialGet functor as we need two possible defaults for diffuse alpha mode based on the alpha content of the diffuse texture --- indra/newview/llpanelface.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 4fd55e1cf2..5d5df01782 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -815,7 +815,7 @@ void LLPanelFace::updateUI() // See if that's been overridden by a material setting for same... // - LLSelectedTEMaterial::getDiffuseAlphaMode(alpha_mode, identical_alpha_mode); + LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha); LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) @@ -2288,6 +2288,38 @@ void LLPanelFace::LLSelectedTEMaterial::getMaxNormalRepeats(F32& repeats, bool& identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_norm_repeats_func, repeats); } +void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha) +{ + struct LLSelectedTEGetDiffuseAlphaMode : public LLSelectedTEGetFunctor + { + LLSelectedTEGetDiffuseAlphaMode() : _isAlpha(false) {} + LLSelectedTEGetDiffuseAlphaMode(bool diffuse_texture_has_alpha) : _isAlpha(diffuse_texture_has_alpha) {} + virtual ~LLSelectedTEGetDiffuseAlphaMode() {} + + U8 get(LLViewerObject* object, S32 face) + { + U8 diffuse_mode = _isAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + + LLTextureEntry* tep = object->getTE(face); + if (tep) + { + LLMaterial* mat = tep->getMaterialParams().get(); + mat = (tep->getMaterialID().isNull() ? NULL : mat); + if (mat) + { + diffuse_mode = mat->getDiffuseAlphaMode(); + } + } + + return diffuse_mode; + } + bool _isAlpha; // whether or not the diffuse texture selected contains alpha information + } get_diff_mode(diffuse_texture_has_alpha); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &get_diff_mode, diffuse_alpha_mode); +} + +static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical); + void LLPanelFace::LLSelectedTE::getObjectScaleS(F32& scale_s, bool& identical) { struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor @@ -2336,4 +2368,4 @@ void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identic } max_diff_repeats_func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats ); -} \ No newline at end of file +} -- cgit v1.2.3 From 7fcbb7c177ba0c7fe3c0e97f95544481a279bf7f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 11 Jun 2013 13:54:03 -0700 Subject: Fix build failure from warning and dav3p no-JIRA bug about normal map scale editing --- indra/newview/llpanelface.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 5d5df01782..c446132289 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -772,10 +772,6 @@ void LLPanelFace::updateUI() // Normal map LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm); - if (bumpy != BUMPY_TEXTURE) - { - normmap_id = LLUUID::null; - } mIsAlpha = FALSE; LLGLenum image_format = GL_RGB; @@ -2318,8 +2314,6 @@ void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_a identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &get_diff_mode, diffuse_alpha_mode); } -static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical); - void LLPanelFace::LLSelectedTE::getObjectScaleS(F32& scale_s, bool& identical) { struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor -- cgit v1.2.3 From 96f7f6d01bb652fb049cd64b55b2933aa436f9d2 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 11 Jun 2013 17:18:20 -0700 Subject: NORSPEC-258 and NORSPEC-226 make tex picker close refresh build tool UI correctly and fix issues with transition from no-bumps to normal maps --- indra/newview/llpanelface.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c446132289..b5bb11b90c 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -171,6 +171,8 @@ BOOL LLPanelFace::postBuild() mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) ); mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); + mTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); + mTextureCtrl->setFollowsTop(); mTextureCtrl->setFollowsLeft(); mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); @@ -184,6 +186,8 @@ BOOL LLPanelFace::postBuild() mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); + mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mShinyTextureCtrl->setFollowsTop(); @@ -200,6 +204,8 @@ BOOL LLPanelFace::postBuild() mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); + mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mBumpyTextureCtrl->setFollowsTop(); @@ -832,7 +838,7 @@ void LLPanelFace::updateUI() updateAlphaControls(); - if(texture_ctrl && !texture_ctrl->isPickerShown()) + if(texture_ctrl) { if (identical_diffuse) { @@ -892,7 +898,7 @@ void LLPanelFace::updateUI() } } - if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) + if (bumpytexture_ctrl) { if (identical_norm && (bumpy == BUMPY_TEXTURE)) { @@ -1796,6 +1802,12 @@ void LLPanelFace::onSelectTexture(const LLSD& data) LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } +void LLPanelFace::onCloseTexturePicker(const LLSD& data) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; + updateUI(); +} + void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; @@ -1805,7 +1817,7 @@ void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) void LLPanelFace::onCommitNormalTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - sendBump(getCurrentNormalMap().isNull() ? 0 : BUMPY_TEXTURE); + sendBump(BUMPY_TEXTURE); } void LLPanelFace::onCancelSpecularTexture(const LLSD& data) -- cgit v1.2.3 From 8ad2c0b8fbd586a8a9c4f090180c45eef1810a65 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 12 Jun 2013 15:01:23 -0700 Subject: NORSPEC-260 fix issues with OK after pressing none being intepreted as add a null normal map --- indra/newview/llpanelface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b5bb11b90c..b6bd6e5f47 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1817,7 +1817,8 @@ void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) void LLPanelFace::onCommitNormalTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - sendBump(BUMPY_TEXTURE); + LLUUID nmap_id = getCurrentNormalMap(); + sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE); } void LLPanelFace::onCancelSpecularTexture(const LLSD& data) @@ -1847,7 +1848,8 @@ void LLPanelFace::onSelectSpecularTexture(const LLSD& data) void LLPanelFace::onSelectNormalTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; - sendBump(BUMPY_TEXTURE); + LLUUID nmap_id = getCurrentNormalMap(); + sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE); } //static -- cgit v1.2.3 From 98d2a434dba0423b7bafe486e4050cb715a3c089 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 13 Jun 2013 08:23:40 -0700 Subject: NORSPEC-263 replaced dropped deg to rad conversion between UI and material update --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b6bd6e5f47..f4226c0a7f 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1941,7 +1941,7 @@ void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; llassert_always(self); - LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot()); + LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot() * DEG_TO_RAD); } //static @@ -1949,7 +1949,7 @@ void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; llassert_always(self); - LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot()); + LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot() * DEG_TO_RAD); } //static -- cgit v1.2.3 From f04e9363b9daca52c1fd2e675c2646f7e1d05054 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 14 Jun 2013 09:41:33 -0700 Subject: NORSPEC-266 fix issues with observer feedback on edits of material map parameters --- indra/newview/llpanelface.cpp | 53 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f4226c0a7f..911af9df04 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -327,16 +327,25 @@ void LLPanelFace::sendBump(U32 bumpiness) { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; bumpytexture_ctrl->clear(); - bumpytexture_ctrl->setImageAssetID(LLUUID()); + bumpytexture_ctrl->setImageAssetID(LLUUID()); } - U8 bump = (U8) bumpiness & TEM_BUMP_MASK; - LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); - updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID(); + + U8 bump = (U8) bumpiness & TEM_BUMP_MASK; + + // Clear legacy bump to None when using an actual normal map + // + if (!current_normal_map.isNull()) + bump = 0; + + // Set the normal map or reset it to null as appropriate + // LLSelectedTEMaterial::setNormalID(this, current_normal_map); + + LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); } void LLPanelFace::sendTexGen() @@ -354,13 +363,21 @@ void LLPanelFace::sendShiny(U32 shininess) if (shininess < SHINY_TEXTURE) { texture_ctrl->clear(); - texture_ctrl->setImageAssetID(LLUUID()); - - U8 shiny = (U8) shininess & TEM_SHINY_MASK; - LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + texture_ctrl->setImageAssetID(LLUUID()); } - updateShinyControls(!texture_ctrl->getImageAssetID().isNull(), true); - LLSelectedTEMaterial::setSpecularID(this, texture_ctrl->getImageAssetID()); + + LLUUID specmap = getCurrentSpecularMap(); + + U8 shiny = (U8) shininess & TEM_SHINY_MASK; + if (!specmap.isNull()) + shiny = 0; + + LLSelectedTEMaterial::setSpecularID(this, specmap); + + LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + + updateShinyControls(!specmap.isNull(), true); + } void LLPanelFace::sendFullbright() @@ -752,21 +769,18 @@ void LLPanelFace::updateUI() LLUUID norm_map_id = getCurrentNormalMap(); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); + + bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE; + if (combobox_bumpiness) { - if ((bumpy == BUMPY_TEXTURE) && !norm_map_id.isNull()) - { - combobox_bumpiness->selectNthItem((S32)BUMPY_TEXTURE); - } - else - { - combobox_bumpiness->selectNthItem((S32)((bumpy < BUMPY_TEXTURE) ? bumpy : 0)); - } + combobox_bumpiness->selectNthItem((S32)bumpy); } else { llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; } + getChildView("combobox bumpiness")->setEnabled(editable); getChild("combobox bumpiness")->setTentative(!identical_bumpy); getChildView("label bumpiness")->setEnabled(editable); @@ -876,8 +890,6 @@ void LLPanelFace::updateUI() if (shinytexture_ctrl) { - // Can't use this test as we can't actually store SHINY_TEXTURE in the TEs *sigh* - // if (identical_spec && (shiny == SHINY_TEXTURE)) { shinytexture_ctrl->setTentative( FALSE ); @@ -2314,7 +2326,6 @@ void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_a if (tep) { LLMaterial* mat = tep->getMaterialParams().get(); - mat = (tep->getMaterialID().isNull() ? NULL : mat); if (mat) { diffuse_mode = mat->getDiffuseAlphaMode(); -- cgit v1.2.3