From 6ee41cfe1425c62bb1c1ac04c0f4dc4810675397 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 15 Feb 2012 16:48:50 -0800 Subject: PATH-284: Adding first pass for toggling state for frozen/unfrozen modes. --- indra/newview/llfloaterpathfindingconsole.cpp | 155 +++++++++++++++++++-- indra/newview/llfloaterpathfindingconsole.h | 15 ++ .../default/xui/en/floater_pathfinding_console.xml | 39 +++--- 3 files changed, 179 insertions(+), 30 deletions(-) diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 728efc52a4..1b948c442b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -70,10 +70,6 @@ LLHandle LLFloaterPathfindingConsole::sInstanceHand BOOL LLFloaterPathfindingConsole::postBuild() { - childSetAction("view_characters_floater", boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); - childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - childSetAction("clear_path", boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); - mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); @@ -97,12 +93,37 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mShowWorldCheckBox != NULL); mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); + mViewCharactersButton = findChild("view_characters_floater"); + llassert(mViewCharactersButton != NULL); + mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); mEditTestTabContainer = findChild("edit_test_tab_container"); llassert(mEditTestTabContainer != NULL); + mUnfreezeLabel = findChild("unfreeze_label"); + llassert(mUnfreezeLabel != NULL); + + mUnfreezeButton = findChild("enter_unfrozen_mode"); + llassert(mUnfreezeButton != NULL); + mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onUnfreezeClicked, this)); + + mLinksetsLabel = findChild("edit_linksets_label"); + llassert(mLinksetsLabel != NULL); + + mLinksetsButton = findChild("view_and_edit_linksets"); + llassert(mLinksetsButton != NULL); + mLinksetsButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + + mFreezeLabel = findChild("freeze_label"); + llassert(mFreezeLabel != NULL); + + mFreezeButton = findChild("enter_frozen_mode"); + llassert(mFreezeButton != NULL); + mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onFreezeClicked, this)); + + mPathfindingStatus = findChild("pathfinding_status"); + llassert(mPathfindingStatus != NULL); + mCharacterWidthSlider = findChild("character_width"); llassert(mCharacterWidthSlider != NULL); mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); @@ -113,6 +134,12 @@ BOOL LLFloaterPathfindingConsole::postBuild() mPathTestingStatus = findChild("path_test_status"); llassert(mPathTestingStatus != NULL); + + mClearPathButton = findChild("clear_path"); + llassert(mClearPathButton != NULL); + mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + + updateOnPathfindingServerStatus(); updatePathTestStatus(); return LLFloater::postBuild(); @@ -237,8 +264,8 @@ void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) mShowWorldCheckBox->set(pIsRenderWorld); } -LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const -{ +LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const +{ ERenderHeatmapType renderHeatmapType; switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) @@ -265,10 +292,10 @@ LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::get } return renderHeatmapType; -} - -void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) -{ +} + +void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) +{ LLSD comboBoxValue; switch (pRenderHeatmapType) @@ -295,7 +322,7 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRende } return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); -} +} F32 LLFloaterPathfindingConsole::getCharacterWidth() const { @@ -390,13 +417,22 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowExclusionVolumesCheckBox(NULL), mShowWorldCheckBox(NULL), mPathfindingStatus(NULL), + mViewCharactersButton(NULL), mEditTestTabContainer(NULL), + mUnfreezeLabel(NULL), + mUnfreezeButton(NULL), + mLinksetsLabel(NULL), + mLinksetsButton(NULL), + mFreezeLabel(NULL), + mFreezeButton(NULL), mCharacterWidthSlider(NULL), mCharacterTypeRadioGroup(NULL), mPathTestingStatus(NULL), + mClearPathButton(NULL), mNavMeshCnt(0), mHasStartPoint(false), - mHasEndPoint(false) + mHasEndPoint(false), + mIsRegionFrozen(false) { mSelfHandle.bind(this); @@ -478,6 +514,21 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } } } + + updateOnPathfindingServerStatus(); +} + +std::string LLFloaterPathfindingConsole::getCurrentRegionCapabilityURL() const +{ + std::string capURL(""); + + LLViewerRegion *region = gAgent.getRegion(); + if (region != NULL) + { + capURL = region->getCapability("RetrieveNavMeshSrc"); + } + + return capURL; } void LLFloaterPathfindingConsole::onShowWalkabilitySet() @@ -573,6 +624,20 @@ void LLFloaterPathfindingConsole::onViewCharactersClicked() LLFloaterPathfindingCharacters::openCharactersViewer(); } +void LLFloaterPathfindingConsole::onUnfreezeClicked() +{ + mIsRegionFrozen = false; + updateOnPathfindingServerStatus(); + llwarns << "functionality has not yet been implemented to set unfrozen state" << llendl; +} + +void LLFloaterPathfindingConsole::onFreezeClicked() +{ + mIsRegionFrozen = true; + updateOnPathfindingServerStatus(); + llwarns << "functionality has not yet been implemented to set frozen state" << llendl; +} + void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); @@ -585,6 +650,68 @@ void LLFloaterPathfindingConsole::onClearPathClicked() updatePathTestStatus(); } +void LLFloaterPathfindingConsole::updateOnPathfindingServerStatus() +{ + std::string capURL = getCurrentRegionCapabilityURL(); + + if (capURL.empty()) + { + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(FALSE); + mEditTestTabContainer->setEnabled(FALSE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeRadioGroup->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + + mEditTestTabContainer->selectTab(0); + } + else + { + mShowNavMeshCheckBox->setEnabled(TRUE); + mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); + mShowWalkablesCheckBox->setEnabled(TRUE); + mShowStaticObstaclesCheckBox->setEnabled(TRUE); + mShowMaterialVolumesCheckBox->setEnabled(TRUE); + mShowExclusionVolumesCheckBox->setEnabled(TRUE); + mShowWorldCheckBox->setEnabled(TRUE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->setEnabled(TRUE); + mCharacterWidthSlider->setEnabled(TRUE); + mCharacterTypeRadioGroup->setEnabled(TRUE); + mClearPathButton->setEnabled(TRUE); + if (mIsRegionFrozen) + { + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + } + else + { + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(TRUE); + mLinksetsButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + } + } +} + void LLFloaterPathfindingConsole::generatePath() { if (mHasStartPoint && mHasEndPoint) diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 726bf36636..10fcf26795 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -41,6 +41,7 @@ class LLTextBase; class LLCheckBoxCtrl; class LLTabContainer; class LLComboBox; +class LLButton; class LLFloaterPathfindingConsole : public LLFloater @@ -113,15 +114,20 @@ private: virtual ~LLFloaterPathfindingConsole(); virtual void onOpen(const LLSD& pKey); + std::string getCurrentRegionCapabilityURL() const; void onShowWalkabilitySet(); void onShowWorldToggle(); void onCharacterWidthSet(); void onCharacterTypeSwitch(); void onViewCharactersClicked(); + void onUnfreezeClicked(); + void onFreezeClicked(); void onViewEditLinksetClicked(); void onClearPathClicked(); + void updateOnPathfindingServerStatus(); + void generatePath(); void updatePathTestStatus(); @@ -134,10 +140,19 @@ private: LLCheckBoxCtrl *mShowExclusionVolumesCheckBox; LLCheckBoxCtrl *mShowWorldCheckBox; LLTextBase *mPathfindingStatus; + LLButton *mViewCharactersButton; LLTabContainer *mEditTestTabContainer; + LLTextBase *mUnfreezeLabel; + LLButton *mUnfreezeButton; + LLTextBase *mLinksetsLabel; + LLButton *mLinksetsButton; + LLTextBase *mFreezeLabel; + LLButton *mFreezeButton; LLSliderCtrl *mCharacterWidthSlider; LLRadioGroup *mCharacterTypeRadioGroup; LLTextBase *mPathTestingStatus; + LLButton *mClearPathButton; + bool mIsRegionFrozen; LLNavMeshDownloadObserver mNavMeshDownloadObserver[10]; int mCurrentMDO; diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml index 4a41736972..b608e513d5 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -2,7 +2,7 @@ + width="456"> Downloading the navmesh ... Navmesh received. No navmesh for region. - Pathfinding is not enabled for this region. + This region is not enabled for pathfinding. Cannot find pathing library implementation. Please choose start and end points. Please choose start point. @@ -31,7 +31,7 @@ follows="left|top" layout="topleft" left="15" - top="8" + top="9" width="208"> Show: @@ -41,7 +41,7 @@ layout="topleft" left="14" name="show_navmesh" - top_pad="8" + top_pad="7" width="90" /> - Show walkability heatmap: + Show walkability map: + top_pad="8" + width="156"> + height="327" + width="218"> - Permit object / terrain changes: + Allow object / terrain changes: