summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-12-13 16:13:49 -0600
committerDave Parks <davep@lindenlab.com>2022-12-13 16:13:49 -0600
commit5fcfe95422b4c3a5434b3eb711cd12401d4329d3 (patch)
treeed3a5a8daaa360e6fd590af6b6a6e7d51086c864
parent0c2e7a8eb70193b083a055dacbfde67239a8ff07 (diff)
SL-18782 Make primitive parameters automatically follow Reflection Probe controls.
-rw-r--r--indra/newview/llpanelvolume.cpp55
-rw-r--r--indra/newview/llvovolume.cpp24
-rw-r--r--indra/newview/llvovolume.h10
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml12
4 files changed, 88 insertions, 13 deletions
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index db37938448..0cbc2b0bad 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -48,6 +48,7 @@
#include "lltexturectrl.h"
#include "llcombobox.h"
//#include "llfirstuse.h"
+#include "llfloaterreg.h"
#include "llfocusmgr.h"
#include "llmanipscale.h"
#include "llinventorymodel.h"
@@ -378,7 +379,7 @@ void LLPanelVolume::getState( )
// Reflection Probe
BOOL is_probe = volobjp && volobjp->isReflectionProbe();
getChild<LLUICtrl>("Reflection Probe")->setValue(is_probe);
- getChildView("Reflection Probe")->setEnabled(editable && single_volume && volobjp);
+ getChildView("Reflection Probe")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh());
bool probe_enabled = is_probe && editable && single_volume;
@@ -746,8 +747,30 @@ void LLPanelVolume::sendIsReflectionProbe()
LLVOVolume* volobjp = (LLVOVolume*)objectp;
BOOL value = getChild<LLUICtrl>("Reflection Probe")->getValue();
+ BOOL old_value = volobjp->isReflectionProbe();
+
volobjp->setIsReflectionProbe(value);
LL_INFOS() << "update reflection probe sent" << LL_ENDL;
+
+ if (value && !old_value)
+ { // has become a reflection probe, slam to a 10m sphere and pop up a message
+ // warning people about the pitfalls of reflection probes
+ auto* select_mgr = LLSelectMgr::getInstance();
+
+ mObject->setScale(LLVector3(10.f, 10.f, 10.f));
+ select_mgr->sendMultipleUpdate(UPD_ROTATION | UPD_POSITION | UPD_SCALE);
+
+ select_mgr->selectionUpdatePhantom(true);
+ select_mgr->selectionSetGLTFMaterial(LLUUID::null);
+ select_mgr->selectionSetAlphaOnly(0.f);
+
+ LLVolumeParams params;
+ params.getPathParams().setCurveType(LL_PCODE_PATH_CIRCLE);
+ params.getProfileParams().setCurveType(LL_PCODE_PROFILE_CIRCLE_HALF);
+ mObject->updateVolume(params);
+
+ LLNotificationsUtil::add("ReflectionProbeApplied");
+ }
}
void LLPanelVolume::sendIsFlexible()
@@ -1309,14 +1332,40 @@ void LLPanelVolume::onCommitProbe(LLUICtrl* ctrl, void* userdata)
}
LLVOVolume* volobjp = (LLVOVolume*)objectp;
-
volobjp->setReflectionProbeAmbiance((F32)self->getChild<LLUICtrl>("Probe Ambiance")->getValue().asReal());
volobjp->setReflectionProbeNearClip((F32)self->getChild<LLUICtrl>("Probe Near Clip")->getValue().asReal());
volobjp->setReflectionProbeIsDynamic(self->getChild<LLUICtrl>("Probe Dynamic")->getValue().asBoolean());
std::string shape_type = self->getChild<LLUICtrl>("Probe Volume Type")->getValue().asString();
- volobjp->setReflectionProbeIsBox(shape_type == "Box");
+ bool is_box = shape_type == "Box";
+
+ if (volobjp->setReflectionProbeIsBox(is_box))
+ {
+ // make the volume match the probe
+ U8 profile, path;
+
+ if (!is_box)
+ {
+ profile = LL_PCODE_PROFILE_CIRCLE_HALF;
+ path = LL_PCODE_PATH_CIRCLE;
+
+ F32 scale = volobjp->getScale().mV[0];
+ volobjp->setScale(LLVector3(scale, scale, scale), FALSE);
+ LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_ROTATION | UPD_POSITION | UPD_SCALE);
+ }
+ else
+ {
+ profile = LL_PCODE_PROFILE_SQUARE;
+ path = LL_PCODE_PATH_LINE;
+ }
+
+ LLVolumeParams params;
+ params.getProfileParams().setCurveType(profile);
+ params.getPathParams().setCurveType(path);
+ objectp->updateVolume(params);
+ }
+
}
// static
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index f06719634e..8660b6d9ea 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3300,7 +3300,7 @@ BOOL LLVOVolume::isReflectionProbe() const
return getParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE);
}
-void LLVOVolume::setIsReflectionProbe(BOOL is_probe)
+bool LLVOVolume::setIsReflectionProbe(BOOL is_probe)
{
BOOL was_probe = isReflectionProbe();
if (is_probe != was_probe)
@@ -3316,9 +3316,11 @@ void LLVOVolume::setIsReflectionProbe(BOOL is_probe)
}
updateReflectionProbePtr();
+
+ return was_probe != is_probe;
}
-void LLVOVolume::setReflectionProbeAmbiance(F32 ambiance)
+bool LLVOVolume::setReflectionProbeAmbiance(F32 ambiance)
{
LLReflectionProbeParams* param_block = (LLReflectionProbeParams*)getParameterEntry(LLNetworkData::PARAMS_REFLECTION_PROBE);
if (param_block)
@@ -3327,11 +3329,14 @@ void LLVOVolume::setReflectionProbeAmbiance(F32 ambiance)
{
param_block->setAmbiance(ambiance);
parameterChanged(LLNetworkData::PARAMS_REFLECTION_PROBE, true);
+ return true;
}
}
+
+ return false;
}
-void LLVOVolume::setReflectionProbeNearClip(F32 near_clip)
+bool LLVOVolume::setReflectionProbeNearClip(F32 near_clip)
{
LLReflectionProbeParams* param_block = (LLReflectionProbeParams*)getParameterEntry(LLNetworkData::PARAMS_REFLECTION_PROBE);
if (param_block)
@@ -3340,11 +3345,14 @@ void LLVOVolume::setReflectionProbeNearClip(F32 near_clip)
{
param_block->setClipDistance(near_clip);
parameterChanged(LLNetworkData::PARAMS_REFLECTION_PROBE, true);
+ return true;
}
}
+
+ return false;
}
-void LLVOVolume::setReflectionProbeIsBox(bool is_box)
+bool LLVOVolume::setReflectionProbeIsBox(bool is_box)
{
LLReflectionProbeParams* param_block = (LLReflectionProbeParams*)getParameterEntry(LLNetworkData::PARAMS_REFLECTION_PROBE);
if (param_block)
@@ -3353,11 +3361,14 @@ void LLVOVolume::setReflectionProbeIsBox(bool is_box)
{
param_block->setIsBox(is_box);
parameterChanged(LLNetworkData::PARAMS_REFLECTION_PROBE, true);
+ return true;
}
}
+
+ return false;
}
-void LLVOVolume::setReflectionProbeIsDynamic(bool is_dynamic)
+bool LLVOVolume::setReflectionProbeIsDynamic(bool is_dynamic)
{
LLReflectionProbeParams* param_block = (LLReflectionProbeParams*)getParameterEntry(LLNetworkData::PARAMS_REFLECTION_PROBE);
if (param_block)
@@ -3366,8 +3377,11 @@ void LLVOVolume::setReflectionProbeIsDynamic(bool is_dynamic)
{
param_block->setIsDynamic(is_dynamic);
parameterChanged(LLNetworkData::PARAMS_REFLECTION_PROBE, true);
+ return true;
}
}
+
+ return false;
}
F32 LLVOVolume::getReflectionProbeAmbiance() const
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 2c269d745d..1c44ddfc5d 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -295,11 +295,11 @@ public:
F32 getLightCutoff() const;
// Reflection Probes
- void setIsReflectionProbe(BOOL is_probe);
- void setReflectionProbeAmbiance(F32 ambiance);
- void setReflectionProbeNearClip(F32 near_clip);
- void setReflectionProbeIsBox(bool is_box);
- void setReflectionProbeIsDynamic(bool is_dynamic);
+ bool setIsReflectionProbe(BOOL is_probe);
+ bool setReflectionProbeAmbiance(F32 ambiance);
+ bool setReflectionProbeNearClip(F32 near_clip);
+ bool setReflectionProbeIsBox(bool is_box);
+ bool setReflectionProbeIsDynamic(bool is_dynamic);
BOOL isReflectionProbe() const override;
F32 getReflectionProbeAmbiance() const;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 1dc979fda6..270fa492de 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -12019,4 +12019,16 @@ Unpacking: [UNPACK_TIME]s [USIZE]KB
type="notifytip">
Material successfully created. Asset ID: [ASSET_ID]
</notification>
+
+ <notification
+ icon="notifytip.tga"
+ name="ReflectionProbeApplied"
+ persist="true"
+ type="alertmodal">
+ Your object has been set to the default Reflection Probe state, which is an invisible, phantom, 5m sphere. To learn more about Reflection Probes and how to use them, see the Knowledge Base.
+ <usetemplate ignoretext="Reflection Probe tips"
+ name="okignore"
+ yestext="OK"/>
+ </notification>
+
</notifications>