From fb1fa8434a1a84105f67e72fdf72d300be2951bb Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 20 Jun 2012 19:46:28 -0700 Subject: PATH-761: Implementing the new design for the pathfinding view floater. --- indra/newview/llfloaterpathfindingconsole.cpp | 57 ++- indra/newview/llfloaterpathfindingconsole.h | 6 +- indra/newview/llpathfindingmanager.cpp | 5 - indra/newview/llpathfindingmanager.h | 2 - indra/newview/llviewermenu.cpp | 9 - .../default/xui/en/floater_pathfinding_console.xml | 390 +++++++++------------ indra/newview/skins/default/xui/en/menu_viewer.xml | 4 +- 7 files changed, 216 insertions(+), 257 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 89aba6654d..047559fa5d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -65,6 +65,9 @@ #define XUI_CHARACTER_TYPE_C 3 #define XUI_CHARACTER_TYPE_D 4 +#define XUI_VIEW_TAB_INDEX 0 +#define XUI_TEST_TAB_INDEX 1 + #define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) #define CONTROL_NAME_RETRIEVE_NEIGHBOR "RetrieveNeighboringRegion" @@ -92,6 +95,13 @@ extern LLPipeline gPipeline; BOOL LLFloaterPathfindingConsole::postBuild() { + mViewTestTabContainer = findChild("view_test_tab_container"); + llassert(mViewTestTabContainer != NULL); + mViewTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this)); + + mViewTab = findChild("view_panel"); + llassert(mViewTab != NULL); + mShowLabel = findChild("show_label"); llassert(mShowLabel != NULL); @@ -132,10 +142,6 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowXRayCheckBox = findChild("show_xray"); llassert(mShowXRayCheckBox != NULL); - mViewCharactersButton = findChild("view_characters_floater"); - llassert(mViewCharactersButton != NULL); - mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); - mTestTab = findChild("test_panel"); llassert(mTestTab != NULL); @@ -229,7 +235,10 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) setDefaultInputs(); updatePathTestStatus(); - switchIntoTestPathMode(); + if (mViewTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } } void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) @@ -438,11 +447,13 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharact LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), - mShowLabel(), + mViewTestTabContainer(NULL), + mViewTab(NULL), + mShowLabel(NULL), mShowWorldCheckBox(NULL), mShowWorldMovablesOnlyCheckBox(NULL), mShowNavMeshCheckBox(NULL), - mShowNavMeshWalkabilityLabel(), + mShowNavMeshWalkabilityLabel(NULL), mShowNavMeshWalkabilityComboBox(NULL), mShowWalkablesCheckBox(NULL), mShowStaticObstaclesCheckBox(NULL), @@ -452,7 +463,6 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowXRayCheckBox(NULL), mPathfindingViewerStatus(NULL), mPathfindingSimulatorStatus(NULL), - mViewCharactersButton(NULL), mTestTab(NULL), mCtrlClickLabel(), mShiftClickLabel(), @@ -494,6 +504,18 @@ LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() { } +void LLFloaterPathfindingConsole::onTabSwitch() +{ + if (mViewTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } + else + { + switchOutOfTestPathMode(); + } +} + void LLFloaterPathfindingConsole::onShowWorldSet() { setWorldRenderState(); @@ -515,11 +537,6 @@ void LLFloaterPathfindingConsole::onShowWalkabilitySet() LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); } -void LLFloaterPathfindingConsole::onViewCharactersClicked() -{ - LLFloaterPathfindingCharacters::openCharactersViewer(); -} - void LLFloaterPathfindingConsole::onCharacterWidthSet() { updateCharacterWidth(); @@ -615,6 +632,7 @@ void LLFloaterPathfindingConsole::onPathEvent() void LLFloaterPathfindingConsole::setDefaultInputs() { + mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); setRenderWorld(TRUE); setRenderNavMesh(FALSE); setRenderWalkables(FALSE); @@ -637,7 +655,7 @@ void LLFloaterPathfindingConsole::setWorldRenderState() { BOOL renderWorld = isRenderWorld(); - mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld); + mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld && mShowWorldCheckBox->getEnabled()); if (!renderWorld) { mShowWorldMovablesOnlyCheckBox->set(FALSE); @@ -671,6 +689,8 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() case kConsoleStateUnknown : case kConsoleStateRegionNotEnabled : case kConsoleStateRegionLoading : + mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); + mViewTab->setEnabled(FALSE); mShowLabel->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); @@ -683,7 +703,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowExclusionVolumesCheckBox->setEnabled(FALSE); mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); - mViewCharactersButton->setEnabled(FALSE); mTestTab->setEnabled(FALSE); mCtrlClickLabel->setEnabled(FALSE); mShiftClickLabel->setEnabled(FALSE); @@ -696,6 +715,8 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() clearPath(); break; case kConsoleStateLibraryNotImplemented : + mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); + mViewTab->setEnabled(FALSE); mShowLabel->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); @@ -708,7 +729,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowExclusionVolumesCheckBox->setEnabled(FALSE); mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); - mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(FALSE); mCtrlClickLabel->setEnabled(FALSE); mShiftClickLabel->setEnabled(FALSE); @@ -723,6 +743,8 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() case kConsoleStateCheckingVersion : case kConsoleStateDownloading : case kConsoleStateError : + mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); + mViewTab->setEnabled(FALSE); mShowLabel->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); @@ -735,7 +757,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowExclusionVolumesCheckBox->setEnabled(FALSE); mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); - mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(FALSE); mCtrlClickLabel->setEnabled(FALSE); mShiftClickLabel->setEnabled(FALSE); @@ -748,6 +769,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() clearPath(); break; case kConsoleStateHasNavMesh : + mViewTab->setEnabled(TRUE); mShowLabel->setEnabled(TRUE); mShowWorldCheckBox->setEnabled(TRUE); setWorldRenderState(); @@ -759,7 +781,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowExclusionVolumesCheckBox->setEnabled(TRUE); mShowRenderWaterPlaneCheckBox->setEnabled(TRUE); mShowXRayCheckBox->setEnabled(TRUE); - mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); mCtrlClickLabel->setEnabled(TRUE); mShiftClickLabel->setEnabled(TRUE); diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 2529b241bf..238dfeb2a0 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -42,6 +42,7 @@ class LLSliderCtrl; class LLLineEditor; class LLTextBase; class LLCheckBoxCtrl; +class LLTabContainer; class LLComboBox; class LLButton; class LLToolset; @@ -113,11 +114,11 @@ private: LLFloaterPathfindingConsole(const LLSD& pSeed); virtual ~LLFloaterPathfindingConsole(); + void onTabSwitch(); void onShowWorldSet(); void onShowWorldMovablesOnlySet(); void onShowNavMeshSet(); void onShowWalkabilitySet(); - void onViewCharactersClicked(); void onCharacterWidthSet(); void onCharacterTypeSwitch(); void onClearPathClicked(); @@ -153,6 +154,8 @@ private: void cleanupRenderableRestoreItems(); LLRootHandle mSelfHandle; + LLTabContainer *mViewTestTabContainer; + LLPanel *mViewTab; LLTextBase *mShowLabel; LLCheckBoxCtrl *mShowWorldCheckBox; LLCheckBoxCtrl *mShowWorldMovablesOnlyCheckBox; @@ -167,7 +170,6 @@ private: LLCheckBoxCtrl *mShowXRayCheckBox; LLTextBase *mPathfindingViewerStatus; LLTextBase *mPathfindingSimulatorStatus; - LLButton *mViewCharactersButton; LLPanel *mTestTab; LLTextBase *mCtrlClickLabel; LLTextBase *mShiftClickLabel; diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 44a491b0b5..44dab04583 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -322,11 +322,6 @@ bool LLPathfindingManager::isPathfindingEnabledForRegion(LLViewerRegion *pRegion return !retrieveNavMeshURL.empty(); } -bool LLPathfindingManager::isPathfindingDebugEnabled() const -{ - return (LLPathingLib::getInstance() != NULL); -} - bool LLPathfindingManager::isAllowViewTerrainProperties() const { LLViewerRegion* region = getCurrentRegion(); diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 38e100f74b..5fa2b94def 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -70,8 +70,6 @@ public: bool isPathfindingEnabledForCurrentRegion() const; bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const; - bool isPathfindingDebugEnabled() const; - bool isAllowViewTerrainProperties() const; LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 69421d240b..d244b19b4f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4806,14 +4806,6 @@ class LLToolsEnablePathfinding : public view_listener_t } }; -class LLToolsEnablePathfindingDebug : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isPathfindingDebugEnabled(); - } -}; - // Round the position of all root objects to the grid class LLToolsSnapObjectXY : public view_listener_t { @@ -8209,7 +8201,6 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory"); view_listener_t::addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding"); - view_listener_t::addMenu(new LLToolsEnablePathfindingDebug(), "Tools.EnablePathfindingDebug"); // Help menu // most items use the ShowFloater method 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 59b816b0e1..3bcbbf342c 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -2,15 +2,15 @@ + title="Pathfinding view" + width="240"> Cannot find pathing library implementation. This region is not enabled for pathfinding. @@ -41,10 +41,10 @@ bevel_style="none" follows="left|top" layout="topleft" - left="14" - top_pad="15" - height="68" - width="200"> + left="12" + top_pad="10" + height="61" + width="214"> + width="214"> Viewer status + width="214"> - + left="12" + height="66" + width="214"> - Show: - - - - + top_pad="5" + width="214"> + Simulator status + - Show walkability map: - - - - - - - - - - - - - - + name="pathfinding_simulator_status" + top_pad="8" + width="214"> + + name="view_test_tab_container" + left="12" + top="157" + height="328" + width="214"> + + + Show: + + + + + + Show walkability map: + + + + + + + + + + + + + + + + top_pad="20" + width="202"> Ctrl-click to select start point. + width="202"> Shift-click to select end point. + width="202"> Character width + width="202"> Character type + width="202">