Skip to content

#3512 Add UX for marking water exclusion surfaces #3645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 78 additions & 5 deletions indra/newview/llpanelface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); });
Expand Down Expand Up @@ -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()) &&
Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 *>
Expand Down
5 changes: 5 additions & 0 deletions indra/newview/llpanelface.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class LLPanelFace : public LLPanel
void updateMediaSettings();
void updateMediaTitle();

bool isMediaTexSelected();

void getState();

void sendTexture(); // applies and sends texture
Expand Down Expand Up @@ -238,6 +240,7 @@ class LLPanelFace : public LLPanel
void onCommitShiny();
void onCommitAlphaMode();
void onCommitFullbright();
void onCommitHideWater();
void onCommitGlow();
void onCommitPlanarAlign();
void onCommitRepeatsPerMeter();
Expand Down Expand Up @@ -308,6 +311,7 @@ class LLPanelFace : public LLPanel
LLRadioGroup* mRadioPbrType { nullptr };

LLCheckBoxCtrl* mCheckFullbright { nullptr };
LLCheckBoxCtrl* mCheckHideWater{ nullptr };

LLTextBox* mLabelColorTransp { nullptr };
LLSpinCtrl* mCtrlColorTransp { nullptr }; // transparency = 1 - alpha
Expand Down Expand Up @@ -555,6 +559,7 @@ class LLPanelFace : public LLPanel
LLMenuButton* mMenuClipboardTexture;

bool mIsAlpha;
bool mExcludeWater { false };

LLSD mClipboardParams;

Expand Down
12 changes: 12 additions & 0 deletions indra/newview/skins/default/xui/en/notifications.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
8 changes: 8 additions & 0 deletions indra/newview/skins/default/xui/en/panel_tools_texture.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down