From 9fdca96f8bd2211a99fe88e57b70cbecefa20b6d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 8 Jul 2024 20:27:14 +0200 Subject: Re-enable compiler warnings C4244 and C4396 except for lltracerecording.h and llunittype.h for now --- indra/newview/llpanelface.cpp | 88 +++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 89af765bb7..00338d3125 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -245,19 +245,19 @@ LLUUID LLPanelFace::getCurrentSpecularMap() { 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(); } +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 (F32)getChild("bumpyRot")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleU() { return (F32)getChild("bumpyScaleU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleV() { return (F32)getChild("bumpyScaleV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetU() { return (F32)getChild("bumpyOffsetU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetV() { return (F32)getChild("bumpyOffsetV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyRot() { return (F32)getChild("shinyRot")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleU() { return (F32)getChild("shinyScaleU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleV() { return (F32)getChild("shinyScaleV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetU() { return (F32)getChild("shinyOffsetU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetV() { return (F32)getChild("shinyOffsetV")->getValue().asReal(); } // // Methods @@ -1854,13 +1854,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); - calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal()); - calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal()); - calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal()); - calcp->setVar(LLCalc::TEX_V_OFFSET, childGetValue("TexOffsetV").asReal()); - calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal()); - calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal()); - calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal()); + calcp->setVar(LLCalc::TEX_U_SCALE, (F32)childGetValue("TexScaleU").asReal()); + calcp->setVar(LLCalc::TEX_V_SCALE, (F32)childGetValue("TexScaleV").asReal()); + calcp->setVar(LLCalc::TEX_U_OFFSET, (F32)childGetValue("TexOffsetU").asReal()); + calcp->setVar(LLCalc::TEX_V_OFFSET, (F32)childGetValue("TexOffsetV").asReal()); + calcp->setVar(LLCalc::TEX_ROTATION, (F32)childGetValue("TexRot").asReal()); + calcp->setVar(LLCalc::TEX_TRANSPARENCY, (F32)childGetValue("ColorTrans").asReal()); + calcp->setVar(LLCalc::TEX_GLOW, (F32)childGetValue("glow").asReal()); } else { @@ -3777,7 +3777,7 @@ void LLPanelFace::onCommitTextureScaleX( LLUICtrl* ctrl, void* userdata ) LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_u = self->getChild("TexScaleU")->getValue().asReal(); + F32 bumpy_scale_u = (F32)self->getChild("TexScaleU")->getValue().asReal(); if (self->isIdenticalPlanarTexgen()) { bumpy_scale_u *= 0.5f; @@ -3797,7 +3797,7 @@ void LLPanelFace::onCommitTextureScaleY( LLUICtrl* ctrl, void* userdata ) LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_v = self->getChild("TexScaleV")->getValue().asReal(); + F32 bumpy_scale_v = (F32)self->getChild("TexScaleV")->getValue().asReal(); if (self->isIdenticalPlanarTexgen()) { bumpy_scale_v *= 0.5f; @@ -3818,7 +3818,7 @@ void LLPanelFace::onCommitTextureRot( LLUICtrl* ctrl, void* userdata ) if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncMaterialRot(self, self->getChild("TexRot")->getValue().asReal()); + syncMaterialRot(self, (F32)self->getChild("TexRot")->getValue().asReal()); } else { @@ -3833,7 +3833,7 @@ void LLPanelFace::onCommitTextureOffsetX( LLUICtrl* ctrl, void* userdata ) LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX(self, self->getChild("TexOffsetU")->getValue().asReal()); + syncOffsetX(self, (F32)self->getChild("TexOffsetU")->getValue().asReal()); } else { @@ -3848,7 +3848,7 @@ void LLPanelFace::onCommitTextureOffsetY( LLUICtrl* ctrl, void* userdata ) LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY(self, self->getChild("TexOffsetV")->getValue().asReal()); + syncOffsetY(self, (F32)self->getChild("TexOffsetV")->getValue().asReal()); } else { @@ -3861,27 +3861,27 @@ void LLPanelFace::onCommitTextureOffsetY( LLUICtrl* ctrl, void* userdata ) // static void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { - LLPanelFace* self = (LLPanelFace*) userdata; + LLPanelFace *self = (LLPanelFace *) userdata; - LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); + LLUICtrl *repeats_ctrl = self->getChild("rptctrl"); U32 materials_media = self->mComboMatMedia->getCurrentIndex(); - U32 material_type = 0; + U32 material_type = 0; if (materials_media == MATMEDIA_PBR) { - LLRadioGroup* radio_mat_type = self->getChild("radio_pbr_type"); - material_type = radio_mat_type->getSelectedIndex(); + LLRadioGroup *radio_mat_type = self->getChild("radio_pbr_type"); + material_type = radio_mat_type->getSelectedIndex(); } if (materials_media == MATMEDIA_MATERIAL) { - LLRadioGroup* radio_mat_type = self->getChild("radio_material_type"); - material_type = radio_mat_type->getSelectedIndex(); + LLRadioGroup *radio_mat_type = self->getChild("radio_material_type"); + material_type = radio_mat_type->getSelectedIndex(); } - F32 repeats_per_meter = repeats_ctrl->getValue().asReal(); + F32 repeats_per_meter = (F32) repeats_ctrl->getValue().asReal(); - F32 obj_scale_s = 1.0f; - F32 obj_scale_t = 1.0f; + F32 obj_scale_s = 1.0f; + F32 obj_scale_t = 1.0f; bool identical_scale_s = false; bool identical_scale_t = false; @@ -3889,10 +3889,10 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) LLSelectedTE::getObjectScaleS(obj_scale_s, identical_scale_s); LLSelectedTE::getObjectScaleS(obj_scale_t, identical_scale_t); - LLUICtrl* bumpy_scale_u = self->getChild("bumpyScaleU"); - LLUICtrl* bumpy_scale_v = self->getChild("bumpyScaleV"); - LLUICtrl* shiny_scale_u = self->getChild("shinyScaleU"); - LLUICtrl* shiny_scale_v = self->getChild("shinyScaleV"); + LLUICtrl *bumpy_scale_u = self->getChild("bumpyScaleU"); + LLUICtrl *bumpy_scale_v = self->getChild("bumpyScaleV"); + LLUICtrl *shiny_scale_u = self->getChild("shinyScaleU"); + LLUICtrl *shiny_scale_v = self->getChild("shinyScaleV"); if (gSavedSettings.getBOOL("SyncMaterialSettings")) { @@ -5085,7 +5085,7 @@ bool LLPanelFace::Selection::compareSelection() void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) { - const float value = ctrl->getValue().asReal(); + const float value = (F32)ctrl->getValue().asReal(); const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { @@ -5095,7 +5095,7 @@ void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) { - const float value = ctrl->getValue().asReal(); + const float value = (F32)ctrl->getValue().asReal(); const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { @@ -5105,7 +5105,7 @@ void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) { - const float value = ctrl->getValue().asReal() * DEG_TO_RAD; + const float value = (F32)ctrl->getValue().asReal() * DEG_TO_RAD; const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { @@ -5115,7 +5115,7 @@ void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) { - const float value = ctrl->getValue().asReal(); + const float value = (F32)ctrl->getValue().asReal(); const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { @@ -5125,7 +5125,7 @@ void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) { - const float value = ctrl->getValue().asReal(); + const float value = (F32)ctrl->getValue().asReal(); const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { -- cgit v1.2.3 From 543dbfee498b84e440ea75ae156d8d666ba1c1c9 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Thu, 25 Jul 2024 23:26:52 -0400 Subject: Reduce findChild stalls in face panel --- indra/newview/llpanelface.cpp | 413 +++++++++++++++++------------------------- 1 file changed, 167 insertions(+), 246 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 00338d3125..0afe967839 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -201,13 +201,11 @@ LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() U32 matmedia_selection = mComboMatMedia->getCurrentIndex(); if (matmedia_selection == MATMEDIA_MATERIAL) { - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); + channel_to_edit = (LLRender::eTexIndex)mRadioMaterialType->getSelectedIndex(); } if (matmedia_selection == MATMEDIA_PBR) { - LLRadioGroup* radio_mat_type = getChild("radio_pbr_type"); - channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); + channel_to_edit = (LLRender::eTexIndex)mRadioPbrType->getSelectedIndex(); } } @@ -220,8 +218,7 @@ LLRender::eTexIndex LLPanelFace::getTextureDropChannel() { if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) { - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - return LLRender::eTexIndex(radio_mat_type->getSelectedIndex()); + return LLRender::eTexIndex(mRadioMaterialType->getSelectedIndex()); } return LLRender::eTexIndex(MATTYPE_DIFFUSE); @@ -231,8 +228,7 @@ LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() { if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { - LLRadioGroup* radio_pbr_type = getChild("radio_pbr_type"); - return texture_info_from_pbrtype(radio_pbr_type->getSelectedIndex()); + return texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); } return texture_info_from_pbrtype(PBRTYPE_BASE_COLOR); @@ -240,8 +236,8 @@ LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() // Things the UI provides... // -LLUUID LLPanelFace::getCurrentNormalMap() { return getChild("bumpytexture control")->getImageAssetID(); } -LLUUID LLPanelFace::getCurrentSpecularMap() { return getChild("shinytexture control")->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->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(); } @@ -307,41 +303,26 @@ bool LLPanelFace::postBuild() childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this); childSetAction("save_selected_pbr", &LLPanelFace::onClickBtnSavePBR, this); - LLTextureCtrl* mTextureCtrl; - LLTextureCtrl* mShinyTextureCtrl; - LLTextureCtrl* mBumpyTextureCtrl; - LLColorSwatchCtrl* mColorSwatch; - LLColorSwatchCtrl* mShinyColorSwatch; - - LLComboBox* mComboTexGen; - - LLCheckBoxCtrl *mCheckFullbright; - - LLTextBox* mLabelColorTransp; - LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha - - LLSpinCtrl* mCtrlGlow; - setMouseOpaque(false); - LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); - if (pbr_ctrl) + mPBRTextureCtrl = getChild("pbr_control"); + if (mPBRTextureCtrl) { - pbr_ctrl->setDefaultImageAssetID(LLUUID::null); - pbr_ctrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); - pbr_ctrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); - pbr_ctrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); - pbr_ctrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); - pbr_ctrl->setDragCallback(boost::bind(&LLPanelFace::onDragPbr, this, _2)); - pbr_ctrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onPbrSelectionChanged, this, _1)); - pbr_ctrl->setOnCloseCallback(boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2)); + mPBRTextureCtrl->setDefaultImageAssetID(LLUUID::null); + mPBRTextureCtrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); + mPBRTextureCtrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); + mPBRTextureCtrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); + mPBRTextureCtrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); + mPBRTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragPbr, this, _2)); + mPBRTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onPbrSelectionChanged, this, _1)); + mPBRTextureCtrl->setOnCloseCallback(boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2)); - pbr_ctrl->setFollowsTop(); - pbr_ctrl->setFollowsLeft(); - pbr_ctrl->setImmediateFilterPermMask(PERM_NONE); - pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - pbr_ctrl->setBakeTextureEnabled(false); - pbr_ctrl->setInventoryPickType(PICK_MATERIAL); + mPBRTextureCtrl->setFollowsTop(); + mPBRTextureCtrl->setFollowsLeft(); + mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mPBRTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); + mPBRTextureCtrl->setBakeTextureEnabled(false); + mPBRTextureCtrl->setInventoryPickType(PICK_MATERIAL); } mTextureCtrl = getChild("texture control"); @@ -454,18 +435,18 @@ bool LLPanelFace::postBuild() mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); } - LLRadioGroup* radio_mat_type = findChild("radio_material_type"); - if(radio_mat_type) + mRadioMaterialType = getChild("radio_material_type"); + if(mRadioMaterialType) { - radio_mat_type->setCommitCallback(LLPanelFace::onCommitMaterialType, this); - radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); + mRadioMaterialType->setCommitCallback(LLPanelFace::onCommitMaterialType, this); + mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); } - LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); - if (radio_pbr_type) + mRadioPbrType = getChild("radio_pbr_type"); + if (mRadioPbrType) { - radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this); - radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); + mRadioPbrType->setCommitCallback(LLPanelFace::onCommitPbrType, this); + mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } mCtrlGlow = getChild("glow"); @@ -532,7 +513,6 @@ void LLPanelFace::draw() void LLPanelFace::sendTexture() { - LLTextureCtrl* mTextureCtrl = getChild("texture control"); if(!mTextureCtrl) return; if( !mTextureCtrl->getTentative() ) { @@ -553,17 +533,16 @@ 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; - bumpytexture_ctrl->clear(); - bumpytexture_ctrl->setImageAssetID(LLUUID()); + mBumpyTextureCtrl->clear(); + mBumpyTextureCtrl->setImageAssetID(LLUUID()); } updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); - LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID(); + LLUUID current_normal_map = mBumpyTextureCtrl->getImageAssetID(); U8 bump = (U8) bumpiness & TEM_BUMP_MASK; @@ -576,25 +555,21 @@ void LLPanelFace::sendBump(U32 bumpiness) // LLSelectedTEMaterial::setNormalID(this, current_normal_map); - LLSelectMgr::getInstance()->selectionSetBumpmap( bump, bumpytexture_ctrl->getImageItemID() ); + LLSelectMgr::getInstance()->selectionSetBumpmap( bump, mBumpyTextureCtrl->getImageItemID() ); } void LLPanelFace::sendTexGen() { - LLComboBox* mComboTexGen = getChild("combobox texgen"); - if(!mComboTexGen)return; U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen ); } void LLPanelFace::sendShiny(U32 shininess) { - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); - if (shininess < SHINY_TEXTURE) { - texture_ctrl->clear(); - texture_ctrl->setImageAssetID(LLUUID()); + mShinyTextureCtrl->clear(); + mShinyTextureCtrl->setImageAssetID(LLUUID()); } LLUUID specmap = getCurrentSpecularMap(); @@ -605,7 +580,7 @@ void LLPanelFace::sendShiny(U32 shininess) LLSelectedTEMaterial::setSpecularID(this, specmap); - LLSelectMgr::getInstance()->selectionSetShiny( shiny, texture_ctrl->getImageItemID() ); + LLSelectMgr::getInstance()->selectionSetShiny( shiny, mShinyTextureCtrl->getImageItemID() ); updateShinyControls(!specmap.isNull(), true); @@ -613,7 +588,6 @@ void LLPanelFace::sendShiny(U32 shininess) void LLPanelFace::sendFullbright() { - LLCheckBoxCtrl* mCheckFullbright = getChild("checkbox fullbright"); if(!mCheckFullbright)return; U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0; LLSelectMgr::getInstance()->selectionSetFullbright( fullbright ); @@ -621,8 +595,6 @@ void LLPanelFace::sendFullbright() void LLPanelFace::sendColor() { - - LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); @@ -631,7 +603,6 @@ void LLPanelFace::sendColor() void LLPanelFace::sendAlpha() { - LLSpinCtrl* mCtrlColorTransp = getChild("ColorTrans"); if(!mCtrlColorTransp)return; F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f; @@ -641,8 +612,6 @@ void LLPanelFace::sendAlpha() void LLPanelFace::sendGlow() { - LLSpinCtrl* mCtrlGlow = getChild("glow"); - llassert(mCtrlGlow); if (mCtrlGlow) { F32 glow = mCtrlGlow->get(); @@ -996,14 +965,13 @@ void LLPanelFace::sendTextureInfo() LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } -void LLPanelFace::alignTestureLayer() +void LLPanelFace::alignTextureLayer() { LLFace* last_face = NULL; bool identical_face = false; LLSelectedTE::getFace(last_face, identical_face); - LLRadioGroup * radio_mat_type = getChild("radio_material_type"); - LLPanelFaceSetAlignedConcreteTEFunctor setfunc(this, last_face, static_cast(radio_mat_type->getSelectedIndex())); + LLPanelFaceSetAlignedConcreteTEFunctor setfunc(this, last_face, static_cast(mRadioMaterialType->getSelectedIndex())); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); } @@ -1055,10 +1023,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool identical_norm = false; bool identical_spec = false; - LLTextureCtrl *texture_ctrl = getChild("texture control"); - LLTextureCtrl *shinytexture_ctrl = getChild("shinytexture control"); - LLTextureCtrl *bumpytexture_ctrl = getChild("bumpytexture control"); - LLUUID id; LLUUID normmap_id; LLUUID specmap_id; @@ -1122,21 +1086,19 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } mComboMatMedia->setEnabled(editable); - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - if (radio_mat_type->getSelectedIndex() < MATTYPE_DIFFUSE) + if (mRadioMaterialType->getSelectedIndex() < MATTYPE_DIFFUSE) { - radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); + mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); } - radio_mat_type->setEnabled(editable); + mRadioMaterialType->setEnabled(editable); - LLRadioGroup* radio_pbr_type = getChild("radio_pbr_type"); - if (radio_pbr_type->getSelectedIndex() < PBRTYPE_RENDER_MATERIAL_ID) + if (mRadioPbrType->getSelectedIndex() < PBRTYPE_RENDER_MATERIAL_ID) { - radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); + mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } - radio_pbr_type->setEnabled(editable); + mRadioPbrType->setEnabled(editable); const bool pbr_selected = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR; - const bool texture_info_selected = pbr_selected && radio_pbr_type->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID; + const bool texture_info_selected = pbr_selected && mRadioPbrType->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID; getChildView("checkbox_sync_settings")->setEnabled(editable); childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); @@ -1147,30 +1109,28 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { getChildView("color label")->setEnabled(editable); } - LLColorSwatchCtrl* color_swatch = findChild("colorswatch"); LLColor4 color = LLColor4::white; bool identical_color = false; - if (color_swatch) { LLSelectedTE::getColor(color, identical_color); - LLColor4 prev_color = color_swatch->get(); + LLColor4 prev_color = mColorSwatch->get(); - color_swatch->setOriginal(color); - color_swatch->set(color, force_set_values || (prev_color != color) || !editable); + mColorSwatch->setOriginal(color); + mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); - color_swatch->setValid(editable && !has_pbr_material); - color_swatch->setEnabled( editable && !has_pbr_material); - color_swatch->setCanApplyImmediately( editable && !has_pbr_material); + mColorSwatch->setValid(editable && !has_pbr_material); + mColorSwatch->setEnabled( editable && !has_pbr_material); + mColorSwatch->setCanApplyImmediately( editable && !has_pbr_material); } // Color transparency - getChildView("color trans")->setEnabled(editable); + mLabelColorTransp->setEnabled(editable); F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; - getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable && has_material); + mCtrlColorTransp->setValue(editable ? transparency : 0); + mCtrlColorTransp->setEnabled(editable && has_material); U8 shiny = 0; bool identical_shiny = false; @@ -1200,10 +1160,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("combobox shininess")->setTentative(!identical_spec); getChild("glossiness")->setTentative(!identical_spec); getChild("environment")->setTentative(!identical_spec); - getChild("shinycolorswatch")->setTentative(!identical_spec); + mShinyColorSwatch->setTentative(!identical_spec); - LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); - if (mShinyColorSwatch) { mShinyColorSwatch->setValid(editable); mShinyColorSwatch->setEnabled( editable ); @@ -1304,13 +1262,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) updateAlphaControls(); - if (texture_ctrl) + if (mTextureCtrl) { if (identical_diffuse) { - texture_ctrl->setTentative(false); - texture_ctrl->setEnabled(editable && !has_pbr_material); - texture_ctrl->setImageAssetID(id); + mTextureCtrl->setTentative(false); + mTextureCtrl->setEnabled(editable && !has_pbr_material); + mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); @@ -1318,27 +1276,27 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("maskcutoff")->setEnabled(can_change_alpha); getChildView("label maskcutoff")->setEnabled(can_change_alpha); - texture_ctrl->setBakeTextureEnabled(true); + mTextureCtrl->setBakeTextureEnabled(true); } else if (id.isNull()) { // None selected - texture_ctrl->setTentative(false); - texture_ctrl->setEnabled(false); - texture_ctrl->setImageAssetID(LLUUID::null); + mTextureCtrl->setTentative(false); + mTextureCtrl->setEnabled(false); + mTextureCtrl->setImageAssetID(LLUUID::null); getChildView("combobox alphamode")->setEnabled(false); getChildView("label alphamode")->setEnabled(false); getChildView("maskcutoff")->setEnabled(false); getChildView("label maskcutoff")->setEnabled(false); - texture_ctrl->setBakeTextureEnabled(false); + mTextureCtrl->setBakeTextureEnabled(false); } else { // Tentative: multiple selected with different textures - texture_ctrl->setTentative(true); - texture_ctrl->setEnabled(editable && !has_pbr_material); - texture_ctrl->setImageAssetID(id); + mTextureCtrl->setTentative(true); + mTextureCtrl->setEnabled(editable && !has_pbr_material); + mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); @@ -1346,7 +1304,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("maskcutoff")->setEnabled(can_change_alpha); getChildView("label maskcutoff")->setEnabled(can_change_alpha); - texture_ctrl->setBakeTextureEnabled(true); + mTextureCtrl->setBakeTextureEnabled(true); } if (attachment) @@ -1354,43 +1312,43 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // attachments are in world and in inventory, // server doesn't support changing permissions // in such case - texture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { - texture_ctrl->setImmediateFilterPermMask(PERM_NONE); + mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } - if (shinytexture_ctrl) + if (mShinyTextureCtrl) { - shinytexture_ctrl->setTentative( !identical_spec ); - shinytexture_ctrl->setEnabled( editable && !has_pbr_material); - shinytexture_ctrl->setImageAssetID( specmap_id ); + mShinyTextureCtrl->setTentative( !identical_spec ); + mShinyTextureCtrl->setEnabled( editable && !has_pbr_material); + mShinyTextureCtrl->setImageAssetID( specmap_id ); if (attachment) { - shinytexture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mShinyTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { - shinytexture_ctrl->setImmediateFilterPermMask(PERM_NONE); + mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } - if (bumpytexture_ctrl) + if (mBumpyTextureCtrl) { - bumpytexture_ctrl->setTentative( !identical_norm ); - bumpytexture_ctrl->setEnabled( editable && !has_pbr_material); - bumpytexture_ctrl->setImageAssetID( normmap_id ); + mBumpyTextureCtrl->setTentative( !identical_norm ); + mBumpyTextureCtrl->setEnabled( editable && !has_pbr_material); + mBumpyTextureCtrl->setImageAssetID( normmap_id ); if (attachment) { - bumpytexture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); } else { - bumpytexture_ctrl->setImmediateFilterPermMask(PERM_NONE); + mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } } @@ -1621,26 +1579,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 glow = 0.f; bool identical_glow = false; LLSelectedTE::getGlow(glow,identical_glow); - getChild("glow")->setValue(glow); - getChild("glow")->setTentative(!identical_glow); - getChildView("glow")->setEnabled(editable); + mCtrlGlow->setValue(glow); + mCtrlGlow->setTentative(!identical_glow); + mCtrlGlow->setEnabled(editable); getChildView("glow label")->setEnabled(editable); } { - LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); - if (combobox_texgen) - { - // Maps from enum to combobox entry index - combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox texgen'" << LL_ENDL; - } + // Maps from enum to combobox entry index + mComboTexGen->selectNthItem(((S32)selected_texgen) >> 1); - getChildView("combobox texgen")->setEnabled(editable); - getChild("combobox texgen")->setTentative(!identical); + mComboTexGen->setEnabled(editable); + mComboTexGen->setTentative(!identical); getChildView("tex gen")->setEnabled(editable); } @@ -1650,9 +1600,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); - getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); - getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material); - getChild("checkbox fullbright")->setTentative(!identical_fullbright); + mCheckFullbright->setValue((S32)(fullbright_flag != 0)); + mCheckFullbright->setEnabled(editable && !has_pbr_material); + mCheckFullbright->setTentative(!identical_fullbright); mComboMatMedia->setEnabledByValue("Materials", !has_pbr_material); } @@ -1670,8 +1620,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats); LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); - LLComboBox* mComboTexGen = getChild("combobox texgen"); - if (mComboTexGen) { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; bool enabled = editable && (index != 1); @@ -1682,12 +1630,12 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) U32 material_type = MATTYPE_DIFFUSE; if (material_selection == MATMEDIA_MATERIAL) { - material_type = radio_mat_type->getSelectedIndex(); + material_type = mRadioMaterialType->getSelectedIndex(); } else if (material_selection == MATMEDIA_PBR) { enabled = editable && has_pbr_material; - material_type = radio_pbr_type->getSelectedIndex(); + material_type = mRadioPbrType->getSelectedIndex(); } switch (material_type) @@ -1783,8 +1731,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); - texture_ctrl->setImageAssetID(material->getSpecularID()); + mShinyTextureCtrl->setImageAssetID(material->getSpecularID()); if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) { @@ -1814,17 +1761,15 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // if (!material->getSpecularID().isNull()) { - LLColorSwatchCtrl* shiny_swatch = getChild("shinycolorswatch"); LLColor4 new_color = material->getSpecularLightColor(); - LLColor4 old_color = shiny_swatch->get(); + LLColor4 old_color = mShinyColorSwatch->get(); - shiny_swatch->setOriginal(new_color); - shiny_swatch->set(new_color, force_set_values || old_color != new_color || !editable); + mShinyColorSwatch->setOriginal(new_color); + mShinyColorSwatch->set(new_color, force_set_values || old_color != new_color || !editable); } // Bumpy (normal) - texture_ctrl = getChild("bumpytexture control"); - texture_ctrl->setImageAssetID(material->getNormalID()); + mBumpyTextureCtrl->setImageAssetID(material->getNormalID()); if (!material->getNormalID().isNull()) { @@ -1859,8 +1804,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) calcp->setVar(LLCalc::TEX_U_OFFSET, (F32)childGetValue("TexOffsetU").asReal()); calcp->setVar(LLCalc::TEX_V_OFFSET, (F32)childGetValue("TexOffsetV").asReal()); calcp->setVar(LLCalc::TEX_ROTATION, (F32)childGetValue("TexRot").asReal()); - calcp->setVar(LLCalc::TEX_TRANSPARENCY, (F32)childGetValue("ColorTrans").asReal()); - calcp->setVar(LLCalc::TEX_GLOW, (F32)childGetValue("glow").asReal()); + calcp->setVar(LLCalc::TEX_TRANSPARENCY, (F32)mCtrlColorTransp->getValue().asReal()); + calcp->setVar(LLCalc::TEX_GLOW, (F32)mCtrlGlow->getValue().asReal()); } else { @@ -1868,32 +1813,31 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) clearCtrls(); // Disable non-UICtrls - LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); - if (pbr_ctrl) + if (mPBRTextureCtrl) { - pbr_ctrl->setImageAssetID(LLUUID::null); - pbr_ctrl->setEnabled(false); + mPBRTextureCtrl->setImageAssetID(LLUUID::null); + mPBRTextureCtrl->setEnabled(false); } - LLTextureCtrl* texture_ctrl = getChild("texture control"); - if (texture_ctrl) + + if (mTextureCtrl) { - texture_ctrl->setImageAssetID( LLUUID::null ); - texture_ctrl->setEnabled( false ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. -// texture_ctrl->setValid(false); + mTextureCtrl->setImageAssetID( LLUUID::null ); + mTextureCtrl->setEnabled( false ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. +// mTextureCtrl->setValid(false); } - LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); + if (mColorSwatch) { mColorSwatch->setEnabled( false ); mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") ); mColorSwatch->setValid(false); } - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - if (radio_mat_type) + + if (mRadioMaterialType) { - radio_mat_type->setSelectedIndex(0); + mRadioMaterialType->setSelectedIndex(0); } - getChildView("color trans")->setEnabled(false); + mLabelColorTransp->setEnabled(false); getChildView("rptctrl")->setEnabled(false); getChildView("tex gen")->setEnabled(false); getChildView("label shininess")->setEnabled(false); @@ -2005,23 +1949,22 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool saveable = LLMaterialEditor::canSaveObjectsMaterial(); // pbr material - LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); LLUUID pbr_id; - if (pbr_ctrl) + if (mPBRTextureCtrl) { LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); - pbr_ctrl->setTentative(!identical_pbr); - pbr_ctrl->setEnabled(settable); - pbr_ctrl->setImageAssetID(pbr_id); + mPBRTextureCtrl->setTentative(!identical_pbr); + mPBRTextureCtrl->setEnabled(settable); + mPBRTextureCtrl->setImageAssetID(pbr_id); if (objectp->isAttachment()) { - pbr_ctrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); + mPBRTextureCtrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); } else { - pbr_ctrl->setImmediateFilterPermMask(PERM_NONE); + mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); } } @@ -2080,13 +2023,12 @@ void LLPanelFace::updateVisibilityGLTF(LLViewerObject* objectp /*= nullptr */) const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); const bool inventory_pending = objectp && objectp->isInventoryPending(); - LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); - radio_pbr_type->setVisible(show_pbr); + mRadioPbrType->setVisible(show_pbr); - const U32 pbr_type = radio_pbr_type->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); const bool show_pbr_render_material_id = show_pbr && (pbr_type == PBRTYPE_RENDER_MATERIAL_ID); - getChildView("pbr_control")->setVisible(show_pbr_render_material_id); + mPBRTextureCtrl->setVisible(show_pbr_render_material_id); getChildView("pbr_from_inventory")->setVisible(show_pbr_render_material_id); getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); @@ -2890,7 +2832,7 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - LLSelectedTEMaterial::setSpecularLightColor(this, getChild("shinycolorswatch")->get()); + LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -2916,7 +2858,7 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onSelectShinyColor(const LLSD& data) { - LLSelectedTEMaterial::setSpecularLightColor(this, getChild("shinycolorswatch")->get()); + LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); LLSelectMgr::getInstance()->saveSelectedShinyColors(); } @@ -2935,33 +2877,31 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) { - LLRadioGroup* radio_mat_type = findChild("radio_material_type"); - LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); LLComboBox* combo_shininess = findChild("combobox shininess"); LLComboBox* combo_bumpiness = findChild("combobox bumpiness"); - if (!radio_mat_type || !radio_pbr_type || !mComboMatMedia || !combo_shininess || !combo_bumpiness) + if (!mRadioMaterialType || !mRadioPbrType || !mComboMatMedia || !combo_shininess || !combo_bumpiness) { LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; } U32 materials_media = mComboMatMedia->getCurrentIndex(); - U32 material_type = radio_mat_type->getSelectedIndex(); + U32 material_type = mRadioMaterialType->getSelectedIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && mComboMatMedia->getEnabled(); bool show_material = materials_media == MATMEDIA_MATERIAL; bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled())); bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); const bool show_pbr_asset = show_pbr && texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; - radio_mat_type->setVisible(show_material); + mRadioMaterialType->setVisible(show_material); // Shared material controls getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); getChildView("tex gen")->setVisible(show_material || show_media || show_pbr_asset); - getChildView("combobox texgen")->setVisible(show_material || show_media || show_pbr_asset); + mComboTexGen->setVisible(show_material || show_media || show_pbr_asset); getChildView("button align textures")->setVisible(show_material || show_media); // Media controls @@ -2971,7 +2911,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) getChildView("button align")->setVisible(show_media); // Diffuse texture controls - getChildView("texture control")->setVisible(show_texture && show_material); + mTextureCtrl->setVisible(show_texture && show_material); getChildView("label alphamode")->setVisible(show_texture && show_material); getChildView("combobox alphamode")->setVisible(show_texture && show_material); getChildView("label maskcutoff")->setVisible(false); @@ -2988,7 +2928,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) getChildView("TexOffsetV")->setVisible(show_texture); // Specular map controls - getChildView("shinytexture control")->setVisible(show_shininess); + mShinyTextureCtrl->setVisible(show_shininess); getChildView("combobox shininess")->setVisible(show_shininess); getChildView("label shininess")->setVisible(show_shininess); getChildView("label glossiness")->setVisible(false); @@ -2996,7 +2936,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) getChildView("label environment")->setVisible(false); getChildView("environment")->setVisible(false); getChildView("label shinycolor")->setVisible(false); - getChildView("shinycolorswatch")->setVisible(false); + mShinyColorSwatch->setVisible(false); if (show_shininess) { updateShinyControls(); @@ -3012,7 +2952,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) { updateBumpyControls(); } - getChildView("bumpytexture control")->setVisible(show_bumpiness); + mBumpyTextureCtrl->setVisible(show_bumpiness); getChildView("combobox bumpiness")->setVisible(show_bumpiness); getChildView("label bumpiness")->setVisible(show_bumpiness); getChildView("bumpyScaleU")->setVisible(show_bumpiness); @@ -3073,8 +3013,7 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) // static void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox) { - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); - LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID(); + LLUUID shiny_texture_ID = mShinyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; LLComboBox* comboShiny = getChild("combobox shininess"); @@ -3110,10 +3049,8 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh } } - - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); U32 materials_media = mComboMatMedia->getCurrentIndex(); - U32 material_type = radio_mat_type->getSelectedIndex(); + U32 material_type = mRadioMaterialType->getSelectedIndex(); bool show_material = (materials_media == MATMEDIA_MATERIAL); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); U32 shiny_value = comboShiny->getCurrentIndex(); @@ -3123,14 +3060,13 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh getChildView("label environment")->setVisible(show_shinyctrls); getChildView("environment")->setVisible(show_shinyctrls); getChildView("label shinycolor")->setVisible(show_shinyctrls); - getChildView("shinycolorswatch")->setVisible(show_shinyctrls); + mShinyColorSwatch->setVisible(show_shinyctrls); } // static void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox) { - LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); - LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); + LLUUID bumpy_texture_ID = mBumpyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; LLComboBox* comboBumpy = getChild("combobox bumpiness"); if (!comboBumpy) @@ -3140,10 +3076,6 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co if (mess_with_combobox) { - 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; - if (!bumpy_texture_ID.isNull() && is_setting_texture) { if (!comboBumpy->itemExists(USE_TEXTURE)) @@ -3196,10 +3128,9 @@ void LLPanelFace::updateAlphaControls() } U32 mat_type = MATTYPE_DIFFUSE; - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - if(radio_mat_type) + if(mRadioMaterialType) { - mat_type = radio_mat_type->getSelectedIndex(); + mat_type = mRadioMaterialType->getSelectedIndex(); } show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL); @@ -3251,20 +3182,19 @@ bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) void LLPanelFace::onCommitPbr(const LLSD& data) { - LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); - if (!pbr_ctrl) return; - if (!pbr_ctrl->getTentative()) + if (!mPBRTextureCtrl) return; + if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a // permissions check in the selection manager. ARGH! - LLUUID id = pbr_ctrl->getImageItemID(); + LLUUID id = mPBRTextureCtrl->getImageItemID(); if (id.isNull()) { - id = pbr_ctrl->getImageAssetID(); + id = mPBRTextureCtrl->getImageAssetID(); } if (!LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) { - // If failed to set material, refresh pbr_ctrl's value + // If failed to set material, refresh mPBRTextureCtrl's value refresh(); } } @@ -3279,16 +3209,15 @@ void LLPanelFace::onSelectPbr(const LLSD& data) { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); - LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); - if (!pbr_ctrl) return; - if (!pbr_ctrl->getTentative()) + if (!mPBRTextureCtrl) return; + if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a // permissions check in the selection manager. ARGH! - LLUUID id = pbr_ctrl->getImageItemID(); + LLUUID id = mPBRTextureCtrl->getImageItemID(); if (id.isNull()) { - id = pbr_ctrl->getImageAssetID(); + id = mPBRTextureCtrl->getImageAssetID(); } if (!LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) { @@ -3388,7 +3317,7 @@ void LLPanelFace::onCancelSpecularTexture(const LLSD& data) U8 shiny = 0; bool identical_shiny = false; LLSelectedTE::getShiny(shiny, identical_shiny); - LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + LLUUID spec_map_id = mShinyTextureCtrl->getImageAssetID(); shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE; sendShiny(shiny); } @@ -3398,7 +3327,7 @@ void LLPanelFace::onCancelNormalTexture(const LLSD& data) U8 bumpy = 0; bool identical_bumpy = false; LLSelectedTE::getBumpmap(bumpy, identical_bumpy); - LLUUID spec_map_id = getChild("bumpytexture control")->getImageAssetID(); + LLUUID spec_map_id = mBumpyTextureCtrl->getImageAssetID(); bumpy = spec_map_id.isNull() ? bumpy : BUMPY_TEXTURE; sendBump(bumpy); } @@ -3869,13 +3798,11 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) U32 material_type = 0; if (materials_media == MATMEDIA_PBR) { - LLRadioGroup *radio_mat_type = self->getChild("radio_pbr_type"); - material_type = radio_mat_type->getSelectedIndex(); + material_type = self->mRadioPbrType->getSelectedIndex(); } if (materials_media == MATMEDIA_MATERIAL) { - LLRadioGroup *radio_mat_type = self->getChild("radio_material_type"); - material_type = radio_mat_type->getSelectedIndex(); + material_type = self->mRadioMaterialType->getSelectedIndex(); } F32 repeats_per_meter = (F32) repeats_ctrl->getValue().asReal(); @@ -4003,15 +3930,14 @@ void LLPanelFace::onClickAutoFix(void* userdata) void LLPanelFace::onAlignTexture(void* userdata) { LLPanelFace* self = (LLPanelFace*)userdata; - self->alignTestureLayer(); + self->alignTextureLayer(); } void LLPanelFace::onClickBtnLoadInvPBR(void* userdata) { // Shouldn't this be "save to inventory?" LLPanelFace* self = (LLPanelFace*)userdata; - LLTextureCtrl* pbr_ctrl = self->findChild("pbr_control"); - pbr_ctrl->showPicker(true); + self->mPBRTextureCtrl->showPicker(true); } void LLPanelFace::onClickBtnEditPBR(void* userdata) @@ -4916,7 +4842,7 @@ void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::fun void LLPanelFace::setMaterialOverridesFromSelection() { - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); U32 texture_info_start; U32 texture_info_end; @@ -5086,7 +5012,7 @@ bool LLPanelFace::Selection::compareSelection() void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VX] = value; @@ -5096,7 +5022,7 @@ void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VY] = value; @@ -5106,7 +5032,7 @@ void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal() * DEG_TO_RAD; - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mRotation = value; @@ -5116,7 +5042,7 @@ void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VX] = value; @@ -5126,7 +5052,7 @@ void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) { const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const U32 pbr_type = mRadioPbrType->getSelectedIndex(); updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VY] = value; @@ -5136,12 +5062,8 @@ void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; - LLRadioGroup* radio_mat_type = findChild("radio_material_type"); - if(!radio_mat_type) - { - return; - } - U32 mattype = radio_mat_type->getSelectedIndex(); + + U32 mattype = mRadioMaterialType->getSelectedIndex(); std::string which_control="texture control"; switch (mattype) { @@ -5187,8 +5109,7 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) { - LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); - if (pbr_ctrl) + if (mPBRTextureCtrl) { LLUUID obj_owner_id; std::string obj_owner_name; @@ -5206,12 +5127,12 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) if ((can_copy && can_transfer && can_modify) || from_library) { - pbr_ctrl->setCanApply(true, true); + mPBRTextureCtrl->setCanApply(true, true); return; } // if material has (no-transfer) attribute it can be applied only for object which we own and is not for sale - pbr_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); + mPBRTextureCtrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); if (gSavedSettings.getBOOL("TextureLivePreview")) { -- cgit v1.2.3 From 93164fc5605a2b3d0d7a21d39c297cd392f75b60 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 7 Aug 2024 08:23:47 +0200 Subject: #1922 Make PBR scale and offset crosshair work (fix callbacks in LLPanelFace) --- indra/newview/llpanelface.cpp | 944 +++++++++++++++++------------------------- 1 file changed, 380 insertions(+), 564 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 0afe967839..f01d327fb4 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -240,10 +240,10 @@ LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl-> LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->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(); } +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 (F32)getChild("bumpyRot")->getValue().asReal(); } F32 LLPanelFace::getCurrentBumpyScaleU() { return (F32)getChild("bumpyScaleU")->getValue().asReal(); } F32 LLPanelFace::getCurrentBumpyScaleV() { return (F32)getChild("bumpyScaleV")->getValue().asReal(); } @@ -259,49 +259,49 @@ F32 LLPanelFace::getCurrentShinyOffsetV() { return (F32)getChild("gltfTextureScaleU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleU, this, _1), nullptr); - getChild("gltfTextureScaleV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleV, this, _1), nullptr); - getChild("gltfTextureRotation")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFRotation, this, _1), nullptr); - getChild("gltfTextureOffsetU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); - getChild("gltfTextureOffsetV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); +bool LLPanelFace::postBuild() +{ + childSetCommitCallback("combobox shininess", [&](LLUICtrl*, const void*) { onCommitShiny(); }, 0); + childSetCommitCallback("combobox bumpiness", [&](LLUICtrl*, const void*) { onCommitBump(); }, 0); + childSetCommitCallback("combobox alphamode", [&](LLUICtrl*, const void*) { onCommitAlphaMode(); }, 0); + childSetCommitCallback("TexScaleU", [&](LLUICtrl*, const void*) { onCommitTextureScaleX(); }, 0); + childSetCommitCallback("TexScaleV", [&](LLUICtrl*, const void*) { onCommitTextureScaleY(); }, 0); + childSetCommitCallback("TexRot", [&](LLUICtrl*, const void*) { onCommitTextureRot(); }, 0); + childSetCommitCallback("rptctrl", [&](LLUICtrl*, const void*) { onCommitRepeatsPerMeter(); }, 0); + childSetCommitCallback("checkbox planar align", [&](LLUICtrl*, const void*) { onCommitPlanarAlign(); }, 0); + childSetCommitCallback("TexOffsetU", [&](LLUICtrl*, const void*) { onCommitTextureOffsetX(); }, 0); + childSetCommitCallback("TexOffsetV", [&](LLUICtrl*, const void*) { onCommitTextureOffsetY(); }, 0); + + childSetCommitCallback("bumpyScaleU", [&](LLUICtrl*, const void*) { onCommitMaterialBumpyScaleX(); }, 0); + childSetCommitCallback("bumpyScaleV", [&](LLUICtrl*, const void*) { onCommitMaterialBumpyScaleY(); }, 0); + childSetCommitCallback("bumpyRot", [&](LLUICtrl*, const void*) { onCommitMaterialBumpyRot(); }, 0); + childSetCommitCallback("bumpyOffsetU", [&](LLUICtrl*, const void*) { onCommitMaterialBumpyOffsetX(); }, 0); + childSetCommitCallback("bumpyOffsetV", [&](LLUICtrl*, const void*) { onCommitMaterialBumpyOffsetY(); }, 0); + childSetCommitCallback("shinyScaleU", [&](LLUICtrl*, const void*) { onCommitMaterialShinyScaleX(); }, 0); + childSetCommitCallback("shinyScaleV", [&](LLUICtrl*, const void*) { onCommitMaterialShinyScaleY(); }, 0); + childSetCommitCallback("shinyRot", [&](LLUICtrl*, const void*) { onCommitMaterialShinyRot(); }, 0); + childSetCommitCallback("shinyOffsetU", [&](LLUICtrl*, const void*) { onCommitMaterialShinyOffsetX(); }, 0); + childSetCommitCallback("shinyOffsetV", [&](LLUICtrl*, const void*) { onCommitMaterialShinyOffsetY(); }, 0); + childSetCommitCallback("glossiness", [&](LLUICtrl*, const void*) { onCommitMaterialGloss(); }, 0); + childSetCommitCallback("environment", [&](LLUICtrl*, const void*) { onCommitMaterialEnv(); }, 0); + childSetCommitCallback("maskcutoff", [&](LLUICtrl*, const void*) { onCommitMaterialMaskCutoff(); }, 0); + childSetCommitCallback("add_media", [&](LLUICtrl*, const void*) { onClickBtnAddMedia(); }, 0); + childSetCommitCallback("delete_media", [&](LLUICtrl*, const void*) { onClickBtnDeleteMedia(); }, 0); + + childSetCommitCallback("gltfTextureScaleU", [&](LLUICtrl*, const void*) { onCommitGLTFTextureScaleU(); }, 0); + childSetCommitCallback("gltfTextureScaleV", [&](LLUICtrl*, const void*) { onCommitGLTFTextureScaleV(); }, 0); + childSetCommitCallback("gltfTextureRotation", [&](LLUICtrl*, const void*) { onCommitGLTFRotation(); }, 0); + childSetCommitCallback("gltfTextureOffsetU", [&](LLUICtrl*, const void*) { onCommitGLTFTextureOffsetU(); }, 0); + childSetCommitCallback("gltfTextureOffsetV", [&](LLUICtrl*, const void*) { onCommitGLTFTextureOffsetV(); }, 0); LLGLTFMaterialList::addSelectionUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); sMaterialOverrideSelection.connect(); - childSetAction("button align",&LLPanelFace::onClickAutoFix,this); - childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); - childSetAction("pbr_from_inventory", &LLPanelFace::onClickBtnLoadInvPBR, this); - childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this); - childSetAction("save_selected_pbr", &LLPanelFace::onClickBtnSavePBR, this); + childSetAction("button align", [&](LLUICtrl*, const LLSD&) { onClickAutoFix(); }); + childSetAction("button align textures", [&](LLUICtrl*, const LLSD&) { onAlignTexture(); }); + childSetAction("pbr_from_inventory", [&](LLUICtrl*, const LLSD&) { onClickBtnLoadInvPBR(); }); + childSetAction("edit_selected_pbr", [&](LLUICtrl*, const LLSD&) { onClickBtnEditPBR(); }); + childSetAction("save_selected_pbr", [&](LLUICtrl*, const LLSD&) { onClickBtnSavePBR(); }); setMouseOpaque(false); @@ -310,12 +310,12 @@ bool LLPanelFace::postBuild() { mPBRTextureCtrl->setDefaultImageAssetID(LLUUID::null); mPBRTextureCtrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); - mPBRTextureCtrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); - mPBRTextureCtrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); - mPBRTextureCtrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); - mPBRTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragPbr, this, _2)); - mPBRTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onPbrSelectionChanged, this, _1)); - mPBRTextureCtrl->setOnCloseCallback(boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2)); + mPBRTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbr(); }); + mPBRTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelPbr(); }); + mPBRTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectPbr(); }); + mPBRTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragPbr(item); }); + mPBRTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onPbrSelectionChanged(item); }); + mPBRTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); mPBRTextureCtrl->setFollowsTop(); mPBRTextureCtrl->setFollowsLeft(); @@ -326,15 +326,15 @@ bool LLPanelFace::postBuild() } mTextureCtrl = getChild("texture control"); - if(mTextureCtrl) + if (mTextureCtrl) { mTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_TEXTURE); - mTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitTexture, this, _2) ); - mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) ); - 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->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexture(); }); + mTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelTexture(); }); + mTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectTexture(); }); + mTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); + mTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); mTextureCtrl->setFollowsTop(); mTextureCtrl->setFollowsLeft(); @@ -343,16 +343,16 @@ bool LLPanelFace::postBuild() } mShinyTextureCtrl = getChild("shinytexture control"); - if(mShinyTextureCtrl) + if (mShinyTextureCtrl) { mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR); - 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->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitSpecularTexture(data); }); + mShinyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelSpecularTexture(data); }); + mShinyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectSpecularTexture(data); }); + mShinyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); - mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); - mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); + mShinyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mShinyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); mShinyTextureCtrl->setFollowsTop(); mShinyTextureCtrl->setFollowsLeft(); mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); @@ -360,17 +360,17 @@ bool LLPanelFace::postBuild() } mBumpyTextureCtrl = getChild("bumpytexture control"); - if(mBumpyTextureCtrl) + if (mBumpyTextureCtrl) { mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL); mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL); - 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->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitNormalTexture(data); }); + mBumpyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelNormalTexture(data); }); + mBumpyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectNormalTexture(data); }); + mBumpyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); - mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); - mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); + mBumpyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mBumpyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); mBumpyTextureCtrl->setFollowsTop(); mBumpyTextureCtrl->setFollowsLeft(); mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); @@ -378,38 +378,38 @@ bool LLPanelFace::postBuild() } mColorSwatch = getChild("colorswatch"); - if(mColorSwatch) + if (mColorSwatch) { - mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2)); - mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2)); - mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2)); + mColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitColor(); }); + mColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelColor(); }); + mColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectColor(); }); mColorSwatch->setFollowsTop(); mColorSwatch->setFollowsLeft(); mColorSwatch->setCanApplyImmediately(true); } mShinyColorSwatch = getChild("shinycolorswatch"); - if(mShinyColorSwatch) + if (mShinyColorSwatch) { - mShinyColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitShinyColor, this, _2)); - mShinyColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelShinyColor, this, _2)); - mShinyColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectShinyColor, this, _2)); + mShinyColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitShinyColor(); }); + mShinyColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelShinyColor(); }); + mShinyColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectShinyColor(); }); mShinyColorSwatch->setFollowsTop(); mShinyColorSwatch->setFollowsLeft(); mShinyColorSwatch->setCanApplyImmediately(true); } mLabelColorTransp = getChild("color trans"); - if(mLabelColorTransp) + if (mLabelColorTransp) { mLabelColorTransp->setFollowsTop(); mLabelColorTransp->setFollowsLeft(); } mCtrlColorTransp = getChild("ColorTrans"); - if(mCtrlColorTransp) + if (mCtrlColorTransp) { - mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2)); + mCtrlColorTransp->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitAlpha(); }); mCtrlColorTransp->setPrecision(0); mCtrlColorTransp->setFollowsTop(); mCtrlColorTransp->setFollowsLeft(); @@ -418,41 +418,41 @@ bool LLPanelFace::postBuild() mCheckFullbright = getChild("checkbox fullbright"); if (mCheckFullbright) { - mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this); + mCheckFullbright->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitFullbright(); }); } mComboTexGen = getChild("combobox texgen"); - if(mComboTexGen) + if (mComboTexGen) { - mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this); + mComboTexGen->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexGen(); }); mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } mComboMatMedia = getChild("combobox matmedia"); - if(mComboMatMedia) + if (mComboMatMedia) { - mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); + mComboMatMedia->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialsMedia(); }); mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); } mRadioMaterialType = getChild("radio_material_type"); - if(mRadioMaterialType) + if (mRadioMaterialType) { - mRadioMaterialType->setCommitCallback(LLPanelFace::onCommitMaterialType, this); + mRadioMaterialType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialType(); }); mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); } mRadioPbrType = getChild("radio_pbr_type"); if (mRadioPbrType) { - mRadioPbrType->setCommitCallback(LLPanelFace::onCommitPbrType, this); + mRadioPbrType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbrType(); }); mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } mCtrlGlow = getChild("glow"); - if(mCtrlGlow) + if (mCtrlGlow) { - mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this); + mCtrlGlow->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitGlow(); }); } mMenuClipboardColor = getChild("clipboard_color_params_btn"); @@ -534,7 +534,7 @@ void LLPanelFace::sendTexture() void LLPanelFace::sendBump(U32 bumpiness) { if (bumpiness < BUMPY_TEXTURE) -{ + { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; mBumpyTextureCtrl->clear(); mBumpyTextureCtrl->setImageAssetID(LLUUID()); @@ -544,12 +544,13 @@ void LLPanelFace::sendBump(U32 bumpiness) LLUUID current_normal_map = mBumpyTextureCtrl->getImageAssetID(); - U8 bump = (U8) bumpiness & TEM_BUMP_MASK; + 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 // @@ -560,14 +561,14 @@ void LLPanelFace::sendBump(U32 bumpiness) void LLPanelFace::sendTexGen() { - U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; - LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen ); + U8 tex_gen = (U8)mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; + LLSelectMgr::getInstance()->selectionSetTexGen(tex_gen); } void LLPanelFace::sendShiny(U32 shininess) { if (shininess < SHINY_TEXTURE) -{ + { mShinyTextureCtrl->clear(); mShinyTextureCtrl->setImageAssetID(LLUUID()); } @@ -576,40 +577,38 @@ void LLPanelFace::sendShiny(U32 shininess) U8 shiny = (U8) shininess & TEM_SHINY_MASK; if (!specmap.isNull()) + { shiny = 0; + } LLSelectedTEMaterial::setSpecularID(this, specmap); - LLSelectMgr::getInstance()->selectionSetShiny( shiny, mShinyTextureCtrl->getImageItemID() ); + LLSelectMgr::getInstance()->selectionSetShiny(shiny, mShinyTextureCtrl->getImageItemID()); updateShinyControls(!specmap.isNull(), true); - } void LLPanelFace::sendFullbright() { if(!mCheckFullbright)return; U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0; - LLSelectMgr::getInstance()->selectionSetFullbright( fullbright ); + LLSelectMgr::getInstance()->selectionSetFullbright(fullbright); } void LLPanelFace::sendColor() { if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); - - LLSelectMgr::getInstance()->selectionSetColorOnly( color ); + LLSelectMgr::getInstance()->selectionSetColorOnly(color); } void LLPanelFace::sendAlpha() { if(!mCtrlColorTransp)return; F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f; - LLSelectMgr::getInstance()->selectionSetAlphaOnly( alpha ); } - void LLPanelFace::sendGlow() { if (mCtrlGlow) @@ -750,6 +749,7 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor } } } + return true; } private: @@ -906,7 +906,7 @@ struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor LLVector2 aligned_st_offset, aligned_st_scale; F32 aligned_st_rot; - if ( facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot) ) + if (facep->calcAlignedPlanarTE(mCenterFace, &aligned_st_offset, &aligned_st_scale, &aligned_st_rot)) { const LLTextureEntry* tep = facep->getTextureEntry(); LLVector2 st_offset, st_scale; @@ -947,7 +947,7 @@ struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor void LLPanelFace::sendTextureInfo() { - if ((bool)childGetValue("checkbox planar align").asBoolean()) + if (childGetValue("checkbox planar align").asBoolean()) { LLFace* last_face = NULL; bool identical_face =false; @@ -1322,9 +1322,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (mShinyTextureCtrl) { - mShinyTextureCtrl->setTentative( !identical_spec ); - mShinyTextureCtrl->setEnabled( editable && !has_pbr_material); - mShinyTextureCtrl->setImageAssetID( specmap_id ); + mShinyTextureCtrl->setTentative(!identical_spec); + mShinyTextureCtrl->setEnabled(editable && !has_pbr_material); + mShinyTextureCtrl->setImageAssetID(specmap_id); if (attachment) { @@ -1338,9 +1338,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (mBumpyTextureCtrl) { - mBumpyTextureCtrl->setTentative( !identical_norm ); - mBumpyTextureCtrl->setEnabled( editable && !has_pbr_material); - mBumpyTextureCtrl->setImageAssetID( normmap_id ); + mBumpyTextureCtrl->setTentative(!identical_norm); + mBumpyTextureCtrl->setEnabled(editable && !has_pbr_material); + mBumpyTextureCtrl->setImageAssetID(normmap_id); if (attachment) { @@ -1386,10 +1386,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool identical_texgen = true; bool identical_planar_texgen = false; - { - LLSelectedTE::getTexGen(selected_texgen, identical_texgen); - identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); - } + LLSelectedTE::getTexGen(selected_texgen, identical_texgen); + identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); // Texture scale { @@ -1428,7 +1426,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool norm_scale_tentative = !(identical && identical_norm_scale_s); bool spec_scale_tentative = !(identical && identical_spec_scale_s); - getChild("TexScaleU")->setTentative( LLSD(diff_scale_tentative)); + getChild("TexScaleU")->setTentative(LLSD(diff_scale_tentative)); getChild("shinyScaleU")->setTentative(LLSD(spec_scale_tentative)); getChild("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative)); } @@ -1550,9 +1548,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 norm_rotation = 0.f; F32 spec_rotation = 0.f; - LLSelectedTE::getRotation(diff_rotation,identical_diff_rotation); - LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation); - LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation); + LLSelectedTE::getRotation(diff_rotation, identical_diff_rotation); + LLSelectedTEMaterial::getSpecularRotation(spec_rotation, identical_spec_rotation); + LLSelectedTEMaterial::getNormalRotation(norm_rotation, identical_norm_rotation); bool diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation); bool norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation); @@ -1566,11 +1564,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("shinyRot")->setEnabled(editable && has_material && specmap_id.notNull()); getChildView("bumpyRot")->setEnabled(editable && has_material && 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")->setTentative(LLSD(diff_rot_tentative)); + getChild("shinyRot")->setTentative(LLSD(spec_rot_tentative)); + getChild("bumpyRot")->setTentative(LLSD(norm_rot_tentative)); - getChild("TexRot")->setValue( editable ? diff_rot_deg : 0.0f); + 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); } @@ -1578,7 +1576,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { F32 glow = 0.f; bool identical_glow = false; - LLSelectedTE::getGlow(glow,identical_glow); + LLSelectedTE::getGlow(glow, identical_glow); mCtrlGlow->setValue(glow); mCtrlGlow->setTentative(!identical_glow); mCtrlGlow->setEnabled(editable); @@ -1598,7 +1596,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) U8 fullbright_flag = 0; bool identical_fullbright = false; - LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); + LLSelectedTE::getFullbright(fullbright_flag, identical_fullbright); mCheckFullbright->setValue((S32)(fullbright_flag != 0)); mCheckFullbright->setEnabled(editable && !has_pbr_material); @@ -1625,7 +1623,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool enabled = editable && (index != 1); bool identical_repeats = true; S32 material_selection = mComboMatMedia->getCurrentIndex(); - F32 repeats = 1.0f; + F32 repeats = 1.0f; U32 material_type = MATTYPE_DIFFUSE; if (material_selection == MATMEDIA_MATERIAL) @@ -1642,37 +1640,29 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { default: case MATTYPE_DIFFUSE: - { if (material_selection != MATMEDIA_PBR) { enabled = editable && !id.isNull(); } identical_repeats = identical_diff_repeats; repeats = repeats_diff; - } - break; - + break; case MATTYPE_SPECULAR: - { if (material_selection != MATMEDIA_PBR) { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); } identical_repeats = identical_spec_repeats; repeats = repeats_spec; - } - break; - + break; case MATTYPE_NORMAL: - { if (material_selection != MATMEDIA_PBR) { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); } identical_repeats = identical_norm_repeats; repeats = repeats_norm; - } - break; + break; } bool repeats_tentative = !identical_repeats; @@ -1724,6 +1714,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; } + getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(); @@ -1735,8 +1726,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) { - material->getSpecularOffset(offset_x,offset_y); - material->getSpecularRepeat(repeat_x,repeat_y); + material->getSpecularOffset(offset_x, offset_y); + material->getSpecularRepeat(repeat_x, repeat_y); if (identical_planar_texgen) { @@ -1747,7 +1738,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) rot = material->getSpecularRotation(); getChild("shinyScaleU")->setValue(repeat_x); getChild("shinyScaleV")->setValue(repeat_y); - getChild("shinyRot")->setValue(rot*RAD_TO_DEG); + getChild("shinyRot")->setValue(rot * RAD_TO_DEG); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); getChild("glossiness")->setValue(material->getSpecularLightExponent()); @@ -1785,7 +1776,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) rot = material->getNormalRotation(); getChild("bumpyScaleU")->setValue(repeat_x); getChild("bumpyScaleV")->setValue(repeat_y); - getChild("bumpyRot")->setValue(rot*RAD_TO_DEG); + getChild("bumpyRot")->setValue(rot * RAD_TO_DEG); getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); @@ -1793,6 +1784,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } } + S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); bool single_volume = (selected_count == 1); mMenuClipboardColor->setEnabled(editable && single_volume); @@ -2814,65 +2806,58 @@ void LLPanelFace::updateMediaTitle() }; } -// -// Static functions -// - // static F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face) { return (F32)(object->getTE(face)->getGlow()); } - -void LLPanelFace::onCommitColor(const LLSD& data) +void LLPanelFace::onCommitColor() { sendColor(); } -void LLPanelFace::onCommitShinyColor(const LLSD& data) +void LLPanelFace::onCommitShinyColor() { LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); } -void LLPanelFace::onCommitAlpha(const LLSD& data) +void LLPanelFace::onCommitAlpha() { sendAlpha(); } -void LLPanelFace::onCancelColor(const LLSD& data) +void LLPanelFace::onCancelColor() { LLSelectMgr::getInstance()->selectionRevertColors(); } -void LLPanelFace::onCancelShinyColor(const LLSD& data) +void LLPanelFace::onCancelShinyColor() { LLSelectMgr::getInstance()->selectionRevertShinyColors(); } -void LLPanelFace::onSelectColor(const LLSD& data) +void LLPanelFace::onSelectColor() { LLSelectMgr::getInstance()->saveSelectedObjectColors(); sendColor(); } -void LLPanelFace::onSelectShinyColor(const LLSD& data) +void LLPanelFace::onSelectShinyColor() { LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); LLSelectMgr::getInstance()->saveSelectedShinyColors(); } -// static -void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialsMedia() { - 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(); - self->refreshMedia(); + updateShinyControls(false, true); + updateBumpyControls(false, true); + updateUI(); + refreshMedia(); } void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) @@ -2967,62 +2952,42 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) updateVisibilityGLTF(objectp); } -// static -void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialType() { - 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(); + updateShinyControls(false, true); + updateBumpyControls(false, true); + updateUI(); } -// static -void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitPbrType() { - 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->updateUI(); + updateUI(); } -// static -void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitBump() { - LLPanelFace* self = (LLPanelFace*) userdata; - - LLComboBox* mComboBumpiness = self->getChild("combobox bumpiness"); - if(!mComboBumpiness) - return; - - U32 bumpiness = mComboBumpiness->getCurrentIndex(); - - self->sendBump(bumpiness); + sendBump(getChild("combobox bumpiness")->getCurrentIndex()); } -// static -void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitTexGen() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendTexGen(); + sendTexGen(); } -// static void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox) { LLUUID shiny_texture_ID = mShinyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; LLComboBox* comboShiny = getChild("combobox shininess"); - if(mess_with_shiny_combobox) + if (mess_with_shiny_combobox) { - if (!comboShiny) - { - return; - } if (!shiny_texture_ID.isNull() && is_setting_texture) { if (!comboShiny->itemExists(USE_TEXTURE)) @@ -3042,7 +3007,7 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh } else { - if (shiny_texture_ID.isNull() && comboShiny && comboShiny->itemExists(USE_TEXTURE)) + if (shiny_texture_ID.isNull() && comboShiny->itemExists(USE_TEXTURE)) { comboShiny->remove(SHINY_TEXTURE); comboShiny->selectFirstItem(); @@ -3063,16 +3028,11 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh mShinyColorSwatch->setVisible(show_shinyctrls); } -// static void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox) { LLUUID bumpy_texture_ID = mBumpyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; LLComboBox* comboBumpy = getChild("combobox bumpiness"); - if (!comboBumpy) - { - return; - } if (mess_with_combobox) { @@ -3095,43 +3055,18 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co } } -// static -void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitShiny() { - LLPanelFace* self = (LLPanelFace*) userdata; - - - LLComboBox* mComboShininess = self->getChild("combobox shininess"); - if(!mComboShininess) - return; - - U32 shininess = mComboShininess->getCurrentIndex(); - - self->sendShiny(shininess); + sendShiny(getChild("combobox shininess")->getCurrentIndex()); } -// static void LLPanelFace::updateAlphaControls() { - LLComboBox* comboAlphaMode = getChild("combobox alphamode"); - if (!comboAlphaMode) - { - return; - } - U32 alpha_value = comboAlphaMode->getCurrentIndex(); + U32 alpha_value = getChild("combobox alphamode")->getCurrentIndex(); bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking - U32 mat_media = MATMEDIA_MATERIAL; - if (mComboMatMedia) - { - mat_media = mComboMatMedia->getCurrentIndex(); - } - - U32 mat_type = MATTYPE_DIFFUSE; - if(mRadioMaterialType) - { - mat_type = mRadioMaterialType->getSelectedIndex(); - } + U32 mat_media = mComboMatMedia->getCurrentIndex(); + U32 mat_type = mRadioMaterialType->getSelectedIndex(); show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL); show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE); @@ -3140,30 +3075,23 @@ void LLPanelFace::updateAlphaControls() getChildView("maskcutoff")->setVisible(show_alphactrls); } -// static -void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitAlphaMode() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->updateAlphaControls(); - LLSelectedTEMaterial::setDiffuseAlphaMode(self,self->getCurrentDiffuseAlphaMode()); + updateAlphaControls(); + LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } -// static -void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitFullbright() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendFullbright(); + sendFullbright(); } -// static -void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitGlow() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendGlow(); + sendGlow(); } -// static -bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragPbr(LLInventoryItem* item) { bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); @@ -3180,9 +3108,8 @@ bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) return accept; } -void LLPanelFace::onCommitPbr(const LLSD& data) +void LLPanelFace::onCommitPbr() { - if (!mPBRTextureCtrl) return; if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a @@ -3200,16 +3127,15 @@ void LLPanelFace::onCommitPbr(const LLSD& data) } } -void LLPanelFace::onCancelPbr(const LLSD& data) +void LLPanelFace::onCancelPbr() { LLSelectMgr::getInstance()->selectionRevertGLTFMaterials(); } -void LLPanelFace::onSelectPbr(const LLSD& data) +void LLPanelFace::onSelectPbr() { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); - if (!mPBRTextureCtrl) return; if (!mPBRTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a @@ -3226,8 +3152,7 @@ void LLPanelFace::onSelectPbr(const LLSD& data) } } -// static -bool LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragTexture(LLInventoryItem* item) { bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); @@ -3244,18 +3169,18 @@ bool LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) return accept; } -void LLPanelFace::onCommitTexture( const LLSD& data ) +void LLPanelFace::onCommitTexture() { add(LLStatViewer::EDIT_TEXTURE, 1); sendTexture(); } -void LLPanelFace::onCancelTexture(const LLSD& data) +void LLPanelFace::onCancelTexture() { LLSelectMgr::getInstance()->selectionRevertTextures(); } -void LLPanelFace::onSelectTexture(const LLSD& data) +void LLPanelFace::onSelectTexture() { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); sendTexture(); @@ -3265,31 +3190,25 @@ void LLPanelFace::onSelectTexture(const LLSD& data) bool missing_asset = false; LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); - LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); - U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - if (combobox_alphamode && !missing_asset) + if (!missing_asset) { switch (image_format) { case GL_RGBA: case GL_ALPHA: - { - alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; - } + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + break; + case GL_RGB: break; - - case GL_RGB: break; default: - { - LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; - } + LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; break; } - combobox_alphamode->selectNthItem(alpha_mode); + childGetSelectionInterface("combobox alphamode")->selectNthItem(alpha_mode); } + LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } @@ -3299,13 +3218,13 @@ void LLPanelFace::onCloseTexturePicker(const LLSD& data) updateUI(); } -void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) +void LLPanelFace::onCommitSpecularTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; sendShiny(SHINY_TEXTURE); } -void LLPanelFace::onCommitNormalTexture( const LLSD& data ) +void LLPanelFace::onCommitNormalTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; LLUUID nmap_id = getCurrentNormalMap(); @@ -3348,34 +3267,32 @@ void LLPanelFace::onSelectNormalTexture(const LLSD& data) ////////////////////////////////////////////////////////////////////////////// // called when a user wants to edit existing media settings on a prim or prim face // TODO: test if there is media on the item and only allow editing if present -void LLPanelFace::onClickBtnEditMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onClickBtnEditMedia() { - LLPanelFace* self = (LLPanelFace*)userdata; - self->refreshMedia(); + refreshMedia(); LLFloaterReg::showInstance("media_settings"); } ////////////////////////////////////////////////////////////////////////////// // called when a user wants to delete media from a prim or prim face -void LLPanelFace::onClickBtnDeleteMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onClickBtnDeleteMedia() { LLNotificationsUtil::add("DeleteMedia", LLSD(), LLSD(), deleteMediaConfirm); } ////////////////////////////////////////////////////////////////////////////// // called when a user wants to add media to a prim or prim face -void LLPanelFace::onClickBtnAddMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onClickBtnAddMedia() { // check if multiple faces are selected if (LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected()) { - LLPanelFace* self = (LLPanelFace*)userdata; - self->refreshMedia(); + refreshMedia(); LLNotificationsUtil::add("MultipleFacesSelected", LLSD(), LLSD(), multipleFacesSelectedConfirm); } else { - onClickBtnEditMedia(ctrl, userdata); + onClickBtnEditMedia(); } } @@ -3416,396 +3333,316 @@ bool LLPanelFace::multipleFacesSelectedConfirm(const LLSD& notification, const L return false; } -//static -void LLPanelFace::syncOffsetX(LLPanelFace* self, F32 offsetU) +void LLPanelFace::syncOffsetX(F32 offsetU) { - LLSelectedTEMaterial::setNormalOffsetX(self,offsetU); - LLSelectedTEMaterial::setSpecularOffsetX(self,offsetU); - self->getChild("TexOffsetU")->forceSetValue(offsetU); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalOffsetX(this, offsetU); + LLSelectedTEMaterial::setSpecularOffsetX(this, offsetU); + getChild("TexOffsetU")->forceSetValue(LLSD(offsetU)); + sendTextureInfo(); } -//static -void LLPanelFace::syncOffsetY(LLPanelFace* self, F32 offsetV) +void LLPanelFace::syncOffsetY(F32 offsetV) { - LLSelectedTEMaterial::setNormalOffsetY(self,offsetV); - LLSelectedTEMaterial::setSpecularOffsetY(self,offsetV); - self->getChild("TexOffsetV")->forceSetValue(offsetV); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalOffsetY(this, offsetV); + LLSelectedTEMaterial::setSpecularOffsetY(this, offsetV); + getChild("TexOffsetV")->forceSetValue(LLSD(offsetV)); + sendTextureInfo(); } -//static -void LLPanelFace::onCommitMaterialBumpyOffsetX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyOffsetX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX(self,self->getCurrentBumpyOffsetU()); + syncOffsetX(getCurrentBumpyOffsetU()); } else { - LLSelectedTEMaterial::setNormalOffsetX(self,self->getCurrentBumpyOffsetU()); + LLSelectedTEMaterial::setNormalOffsetX(this, getCurrentBumpyOffsetU()); } - } -//static -void LLPanelFace::onCommitMaterialBumpyOffsetY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyOffsetY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY(self,self->getCurrentBumpyOffsetV()); + syncOffsetY(getCurrentBumpyOffsetV()); } else { - LLSelectedTEMaterial::setNormalOffsetY(self,self->getCurrentBumpyOffsetV()); + LLSelectedTEMaterial::setNormalOffsetY(this, getCurrentBumpyOffsetV()); } } -//static -void LLPanelFace::onCommitMaterialShinyOffsetX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyOffsetX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX(self, self->getCurrentShinyOffsetU()); + syncOffsetX(getCurrentShinyOffsetU()); } else { - LLSelectedTEMaterial::setSpecularOffsetX(self,self->getCurrentShinyOffsetU()); + LLSelectedTEMaterial::setSpecularOffsetX(this, getCurrentShinyOffsetU()); } } -//static -void LLPanelFace::onCommitMaterialShinyOffsetY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyOffsetY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY(self,self->getCurrentShinyOffsetV()); + syncOffsetY(getCurrentShinyOffsetV()); } else { - LLSelectedTEMaterial::setSpecularOffsetY(self,self->getCurrentShinyOffsetV()); + LLSelectedTEMaterial::setSpecularOffsetY(this, getCurrentShinyOffsetV()); } } -//static -void LLPanelFace::syncRepeatX(LLPanelFace* self, F32 scaleU) +void LLPanelFace::syncRepeatX(F32 scaleU) { - LLSelectedTEMaterial::setNormalRepeatX(self,scaleU); - LLSelectedTEMaterial::setSpecularRepeatX(self,scaleU); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalRepeatX(this, scaleU); + LLSelectedTEMaterial::setSpecularRepeatX(this, scaleU); + sendTextureInfo(); } -//static -void LLPanelFace::syncRepeatY(LLPanelFace* self, F32 scaleV) +void LLPanelFace::syncRepeatY(F32 scaleV) { - LLSelectedTEMaterial::setNormalRepeatY(self,scaleV); - LLSelectedTEMaterial::setSpecularRepeatY(self,scaleV); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalRepeatY(this, scaleV); + LLSelectedTEMaterial::setSpecularRepeatY(this, scaleV); + sendTextureInfo(); } -//static -void LLPanelFace::onCommitMaterialBumpyScaleX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyScaleX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 bumpy_scale_u = self->getCurrentBumpyScaleU(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_u = getCurrentBumpyScaleU(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_u *= 0.5f; } if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild("TexScaleU")->forceSetValue(self->getCurrentBumpyScaleU()); - syncRepeatX(self, bumpy_scale_u); + getChild("TexScaleU")->forceSetValue(getCurrentBumpyScaleU()); + syncRepeatX(bumpy_scale_u); } else { - LLSelectedTEMaterial::setNormalRepeatX(self,bumpy_scale_u); + LLSelectedTEMaterial::setNormalRepeatX(this, bumpy_scale_u); } } -//static -void LLPanelFace::onCommitMaterialBumpyScaleY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyScaleY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 bumpy_scale_v = self->getCurrentBumpyScaleV(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_v = getCurrentBumpyScaleV(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_v *= 0.5f; } - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild("TexScaleV")->forceSetValue(self->getCurrentBumpyScaleV()); - syncRepeatY(self, bumpy_scale_v); + getChild("TexScaleV")->forceSetValue(getCurrentBumpyScaleV()); + syncRepeatY(bumpy_scale_v); } else { - LLSelectedTEMaterial::setNormalRepeatY(self,bumpy_scale_v); + LLSelectedTEMaterial::setNormalRepeatY(this, bumpy_scale_v); } } -//static -void LLPanelFace::onCommitMaterialShinyScaleX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyScaleX() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 shiny_scale_u = self->getCurrentShinyScaleU(); - if (self->isIdenticalPlanarTexgen()) + F32 shiny_scale_u = getCurrentShinyScaleU(); + if (isIdenticalPlanarTexgen()) { shiny_scale_u *= 0.5f; } if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild("TexScaleU")->forceSetValue(self->getCurrentShinyScaleU()); - syncRepeatX(self, shiny_scale_u); + getChild("TexScaleU")->forceSetValue(LLSD(getCurrentShinyScaleU())); + syncRepeatX(shiny_scale_u); } else { - LLSelectedTEMaterial::setSpecularRepeatX(self,shiny_scale_u); + LLSelectedTEMaterial::setSpecularRepeatX(this, shiny_scale_u); } } -//static -void LLPanelFace::onCommitMaterialShinyScaleY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyScaleY() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 shiny_scale_v = self->getCurrentShinyScaleV(); - if (self->isIdenticalPlanarTexgen()) + F32 shiny_scale_v = getCurrentShinyScaleV(); + if (isIdenticalPlanarTexgen()) { shiny_scale_v *= 0.5f; } if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild("TexScaleV")->forceSetValue(self->getCurrentShinyScaleV()); - syncRepeatY(self, shiny_scale_v); + getChild("TexScaleV")->forceSetValue(LLSD(getCurrentShinyScaleV())); + syncRepeatY(shiny_scale_v); } else { - LLSelectedTEMaterial::setSpecularRepeatY(self,shiny_scale_v); + LLSelectedTEMaterial::setSpecularRepeatY(this, shiny_scale_v); } } -//static -void LLPanelFace::syncMaterialRot(LLPanelFace* self, F32 rot, int te) +void LLPanelFace::syncMaterialRot(F32 rot, int te) { - LLSelectedTEMaterial::setNormalRotation(self,rot * DEG_TO_RAD, te); - LLSelectedTEMaterial::setSpecularRotation(self,rot * DEG_TO_RAD, te); - self->sendTextureInfo(); + LLSelectedTEMaterial::setNormalRotation(this, rot * DEG_TO_RAD, te); + LLSelectedTEMaterial::setSpecularRotation(this, rot * DEG_TO_RAD, te); + sendTextureInfo(); } -//static -void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyRot() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild("TexRot")->forceSetValue(self->getCurrentBumpyRot()); - syncMaterialRot(self, self->getCurrentBumpyRot()); + getChild("TexRot")->forceSetValue(LLSD(getCurrentBumpyRot())); + syncMaterialRot(getCurrentBumpyRot()); } else { - if ((bool)self->childGetValue("checkbox planar align").asBoolean()) + if (childGetValue("checkbox planar align").asBoolean()) { LLFace* last_face = NULL; bool identical_face = false; LLSelectedTE::getFace(last_face, identical_face); - LLPanelFaceSetAlignedTEFunctor setfunc(self, last_face); + LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); } else { - LLSelectedTEMaterial::setNormalRotation(self, self->getCurrentBumpyRot() * DEG_TO_RAD); + LLSelectedTEMaterial::setNormalRotation(this, getCurrentBumpyRot() * DEG_TO_RAD); } } } -//static -void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyRot() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - self->getChild("TexRot")->forceSetValue(self->getCurrentShinyRot()); - syncMaterialRot(self, self->getCurrentShinyRot()); + getChild("TexRot")->forceSetValue(LLSD(getCurrentShinyRot())); + syncMaterialRot(getCurrentShinyRot()); } else { - if ((bool)self->childGetValue("checkbox planar align").asBoolean()) + if (childGetValue("checkbox planar align").asBoolean()) { LLFace* last_face = NULL; bool identical_face = false; LLSelectedTE::getFace(last_face, identical_face); - LLPanelFaceSetAlignedTEFunctor setfunc(self, last_face); + LLPanelFaceSetAlignedTEFunctor setfunc(this, last_face); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); } else { - LLSelectedTEMaterial::setSpecularRotation(self, self->getCurrentShinyRot() * DEG_TO_RAD); + LLSelectedTEMaterial::setSpecularRotation(this, getCurrentShinyRot() * DEG_TO_RAD); } } } -//static -void LLPanelFace::onCommitMaterialGloss(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialGloss() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setSpecularLightExponent(self,self->getCurrentGlossiness()); + LLSelectedTEMaterial::setSpecularLightExponent(this, getCurrentGlossiness()); } -//static -void LLPanelFace::onCommitMaterialEnv(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialEnv() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setEnvironmentIntensity(self,self->getCurrentEnvIntensity()); + LLSelectedTEMaterial::setEnvironmentIntensity(this, getCurrentEnvIntensity()); } -//static -void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialMaskCutoff() { - LLPanelFace* self = (LLPanelFace*) userdata; - LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff()); + LLSelectedTEMaterial::setAlphaMaskCutoff(this, getCurrentAlphaMaskCutoff()); } -// static -void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureInfo() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendTextureInfo(); + sendTextureInfo(); // vertical scale and repeats per meter depends on each other, so force set on changes - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureScaleX( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureScaleX() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_u = (F32)self->getChild("TexScaleU")->getValue().asReal(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_u = (F32)getChild("TexScaleU")->getValue().asReal(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_u *= 0.5f; } - syncRepeatX(self, bumpy_scale_u); + syncRepeatX(bumpy_scale_u); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureScaleY( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureScaleY() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_v = (F32)self->getChild("TexScaleV")->getValue().asReal(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_v = (F32)getChild("TexScaleV")->getValue().asReal(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_v *= 0.5f; } - syncRepeatY(self, bumpy_scale_v); + syncRepeatY(bumpy_scale_v); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureRot( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureRot() { - LLPanelFace* self = (LLPanelFace*) userdata; - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncMaterialRot(self, (F32)self->getChild("TexRot")->getValue().asReal()); + syncMaterialRot((F32)getChild("TexRot")->getValue().asReal()); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureOffsetX( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureOffsetX() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX(self, (F32)self->getChild("TexOffsetU")->getValue().asReal()); + syncOffsetX((F32)getChild("TexOffsetU")->getValue().asReal()); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } -// static -void LLPanelFace::onCommitTextureOffsetY( LLUICtrl* ctrl, void* userdata ) +void LLPanelFace::onCommitTextureOffsetY() { - LLPanelFace* self = (LLPanelFace*) userdata; if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY(self, (F32)self->getChild("TexOffsetV")->getValue().asReal()); + syncOffsetY((F32)getChild("TexOffsetV")->getValue().asReal()); } else { - self->sendTextureInfo(); + sendTextureInfo(); } - self->updateUI(true); + updateUI(true); } // Commit the number of repeats per meter -// static -void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitRepeatsPerMeter() { - LLPanelFace *self = (LLPanelFace *) userdata; - - LLUICtrl *repeats_ctrl = self->getChild("rptctrl"); - - U32 materials_media = self->mComboMatMedia->getCurrentIndex(); - U32 material_type = 0; - if (materials_media == MATMEDIA_PBR) - { - material_type = self->mRadioPbrType->getSelectedIndex(); - } - if (materials_media == MATMEDIA_MATERIAL) - { - material_type = self->mRadioMaterialType->getSelectedIndex(); - } - - F32 repeats_per_meter = (F32) repeats_ctrl->getValue().asReal(); + F32 repeats_per_meter = (F32)getChild("rptctrl")->getValue().asReal(); F32 obj_scale_s = 1.0f; F32 obj_scale_t = 1.0f; @@ -3816,64 +3653,57 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) LLSelectedTE::getObjectScaleS(obj_scale_s, identical_scale_s); LLSelectedTE::getObjectScaleS(obj_scale_t, identical_scale_t); - LLUICtrl *bumpy_scale_u = self->getChild("bumpyScaleU"); - LLUICtrl *bumpy_scale_v = self->getChild("bumpyScaleV"); - LLUICtrl *shiny_scale_u = self->getChild("shinyScaleU"); - LLUICtrl *shiny_scale_v = self->getChild("shinyScaleV"); + LLUICtrl* bumpy_scale_u = getChild("bumpyScaleU"); + LLUICtrl* bumpy_scale_v = getChild("bumpyScaleV"); + LLUICtrl* shiny_scale_u = getChild("shinyScaleU"); + LLUICtrl* shiny_scale_v = getChild("shinyScaleV"); if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); + LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); } else { + U32 material_type = mRadioMaterialType->getSelectedIndex(); switch (material_type) { - case MATTYPE_DIFFUSE: - { - LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); - } + case MATTYPE_DIFFUSE: + LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); break; + case MATTYPE_NORMAL: + bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); + bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); - case MATTYPE_NORMAL: - { - bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); - bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter); - } + LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); break; + case MATTYPE_SPECULAR: + bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); + bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); - case MATTYPE_SPECULAR: - { - shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); - shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter); - } + LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); + break; + default: + llassert(false); break; - - default: - llassert(false); - break; } } + // vertical scale and repeats per meter depends on each other, so force set on changes - self->updateUI(true); + updateUI(true); } struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor @@ -3883,22 +3713,20 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor viewer_media_t pMediaImpl; const LLTextureEntry* tep = object->getTE(te); - const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL; - if ( mep ) + if (const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL) { pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mep->getMediaID()); } - if ( pMediaImpl.isNull()) + if (pMediaImpl.isNull()) { // If we didn't find face media for this face, check whether this face is showing parcel media. pMediaImpl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(tep->getID()); } - if ( pMediaImpl.notNull()) + if (pMediaImpl.notNull()) { - LLPluginClassMedia *media = pMediaImpl->getMediaPlugin(); - if(media) + if (LLPluginClassMedia* media = pMediaImpl->getMediaPlugin()) { S32 media_width = media->getWidth(); S32 media_height = media->getHeight(); @@ -3908,17 +3736,17 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor F32 scale_t = (F32)media_height / (F32)texture_height; // set scale and adjust offset - object->setTEScaleS( te, scale_s ); - object->setTEScaleT( te, scale_t ); // don't need to flip Y anymore since QT does this for us now. - object->setTEOffsetS( te, -( 1.0f - scale_s ) / 2.0f ); - object->setTEOffsetT( te, -( 1.0f - scale_t ) / 2.0f ); + object->setTEScaleS(te, scale_s); + object->setTEScaleT(te, scale_t); // don't need to flip Y anymore since QT does this for us now. + object->setTEOffsetS(te, -( 1.0f - scale_s ) / 2.0f); + object->setTEOffsetT(te, -( 1.0f - scale_t ) / 2.0f); } } return true; }; }; -void LLPanelFace::onClickAutoFix(void* userdata) +void LLPanelFace::onClickAutoFix() { LLPanelFaceSetMediaFunctor setfunc; LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); @@ -3927,25 +3755,23 @@ void LLPanelFace::onClickAutoFix(void* userdata) LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } -void LLPanelFace::onAlignTexture(void* userdata) +void LLPanelFace::onAlignTexture() { - LLPanelFace* self = (LLPanelFace*)userdata; - self->alignTextureLayer(); + alignTextureLayer(); } -void LLPanelFace::onClickBtnLoadInvPBR(void* userdata) +void LLPanelFace::onClickBtnLoadInvPBR() { // Shouldn't this be "save to inventory?" - LLPanelFace* self = (LLPanelFace*)userdata; - self->mPBRTextureCtrl->showPicker(true); + mPBRTextureCtrl->showPicker(true); } -void LLPanelFace::onClickBtnEditPBR(void* userdata) +void LLPanelFace::onClickBtnEditPBR() { LLMaterialEditor::loadLive(); } -void LLPanelFace::onClickBtnSavePBR(void* userdata) +void LLPanelFace::onClickBtnSavePBR() { LLMaterialEditor::saveObjectsMaterialAs(); } @@ -4806,44 +4632,39 @@ bool LLPanelFace::menuEnableItem(const LLSD& userdata) return false; } - -// static -void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitPlanarAlign() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->getState(); - self->sendTextureInfo(); + getState(); + sendTextureInfo(); } -void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::function edit) +void LLPanelFace::updateGLTFTextureTransform(std::function edit) { - U32 texture_info_start; - U32 texture_info_end; - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); if (texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) { - texture_info_start = 0; - texture_info_end = LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) + { + for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i) + { + LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[(LLGLTFMaterial::TextureInfo)i]; + edit(&new_transform); + } + }); } else { - texture_info_start = texture_info_from_pbrtype(pbr_type); - texture_info_end = texture_info_start + 1; + updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) + { + LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[texture_info]; + edit(&new_transform); + }); } - updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) - { - for (U32 ti = texture_info_start; ti < texture_info_end; ++ti) - { - LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[(LLGLTFMaterial::TextureInfo)ti]; - edit(&new_transform); - } - }); } void LLPanelFace::setMaterialOverridesFromSelection() { - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); U32 texture_info_start; U32 texture_info_end; if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) @@ -5009,51 +4830,46 @@ bool LLPanelFace::Selection::compareSelection() return selection_changed; } -void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureScaleU() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)getChild("gltfTextureScaleU")->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VX] = value; }); } -void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureScaleV() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)getChild("gltfTextureScaleV")->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VY] = value; }); } -void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFRotation() { - const float value = (F32)ctrl->getValue().asReal() * DEG_TO_RAD; - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)getChild("gltfTextureRotation")->getValue().asReal() * DEG_TO_RAD; + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mRotation = value; }); } -void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureOffsetU() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)getChild("gltfTextureOffsetU")->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VX] = value; }); } -void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) +void LLPanelFace::onCommitGLTFTextureOffsetV() { - const float value = (F32)ctrl->getValue().asReal(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + F32 value = (F32)getChild("gltfTextureOffsetV")->getValue().asReal(); + updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VY] = value; }); @@ -5063,20 +4879,20 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; + LLTextureCtrl* texture_ctrl; U32 mattype = mRadioMaterialType->getSelectedIndex(); - std::string which_control="texture control"; switch (mattype) { case MATTYPE_SPECULAR: - which_control = "shinytexture control"; + texture_ctrl = getChild("shinytexture control"); break; case MATTYPE_NORMAL: - which_control = "bumpytexture control"; + texture_ctrl = getChild("bumpytexture control"); break; - // no default needed + default: + texture_ctrl = getChild("texture control"); } - LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL; - LLTextureCtrl* texture_ctrl = getChild(which_control); + if (texture_ctrl) { LLUUID obj_owner_id; -- cgit v1.2.3 From 413ece6c481e430ad380697934a20ecd95aaa7fb Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 7 Aug 2024 18:08:21 +0200 Subject: #1922 Make PBR scale and offset crosshair work (store control pointers in LLPanelFace) --- indra/newview/llpanelface.cpp | 1074 +++++++++++++++++++---------------------- 1 file changed, 486 insertions(+), 588 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f01d327fb4..936ca273c3 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -226,7 +226,7 @@ LLRender::eTexIndex LLPanelFace::getTextureDropChannel() LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() { - if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { return texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); } @@ -236,24 +236,24 @@ LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() // Things the UI provides... // -LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); } -LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->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 (F32)getChild("bumpyRot")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyScaleU() { return (F32)getChild("bumpyScaleU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyScaleV() { return (F32)getChild("bumpyScaleV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyOffsetU() { return (F32)getChild("bumpyOffsetU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyOffsetV() { return (F32)getChild("bumpyOffsetV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyRot() { return (F32)getChild("shinyRot")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyScaleU() { return (F32)getChild("shinyScaleU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyScaleV() { return (F32)getChild("shinyScaleV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyOffsetU() { return (F32)getChild("shinyOffsetU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyOffsetV() { return (F32)getChild("shinyOffsetV")->getValue().asReal(); } +LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->getImageAssetID(); } +U32 LLPanelFace::getCurrentShininess() { return mComboShininess->getCurrentIndex(); } +U32 LLPanelFace::getCurrentBumpiness() { return mComboBumpiness->getCurrentIndex(); } +U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)mComboAlphaMode->getCurrentIndex(); } +U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)mMaskCutoff->getValue().asInteger(); } +U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)mEnvironment->getValue().asInteger(); } +U8 LLPanelFace::getCurrentGlossiness() { return (U8)mGlossiness->getValue().asInteger(); } +F32 LLPanelFace::getCurrentBumpyRot() { return (F32)mBumpyRotate->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleU() { return (F32)mBumpyScaleU->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyScaleV() { return (F32)mBumpyScaleV->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetU() { return (F32)mBumpyOffsetU->getValue().asReal(); } +F32 LLPanelFace::getCurrentBumpyOffsetV() { return (F32)mBumpyOffsetV->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyRot() { return (F32)mShinyRotate->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleU() { return (F32)mShinyScaleU->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyScaleV() { return (F32)mShinyScaleV->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetU() { return (F32)mShinyOffsetU->getValue().asReal(); } +F32 LLPanelFace::getCurrentShinyOffsetV() { return (F32)mShinyOffsetV->getValue().asReal(); } // // Methods @@ -261,199 +261,156 @@ F32 LLPanelFace::getCurrentShinyOffsetV() { return (F32)getChild("pbr_control"); - if (mPBRTextureCtrl) - { - mPBRTextureCtrl->setDefaultImageAssetID(LLUUID::null); - mPBRTextureCtrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); - mPBRTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbr(); }); - mPBRTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelPbr(); }); - mPBRTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectPbr(); }); - mPBRTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragPbr(item); }); - mPBRTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onPbrSelectionChanged(item); }); - mPBRTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); - - mPBRTextureCtrl->setFollowsTop(); - mPBRTextureCtrl->setFollowsLeft(); - mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mPBRTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - mPBRTextureCtrl->setBakeTextureEnabled(false); - mPBRTextureCtrl->setInventoryPickType(PICK_MATERIAL); - } + mPBRTextureCtrl->setDefaultImageAssetID(LLUUID::null); + mPBRTextureCtrl->setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID); + mPBRTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbr(); }); + mPBRTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelPbr(); }); + mPBRTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectPbr(); }); + mPBRTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragPbr(item); }); + mPBRTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onPbrSelectionChanged(item); }); + mPBRTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mPBRTextureCtrl->setFollowsTop(); + mPBRTextureCtrl->setFollowsLeft(); + mPBRTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mPBRTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); + mPBRTextureCtrl->setBakeTextureEnabled(false); + mPBRTextureCtrl->setInventoryPickType(PICK_MATERIAL); mTextureCtrl = getChild("texture control"); - if (mTextureCtrl) - { - mTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_TEXTURE); - mTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexture(); }); - mTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelTexture(); }); - mTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectTexture(); }); - mTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); - mTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); - mTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); - - mTextureCtrl->setFollowsTop(); - mTextureCtrl->setFollowsLeft(); - mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - } + mTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_TEXTURE); + mTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexture(); }); + mTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelTexture(); }); + mTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectTexture(); }); + mTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); + mTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mTextureCtrl->setFollowsTop(); + mTextureCtrl->setFollowsLeft(); + mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); mShinyTextureCtrl = getChild("shinytexture control"); - if (mShinyTextureCtrl) - { - mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR); - mShinyTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitSpecularTexture(data); }); - mShinyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelSpecularTexture(data); }); - mShinyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectSpecularTexture(data); }); - mShinyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); - - mShinyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); - mShinyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); - mShinyTextureCtrl->setFollowsTop(); - mShinyTextureCtrl->setFollowsLeft(); - mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - } + mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR); + mShinyTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitSpecularTexture(data); }); + mShinyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelSpecularTexture(data); }); + mShinyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectSpecularTexture(data); }); + mShinyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mShinyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); + mShinyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mShinyTextureCtrl->setFollowsTop(); + mShinyTextureCtrl->setFollowsLeft(); + mShinyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mShinyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); mBumpyTextureCtrl = getChild("bumpytexture control"); - if (mBumpyTextureCtrl) - { - mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL); - mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL); - mBumpyTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitNormalTexture(data); }); - mBumpyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelNormalTexture(data); }); - mBumpyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectNormalTexture(data); }); - mBumpyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); - - mBumpyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); - mBumpyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); - mBumpyTextureCtrl->setFollowsTop(); - mBumpyTextureCtrl->setFollowsLeft(); - mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); - mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); - } + mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL); + mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL); + mBumpyTextureCtrl->setCommitCallback([&](LLUICtrl*, const LLSD& data) { onCommitNormalTexture(data); }); + mBumpyTextureCtrl->setOnCancelCallback([&](LLUICtrl*, const LLSD& data) { onCancelNormalTexture(data); }); + mBumpyTextureCtrl->setOnSelectCallback([&](LLUICtrl*, const LLSD& data) { onSelectNormalTexture(data); }); + mBumpyTextureCtrl->setDragCallback([&](LLUICtrl*, LLInventoryItem* item) { return onDragTexture(item); }); + mBumpyTextureCtrl->setOnTextureSelectedCallback([&](LLInventoryItem* item) { onTextureSelectionChanged(item); }); + mBumpyTextureCtrl->setOnCloseCallback([&](LLUICtrl*, const LLSD& data) { onCloseTexturePicker(data); }); + mBumpyTextureCtrl->setFollowsTop(); + mBumpyTextureCtrl->setFollowsLeft(); + mBumpyTextureCtrl->setImmediateFilterPermMask(PERM_NONE); + mBumpyTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); mColorSwatch = getChild("colorswatch"); - if (mColorSwatch) - { - mColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitColor(); }); - mColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelColor(); }); - mColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectColor(); }); - mColorSwatch->setFollowsTop(); - mColorSwatch->setFollowsLeft(); - mColorSwatch->setCanApplyImmediately(true); - } + mColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitColor(); }); + mColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelColor(); }); + mColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectColor(); }); + mColorSwatch->setFollowsTop(); + mColorSwatch->setFollowsLeft(); + mColorSwatch->setCanApplyImmediately(true); mShinyColorSwatch = getChild("shinycolorswatch"); - if (mShinyColorSwatch) - { - mShinyColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitShinyColor(); }); - mShinyColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelShinyColor(); }); - mShinyColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectShinyColor(); }); - mShinyColorSwatch->setFollowsTop(); - mShinyColorSwatch->setFollowsLeft(); - mShinyColorSwatch->setCanApplyImmediately(true); - } + mShinyColorSwatch->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitShinyColor(); }); + mShinyColorSwatch->setOnCancelCallback([&](LLUICtrl*, const LLSD&) { onCancelShinyColor(); }); + mShinyColorSwatch->setOnSelectCallback([&](LLUICtrl*, const LLSD&) { onSelectShinyColor(); }); + mShinyColorSwatch->setFollowsTop(); + mShinyColorSwatch->setFollowsLeft(); + mShinyColorSwatch->setCanApplyImmediately(true); mLabelColorTransp = getChild("color trans"); - if (mLabelColorTransp) - { - mLabelColorTransp->setFollowsTop(); - mLabelColorTransp->setFollowsLeft(); - } + mLabelColorTransp->setFollowsTop(); + mLabelColorTransp->setFollowsLeft(); mCtrlColorTransp = getChild("ColorTrans"); - if (mCtrlColorTransp) - { - mCtrlColorTransp->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitAlpha(); }); - mCtrlColorTransp->setPrecision(0); - mCtrlColorTransp->setFollowsTop(); - mCtrlColorTransp->setFollowsLeft(); - } + mCtrlColorTransp->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitAlpha(); }); + mCtrlColorTransp->setPrecision(0); + mCtrlColorTransp->setFollowsTop(); + mCtrlColorTransp->setFollowsLeft(); mCheckFullbright = getChild("checkbox fullbright"); - if (mCheckFullbright) - { - mCheckFullbright->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitFullbright(); }); - } + mCheckFullbright->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitFullbright(); }); + mLabelTexGen = getChild("tex gen"); mComboTexGen = getChild("combobox texgen"); - if (mComboTexGen) - { - mComboTexGen->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexGen(); }); - mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); - } + mComboTexGen->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexGen(); }); + mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); mComboMatMedia = getChild("combobox matmedia"); - if (mComboMatMedia) - { - mComboMatMedia->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialsMedia(); }); - mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); - } + mComboMatMedia->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialsMedia(); }); + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); mRadioMaterialType = getChild("radio_material_type"); - if (mRadioMaterialType) - { - mRadioMaterialType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialType(); }); - mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); - } + mRadioMaterialType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialType(); }); + mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); mRadioPbrType = getChild("radio_pbr_type"); - if (mRadioPbrType) - { - mRadioPbrType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbrType(); }); - mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); - } + mRadioPbrType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbrType(); }); + mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); + mLabelGlow = getChild("glow label"); mCtrlGlow = getChild("glow"); - if (mCtrlGlow) - { - mCtrlGlow->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitGlow(); }); - } + mCtrlGlow->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitGlow(); }); mMenuClipboardColor = getChild("clipboard_color_params_btn"); mMenuClipboardTexture = getChild("clipboard_texture_params_btn"); @@ -461,6 +418,19 @@ bool LLPanelFace::postBuild() mTitleMedia = getChild("title_media"); mTitleMediaText = getChild("media_info"); + mLabelBumpiness = getChild("label bumpiness"); + mLabelShininess = getChild("label shininess"); + mLabelAlphaMode = getChild("label alphamode"); + mLabelGlossiness = getChild("label glossiness"); + mLabelEnvironment = getChild("label environment"); + mLabelMaskCutoff = getChild("label maskcutoff"); + mLabelShiniColor = getChild("label shinycolor"); + mLabelColor = getChild("color label"); + + mLabelMatPermLoading = getChild("material_permissions_loading_label"); + + mCheckSyncSettings = getChild("checkbox_sync_settings"); + clearCtrls(); return true; @@ -513,8 +483,7 @@ void LLPanelFace::draw() void LLPanelFace::sendTexture() { - if(!mTextureCtrl) return; - if( !mTextureCtrl->getTentative() ) + if (!mTextureCtrl->getTentative()) { // we grab the item id first, because we want to do a // permissions check in the selection manager. ARGH! @@ -590,32 +559,26 @@ void LLPanelFace::sendShiny(U32 shininess) void LLPanelFace::sendFullbright() { - if(!mCheckFullbright)return; U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0; LLSelectMgr::getInstance()->selectionSetFullbright(fullbright); } void LLPanelFace::sendColor() { - if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); LLSelectMgr::getInstance()->selectionSetColorOnly(color); } void LLPanelFace::sendAlpha() { - if(!mCtrlColorTransp)return; F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f; LLSelectMgr::getInstance()->selectionSetAlphaOnly( alpha ); } void LLPanelFace::sendGlow() { - if (mCtrlGlow) - { - F32 glow = mCtrlGlow->get(); - LLSelectMgr::getInstance()->selectionSetGlow( glow ); - } + F32 glow = mCtrlGlow->get(); + LLSelectMgr::getInstance()->selectionSetGlow(glow); } struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor @@ -623,47 +586,49 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {} virtual bool apply(LLViewerObject* object, S32 te) { - bool valid; - F32 value; - std::string prefix; + LLSpinCtrl *ctrlTexScaleS, *ctrlTexScaleT, *ctrlTexOffsetS, *ctrlTexOffsetT, *ctrlTexRotation; // Effectively the same as MATMEDIA_PBR sans using different radio, // separate for the sake of clarity - LLRadioGroup * radio_mat_type = mPanel->getChild("radio_material_type"); - switch (radio_mat_type->getSelectedIndex()) + switch (mPanel->mRadioMaterialType->getSelectedIndex()) { case MATTYPE_DIFFUSE: - prefix = "Tex"; + ctrlTexScaleS = mPanel->mTexScaleU; + ctrlTexScaleT = mPanel->mTexScaleV; + ctrlTexOffsetS = mPanel->mTexOffsetU; + ctrlTexOffsetT = mPanel->mTexOffsetV; + ctrlTexRotation = mPanel->mTexRotate; break; case MATTYPE_NORMAL: - prefix = "bumpy"; + ctrlTexScaleS = mPanel->mBumpyScaleU; + ctrlTexScaleT = mPanel->mBumpyScaleV; + ctrlTexOffsetS = mPanel->mBumpyOffsetU; + ctrlTexOffsetT = mPanel->mBumpyOffsetV; + ctrlTexRotation = mPanel->mBumpyRotate; break; case MATTYPE_SPECULAR: - prefix = "shiny"; + ctrlTexScaleS = mPanel->mShinyScaleU; + ctrlTexScaleT = mPanel->mShinyScaleV; + ctrlTexOffsetS = mPanel->mShinyOffsetU; + ctrlTexOffsetT = mPanel->mShinyOffsetV; + ctrlTexRotation = mPanel->mShinyRotate; break; + default: + llassert(false); + return false; } - LLSpinCtrl * ctrlTexScaleS = mPanel->getChild(prefix + "ScaleU"); - LLSpinCtrl * ctrlTexScaleT = mPanel->getChild(prefix + "ScaleV"); - LLSpinCtrl * ctrlTexOffsetS = mPanel->getChild(prefix + "OffsetU"); - LLSpinCtrl * ctrlTexOffsetT = mPanel->getChild(prefix + "OffsetV"); - LLSpinCtrl * ctrlTexRotation = mPanel->getChild(prefix + "Rot"); - - LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); - LLCheckBoxCtrl* cb_planar_align = mPanel->getChild("checkbox planar align"); - bool align_planar = (cb_planar_align && cb_planar_align->get()); + bool align_planar = mPanel->mPlanarAlign->get(); - llassert(comboTexGen); llassert(object); if (ctrlTexScaleS) { - valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); + bool valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); if (valid || align_planar) { - value = ctrlTexScaleS->get(); - if (comboTexGen && - comboTexGen->getCurrentIndex() == 1) + F32 value = ctrlTexScaleS->get(); + if (mPanel->mComboTexGen->getCurrentIndex() == 1) { value *= 0.5f; } @@ -679,20 +644,19 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexScaleT) { - valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); + bool valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); if (valid || align_planar) { - value = ctrlTexScaleT->get(); - //if( checkFlipScaleT->get() ) + F32 value = ctrlTexScaleT->get(); + //if (checkFlipScaleT->get()) //{ // value = -value; //} - if (comboTexGen && - comboTexGen->getCurrentIndex() == 1) + if (mPanel->mComboTexGen->getCurrentIndex() == 1) { value *= 0.5f; } - object->setTEScaleT( te, value ); + object->setTEScaleT(te, value); if (align_planar) { @@ -704,11 +668,11 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexOffsetS) { - valid = !ctrlTexOffsetS->getTentative(); + bool valid = !ctrlTexOffsetS->getTentative(); if (valid || align_planar) { - value = ctrlTexOffsetS->get(); - object->setTEOffsetS( te, value ); + F32 value = ctrlTexOffsetS->get(); + object->setTEOffsetS(te, value); if (align_planar) { @@ -720,11 +684,11 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexOffsetT) { - valid = !ctrlTexOffsetT->getTentative(); + bool valid = !ctrlTexOffsetT->getTentative(); if (valid || align_planar) { - value = ctrlTexOffsetT->get(); - object->setTEOffsetT( te, value ); + F32 value = ctrlTexOffsetT->get(); + object->setTEOffsetT(te, value); if (align_planar) { @@ -736,11 +700,11 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor if (ctrlTexRotation) { - valid = !ctrlTexRotation->getTentative(); + bool valid = !ctrlTexRotation->getTentative(); if (valid || align_planar) { - value = ctrlTexRotation->get() * DEG_TO_RAD; - object->setTERotation( te, value ); + F32 value = ctrlTexRotation->get() * DEG_TO_RAD; + object->setTERotation(te, value); if (align_planar) { @@ -947,7 +911,7 @@ struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor void LLPanelFace::sendTextureInfo() { - if (childGetValue("checkbox planar align").asBoolean()) + if (mPlanarAlign->getValue().asBoolean()) { LLFace* last_face = NULL; bool identical_face =false; @@ -999,7 +963,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) const bool has_material = !has_pbr_material; // only turn on auto-adjust button if there is a media renderer and the media is loaded - childSetEnabled("button align", editable); + mBtnAlign->setEnabled(editable); if (mComboMatMedia->getCurrentIndex() < MATMEDIA_MATERIAL) { @@ -1100,30 +1064,23 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) const bool pbr_selected = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR; const bool texture_info_selected = pbr_selected && mRadioPbrType->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID; - getChildView("checkbox_sync_settings")->setEnabled(editable); - childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); + mCheckSyncSettings->setEnabled(editable); + mCheckSyncSettings->setValue(gSavedSettings.getBOOL("SyncMaterialSettings")); updateVisibility(objectp); // Color swatch - { - getChildView("color label")->setEnabled(editable); - } - + mLabelColor->setEnabled(editable); LLColor4 color = LLColor4::white; bool identical_color = false; - { - LLSelectedTE::getColor(color, identical_color); - LLColor4 prev_color = mColorSwatch->get(); - - mColorSwatch->setOriginal(color); - mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); - - mColorSwatch->setValid(editable && !has_pbr_material); - mColorSwatch->setEnabled( editable && !has_pbr_material); - mColorSwatch->setCanApplyImmediately( editable && !has_pbr_material); - } + LLSelectedTE::getColor(color, identical_color); + LLColor4 prev_color = mColorSwatch->get(); + mColorSwatch->setOriginal(color); + mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); + mColorSwatch->setValid(editable && !has_pbr_material); + mColorSwatch->setEnabled( editable && !has_pbr_material); + mColorSwatch->setCanApplyImmediately( editable && !has_pbr_material); // Color transparency mLabelColorTransp->setEnabled(editable); @@ -1132,65 +1089,51 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mCtrlColorTransp->setValue(editable ? transparency : 0); mCtrlColorTransp->setEnabled(editable && has_material); + // Shiny U8 shiny = 0; - bool identical_shiny = false; + { + 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); - } + mComboShininess->getSelectionInterface()->selectNthItem((S32)shiny); - getChildView("label shininess")->setEnabled(editable); - getChildView("combobox shininess")->setEnabled(editable); + mLabelShininess->setEnabled(editable); + mComboShininess->setEnabled(editable); - getChildView("label glossiness")->setEnabled(editable); - getChildView("glossiness")->setEnabled(editable); + mLabelGlossiness->setEnabled(editable); + mGlossiness->setEnabled(editable); - getChildView("label environment")->setEnabled(editable); - getChildView("environment")->setEnabled(editable); - getChildView("label shinycolor")->setEnabled(editable); + mLabelEnvironment->setEnabled(editable); + mEnvironment->setEnabled(editable); + mLabelShiniColor->setEnabled(editable); - getChild("combobox shininess")->setTentative(!identical_spec); - getChild("glossiness")->setTentative(!identical_spec); - getChild("environment")->setTentative(!identical_spec); - mShinyColorSwatch->setTentative(!identical_spec); + mComboShininess->setTentative(!identical_spec); + mGlossiness->setTentative(!identical_spec); + mEnvironment->setTentative(!identical_spec); + mShinyColorSwatch->setTentative(!identical_spec); - { mShinyColorSwatch->setValid(editable); - mShinyColorSwatch->setEnabled( editable ); - mShinyColorSwatch->setCanApplyImmediately( editable ); + mShinyColorSwatch->setEnabled(editable); + mShinyColorSwatch->setCanApplyImmediately(editable); } - U8 bumpy = 0; // Bumpy + U8 bumpy = 0; { bool identical_bumpy = false; - LLSelectedTE::getBumpmap(bumpy,identical_bumpy); + LLSelectedTE::getBumpmap(bumpy, identical_bumpy); LLUUID norm_map_id = getCurrentNormalMap(); - LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); - bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE; + mComboBumpiness->getSelectionInterface()->selectNthItem((S32)bumpy); - if (combobox_bumpiness) - { - combobox_bumpiness->selectNthItem((S32)bumpy); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox bumpiness'" << LL_ENDL; - } - - getChildView("combobox bumpiness")->setEnabled(editable); - getChild("combobox bumpiness")->setTentative(!identical_bumpy); - getChildView("label bumpiness")->setEnabled(editable); + mComboBumpiness->setEnabled(editable); + mComboBumpiness->setTentative(!identical_bumpy); + mLabelBumpiness->setEnabled(editable); } // Texture @@ -1228,7 +1171,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (LLViewerMedia::getInstance()->textureHasMedia(id)) { - getChildView("button align")->setEnabled(editable); + mBtnAlign->setEnabled(editable); } // Diffuse Alpha Mode @@ -1243,22 +1186,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha); - 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; + // 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 be none - alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_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); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; - } + mComboAlphaMode->getSelectionInterface()->selectNthItem(alpha_mode); updateAlphaControls(); @@ -1271,10 +1206,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; - getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(can_change_alpha); - getChildView("maskcutoff")->setEnabled(can_change_alpha); - getChildView("label maskcutoff")->setEnabled(can_change_alpha); + mComboAlphaMode->setEnabled(can_change_alpha && transparency <= 0.f); + mLabelAlphaMode->setEnabled(can_change_alpha); + mMaskCutoff->setEnabled(can_change_alpha); + mLabelMaskCutoff->setEnabled(can_change_alpha); mTextureCtrl->setBakeTextureEnabled(true); } @@ -1284,10 +1219,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mTextureCtrl->setTentative(false); mTextureCtrl->setEnabled(false); mTextureCtrl->setImageAssetID(LLUUID::null); - getChildView("combobox alphamode")->setEnabled(false); - getChildView("label alphamode")->setEnabled(false); - getChildView("maskcutoff")->setEnabled(false); - getChildView("label maskcutoff")->setEnabled(false); + mComboAlphaMode->setEnabled(false); + mLabelAlphaMode->setEnabled(false); + mMaskCutoff->setEnabled(false); + mLabelMaskCutoff->setEnabled(false); mTextureCtrl->setBakeTextureEnabled(false); } @@ -1299,10 +1234,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mTextureCtrl->setImageAssetID(id); bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; - getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(can_change_alpha); - getChildView("maskcutoff")->setEnabled(can_change_alpha); - getChildView("label maskcutoff")->setEnabled(can_change_alpha); + mComboAlphaMode->setEnabled(can_change_alpha && transparency <= 0.f); + mLabelAlphaMode->setEnabled(can_change_alpha); + mMaskCutoff->setEnabled(can_change_alpha); + mLabelMaskCutoff->setEnabled(can_change_alpha); mTextureCtrl->setBakeTextureEnabled(true); } @@ -1354,28 +1289,24 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } // planar align - bool align_planar = false; + bool align_planar = mPlanarAlign->get(); bool identical_planar_aligned = false; - { - LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align"); - align_planar = (cb_planar_align && cb_planar_align->get()); - bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected); - childSetValue("checkbox planar align", align_planar && enabled); - childSetVisible("checkbox planar align", enabled); - childSetEnabled("checkbox planar align", enabled); - childSetEnabled("button align textures", enabled && LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); + bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected); + mPlanarAlign->setValue(align_planar && enabled); + mPlanarAlign->setVisible(enabled); + mPlanarAlign->setEnabled(enabled); + mBtnAlignTex->setEnabled(enabled && LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); - if (align_planar && enabled) - { - LLFace* last_face = NULL; - bool identical_face = false; - LLSelectedTE::getFace(last_face, identical_face); + if (align_planar && enabled) + { + 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); - } + 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); } // Needs to be public and before tex scale settings below to properly reflect @@ -1414,21 +1345,21 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) spec_scale_s = editable ? spec_scale_s : 1.0f; spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f; - getChild("TexScaleU")->setValue(diff_scale_s); - getChild("shinyScaleU")->setValue(spec_scale_s); - getChild("bumpyScaleU")->setValue(norm_scale_s); + mTexScaleU->setValue(diff_scale_s); + mShinyScaleU->setValue(spec_scale_s); + mBumpyScaleU->setValue(norm_scale_s); - getChildView("TexScaleU")->setEnabled(editable && has_material); - getChildView("shinyScaleU")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyScaleU")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexScaleU->setEnabled(editable && has_material); + mShinyScaleU->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyScaleU->setEnabled(editable && has_material && normmap_id.notNull()); 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("TexScaleU")->setTentative(LLSD(diff_scale_tentative)); - getChild("shinyScaleU")->setTentative(LLSD(spec_scale_tentative)); - getChild("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative)); + mTexScaleU->setTentative(LLSD(diff_scale_tentative)); + mShinyScaleU->setTentative(LLSD(spec_scale_tentative)); + mBumpyScaleU->setTentative(LLSD(norm_scale_tentative)); } { @@ -1457,24 +1388,24 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool norm_scale_tentative = !identical_norm_scale_t; bool spec_scale_tentative = !identical_spec_scale_t; - getChildView("TexScaleV")->setEnabled(editable && has_material); - getChildView("shinyScaleV")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyScaleV")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexScaleV->setEnabled(editable && has_material); + mShinyScaleV->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyScaleV->setEnabled(editable && has_material && normmap_id.notNull()); if (force_set_values) { - getChild("TexScaleV")->forceSetValue(diff_scale_t); + mTexScaleV->forceSetValue(diff_scale_t); } else { - getChild("TexScaleV")->setValue(diff_scale_t); + mTexScaleV->setValue(diff_scale_t); } - getChild("shinyScaleV")->setValue(norm_scale_t); - getChild("bumpyScaleV")->setValue(spec_scale_t); + mShinyScaleV->setValue(norm_scale_t); + mBumpyScaleV->setValue(spec_scale_t); - getChild("TexScaleV")->setTentative(LLSD(diff_scale_tentative)); - getChild("shinyScaleV")->setTentative(LLSD(norm_scale_tentative)); - getChild("bumpyScaleV")->setTentative(LLSD(spec_scale_tentative)); + mTexScaleV->setTentative(LLSD(diff_scale_tentative)); + mShinyScaleV->setTentative(LLSD(spec_scale_tentative)); + mBumpyScaleV->setTentative(LLSD(norm_scale_tentative)); } // Texture offset @@ -1495,17 +1426,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) 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); - 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); + mTexOffsetU->setValue(editable ? diff_offset_s : 0.0f); + mBumpyOffsetU->setValue(editable ? norm_offset_s : 0.0f); + mShinyOffsetU->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)); + mTexOffsetU->setTentative(LLSD(diff_offset_u_tentative)); + mShinyOffsetU->setTentative(LLSD(spec_offset_u_tentative)); + mBumpyOffsetU->setTentative(LLSD(norm_offset_u_tentative)); - getChildView("TexOffsetU")->setEnabled(editable && has_material); - getChildView("shinyOffsetU")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyOffsetU")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexOffsetU->setEnabled(editable && has_material); + mShinyOffsetU->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyOffsetU->setEnabled(editable && has_material && normmap_id.notNull()); } { @@ -1525,17 +1456,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) 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); - 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); + mTexOffsetV->setValue( editable ? diff_offset_t : 0.0f); + mBumpyOffsetV->setValue(editable ? norm_offset_t : 0.0f); + mShinyOffsetV->setValue(editable ? spec_offset_t : 0.0f); - getChild("TexOffsetV")->setTentative(LLSD(diff_offset_v_tentative)); - getChild("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative)); - getChild("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); + mTexOffsetV->setTentative(LLSD(diff_offset_v_tentative)); + mBumpyOffsetV->setTentative(LLSD(norm_offset_v_tentative)); + mShinyOffsetV->setTentative(LLSD(spec_offset_v_tentative)); - getChildView("TexOffsetV")->setEnabled(editable && has_material); - getChildView("shinyOffsetV")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyOffsetV")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexOffsetV->setEnabled(editable && has_material); + mShinyOffsetV->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyOffsetV->setEnabled(editable && has_material && normmap_id.notNull()); } // Texture rotation @@ -1560,17 +1491,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - getChildView("TexRot")->setEnabled(editable && has_material); - getChildView("shinyRot")->setEnabled(editable && has_material && specmap_id.notNull()); - getChildView("bumpyRot")->setEnabled(editable && has_material && normmap_id.notNull()); + mTexRotate->setEnabled(editable && has_material); + mShinyRotate->setEnabled(editable && has_material && specmap_id.notNull()); + mBumpyRotate->setEnabled(editable && has_material && normmap_id.notNull()); - getChild("TexRot")->setTentative(LLSD(diff_rot_tentative)); - getChild("shinyRot")->setTentative(LLSD(spec_rot_tentative)); - getChild("bumpyRot")->setTentative(LLSD(norm_rot_tentative)); + mTexRotate->setTentative(LLSD(diff_rot_tentative)); + mShinyRotate->setTentative(LLSD(spec_rot_tentative)); + mBumpyRotate->setTentative(LLSD(norm_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); + mTexRotate->setValue(editable ? diff_rot_deg : 0.0f); + mShinyRotate->setValue(editable ? spec_rot_deg : 0.0f); + mBumpyRotate->setValue(editable ? norm_rot_deg : 0.0f); } { @@ -1580,7 +1511,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mCtrlGlow->setValue(glow); mCtrlGlow->setTentative(!identical_glow); mCtrlGlow->setEnabled(editable); - getChildView("glow label")->setEnabled(editable); + mLabelGlow->setEnabled(editable); } { @@ -1589,7 +1520,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mComboTexGen->setEnabled(editable); mComboTexGen->setTentative(!identical); - getChildView("tex gen")->setEnabled(editable); + mLabelTexGen->setEnabled(editable); } { @@ -1667,18 +1598,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool repeats_tentative = !identical_repeats; - LLSpinCtrl* rpt_ctrl = getChild("rptctrl"); if (force_set_values) { - //onCommit, previosly edited element updates related ones - rpt_ctrl->forceSetValue(editable ? repeats : 1.0f); + // onCommit, previosly edited element updates related ones + mTexRepeat->forceSetValue(editable ? repeats : 1.0f); } else { - rpt_ctrl->setValue(editable ? repeats : 1.0f); + mTexRepeat->setValue(editable ? repeats : 1.0f); } - rpt_ctrl->setTentative(LLSD(repeats_tentative)); - rpt_ctrl->setEnabled(has_material && !identical_planar_texgen && enabled); + mTexRepeat->setTentative(LLSD(repeats_tentative)); + mTexRepeat->setEnabled(has_material && !identical_planar_texgen && enabled); } } @@ -1692,9 +1622,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL; // Alpha - LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); - if (combobox_alphamode) { U32 alpha_mode = material->getDiffuseAlphaMode(); @@ -1708,14 +1635,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; } - combobox_alphamode->selectNthItem(alpha_mode); - } - else - { - LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; + mComboAlphaMode->getSelectionInterface()->selectNthItem(alpha_mode); } - getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); + mMaskCutoff->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(); identical_planar_texgen = isIdenticalPlanarTexgen(); @@ -1736,13 +1659,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } 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()); + mShinyScaleU->setValue(repeat_x); + mShinyScaleV->setValue(repeat_y); + mShinyRotate->setValue(rot * RAD_TO_DEG); + mShinyOffsetU->setValue(offset_x); + mShinyOffsetV->setValue(offset_y); + mGlossiness->setValue(material->getSpecularLightExponent()); + mEnvironment->setValue(material->getEnvironmentIntensity()); updateShinyControls(!material->getSpecularID().isNull(), true); } @@ -1774,11 +1697,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } 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); + mBumpyScaleU->setValue(repeat_x); + mBumpyScaleV->setValue(repeat_y); + mBumpyRotate->setValue(rot*RAD_TO_DEG); + mBumpyOffsetU->setValue(offset_x); + mBumpyOffsetV->setValue(offset_y); updateBumpyControls(!material->getNormalID().isNull(), true); } @@ -1791,11 +1714,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); - calcp->setVar(LLCalc::TEX_U_SCALE, (F32)childGetValue("TexScaleU").asReal()); - calcp->setVar(LLCalc::TEX_V_SCALE, (F32)childGetValue("TexScaleV").asReal()); - calcp->setVar(LLCalc::TEX_U_OFFSET, (F32)childGetValue("TexOffsetU").asReal()); - calcp->setVar(LLCalc::TEX_V_OFFSET, (F32)childGetValue("TexOffsetV").asReal()); - calcp->setVar(LLCalc::TEX_ROTATION, (F32)childGetValue("TexRot").asReal()); + calcp->setVar(LLCalc::TEX_U_SCALE, (F32)mTexScaleU->getValue().asReal()); + calcp->setVar(LLCalc::TEX_V_SCALE, (F32)mTexScaleV->getValue().asReal()); + calcp->setVar(LLCalc::TEX_U_OFFSET, (F32)mTexOffsetU->getValue().asReal()); + calcp->setVar(LLCalc::TEX_V_OFFSET, (F32)mTexOffsetV->getValue().asReal()); + calcp->setVar(LLCalc::TEX_ROTATION, (F32)mTexRotate->getValue().asReal()); calcp->setVar(LLCalc::TEX_TRANSPARENCY, (F32)mCtrlColorTransp->getValue().asReal()); calcp->setVar(LLCalc::TEX_GLOW, (F32)mCtrlGlow->getValue().asReal()); } @@ -1830,14 +1753,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mRadioMaterialType->setSelectedIndex(0); } mLabelColorTransp->setEnabled(false); - getChildView("rptctrl")->setEnabled(false); - getChildView("tex gen")->setEnabled(false); - getChildView("label shininess")->setEnabled(false); - getChildView("label bumpiness")->setEnabled(false); - getChildView("button align")->setEnabled(false); - getChildView("pbr_from_inventory")->setEnabled(false); - getChildView("edit_selected_pbr")->setEnabled(false); - getChildView("save_selected_pbr")->setEnabled(false); + mTexRepeat->setEnabled(false); + mLabelTexGen->setEnabled(false); + mLabelShininess->setEnabled(false); + mLabelBumpiness->setEnabled(false); + mBtnAlign->setEnabled(false); + mBtnPbrFromInv->setEnabled(false); + mBtnEditBbr->setEnabled(false); + mBtnSaveBbr->setEnabled(false); updateVisibility(); @@ -1960,9 +1883,9 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, } } - getChildView("pbr_from_inventory")->setEnabled(settable); - getChildView("edit_selected_pbr")->setEnabled(editable && !has_faces_without_pbr); - getChildView("save_selected_pbr")->setEnabled(saveable && identical_pbr); + mBtnPbrFromInv->setEnabled(settable); + mBtnEditBbr->setEnabled(editable && !has_faces_without_pbr); + mBtnSaveBbr->setEnabled(saveable && identical_pbr); if (objectp->isInventoryPending()) { // Reuse the same listener when possible @@ -1992,17 +1915,11 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { const bool new_state = has_pbr_capabilities && has_pbr_material && !has_faces_without_pbr; - LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); - LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); - LLUICtrl* gltfCtrlTextureRotation = getChild("gltfTextureRotation"); - LLUICtrl* gltfCtrlTextureOffsetU = getChild("gltfTextureOffsetU"); - LLUICtrl* gltfCtrlTextureOffsetV = getChild("gltfTextureOffsetV"); - - gltfCtrlTextureScaleU->setEnabled(new_state); - gltfCtrlTextureScaleV->setEnabled(new_state); - gltfCtrlTextureRotation->setEnabled(new_state); - gltfCtrlTextureOffsetU->setEnabled(new_state); - gltfCtrlTextureOffsetV->setEnabled(new_state); + mPBRScaleU->setEnabled(new_state); + mPBRScaleV->setEnabled(new_state); + mPBRRotate->setEnabled(new_state); + mPBROffsetU->setEnabled(new_state); + mPBROffsetV->setEnabled(new_state); // Control values will be set once per frame in // setMaterialOverridesFromSelection @@ -2022,16 +1939,16 @@ void LLPanelFace::updateVisibilityGLTF(LLViewerObject* objectp /*= nullptr */) mPBRTextureCtrl->setVisible(show_pbr_render_material_id); - getChildView("pbr_from_inventory")->setVisible(show_pbr_render_material_id); - getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); - getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); - getChildView("material_permissions_loading_label")->setVisible(show_pbr_render_material_id && inventory_pending); + mBtnPbrFromInv->setVisible(show_pbr_render_material_id); + mBtnEditBbr->setVisible(show_pbr_render_material_id && !inventory_pending); + mBtnSaveBbr->setVisible(show_pbr_render_material_id && !inventory_pending); + mLabelMatPermLoading->setVisible(show_pbr_render_material_id && inventory_pending); - getChildView("gltfTextureScaleU")->setVisible(show_pbr); - getChildView("gltfTextureScaleV")->setVisible(show_pbr); - getChildView("gltfTextureRotation")->setVisible(show_pbr); - getChildView("gltfTextureOffsetU")->setVisible(show_pbr); - getChildView("gltfTextureOffsetV")->setVisible(show_pbr); + mPBRScaleU->setVisible(show_pbr); + mPBRScaleV->setVisible(show_pbr); + mPBRRotate->setVisible(show_pbr); + mPBROffsetU->setVisible(show_pbr); + mPBROffsetV->setVisible(show_pbr); } void LLPanelFace::updateCopyTexButton() @@ -2061,7 +1978,7 @@ void LLPanelFace::refreshMedia() && first_object->permModify() )) { - getChildView("add_media")->setEnabled(false); + mAddMedia->setEnabled(false); mTitleMediaText->clear(); clearMediaSettings(); return; @@ -2072,7 +1989,7 @@ void LLPanelFace::refreshMedia() if (!has_media_capability) { - getChildView("add_media")->setEnabled(false); + mAddMedia->setEnabled(false); LL_WARNS("LLFloaterToolsMedia") << "Media not enabled (no capability) in this region!" << LL_ENDL; clearMediaSettings(); return; @@ -2154,7 +2071,7 @@ void LLPanelFace::refreshMedia() // update UI depending on whether "object" (prim or face) has media // and whether or not you are allowed to edit it. - getChildView("add_media")->setEnabled(editable); + mAddMedia->setEnabled(editable); // IF all the faces have media (or all dont have media) if (LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo) { @@ -2176,7 +2093,7 @@ void LLPanelFace::refreshMedia() media_title = multi_media_info_str; } - getChildView("delete_media")->setEnabled(bool_has_media && editable); + mDelMedia->setEnabled(bool_has_media && editable); // TODO: display a list of all media on the face - use 'identical' flag } else // not all face has media but at least one does. @@ -2198,7 +2115,7 @@ void LLPanelFace::refreshMedia() } } - getChildView("delete_media")->setEnabled(true); + mDelMedia->setEnabled(true); } U32 materials_media = mComboMatMedia->getCurrentIndex(); @@ -2862,9 +2779,7 @@ void LLPanelFace::onCommitMaterialsMedia() void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) { - LLComboBox* combo_shininess = findChild("combobox shininess"); - LLComboBox* combo_bumpiness = findChild("combobox bumpiness"); - if (!mRadioMaterialType || !mRadioPbrType || !mComboMatMedia || !combo_shininess || !combo_bumpiness) + if (!mRadioMaterialType || !mRadioPbrType) { LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; @@ -2884,53 +2799,53 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) mRadioMaterialType->setVisible(show_material); // Shared material controls - getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); - getChildView("tex gen")->setVisible(show_material || show_media || show_pbr_asset); + mCheckSyncSettings->setVisible(show_material || show_media); + mLabelTexGen->setVisible(show_material || show_media || show_pbr_asset); mComboTexGen->setVisible(show_material || show_media || show_pbr_asset); - getChildView("button align textures")->setVisible(show_material || show_media); + mBtnAlignTex->setVisible(show_material || show_media); // Media controls mTitleMediaText->setVisible(show_media); - getChildView("add_media")->setVisible(show_media); - getChildView("delete_media")->setVisible(show_media); - getChildView("button align")->setVisible(show_media); + mAddMedia->setVisible(show_media); + mDelMedia->setVisible(show_media); + mBtnAlign->setVisible(show_media); // Diffuse texture controls mTextureCtrl->setVisible(show_texture && show_material); - getChildView("label alphamode")->setVisible(show_texture && show_material); - getChildView("combobox alphamode")->setVisible(show_texture && show_material); - getChildView("label maskcutoff")->setVisible(false); - getChildView("maskcutoff")->setVisible(false); + mLabelAlphaMode->setVisible(show_texture && show_material); + mComboAlphaMode->setVisible(show_texture && show_material); + mLabelMaskCutoff->setVisible(false); + mMaskCutoff->setVisible(false); if (show_texture && show_material) { updateAlphaControls(); } // texture scale and position controls - 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); + mTexScaleU->setVisible(show_texture); + mTexScaleV->setVisible(show_texture); + mTexRotate->setVisible(show_texture); + mTexOffsetU->setVisible(show_texture); + mTexOffsetV->setVisible(show_texture); // Specular map controls mShinyTextureCtrl->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); + mComboShininess->setVisible(show_shininess); + mLabelShininess->setVisible(show_shininess); + mLabelGlossiness->setVisible(false); + mGlossiness->setVisible(false); + mLabelEnvironment->setVisible(false); + mEnvironment->setVisible(false); + mLabelShiniColor->setVisible(false); mShinyColorSwatch->setVisible(false); if (show_shininess) { updateShinyControls(); } - 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); + mShinyScaleU->setVisible(show_shininess); + mShinyScaleV->setVisible(show_shininess); + mShinyRotate->setVisible(show_shininess); + mShinyOffsetU->setVisible(show_shininess); + mShinyOffsetV->setVisible(show_shininess); // Normal map controls if (show_bumpiness) @@ -2938,15 +2853,15 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) updateBumpyControls(); } mBumpyTextureCtrl->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); + mComboBumpiness->setVisible(show_bumpiness); + mLabelBumpiness->setVisible(show_bumpiness); + mBumpyScaleU->setVisible(show_bumpiness); + mBumpyScaleV->setVisible(show_bumpiness); + mBumpyRotate->setVisible(show_bumpiness); + mBumpyOffsetU->setVisible(show_bumpiness); + mBumpyOffsetV->setVisible(show_bumpiness); - getChild("rptctrl")->setVisible(show_material || show_media); + mTexRepeat->setVisible(show_material || show_media); // PBR controls updateVisibilityGLTF(objectp); @@ -2972,7 +2887,7 @@ void LLPanelFace::onCommitPbrType() void LLPanelFace::onCommitBump() { - sendBump(getChild("combobox bumpiness")->getCurrentIndex()); + sendBump(mComboBumpiness->getCurrentIndex()); } void LLPanelFace::onCommitTexGen() @@ -2984,33 +2899,32 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh { LLUUID shiny_texture_ID = mShinyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; - LLComboBox* comboShiny = getChild("combobox shininess"); if (mess_with_shiny_combobox) { if (!shiny_texture_ID.isNull() && is_setting_texture) { - if (!comboShiny->itemExists(USE_TEXTURE)) + if (!mComboShininess->itemExists(USE_TEXTURE)) { - comboShiny->add(USE_TEXTURE); + mComboShininess->add(USE_TEXTURE); } - comboShiny->setSimple(USE_TEXTURE); + mComboShininess->setSimple(USE_TEXTURE); } else { - if (comboShiny->itemExists(USE_TEXTURE)) + if (mComboShininess->itemExists(USE_TEXTURE)) { - comboShiny->remove(SHINY_TEXTURE); - comboShiny->selectFirstItem(); + mComboShininess->remove(SHINY_TEXTURE); + mComboShininess->selectFirstItem(); } } } else { - if (shiny_texture_ID.isNull() && comboShiny->itemExists(USE_TEXTURE)) + if (shiny_texture_ID.isNull() && mComboShininess->itemExists(USE_TEXTURE)) { - comboShiny->remove(SHINY_TEXTURE); - comboShiny->selectFirstItem(); + mComboShininess->remove(SHINY_TEXTURE); + mComboShininess->selectFirstItem(); } } @@ -3018,13 +2932,13 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh U32 material_type = mRadioMaterialType->getSelectedIndex(); bool show_material = (materials_media == MATMEDIA_MATERIAL); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); - U32 shiny_value = comboShiny->getCurrentIndex(); + U32 shiny_value = mComboShininess->getCurrentIndex(); bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture - 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); + mLabelGlossiness->setVisible(show_shinyctrls); + mGlossiness->setVisible(show_shinyctrls); + mLabelEnvironment->setVisible(show_shinyctrls); + mEnvironment->setVisible(show_shinyctrls); + mLabelShiniColor->setVisible(show_shinyctrls); mShinyColorSwatch->setVisible(show_shinyctrls); } @@ -3032,24 +2946,23 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co { LLUUID bumpy_texture_ID = mBumpyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; - LLComboBox* comboBumpy = getChild("combobox bumpiness"); if (mess_with_combobox) { if (!bumpy_texture_ID.isNull() && is_setting_texture) { - if (!comboBumpy->itemExists(USE_TEXTURE)) + if (!mComboBumpiness->itemExists(USE_TEXTURE)) { - comboBumpy->add(USE_TEXTURE); + mComboBumpiness->add(USE_TEXTURE); } - comboBumpy->setSimple(USE_TEXTURE); + mComboBumpiness->setSimple(USE_TEXTURE); } else { - if (comboBumpy->itemExists(USE_TEXTURE)) + if (mComboBumpiness->itemExists(USE_TEXTURE)) { - comboBumpy->remove(BUMPY_TEXTURE); - comboBumpy->selectFirstItem(); + mComboBumpiness->remove(BUMPY_TEXTURE); + mComboBumpiness->selectFirstItem(); } } } @@ -3057,12 +2970,12 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co void LLPanelFace::onCommitShiny() { - sendShiny(getChild("combobox shininess")->getCurrentIndex()); + sendShiny(mComboShininess->getCurrentIndex()); } void LLPanelFace::updateAlphaControls() { - U32 alpha_value = getChild("combobox alphamode")->getCurrentIndex(); + U32 alpha_value = mComboAlphaMode->getCurrentIndex(); bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking U32 mat_media = mComboMatMedia->getCurrentIndex(); @@ -3071,8 +2984,8 @@ void LLPanelFace::updateAlphaControls() show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL); show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE); - getChildView("label maskcutoff")->setVisible(show_alphactrls); - getChildView("maskcutoff")->setVisible(show_alphactrls); + mLabelMaskCutoff->setVisible(show_alphactrls); + mMaskCutoff->setVisible(show_alphactrls); } void LLPanelFace::onCommitAlphaMode() @@ -3206,7 +3119,7 @@ void LLPanelFace::onSelectTexture() break; } - childGetSelectionInterface("combobox alphamode")->selectNthItem(alpha_mode); + mComboAlphaMode->getSelectionInterface()->selectNthItem(alpha_mode); } LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); @@ -3337,7 +3250,7 @@ void LLPanelFace::syncOffsetX(F32 offsetU) { LLSelectedTEMaterial::setNormalOffsetX(this, offsetU); LLSelectedTEMaterial::setSpecularOffsetX(this, offsetU); - getChild("TexOffsetU")->forceSetValue(LLSD(offsetU)); + mTexOffsetU->forceSetValue(LLSD(offsetU)); sendTextureInfo(); } @@ -3345,7 +3258,7 @@ void LLPanelFace::syncOffsetY(F32 offsetV) { LLSelectedTEMaterial::setNormalOffsetY(this, offsetV); LLSelectedTEMaterial::setSpecularOffsetY(this, offsetV); - getChild("TexOffsetV")->forceSetValue(LLSD(offsetV)); + mTexOffsetV->forceSetValue(LLSD(offsetV)); sendTextureInfo(); } @@ -3421,7 +3334,7 @@ void LLPanelFace::onCommitMaterialBumpyScaleX() if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - getChild("TexScaleU")->forceSetValue(getCurrentBumpyScaleU()); + mTexScaleU->forceSetValue(LLSD(getCurrentBumpyScaleU())); syncRepeatX(bumpy_scale_u); } else @@ -3440,7 +3353,7 @@ void LLPanelFace::onCommitMaterialBumpyScaleY() if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - getChild("TexScaleV")->forceSetValue(getCurrentBumpyScaleV()); + mTexScaleV->forceSetValue(LLSD(getCurrentBumpyScaleV())); syncRepeatY(bumpy_scale_v); } else @@ -3459,7 +3372,7 @@ void LLPanelFace::onCommitMaterialShinyScaleX() if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - getChild("TexScaleU")->forceSetValue(LLSD(getCurrentShinyScaleU())); + mTexScaleU->forceSetValue(LLSD(getCurrentShinyScaleU())); syncRepeatX(shiny_scale_u); } else @@ -3478,7 +3391,7 @@ void LLPanelFace::onCommitMaterialShinyScaleY() if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - getChild("TexScaleV")->forceSetValue(LLSD(getCurrentShinyScaleV())); + mTexScaleV->forceSetValue(LLSD(getCurrentShinyScaleV())); syncRepeatY(shiny_scale_v); } else @@ -3498,12 +3411,12 @@ void LLPanelFace::onCommitMaterialBumpyRot() { if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - getChild("TexRot")->forceSetValue(LLSD(getCurrentBumpyRot())); + mTexRotate->forceSetValue(LLSD(getCurrentBumpyRot())); syncMaterialRot(getCurrentBumpyRot()); } else { - if (childGetValue("checkbox planar align").asBoolean()) + if (mPlanarAlign->getValue().asBoolean()) { LLFace* last_face = NULL; bool identical_face = false; @@ -3522,12 +3435,12 @@ void LLPanelFace::onCommitMaterialShinyRot() { if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - getChild("TexRot")->forceSetValue(LLSD(getCurrentShinyRot())); + mTexRotate->forceSetValue(LLSD(getCurrentShinyRot())); syncMaterialRot(getCurrentShinyRot()); } else { - if (childGetValue("checkbox planar align").asBoolean()) + if (mPlanarAlign->getValue().asBoolean()) { LLFace* last_face = NULL; bool identical_face = false; @@ -3568,7 +3481,7 @@ void LLPanelFace::onCommitTextureScaleX() { if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_u = (F32)getChild("TexScaleU")->getValue().asReal(); + F32 bumpy_scale_u = (F32)mTexScaleU->getValue().asReal(); if (isIdenticalPlanarTexgen()) { bumpy_scale_u *= 0.5f; @@ -3586,7 +3499,7 @@ void LLPanelFace::onCommitTextureScaleY() { if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - F32 bumpy_scale_v = (F32)getChild("TexScaleV")->getValue().asReal(); + F32 bumpy_scale_v = (F32)mTexScaleV->getValue().asReal(); if (isIdenticalPlanarTexgen()) { bumpy_scale_v *= 0.5f; @@ -3604,7 +3517,7 @@ void LLPanelFace::onCommitTextureRot() { if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncMaterialRot((F32)getChild("TexRot")->getValue().asReal()); + syncMaterialRot((F32)mTexRotate->getValue().asReal()); } else { @@ -3617,7 +3530,7 @@ void LLPanelFace::onCommitTextureOffsetX() { if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetX((F32)getChild("TexOffsetU")->getValue().asReal()); + syncOffsetX((F32)mTexOffsetU->getValue().asReal()); } else { @@ -3630,7 +3543,7 @@ void LLPanelFace::onCommitTextureOffsetY() { if (gSavedSettings.getBOOL("SyncMaterialSettings")) { - syncOffsetY((F32)getChild("TexOffsetV")->getValue().asReal()); + syncOffsetY((F32)mTexOffsetV->getValue().asReal()); } else { @@ -3642,7 +3555,7 @@ void LLPanelFace::onCommitTextureOffsetY() // Commit the number of repeats per meter void LLPanelFace::onCommitRepeatsPerMeter() { - F32 repeats_per_meter = (F32)getChild("rptctrl")->getValue().asReal(); + F32 repeats_per_meter = (F32)mTexRepeat->getValue().asReal(); F32 obj_scale_s = 1.0f; F32 obj_scale_t = 1.0f; @@ -3653,23 +3566,18 @@ void LLPanelFace::onCommitRepeatsPerMeter() LLSelectedTE::getObjectScaleS(obj_scale_s, identical_scale_s); LLSelectedTE::getObjectScaleS(obj_scale_t, identical_scale_t); - LLUICtrl* bumpy_scale_u = getChild("bumpyScaleU"); - LLUICtrl* bumpy_scale_v = getChild("bumpyScaleV"); - LLUICtrl* shiny_scale_u = getChild("shinyScaleU"); - LLUICtrl* shiny_scale_v = getChild("shinyScaleV"); - if (gSavedSettings.getBOOL("SyncMaterialSettings")) { LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); - bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); - bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); + mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); + mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); - shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); - shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); + mShinyScaleU->setValue(obj_scale_s * repeats_per_meter); + mShinyScaleV->setValue(obj_scale_t * repeats_per_meter); LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); @@ -3683,15 +3591,15 @@ void LLPanelFace::onCommitRepeatsPerMeter() LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); break; case MATTYPE_NORMAL: - bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); - bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); + mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); + mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); break; case MATTYPE_SPECULAR: - bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); - bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); + mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); + mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); @@ -3701,7 +3609,6 @@ void LLPanelFace::onCommitRepeatsPerMeter() break; } } - // vertical scale and repeats per meter depends on each other, so force set on changes updateUI(true); } @@ -4737,23 +4644,17 @@ void LLPanelFace::setMaterialOverridesFromSelection() } } - LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); - LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); - LLUICtrl* gltfCtrlTextureRotation = getChild("gltfTextureRotation"); - LLUICtrl* gltfCtrlTextureOffsetU = getChild("gltfTextureOffsetU"); - LLUICtrl* gltfCtrlTextureOffsetV = getChild("gltfTextureOffsetV"); - - gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); - gltfCtrlTextureScaleV->setValue(transform.mScale[VY]); - gltfCtrlTextureRotation->setValue(transform.mRotation * RAD_TO_DEG); - gltfCtrlTextureOffsetU->setValue(transform.mOffset[VX]); - gltfCtrlTextureOffsetV->setValue(transform.mOffset[VY]); + mPBRScaleU->setValue(transform.mScale[VX]); + mPBRScaleV->setValue(transform.mScale[VY]); + mPBRRotate->setValue(transform.mRotation * RAD_TO_DEG); + mPBROffsetU->setValue(transform.mOffset[VX]); + mPBROffsetV->setValue(transform.mOffset[VY]); - gltfCtrlTextureScaleU->setTentative(!scale_u_same); - gltfCtrlTextureScaleV->setTentative(!scale_v_same); - gltfCtrlTextureRotation->setTentative(!rotation_same); - gltfCtrlTextureOffsetU->setTentative(!offset_u_same); - gltfCtrlTextureOffsetV->setTentative(!offset_v_same); + mPBRScaleU->setTentative(!scale_u_same); + mPBRScaleV->setTentative(!scale_v_same); + mPBRRotate->setTentative(!rotation_same); + mPBROffsetU->setTentative(!offset_u_same); + mPBROffsetV->setTentative(!offset_v_same); } void LLPanelFace::Selection::connect() @@ -4832,7 +4733,7 @@ bool LLPanelFace::Selection::compareSelection() void LLPanelFace::onCommitGLTFTextureScaleU() { - F32 value = (F32)getChild("gltfTextureScaleU")->getValue().asReal(); + F32 value = (F32)mPBRScaleU->getValue().asReal(); updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VX] = value; @@ -4841,7 +4742,7 @@ void LLPanelFace::onCommitGLTFTextureScaleU() void LLPanelFace::onCommitGLTFTextureScaleV() { - F32 value = (F32)getChild("gltfTextureScaleV")->getValue().asReal(); + F32 value = (F32)mPBRScaleV->getValue().asReal(); updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mScale.mV[VY] = value; @@ -4850,7 +4751,7 @@ void LLPanelFace::onCommitGLTFTextureScaleV() void LLPanelFace::onCommitGLTFRotation() { - F32 value = (F32)getChild("gltfTextureRotation")->getValue().asReal() * DEG_TO_RAD; + F32 value = (F32)mPBRRotate->getValue().asReal() * DEG_TO_RAD; updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mRotation = value; @@ -4859,7 +4760,7 @@ void LLPanelFace::onCommitGLTFRotation() void LLPanelFace::onCommitGLTFTextureOffsetU() { - F32 value = (F32)getChild("gltfTextureOffsetU")->getValue().asReal(); + F32 value = (F32)mPBROffsetU->getValue().asReal(); updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VX] = value; @@ -4868,7 +4769,7 @@ void LLPanelFace::onCommitGLTFTextureOffsetU() void LLPanelFace::onCommitGLTFTextureOffsetV() { - F32 value = (F32)getChild("gltfTextureOffsetV")->getValue().asReal(); + F32 value = (F32)mPBROffsetV->getValue().asReal(); updateGLTFTextureTransform([&](LLGLTFMaterial::TextureTransform* new_transform) { new_transform->mOffset.mV[VY] = value; @@ -4884,42 +4785,39 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) switch (mattype) { case MATTYPE_SPECULAR: - texture_ctrl = getChild("shinytexture control"); + texture_ctrl = mShinyTextureCtrl; break; case MATTYPE_NORMAL: - texture_ctrl = getChild("bumpytexture control"); + texture_ctrl = mBumpyTextureCtrl; break; default: - texture_ctrl = getChild("texture control"); + texture_ctrl = mTextureCtrl; } - if (texture_ctrl) - { - LLUUID obj_owner_id; - std::string obj_owner_name; - LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name); + LLUUID obj_owner_id; + std::string obj_owner_name; + LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name); - LLSaleInfo sale_info; - LLSelectMgr::instance().selectGetSaleInfo(sale_info); + LLSaleInfo sale_info; + LLSelectMgr::instance().selectGetSaleInfo(sale_info); - bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? - bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? - bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? - bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale? + bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? + bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? + bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? + bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale? - if (can_copy && can_transfer) - { - texture_ctrl->setCanApply(true, true); - return; - } + if (can_copy && can_transfer) + { + texture_ctrl->setCanApply(true, true); + return; + } - // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale - texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); + // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale + texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); - if (gSavedSettings.getBOOL("TextureLivePreview")) - { - LLNotificationsUtil::add("LivePreviewUnavailable"); - } + if (gSavedSettings.getBOOL("TextureLivePreview")) + { + LLNotificationsUtil::add("LivePreviewUnavailable"); } } -- cgit v1.2.3 From e20e387d481513e4e7eed570d224da19aa532fb8 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 7 Aug 2024 19:13:40 +0200 Subject: #1922 Make PBR scale and offset crosshair work (fix PBR channels in LLPanelFace) --- indra/newview/llpanelface.cpp | 112 +++++++++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 44 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 936ca273c3..94674dc557 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -117,26 +117,23 @@ const S32 PBRTYPE_METALLIC_ROUGHNESS = 2; // PBR Metallic const S32 PBRTYPE_EMISSIVE = 3; // PBR Emissive const S32 PBRTYPE_NORMAL = 4; // PBR Normal -LLGLTFMaterial::TextureInfo texture_info_from_pbrtype(S32 pbr_type) +LLGLTFMaterial::TextureInfo LLPanelFace::getPBRTextureInfo() { - switch (pbr_type) + // Radiogroup [ "Complete material", "Base color", "Metallic/roughness", "Emissive", "Normal" ] + S32 radio_group_index = mRadioPbrType->getSelectedIndex(); + switch (radio_group_index) { case PBRTYPE_BASE_COLOR: return LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR; - break; case PBRTYPE_NORMAL: return LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL; - break; case PBRTYPE_METALLIC_ROUGHNESS: return LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS; - break; case PBRTYPE_EMISSIVE: return LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE; - break; - default: - return LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; - break; } + // The default value is used as a fallback + return LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; } void LLPanelFace::updateSelectedGLTFMaterials(std::function func) @@ -195,43 +192,77 @@ std::string USE_TEXTURE; LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() { - LLRender::eTexIndex channel_to_edit = LLRender::DIFFUSE_MAP; - if (mComboMatMedia) + S32 matmedia_selection = mComboMatMedia->getCurrentIndex(); + switch (matmedia_selection) { - U32 matmedia_selection = mComboMatMedia->getCurrentIndex(); - if (matmedia_selection == MATMEDIA_MATERIAL) - { - channel_to_edit = (LLRender::eTexIndex)mRadioMaterialType->getSelectedIndex(); - } - if (matmedia_selection == MATMEDIA_PBR) - { - channel_to_edit = (LLRender::eTexIndex)mRadioPbrType->getSelectedIndex(); - } + case MATMEDIA_MATERIAL: + return getMatTextureChannel(); + case MATMEDIA_PBR: + return getPBRTextureChannel(); + } + return (LLRender::eTexIndex)0; +} + +LLRender::eTexIndex LLPanelFace::getMatTextureChannel() +{ + // Radiogroup [ "Texture (diffuse)", "Bumpiness (normal)", "Shininess (specular)" ] + S32 radio_group_index = mRadioMaterialType->getSelectedIndex(); + switch (radio_group_index) + { + case MATTYPE_DIFFUSE: // "Texture (diffuse)" + return LLRender::DIFFUSE_MAP; + case MATTYPE_NORMAL: // "Bumpiness (normal)" + if (getCurrentNormalMap().notNull()) + return LLRender::NORMAL_MAP; + break; + case MATTYPE_SPECULAR: // "Shininess (specular)" + if (getCurrentNormalMap().notNull()) + return LLRender::SPECULAR_MAP; + break; } + // The default value is used as a fallback if no required texture is chosen + return (LLRender::eTexIndex)0; +} - channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; - channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; - return channel_to_edit; +LLRender::eTexIndex LLPanelFace::getPBRTextureChannel() +{ + // Radiogroup [ "Complete material", "Base color", "Metallic/roughness", "Emissive", "Normal" ] + S32 radio_group_index = mRadioPbrType->getSelectedIndex(); + switch (radio_group_index) + { + case PBRTYPE_RENDER_MATERIAL_ID: // "Complete material" + return LLRender::NUM_TEXTURE_CHANNELS; + case PBRTYPE_BASE_COLOR: // "Base color" + return LLRender::BASECOLOR_MAP; + case PBRTYPE_METALLIC_ROUGHNESS: // "Metallic/roughness" + return LLRender::METALLIC_ROUGHNESS_MAP; + case PBRTYPE_EMISSIVE: // "Emissive" + return LLRender::EMISSIVE_MAP; + case PBRTYPE_NORMAL: // "Normal" + return LLRender::GLTF_NORMAL_MAP; + } + // The default value is used as a fallback + return LLRender::NUM_TEXTURE_CHANNELS; } LLRender::eTexIndex LLPanelFace::getTextureDropChannel() { - if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) { - return LLRender::eTexIndex(mRadioMaterialType->getSelectedIndex()); + return getMatTextureChannel(); } - return LLRender::eTexIndex(MATTYPE_DIFFUSE); + return (LLRender::eTexIndex)0; } LLGLTFMaterial::TextureInfo LLPanelFace::getPBRDropChannel() { if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { - return texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); + return getPBRTextureInfo(); } - return texture_info_from_pbrtype(PBRTYPE_BASE_COLOR); + return (LLGLTFMaterial::TextureInfo)0; } // Things the UI provides... @@ -388,29 +419,23 @@ bool LLPanelFace::postBuild() mCtrlColorTransp->setFollowsTop(); mCtrlColorTransp->setFollowsLeft(); - mCheckFullbright = getChild("checkbox fullbright"); - mCheckFullbright->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitFullbright(); }); + getChildSetCommitCallback(mCheckFullbright, "checkbox fullbright", [&](LLUICtrl*, const LLSD&) { onCommitFullbright(); }); mLabelTexGen = getChild("tex gen"); - mComboTexGen = getChild("combobox texgen"); - mComboTexGen->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitTexGen(); }); + getChildSetCommitCallback(mComboTexGen, "combobox texgen", [&](LLUICtrl*, const LLSD&) { onCommitTexGen(); }); mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); - mComboMatMedia = getChild("combobox matmedia"); - mComboMatMedia->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialsMedia(); }); + getChildSetCommitCallback(mComboMatMedia, "combobox matmedia", [&](LLUICtrl*, const LLSD&) { onCommitMaterialsMedia(); }); mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); - mRadioMaterialType = getChild("radio_material_type"); - mRadioMaterialType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitMaterialType(); }); + getChildSetCommitCallback(mRadioMaterialType, "radio_material_type", [&](LLUICtrl*, const LLSD&) { onCommitMaterialType(); }); mRadioMaterialType->selectNthItem(MATTYPE_DIFFUSE); - mRadioPbrType = getChild("radio_pbr_type"); - mRadioPbrType->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitPbrType(); }); + getChildSetCommitCallback(mRadioPbrType, "radio_pbr_type", [&](LLUICtrl*, const LLSD&) { onCommitPbrType(); }); mRadioPbrType->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); mLabelGlow = getChild("glow label"); - mCtrlGlow = getChild("glow"); - mCtrlGlow->setCommitCallback([&](LLUICtrl*, const LLSD&) { onCommitGlow(); }); + getChildSetCommitCallback(mCtrlGlow, "glow", [&](LLUICtrl*, const LLSD&) { onCommitGlow(); }); mMenuClipboardColor = getChild("clipboard_color_params_btn"); mMenuClipboardTexture = getChild("clipboard_texture_params_btn"); @@ -2792,8 +2817,7 @@ void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); - const U32 pbr_type = mRadioPbrType->getSelectedIndex(); - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const LLGLTFMaterial::TextureInfo texture_info = getPBRTextureInfo(); const bool show_pbr_asset = show_pbr && texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; mRadioMaterialType->setVisible(show_material); @@ -4547,7 +4571,7 @@ void LLPanelFace::onCommitPlanarAlign() void LLPanelFace::updateGLTFTextureTransform(std::function edit) { - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(mRadioPbrType->getSelectedIndex()); + const LLGLTFMaterial::TextureInfo texture_info = getPBRTextureInfo(); if (texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) { updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) @@ -4571,7 +4595,7 @@ void LLPanelFace::updateGLTFTextureTransform(std::functiongetSelectedIndex()); + const LLGLTFMaterial::TextureInfo texture_info = getPBRTextureInfo(); U32 texture_info_start; U32 texture_info_end; if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) -- cgit v1.2.3 From f782f5f5345e68e0c579e5fe78be94f749723dee Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Thu, 8 Aug 2024 23:21:28 +0200 Subject: Fix copy&paste error in LLPanelFace (#2233) --- indra/newview/llpanelface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 94674dc557..544b6fbc9c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1425,8 +1425,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { mTexScaleV->setValue(diff_scale_t); } - mShinyScaleV->setValue(norm_scale_t); - mBumpyScaleV->setValue(spec_scale_t); + mShinyScaleV->setValue(spec_scale_t); + mBumpyScaleV->setValue(norm_scale_t); mTexScaleV->setTentative(LLSD(diff_scale_tentative)); mShinyScaleV->setTentative(LLSD(spec_scale_tentative)); @@ -2181,7 +2181,7 @@ void LLPanelFace::onMaterialOverrideReceived(const LLUUID& object_id, S32 side) ////////////////////////////////////////////////////////////////////////////// // -void LLPanelFace::navigateToTitleMedia( const std::string url ) +void LLPanelFace::navigateToTitleMedia(const std::string& url) { std::string multi_media_info_str = LLTrans::getString("Multiple Media"); if (url.empty() || multi_media_info_str == url) @@ -2193,9 +2193,9 @@ void LLPanelFace::navigateToTitleMedia( const std::string url ) { LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin(); // check if url changed or if we need a new media source - if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == NULL) + if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == nullptr) { - mTitleMedia->navigateTo( url ); + mTitleMedia->navigateTo(url); LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mTitleMedia->getTextureID()); if (impl) -- cgit v1.2.3