Commits

Stinson Linden committed 6aeba68

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.

Comments (0)

Files changed (7)

indra/newview/llfloaterpathfindinglinksets.cpp

 	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;
 {
 	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

indra/newview/llfloaterpathfindinglinksets.h

 	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();

indra/newview/llpathfindinglinkset.cpp

 	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)));

indra/newview/llpathfindinglinkset.h

 	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;
 

indra/newview/llpathfindinglinksetlist.cpp

 	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;

indra/newview/llpathfindinglinksetlist.h

 	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,

indra/newview/skins/default/xui/en/notifications.xml

 
   <notification
    icon="alertmodal.tga"
-   name="PathfindingLinksets_SetLinksetUseMismatchOnRestricted"
-   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.
+   name="PathfindingLinksets_WarnOnPhantom"
+   type="alertmodal">
+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."
 
   <notification
    icon="alertmodal.tga"
-   name="PathfindingLinksets_SetLinksetUseMismatchOnVolume"
-   type="alertmodal">
-    Some selected linksets cannot be set to be '[REQUESTED_TYPE]' because the shape is non-convex.
+   name="PathfindingLinksets_MismatchOnVolume"
+   type="alertmodal">
+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"
 
   <notification
    icon="alertmodal.tga"
-   name="PathfindingLinksets_SetLinksetUseMismatchOnRestrictedAndVolume"
-   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.
+   name="PathfindingLinksets_WarnOnPhantom_MismatchOnRestricted"
+   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.
+
+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."
 
   <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"
    type="alertmodal">
     The selected object affects the navmesh.  Changing it to a Flexible Path will remove it from the navmesh.