diff options
Diffstat (limited to 'indra/newview/llfloaterpathfindinglinksets.cpp')
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.cpp | 605 |
1 files changed, 328 insertions, 277 deletions
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 11211feb43..e24703aca6 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -36,6 +36,7 @@ #include "llfloaterreg.h"
#include "lltextbase.h"
#include "lllineeditor.h"
+#include "llscrolllistitem.h"
#include "llscrolllistctrl.h"
#include "llcheckboxctrl.h"
#include "llbutton.h"
@@ -44,29 +45,43 @@ #include "llhttpclient.h"
#include "lluuid.h"
-//#define XXX_STINSON_USE_FAKE_DATA
-#ifdef XXX_STINSON_USE_FAKE_DATA
-#include "llviewerobject.h"
-#include "llviewerobjectlist.h"
-#endif // XXX_STINSON_USE_FAKE_DATA
+//---------------------------------------------------------------------------
+// NavMeshDataGetResponder
+//---------------------------------------------------------------------------
+
+class NavMeshDataGetResponder : public LLHTTPClient::Responder
+{
+public:
+ NavMeshDataGetResponder(const std::string& pNavMeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater);
+ virtual ~NavMeshDataGetResponder();
+
+ virtual void result(const LLSD& pContent);
+ virtual void error(U32 pStatus, const std::string& pReason);
+
+private:
+ NavMeshDataGetResponder(const NavMeshDataGetResponder& pOther);
+
+ std::string mNavMeshDataGetURL;
+ LLFloaterPathfindingLinksets *mLinksetsFloater;
+};
//---------------------------------------------------------------------------
-// NavmeshDataGetResponder
+// NavMeshDataPutResponder
//---------------------------------------------------------------------------
-class NavmeshDataGetResponder : public LLHTTPClient::Responder
+class NavMeshDataPutResponder : public LLHTTPClient::Responder
{
public:
- NavmeshDataGetResponder(const std::string& pNavmeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater);
- virtual ~NavmeshDataGetResponder();
+ NavMeshDataPutResponder(const std::string& pNavMeshDataPutURL, LLFloaterPathfindingLinksets *pLinksetsFloater);
+ virtual ~NavMeshDataPutResponder();
virtual void result(const LLSD& pContent);
virtual void error(U32 pStatus, const std::string& pReason);
private:
- NavmeshDataGetResponder(const NavmeshDataGetResponder& pOther);
+ NavMeshDataPutResponder(const NavMeshDataPutResponder& pOther);
- std::string mNavmeshDataGetURL;
+ std::string mNavMeshDataPutURL;
LLFloaterPathfindingLinksets *mLinksetsFloater;
};
@@ -74,7 +89,7 @@ private: // PathfindingLinkset
//---------------------------------------------------------------------------
-PathfindingLinkset::PathfindingLinkset(const std::string &pUUID, const LLSD& pNavmeshItem)
+PathfindingLinkset::PathfindingLinkset(const std::string &pUUID, const LLSD& pNavMeshItem)
: mUUID(pUUID),
mName(),
mDescription(),
@@ -83,55 +98,55 @@ PathfindingLinkset::PathfindingLinkset(const std::string &pUUID, const LLSD& pNa mIsFixed(false),
mIsWalkable(false),
mIsPhantom(false),
- mA(0.0f),
- mB(0.0f),
- mC(0.0f),
- mD(0.0f)
+ mA(0),
+ mB(0),
+ mC(0),
+ mD(0)
{
- llassert(pNavmeshItem.has("name"));
- llassert(pNavmeshItem.get("name").isString());
- mName = pNavmeshItem.get("name").asString();
+ llassert(pNavMeshItem.has("name"));
+ llassert(pNavMeshItem.get("name").isString());
+ mName = pNavMeshItem.get("name").asString();
- llassert(pNavmeshItem.has("description"));
- llassert(pNavmeshItem.get("description").isString());
- mDescription = pNavmeshItem.get("description").asString();
+ llassert(pNavMeshItem.has("description"));
+ llassert(pNavMeshItem.get("description").isString());
+ mDescription = pNavMeshItem.get("description").asString();
- llassert(pNavmeshItem.has("landimpact"));
- llassert(pNavmeshItem.get("landimpact").isInteger());
- llassert(pNavmeshItem.get("landimpact").asInteger() >= 0);
- mLandImpact = pNavmeshItem.get("landimpact").asInteger();
+ llassert(pNavMeshItem.has("landimpact"));
+ llassert(pNavMeshItem.get("landimpact").isInteger());
+ llassert(pNavMeshItem.get("landimpact").asInteger() >= 0);
+ mLandImpact = pNavMeshItem.get("landimpact").asInteger();
- llassert(pNavmeshItem.has("fixed"));
- llassert(pNavmeshItem.get("fixed").isBoolean());
- mIsFixed = pNavmeshItem.get("fixed").asBoolean();
+ llassert(pNavMeshItem.has("permanent"));
+ llassert(pNavMeshItem.get("permanent").isBoolean());
+ mIsFixed = pNavMeshItem.get("permanent").asBoolean();
- llassert(pNavmeshItem.has("walkable"));
- llassert(pNavmeshItem.get("walkable").isBoolean());
- mIsWalkable = pNavmeshItem.get("walkable").asBoolean();
+ llassert(pNavMeshItem.has("walkable"));
+ llassert(pNavMeshItem.get("walkable").isBoolean());
+ mIsWalkable = pNavMeshItem.get("walkable").asBoolean();
- llassert(pNavmeshItem.has("phantom"));
- //llassert(pNavmeshItem.get("phantom").isBoolean()); XXX stinson 01/10/2012: this should be a boolean but is not
- mIsPhantom = pNavmeshItem.get("phantom").asBoolean();
+ llassert(pNavMeshItem.has("phantom"));
+ //llassert(pNavMeshItem.get("phantom").isBoolean()); XXX stinson 01/10/2012: this should be a boolean but is not
+ mIsPhantom = pNavMeshItem.get("phantom").asBoolean();
- llassert(pNavmeshItem.has("A"));
- llassert(pNavmeshItem.get("A").isReal());
- mA = pNavmeshItem.get("A").asReal();
+ llassert(pNavMeshItem.has("A"));
+ llassert(pNavMeshItem.get("A").isReal());
+ mA = llround(pNavMeshItem.get("A").asReal() * 100.0f);
- llassert(pNavmeshItem.has("B"));
- llassert(pNavmeshItem.get("B").isReal());
- mB = pNavmeshItem.get("B").asReal();
+ llassert(pNavMeshItem.has("B"));
+ llassert(pNavMeshItem.get("B").isReal());
+ mB = llround(pNavMeshItem.get("B").asReal() * 100.0f);
- llassert(pNavmeshItem.has("C"));
- llassert(pNavmeshItem.get("C").isReal());
- mC = pNavmeshItem.get("C").asReal();
+ llassert(pNavMeshItem.has("C"));
+ llassert(pNavMeshItem.get("C").isReal());
+ mC = llround(pNavMeshItem.get("C").asReal() * 100.0f);
- llassert(pNavmeshItem.has("D"));
- llassert(pNavmeshItem.get("D").isReal());
- mD = pNavmeshItem.get("D").asReal();
+ llassert(pNavMeshItem.has("D"));
+ llassert(pNavMeshItem.get("D").isReal());
+ mD = llround(pNavMeshItem.get("D").asReal() * 100.0f);
- llassert(pNavmeshItem.has("position"));
- llassert(pNavmeshItem.get("position").isArray());
- mLocation.setValue(pNavmeshItem.get("position"));
+ llassert(pNavMeshItem.has("position"));
+ llassert(pNavMeshItem.get("position").isArray());
+ mLocation.setValue(pNavMeshItem.get("position"));
}
PathfindingLinkset::PathfindingLinkset(const PathfindingLinkset& pOther)
@@ -227,42 +242,42 @@ void PathfindingLinkset::setPhantom(BOOL pIsPhantom) mIsPhantom = pIsPhantom;
}
-F32 PathfindingLinkset::getA() const
+S32 PathfindingLinkset::getA() const
{
return mA;
}
-void PathfindingLinkset::setA(F32 pA)
+void PathfindingLinkset::setA(S32 pA)
{
mA = pA;
}
-F32 PathfindingLinkset::getB() const
+S32 PathfindingLinkset::getB() const
{
return mB;
}
-void PathfindingLinkset::setB(F32 pB)
+void PathfindingLinkset::setB(S32 pB)
{
mB = pB;
}
-F32 PathfindingLinkset::getC() const
+S32 PathfindingLinkset::getC() const
{
return mC;
}
-void PathfindingLinkset::setC(F32 pC)
+void PathfindingLinkset::setC(S32 pC)
{
mC = pC;
}
-F32 PathfindingLinkset::getD() const
+S32 PathfindingLinkset::getD() const
{
return mD;
}
-void PathfindingLinkset::setD(F32 pD)
+void PathfindingLinkset::setD(S32 pD)
{
mD = pD;
}
@@ -359,7 +374,7 @@ PathfindingLinksets::PathfindingLinksets() {
}
-PathfindingLinksets::PathfindingLinksets(const LLSD& pNavmeshData)
+PathfindingLinksets::PathfindingLinksets(const LLSD& pNavMeshData)
: mAllLinksets(),
mFilteredLinksets(),
mIsFiltersDirty(false),
@@ -368,7 +383,7 @@ PathfindingLinksets::PathfindingLinksets(const LLSD& pNavmeshData) mIsFixedFilter(false),
mIsWalkableFilter(false)
{
- parseNavmeshData(pNavmeshData);
+ parseNavMeshData(pNavMeshData);
}
PathfindingLinksets::PathfindingLinksets(const PathfindingLinksets& pOther)
@@ -387,12 +402,12 @@ PathfindingLinksets::~PathfindingLinksets() clearLinksets();
}
-void PathfindingLinksets::parseNavmeshData(const LLSD& pNavmeshData)
+void PathfindingLinksets::parseNavMeshData(const LLSD& pNavMeshData)
{
clearLinksets();
- for (LLSD::map_const_iterator linksetIter = pNavmeshData.beginMap();
- linksetIter != pNavmeshData.endMap(); ++linksetIter)
+ for (LLSD::map_const_iterator linksetIter = pNavMeshData.beginMap();
+ linksetIter != pNavMeshData.endMap(); ++linksetIter)
{
const std::string& uuid(linksetIter->first);
const LLSD& linksetData = linksetIter->second;
@@ -560,27 +575,42 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mEditPhantom = findChild<LLCheckBoxCtrl>("edit_phantom_value");
llassert(mEditPhantom != NULL);
+ mLabelWalkabilityCoefficients = findChild<LLTextBase>("walkability_coefficients_label");
+ llassert(mLabelWalkabilityCoefficients != NULL);
+
+ mLabelEditA = findChild<LLTextBase>("edit_a_label");
+ llassert(mLabelEditA != NULL);
+
+ mLabelEditB = findChild<LLTextBase>("edit_b_label");
+ llassert(mLabelEditB != NULL);
+
+ mLabelEditC = findChild<LLTextBase>("edit_c_label");
+ llassert(mLabelEditC != NULL);
+
+ mLabelEditD = findChild<LLTextBase>("edit_d_label");
+ llassert(mLabelEditD != NULL);
+
mEditA = findChild<LLLineEditor>("edit_a_value");
llassert(mEditA != NULL);
- mEditA->setPrevalidate(LLTextValidate::validateFloat);
+ mEditA->setPrevalidate(LLTextValidate::validatePositiveS32);
mEditB = findChild<LLLineEditor>("edit_b_value");
llassert(mEditB != NULL);
- mEditB->setPrevalidate(LLTextValidate::validateFloat);
+ mEditB->setPrevalidate(LLTextValidate::validatePositiveS32);
mEditC = findChild<LLLineEditor>("edit_c_value");
llassert(mEditC != NULL);
- mEditC->setPrevalidate(LLTextValidate::validateFloat);
+ mEditC->setPrevalidate(LLTextValidate::validatePositiveS32);
mEditD = findChild<LLLineEditor>("edit_d_value");
llassert(mEditD != NULL);
- mEditD->setPrevalidate(LLTextValidate::validateFloat);
+ mEditD->setPrevalidate(LLTextValidate::validatePositiveS32);
mApplyEdits = findChild<LLButton>("apply_edit_values");
llassert(mApplyEdits != NULL);
mApplyEdits->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyChangesClicked, this));
- mApplyEdits->setEnabled(false);
+ setEnableEditFields(false);
setFetchState(kFetchInitial);
return LLFloater::postBuild();
@@ -588,7 +618,7 @@ BOOL LLFloaterPathfindingLinksets::postBuild() void LLFloaterPathfindingLinksets::onOpen(const LLSD& pKey)
{
- sendNavmeshDataGetRequest();
+ sendNavMeshDataGetRequest();
}
void LLFloaterPathfindingLinksets::openLinksetsEditor()
@@ -632,6 +662,12 @@ LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) mFilterByWalkable(NULL),
mEditFixed(NULL),
mEditWalkable(NULL),
+ mEditPhantom(NULL),
+ mLabelWalkabilityCoefficients(NULL),
+ mLabelEditA(NULL),
+ mLabelEditB(NULL),
+ mLabelEditC(NULL),
+ mLabelEditD(NULL),
mEditA(NULL),
mEditB(NULL),
mEditC(NULL),
@@ -644,143 +680,8 @@ LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets() {
}
-void LLFloaterPathfindingLinksets::sendNavmeshDataGetRequest()
-{
-#ifdef XXX_STINSON_USE_FAKE_DATA
- LLSD allData;
-
- const std::string firstUUID(gObjectList.getObject(0)->getID().asString());
- LLSD firstData;
- firstData["name"] = "Curabitur malesuada";
- firstData["description"] = "Accusam nominavi contentiones per ad";
- firstData["landimpact"] = S32(57);
- firstData["fixed"] = bool(false);
- firstData["walkable"] = bool(false);
- firstData["phantom"] = bool(false);
- firstData["A"] = F32(37.5f);
- firstData["B"] = F32(7.8f);
- firstData["C"] = F32(98.6f);
- firstData["D"] = F32(0.0f);
- LLVector3 firstLocation(135.0f, 57.0f, 2.0f);
- firstData["position"] = firstLocation.getValue();
-
- const std::string secondUUID(gObjectList.getObject(1)->getID().asString());
- LLSD secondData;
- secondData["name"] = "At tota";
- secondData["description"] = "His ad placerat tincidun";
- secondData["landimpact"] = S32(2);
- secondData["fixed"] = bool(false);
- secondData["walkable"] = bool(false);
- secondData["phantom"] = bool(true);
- secondData["A"] = F32(30.5f);
- secondData["B"] = F32(70.8f);
- secondData["C"] = F32(100.0f);
- secondData["D"] = F32(0.1f);
- LLVector3 secondLocation(15.0f, 157.0f, 22.0f);
- secondData["position"] = secondLocation.getValue();
-
- const std::string thirdUUID(gObjectList.getObject(2)->getID().asString());
- LLSD thirdData;
- thirdData["name"] = "No soleat";
- thirdData["description"] = "";
- thirdData["landimpact"] = S32(200);
- thirdData["fixed"] = bool(false);
- thirdData["walkable"] = bool(true);
- thirdData["phantom"] = bool(false);
- thirdData["A"] = F32(58.5f);
- thirdData["B"] = F32(8.0f);
- thirdData["C"] = F32(2.0f);
- thirdData["D"] = F32(15.5f);
- LLVector3 thirdLocation(577.0f, 14.0f, -14.5f);
- thirdData["position"] = thirdLocation.getValue();
-
- const std::string fourthUUID(gObjectList.getObject(3)->getID().asString());
- LLSD fourthData;
- fourthData["name"] = "Paulo tritani bonorum";
- fourthData["description"] = "Vis verear impetus";
- fourthData["landimpact"] = S32(56);
- fourthData["fixed"] = bool(false);
- fourthData["walkable"] = bool(true);
- fourthData["phantom"] = bool(true);
- fourthData["A"] = F32(100.0f);
- fourthData["B"] = F32(100.0f);
- fourthData["C"] = F32(0.0f);
- fourthData["D"] = F32(0.0f);
- LLVector3 fourthLocation(215.0f, 57.0f, 5.0f);
- fourthData["position"] = fourthLocation.getValue();
-
- const std::string fifthUUID(gObjectList.getObject(4)->getID().asString());
- LLSD fifthData;
- fifthData["name"] = "Curabitur malesuada";
- fifthData["description"] = "Reque possit philosophia";
- fifthData["landimpact"] = S32(20);
- fifthData["fixed"] = bool(true);
- fifthData["walkable"] = bool(false);
- fifthData["phantom"] = bool(false);
- fifthData["A"] = F32(37.5f);
- fifthData["B"] = F32(7.8f);
- fifthData["C"] = F32(98.6f);
- fifthData["D"] = F32(0.0f);
- LLVector3 fifthLocation(135.0f, 57.0f, 2.0f);
- fifthData["position"] = fifthLocation.getValue();
-
- const std::string sixthUUID(gObjectList.getObject(5)->getID().asString());
- LLSD sixthData;
- sixthData["name"] = "At tota";
- sixthData["description"] = "Usu no aliquid dignissim";
- sixthData["landimpact"] = S32(257);
- sixthData["fixed"] = bool(true);
- sixthData["walkable"] = bool(false);
- sixthData["phantom"] = bool(true);
- sixthData["A"] = F32(0.0f);
- sixthData["B"] = F32(0.0f);
- sixthData["C"] = F32(100.0f);
- sixthData["D"] = F32(0.1f);
- LLVector3 sixthLocation(315.0f, 57.0f, 12.0f);
- sixthData["position"] = sixthLocation.getValue();
-
- const std::string seventhUUID(gObjectList.getObject(6)->getID().asString());
- LLSD seventhData;
- seventhData["name"] = "No soleat";
- seventhData["description"] = "honestatis";
- seventhData["landimpact"] = S32(25);
- seventhData["fixed"] = bool(true);
- seventhData["walkable"] = bool(true);
- seventhData["phantom"] = bool(false);
- seventhData["A"] = F32(55.4f);
- seventhData["B"] = F32(27.12f);
- seventhData["C"] = F32(32.5f);
- seventhData["D"] = F32(15.5f);
- LLVector3 seventhLocation(7.0f, 0.0f, 0.0f);
- seventhData["position"] = seventhLocation.getValue();
-
- const std::string eigthUUID(gObjectList.getObject(7)->getID().asString());
- LLSD eigthData;
- eigthData["name"] = "Sea te aliquam";
- eigthData["description"] = "";
- eigthData["landimpact"] = S32(17);
- eigthData["fixed"] = bool(true);
- eigthData["walkable"] = bool(true);
- eigthData["phantom"] = bool(true);
- eigthData["A"] = F32(10.0f);
- eigthData["B"] = F32(10.0f);
- eigthData["C"] = F32(50.0f);
- eigthData["D"] = F32(60.0f);
- LLVector3 eigthLocation(25.0f, 7.0f, 5.0f);
- eigthData["position"] = eigthLocation.getValue();
-
- allData[firstUUID] = firstData;
- allData[secondUUID] = secondData;
- allData[thirdUUID] = thirdData;
- allData[fourthUUID] = fourthData;
- allData[fifthUUID] = fifthData;
- allData[sixthUUID] = sixthData;
- allData[seventhUUID] = seventhData;
- allData[eigthUUID] = eigthData;
-
- handleNavmeshDataGetReply(allData);
-
-#else // XXX_STINSON_USE_FAKE_DATA
+void LLFloaterPathfindingLinksets::sendNavMeshDataGetRequest()
+{
if (isFetchInProgress())
{
if (getFetchState() == kFetchRequestSent)
@@ -794,39 +695,105 @@ void LLFloaterPathfindingLinksets::sendNavmeshDataGetRequest() mPathfindingLinksets.clearLinksets();
updateLinksetsList();
- LLViewerRegion* region = gAgent.getRegion();
- if (region != NULL)
+ std::string navMeshDataURL = getCapabilityURL();
+ if (navMeshDataURL.empty())
{
- std::string navmeshDataURL = region->getCapability("ObjectNavmesh");
- if (navmeshDataURL.empty())
- {
- setFetchState(kFetchComplete);
- llwarns << "cannot query navmesh data from current region '" << region->getName() << "'" << llendl;
- }
- else
- {
- setFetchState(kFetchRequestSent);
- LLHTTPClient::get(navmeshDataURL, new NavmeshDataGetResponder(navmeshDataURL, this));
- }
+ setFetchState(kFetchComplete);
+ llwarns << "cannot query object navmesh properties from current region '" << getRegionName() << "'" << llendl;
+ }
+ else
+ {
+ setFetchState(kFetchRequestSent);
+ LLHTTPClient::get(navMeshDataURL, new NavMeshDataGetResponder(navMeshDataURL, this));
}
}
-#endif
}
-void LLFloaterPathfindingLinksets::handleNavmeshDataGetReply(const LLSD& pNavmeshData)
+void LLFloaterPathfindingLinksets::sendNavMeshDataPutRequest(const LLSD& pPostData)
+{
+ std::string navMeshDataURL = getCapabilityURL();
+ if (navMeshDataURL.empty())
+ {
+ llwarns << "cannot put object navmesh properties for current region '" << getRegionName() << "'" << llendl;
+ }
+ else
+ {
+ LLHTTPClient::put(navMeshDataURL, pPostData, new NavMeshDataPutResponder(navMeshDataURL, this));
+ }
+}
+
+void LLFloaterPathfindingLinksets::handleNavMeshDataGetReply(const LLSD& pNavMeshData)
+{
+ setFetchState(kFetchReceived);
+ mPathfindingLinksets.parseNavMeshData(pNavMeshData);
+ updateLinksetsList();
+ setFetchState(kFetchComplete);
+}
+
+void LLFloaterPathfindingLinksets::handleNavMeshDataGetError(const std::string& pURL, const std::string& pErrorReason)
+{
+ setFetchState(kFetchError);
+ mPathfindingLinksets.clearLinksets();
+ updateLinksetsList();
+ llwarns << "Error fetching object navmesh properties from URL '" << pURL << "' because " << pErrorReason << llendl;
+}
+
+void LLFloaterPathfindingLinksets::handleNavMeshDataPutReply(const LLSD& pModifiedData)
{
setFetchState(kFetchReceived);
- mPathfindingLinksets.parseNavmeshData(pNavmeshData);
+ mPathfindingLinksets.parseNavMeshData(pModifiedData);
updateLinksetsList();
setFetchState(kFetchComplete);
}
-void LLFloaterPathfindingLinksets::handleNavmeshDataGetError(const std::string& pURL, const std::string& pErrorReason)
+void LLFloaterPathfindingLinksets::handleNavMeshDataPutError(const std::string& pURL, const std::string& pErrorReason)
{
setFetchState(kFetchError);
mPathfindingLinksets.clearLinksets();
updateLinksetsList();
- llwarns << "Error fetching navmesh data from URL '" << pURL << "' because " << pErrorReason << llendl;
+ llwarns << "Error putting object navmesh properties to URL '" << pURL << "' because " << pErrorReason << llendl;
+}
+
+std::string LLFloaterPathfindingLinksets::getRegionName() const
+{
+ std::string regionName("");
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region != NULL)
+ {
+ regionName = region->getName();
+ }
+
+ return regionName;
+}
+
+std::string LLFloaterPathfindingLinksets::getCapabilityURL() const
+{
+#ifdef XXX_STINSON_REGION_CAP_RENAME
+ std::string navMeshDataURL("");
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region != NULL)
+ {
+ navMeshDataURL = region->getCapability("ObjectNavMeshProperties");
+ if (navMeshDataURL.empty())
+ {
+ navMeshDataURL = region->getCapability("ObjectNavmesh");
+ }
+ }
+
+ return navMeshDataURL;
+#else // XXX_STINSON_REGION_CAP_RENAME
+ std::string navMeshDataURL("");
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region != NULL)
+ {
+ navMeshDataURL = region->getCapability("ObjectNavMeshProperties");
+ }
+
+ return navMeshDataURL;
+#endif // XXX_STINSON_REGION_CAP_RENAME
}
void LLFloaterPathfindingLinksets::setFetchState(EFetchState pFetchState)
@@ -853,7 +820,7 @@ void LLFloaterPathfindingLinksets::onLinksetsSelectionChange() void LLFloaterPathfindingLinksets::onRefreshLinksetsClicked()
{
- sendNavmeshDataGetRequest();
+ sendNavMeshDataGetRequest();
}
void LLFloaterPathfindingLinksets::onSelectAllLinksetsClicked()
@@ -948,19 +915,19 @@ void LLFloaterPathfindingLinksets::updateLinksetsList() columns[6]["font"] = "SANSSERIF";
columns[7]["column"] = "a_percent";
- columns[7]["value"] = llformat("%2.0f", linkset.getA());
+ columns[7]["value"] = llformat("%3d", linkset.getA());
columns[7]["font"] = "SANSSERIF";
columns[8]["column"] = "b_percent";
- columns[8]["value"] = llformat("%2.0f", linkset.getB());
+ columns[8]["value"] = llformat("%3d", linkset.getB());
columns[8]["font"] = "SANSSERIF";
columns[9]["column"] = "c_percent";
- columns[9]["value"] = llformat("%2.0f", linkset.getC());
+ columns[9]["value"] = llformat("%3d", linkset.getC());
columns[9]["font"] = "SANSSERIF";
columns[10]["column"] = "d_percent";
- columns[10]["value"] = llformat("%2.0f", linkset.getD());
+ columns[10]["value"] = llformat("%3d", linkset.getD());
columns[10]["font"] = "SANSSERIF";
LLSD element;
@@ -1054,7 +1021,7 @@ void LLFloaterPathfindingLinksets::updateEditFields() mEditC->clear();
mEditD->clear();
- mApplyEdits->setEnabled(false);
+ setEnableEditFields(false);
}
else
{
@@ -1072,73 +1039,157 @@ void LLFloaterPathfindingLinksets::updateEditFields() mEditC->setValue(LLSD(linkset.getC()));
mEditD->setValue(LLSD(linkset.getD()));
- mApplyEdits->setEnabled(true);
+ setEnableEditFields(true);
}
}
void LLFloaterPathfindingLinksets::applyEditFields()
{
- BOOL isFixedBool = mEditFixed->getValue();
- BOOL isWalkableBool = mEditWalkable->getValue();
- BOOL isPhantomBool = mEditPhantom->getValue();
- const std::string &aString = mEditA->getText();
- const std::string &bString = mEditB->getText();
- const std::string &cString = mEditC->getText();
- const std::string &dString = mEditD->getText();
- F32 aValue = (F32)atof(aString.c_str());
- F32 bValue = (F32)atof(bString.c_str());
- F32 cValue = (F32)atof(cString.c_str());
- F32 dValue = (F32)atof(dString.c_str());
-
- LLSD isFixed = (bool)isFixedBool;
- LLSD isWalkable = (bool)isWalkableBool;
- LLSD isPhantom = (bool)isPhantomBool;
- LLSD a = aValue;
- LLSD b = bValue;
- LLSD c = cValue;
- LLSD d = dValue;
-
- LLSD applyData;
- applyData["fixed"] = isFixed;
- applyData["walkable"] = isWalkable;
- applyData["phantom"] = isPhantom;
- applyData["a"] = a;
- applyData["b"] = b;
- applyData["c"] = c;
- applyData["d"] = d;
-
- llinfos << "Apply changes:" << llendl;
- llinfos << " isFixed: " << isFixed << llendl;
- llinfos << " isWalkable: " << isWalkable << llendl;
- llinfos << " isPhantom: " << isPhantom << llendl;
- llinfos << " a: " << a << llendl;
- llinfos << " b: " << b << llendl;
- llinfos << " c: " << c << llendl;
- llinfos << " d: " << d << llendl;
- llinfos << " applyData: " << applyData << llendl;
+ std::vector<LLScrollListItem*> selectedItems = mLinksetsScrollList->getAllSelected();
+ if (!selectedItems.empty())
+ {
+ BOOL isFixedBool = mEditFixed->getValue();
+ BOOL isWalkableBool = mEditWalkable->getValue();
+ BOOL isPhantomBool = mEditPhantom->getValue();
+ const std::string &aString = mEditA->getText();
+ const std::string &bString = mEditB->getText();
+ const std::string &cString = mEditC->getText();
+ const std::string &dString = mEditD->getText();
+ S32 aValue = static_cast<S32>(atoi(aString.c_str()));
+ S32 bValue = static_cast<S32>(atoi(bString.c_str()));
+ S32 cValue = static_cast<S32>(atoi(cString.c_str()));
+ S32 dValue = static_cast<S32>(atoi(dString.c_str()));
+
+ LLSD isFixed = (bool)isFixedBool;
+ LLSD isWalkable = (bool)isWalkableBool;
+ LLSD isPhantom = (bool)isPhantomBool;
+ LLSD a = static_cast<F32>(aValue) / 100.0f;
+ LLSD b = static_cast<F32>(bValue) / 100.0f;
+ LLSD c = static_cast<F32>(cValue) / 100.0f;
+ LLSD d = static_cast<F32>(dValue) / 100.0f;
+
+ const PathfindingLinksets::PathfindingLinksetMap &linksetsMap = mPathfindingLinksets.getAllLinksets();
+
+ LLSD editData;
+ for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
+ itemIter != selectedItems.end(); ++itemIter)
+ {
+ const LLScrollListItem *listItem = *itemIter;
+ LLUUID uuid = listItem->getUUID();
+
+ const PathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetsMap.find(uuid.asString());
+ const PathfindingLinkset &linkset = linksetIter->second;
+
+ LLSD itemData;
+ if (linkset.isFixed() != isFixedBool)
+ {
+ itemData["permanent"] = isFixed;
+ }
+ if (linkset.isWalkable() != isWalkableBool)
+ {
+ itemData["walkable"] = isWalkable;
+ }
+ if (linkset.isPhantom() != isPhantomBool)
+ {
+ itemData["phantom"] = isPhantom;
+ }
+ if (linkset.getA() != aValue)
+ {
+ itemData["A"] = a;
+ }
+ if (linkset.getB() != bValue)
+ {
+ itemData["B"] = b;
+ }
+ if (linkset.getC() != cValue)
+ {
+ itemData["C"] = c;
+ }
+ if (linkset.getD() != dValue)
+ {
+ itemData["D"] = d;
+ }
+
+ if (!itemData.isUndefined())
+ {
+ editData[uuid.asString()] = itemData;
+ }
+ }
+
+ if (editData.isUndefined())
+ {
+ llwarns << "No PUT data specified" << llendl;
+ }
+ else
+ {
+ sendNavMeshDataPutRequest(editData);
+ }
+ }
+}
+
+void LLFloaterPathfindingLinksets::setEnableEditFields(BOOL pEnabled)
+{
+ mEditFixed->setEnabled(pEnabled);
+ mEditWalkable->setEnabled(pEnabled);
+ mEditPhantom->setEnabled(pEnabled);
+ mLabelWalkabilityCoefficients->setEnabled(pEnabled);
+ mLabelEditA->setEnabled(pEnabled);
+ mLabelEditB->setEnabled(pEnabled);
+ mLabelEditC->setEnabled(pEnabled);
+ mLabelEditD->setEnabled(pEnabled);
+ mEditA->setEnabled(pEnabled);
+ mEditB->setEnabled(pEnabled);
+ mEditC->setEnabled(pEnabled);
+ mEditD->setEnabled(pEnabled);
+ mApplyEdits->setEnabled(pEnabled);
+}
+
+//---------------------------------------------------------------------------
+// NavMeshDataGetResponder
+//---------------------------------------------------------------------------
+
+NavMeshDataGetResponder::NavMeshDataGetResponder(const std::string& pNavMeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater)
+ : mNavMeshDataGetURL(pNavMeshDataGetURL),
+ mLinksetsFloater(pLinksetsFloater)
+{
+}
+
+NavMeshDataGetResponder::~NavMeshDataGetResponder()
+{
+ mLinksetsFloater = NULL;
+}
+
+void NavMeshDataGetResponder::result(const LLSD& pContent)
+{
+ mLinksetsFloater->handleNavMeshDataGetReply(pContent);
+}
+
+void NavMeshDataGetResponder::error(U32 status, const std::string& reason)
+{
+ mLinksetsFloater->handleNavMeshDataGetError(mNavMeshDataGetURL, reason);
}
//---------------------------------------------------------------------------
-// NavmeshDataGetResponder
+// NavMeshDataPutResponder
//---------------------------------------------------------------------------
-NavmeshDataGetResponder::NavmeshDataGetResponder(const std::string& pNavmeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater)
- : mNavmeshDataGetURL(pNavmeshDataGetURL),
+NavMeshDataPutResponder::NavMeshDataPutResponder(const std::string& pNavMeshDataPutURL, LLFloaterPathfindingLinksets *pLinksetsFloater)
+ : mNavMeshDataPutURL(pNavMeshDataPutURL),
mLinksetsFloater(pLinksetsFloater)
{
}
-NavmeshDataGetResponder::~NavmeshDataGetResponder()
+NavMeshDataPutResponder::~NavMeshDataPutResponder()
{
mLinksetsFloater = NULL;
}
-void NavmeshDataGetResponder::result(const LLSD& pContent)
+void NavMeshDataPutResponder::result(const LLSD& pContent)
{
- mLinksetsFloater->handleNavmeshDataGetReply(pContent);
+ mLinksetsFloater->handleNavMeshDataPutReply(pContent);
}
-void NavmeshDataGetResponder::error(U32 status, const std::string& reason)
+void NavMeshDataPutResponder::error(U32 status, const std::string& reason)
{
- mLinksetsFloater->handleNavmeshDataGetError(mNavmeshDataGetURL, reason);
+ mLinksetsFloater->handleNavMeshDataPutError(mNavMeshDataPutURL, reason);
}
|