PATH-856: Adding a new notification to indicate when the user will be toggling the phantom flag of a linkset through the Pathfinding Linksets floater.

master
Todd Stinson 2012-08-14 17:58:26 -07:00
parent 0517f5f487
commit 2e338ef2ef
7 changed files with 141 additions and 15 deletions

View File

@ -500,6 +500,23 @@ bool LLFloaterPathfindingLinksets::isShowUnmodifiablePhantomWarning(LLPathfindin
return isShowWarning;
}
bool LLFloaterPathfindingLinksets::isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
bool isShowWarning = false;
if (pLinksetUse != LLPathfindingLinkset::kUnknown)
{
LLPathfindingObjectListPtr selectedObjects = getSelectedObjects();
if ((selectedObjects != NULL) && !selectedObjects->isEmpty())
{
const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get());
isShowWarning = linksetList->isShowPhantomToggleWarning(pLinksetUse);
}
}
return isShowWarning;
}
bool LLFloaterPathfindingLinksets::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
bool isShowWarning = false;
@ -569,29 +586,41 @@ void LLFloaterPathfindingLinksets::applyEdit()
{
LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse();
bool showPhantomToggleWarning = isShowPhantomToggleWarning(linksetUse);
bool showUnmodifiablePhantomWarning = isShowUnmodifiablePhantomWarning(linksetUse);
bool showCannotBeVolumeWarning = isShowCannotBeVolumeWarning(linksetUse);
if (showUnmodifiablePhantomWarning || showCannotBeVolumeWarning)
if (showPhantomToggleWarning || showUnmodifiablePhantomWarning || showCannotBeVolumeWarning)
{
LLPathfindingLinkset::ELinksetUse restrictedLinksetUse = LLPathfindingLinkset::getLinksetUseWithToggledPhantom(linksetUse);
LLSD substitutions;
substitutions["REQUESTED_TYPE"] = getLinksetUseString(linksetUse);
substitutions["RESTRICTED_TYPE"] = getLinksetUseString(restrictedLinksetUse);
std::string notificationName;
if (showUnmodifiablePhantomWarning && showCannotBeVolumeWarning)
// Build one of the following notifications names
// - PathfindingLinksets_WarnOnPhantom
// - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted
// - PathfindingLinksets_WarnOnPhantom_MismatchOnVolume
// - PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted_MismatchOnVolume
// - PathfindingLinksets_MismatchOnRestricted
// - PathfindingLinksets_MismatchOnVolume
// - PathfindingLinksets_MismatchOnRestricted_MismatchOnVolume
std::string notificationName = "PathfindingLinksets";
if (showPhantomToggleWarning)
{
notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnRestrictedAndVolume";
notificationName += "_WarnOnPhantom";
}
else if (showUnmodifiablePhantomWarning)
if (showUnmodifiablePhantomWarning)
{
notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnRestricted";
notificationName += "_MismatchOnRestricted";
}
else
if (showCannotBeVolumeWarning)
{
notificationName = "PathfindingLinksets_SetLinksetUseMismatchOnVolume";
notificationName += "_MismatchOnVolume";
}
LLNotificationsUtil::add(notificationName, substitutions, LLSD(), boost::bind(&LLFloaterPathfindingLinksets::handleApplyEdit, this, _1, _2));
}
else

View File

@ -84,6 +84,7 @@ private:
LLSD buildLinksetUseScrollListData(const std::string &pLabel, S32 pValue) const;
bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
bool isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
void updateStateOnEditFields();

View File

@ -149,6 +149,11 @@ bool LLPathfindingLinkset::isShowUnmodifiablePhantomWarning(ELinksetUse pLinkset
return (!isModifiable() && (isPhantom() != isPhantom(pLinksetUse)));
}
bool LLPathfindingLinkset::isShowPhantomToggleWarning(ELinksetUse pLinksetUse) const
{
return (isModifiable() && (isPhantom() != isPhantom(pLinksetUse)));
}
bool LLPathfindingLinkset::isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const
{
return (!canBeVolume() && ((pLinksetUse == kMaterialVolume) || (pLinksetUse == kExclusionVolume)));

View File

@ -72,6 +72,7 @@ public:
inline S32 getWalkabilityCoefficientD() const {return mWalkabilityCoefficientD;};
bool isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const;
bool isShowPhantomToggleWarning(ELinksetUse pLinksetUse) const;
bool isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const;
LLSD encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;

View File

@ -113,6 +113,20 @@ bool LLPathfindingLinksetList::isShowUnmodifiablePhantomWarning(LLPathfindingLin
return isShowWarning;
}
bool LLPathfindingLinksetList::isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
bool isShowWarning = false;
for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
{
const LLPathfindingObjectPtr objectPtr = objectIter->second;
const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
isShowWarning = linkset->isShowPhantomToggleWarning(pLinksetUse);
}
return isShowWarning;
}
bool LLPathfindingLinksetList::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
{
bool isShowWarning = false;

View File

@ -43,6 +43,7 @@ public:
LLSD encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
bool isShowPhantomToggleWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
void determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle,

View File

@ -8075,9 +8075,26 @@ The site at &apos;&lt;nolink&gt;[HOST_NAME]&lt;/nolink&gt;&apos; in realm &apos;
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_SetLinksetUseMismatchOnRestricted"
name="PathfindingLinksets_WarnOnPhantom"
type="alertmodal">
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead.
Some selected linksets will have the Phantom flag toggled.
Do you wish to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Some selected linksets phantom flag will be toggled."
name="okcancelignore"
notext="Cancel"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_MismatchOnRestricted"
type="alertmodal">
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead.
Do you wish to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Some selected linksets cannot be set because of permission restrictions on the linkset."
@ -8088,9 +8105,11 @@ The site at &apos;&lt;nolink&gt;[HOST_NAME]&lt;/nolink&gt;&apos; in realm &apos;
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_SetLinksetUseMismatchOnVolume"
name="PathfindingLinksets_MismatchOnVolume"
type="alertmodal">
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because the shape is non-convex.
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because the shape is non-convex.
Do you wish to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Some selected linksets cannot be set because the shape is non-convex"
@ -8101,10 +8120,47 @@ The site at &apos;&lt;nolink&gt;[HOST_NAME]&lt;/nolink&gt;&apos; in realm &apos;
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_SetLinksetUseMismatchOnRestrictedAndVolume"
name="PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted"
type="alertmodal">
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead.
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because the shape is non-convex. These linksets&apos; use types will not change.
Some selected linksets will have the Phantom flag toggled.
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead.
Do you wish to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Some selected linksets phantom flag will be toggled and others cannot be set because of permission restrictions on the linkset."
name="okcancelignore"
notext="Cancel"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_WarnOnPhantom_MismatchOnVolume"
type="alertmodal">
Some selected linksets will have the Phantom flag toggled.
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because the shape is non-convex.
Do you wish to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Some selected linksets phantom flag will be toggled and others cannot be set because the shape is non-convex"
name="okcancelignore"
notext="Cancel"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_MismatchOnRestricted_MismatchOnVolume"
type="alertmodal">
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead.
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because the shape is non-convex. These linksets&apos; use types will not change.
Do you wish to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Some selected linksets cannot be set because of permission restrictions on the linkset and because the shape is non-convex."
@ -8113,6 +8169,25 @@ The site at &apos;&lt;nolink&gt;[HOST_NAME]&lt;/nolink&gt;&apos; in realm &apos;
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted_MismatchOnVolume"
type="alertmodal">
Some selected linksets will have the Phantom flag toggled.
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because of permission restrictions on the linkset. These linksets will be set to be '[RESTRICTED_TYPE]' instead.
Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because the shape is non-convex. These linksets&apos; use types will not change.
Do you wish to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Some selected linksets phantom flag will be toggled and others cannot be set because of permission restrictions on the linkset and because the shape is non-convex."
name="okcancelignore"
notext="Cancel"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="PathfindingLinksets_ChangeToFlexiblePath"