diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2025-03-03 22:29:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-03 22:29:26 +0200 |
commit | a1ccb44c15b484787bce34e06adb0396bfc6d2a4 (patch) | |
tree | e47adf8b1844bc201d658735db3a8075adc4f11a | |
parent | 4214ab8e79809412fdec626fa5f914723e6d4704 (diff) |
#3512 Add UX for marking water exclusion surfaces
-rw-r--r-- | indra/newview/llpanelface.cpp | 83 | ||||
-rw-r--r-- | indra/newview/llpanelface.h | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_tools_texture.xml | 8 |
4 files changed, 103 insertions, 5 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c080d72580..692bd9cc41 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -420,6 +420,7 @@ bool LLPanelFace::postBuild() mCtrlColorTransp->setFollowsLeft(); getChildSetCommitCallback(mCheckFullbright, "checkbox fullbright", [&](LLUICtrl*, const LLSD&) { onCommitFullbright(); }); + getChildSetCommitCallback(mCheckHideWater, "checkbox_hide_water", [&](LLUICtrl*, const LLSD&) { onCommitHideWater(); }); mLabelTexGen = getChild<LLTextBox>("tex gen"); getChildSetCommitCallback(mComboTexGen, "combobox texgen", [&](LLUICtrl*, const LLSD&) { onCommitTexGen(); }); @@ -1024,6 +1025,13 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm); LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); + LLColor4 color = LLColor4::white; + bool identical_color = false; + + LLSelectedTE::getColor(color, identical_color); + F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; + mExcludeWater = (id == IMG_ALPHA_GRAD) && normmap_id.isNull() && specmap_id.isNull() && (transparency == 0); + static S32 selected_te = -1; static LLUUID prev_obj_id; if ((LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()) && @@ -1098,12 +1106,26 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) updateVisibility(objectp); + // Water exclusion + { + mCheckHideWater->setEnabled(editable && !has_pbr_material && !isMediaTexSelected()); + mCheckHideWater->set(mExcludeWater); + if (mExcludeWater && !has_pbr_material) + { + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + } + editable &= !mExcludeWater; + + // disable controls for water exclusion face after updateVisibility, so the whole panel is not hidden + mComboMatMedia->setEnabled(editable); + mRadioMaterialType->setEnabled(editable); + mRadioPbrType->setEnabled(editable); + mCheckSyncSettings->setEnabled(editable); + } + // Color swatch 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); @@ -1114,7 +1136,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Color transparency mLabelColorTransp->setEnabled(editable); - F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; mCtrlColorTransp->setValue(editable ? transparency : 0); mCtrlColorTransp->setEnabled(editable && has_material); @@ -1986,7 +2007,8 @@ void LLPanelFace::updateCopyTexButton() mMenuClipboardTexture->setEnabled(objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify() && !objectp->isPermanentEnforced() && !objectp->isInventoryPending() && (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) - && LLMaterialEditor::canClipboardObjectsMaterial()); + && LLMaterialEditor::canClipboardObjectsMaterial() + && !mExcludeWater); std::string tooltip = (objectp && objectp->isInventoryPending()) ? LLTrans::getString("LoadingContents") : getString("paste_options"); mMenuClipboardTexture->setToolTip(tooltip); } @@ -3027,6 +3049,37 @@ void LLPanelFace::onCommitFullbright() sendFullbright(); } +void LLPanelFace::onCommitHideWater() +{ + if (mCheckHideWater->get()) + { + LLHandle<LLPanel> handle = getHandle(); + LLNotificationsUtil::add("WaterExclusionSurfacesWarning", LLSD(), LLSD(), + [handle](const LLSD& notification, const LLSD& response) + { + if(LLPanelFace* panel = (LLPanelFace*)handle.get()) + { + if (LLNotificationsUtil::getSelectedOption(notification, response) == 1) + { + panel->mCheckHideWater->setValue(false); + return; + } + // apply invisiprim texture and reset related params to set water exclusion surface + panel->sendBump(0); + panel->sendShiny(0); + LLSelectMgr::getInstance()->selectionSetAlphaOnly(1.f); + LLSelectMgr::getInstance()->selectionSetImage(IMG_ALPHA_GRAD); + LLSelectedTEMaterial::setDiffuseAlphaMode(panel, LLMaterial::DIFFUSE_ALPHA_MODE_BLEND); + } + }); + } + else + { + // reset texture to default plywood + LLSelectMgr::getInstance()->selectionSetImage(DEFAULT_OBJECT_TEXTURE); + } +} + void LLPanelFace::onCommitGlow() { sendGlow(); @@ -4891,6 +4944,26 @@ bool LLPanelFace::isIdenticalPlanarTexgen() return (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); } +bool LLPanelFace::isMediaTexSelected() +{ + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); + if (LLViewerObject* objectp = node->getObject()) + { + S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); + for (S32 te = 0; te < num_tes; ++te) + { + if (node->isTESelected(te)) + { + if (objectp->getTE(te) && objectp->getTE(te)->hasMedia()) + { + return true; + } + } + } + } + return false; +} + void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical_face) { struct LLSelectedTEGetFace : public LLSelectedTEGetFunctor<LLFace *> diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index dfd3201533..6e0d34cbd6 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -139,6 +139,8 @@ protected: void updateMediaSettings(); void updateMediaTitle(); + bool isMediaTexSelected(); + void getState(); void sendTexture(); // applies and sends texture @@ -238,6 +240,7 @@ protected: void onCommitShiny(); void onCommitAlphaMode(); void onCommitFullbright(); + void onCommitHideWater(); void onCommitGlow(); void onCommitPlanarAlign(); void onCommitRepeatsPerMeter(); @@ -308,6 +311,7 @@ private: LLRadioGroup* mRadioPbrType { nullptr }; LLCheckBoxCtrl* mCheckFullbright { nullptr }; + LLCheckBoxCtrl* mCheckHideWater{ nullptr }; LLTextBox* mLabelColorTransp { nullptr }; LLSpinCtrl* mCtrlColorTransp { nullptr }; // transparency = 1 - alpha @@ -555,6 +559,7 @@ private: LLMenuButton* mMenuClipboardTexture; bool mIsAlpha; + bool mExcludeWater { false }; LLSD mClipboardParams; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index b5f742e5fb..dba48012ac 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -12580,4 +12580,16 @@ are wearing now. name="okbutton" yestext="OK"/> </notification> + + <notification + icon="alertmodal.tga" + name="WaterExclusionSurfacesWarning" + type="alertmodal"> + Checking the hide water box will overwrite the texture, bumpiness, and shininess choices. + <tag>confirm</tag> + <usetemplate + name="okcancelbuttons" + notext="Cancel" + yestext="Continue"/> + </notification> </notifications> diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index e80f315259..9a19d06432 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -123,6 +123,14 @@ name="checkbox fullbright" top_pad="4" width="81" /> + <check_box + height="19" + label="Hide water" + layout="topleft" + left="172" + top_delta="0" + name="checkbox_hide_water" + width="81" /> <view_border bevel_style="none" follows="top|left" |