From 64acf29c53639cbd3784f5bcc617b02985cbe412 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 16 Dec 2011 17:30:12 -0800 Subject: Hooking the navmesh and exclusion volumes render states up to the pathfinding console floater. --- indra/newview/llfloaterpathfindingconsole.cpp | 82 ++++++++++++++++++++-- indra/newview/llfloaterpathfindingconsole.h | 14 +++- indra/newview/llviewermenufile.cpp | 32 --------- .../default/xui/en/floater_pathfinding_console.xml | 8 +-- indra/newview/skins/default/xui/en/menu_viewer.xml | 13 ---- 5 files changed, 92 insertions(+), 57 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index a2182a2551..129921d93e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -31,6 +31,9 @@ #include "llsd.h" #include "llbutton.h" +#include "llcheckboxctrl.h" + +#include "llpathinglib.h" //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole @@ -38,16 +41,33 @@ BOOL LLFloaterPathfindingConsole::postBuild() { - LLButton *linksetBtn = getChild("view_and_edit_linksets"); - llassert(linksetBtn != NULL); + childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + + mShowNavmeshCheckBox = findChild("show_navmesh_overlay"); + llassert(mShowNavmeshCheckBox != NULL); + mShowNavmeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavmeshToggle, this)); + + mShowExcludeVolumesCheckBox = findChild("show_exclusion_volumes"); + llassert(mShowExcludeVolumesCheckBox != NULL); + mShowExcludeVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExcludeVolumesToggle, this)); + + mShowPathCheckBox = findChild("show_path"); + llassert(mShowPathCheckBox != NULL); + mShowPathCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowPathToggle, this)); + + mShowWaterPlaneCheckBox = findChild("show_water_plane"); + llassert(mShowWaterPlaneCheckBox != NULL); + mShowWaterPlaneCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWaterPlaneToggle, this)); - linksetBtn->setClickedCallback(boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - return LLFloater::postBuild(); } -LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& seed) - : LLFloater(seed) +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) + : LLFloater(pSeed), + mShowNavmeshCheckBox(NULL), + mShowExcludeVolumesCheckBox(NULL), + mShowPathCheckBox(NULL), + mShowWaterPlaneCheckBox(NULL) { } @@ -55,6 +75,56 @@ LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() { } +void LLFloaterPathfindingConsole::onShowNavmeshToggle() +{ + BOOL checkBoxValue = mShowNavmeshCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderNavMesh(checkBoxValue); + } + else + { + mShowNavmeshCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() +{ + BOOL checkBoxValue = mShowExcludeVolumesCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderNavMeshandShapes(checkBoxValue); + } + else + { + mShowExcludeVolumesCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onShowPathToggle() +{ + BOOL checkBoxValue = mShowPathCheckBox->get(); + + llwarns << "functionality has not yet been implemented to toggle '" + << mShowPathCheckBox->getLabel() << "' to " + << (checkBoxValue ? "ON" : "OFF") << llendl; +} + +void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() +{ + BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); + + llwarns << "functionality has not yet been implemented to toggle '" + << mShowWaterPlaneCheckBox->getLabel() << "' to " + << (checkBoxValue ? "ON" : "OFF") << llendl; +} + void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 4c61044b1d..b6107ea64b 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -31,6 +31,7 @@ #include "llfloater.h" class LLSD; +class LLCheckBoxCtrl; class LLFloaterPathfindingConsole : public LLFloater @@ -45,10 +46,19 @@ protected: private: // Does its own instance management, so clients not allowed // to allocate or destroy. - LLFloaterPathfindingConsole(const LLSD& seed); + LLFloaterPathfindingConsole(const LLSD& pSeed); virtual ~LLFloaterPathfindingConsole(); - + + void onShowNavmeshToggle(); + void onShowExcludeVolumesToggle(); + void onShowPathToggle(); + void onShowWaterPlaneToggle(); void onViewEditLinksetClicked(); + + LLCheckBoxCtrl *mShowNavmeshCheckBox; + LLCheckBoxCtrl *mShowExcludeVolumesCheckBox; + LLCheckBoxCtrl *mShowPathCheckBox; + LLCheckBoxCtrl *mShowWaterPlaneCheckBox; }; #endif // LL_LLFLOATERPATHFINDINGCONSOLE_H diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 850bf35c61..b5df16566a 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -80,36 +80,6 @@ // system libraries #include -class LLBuildNavMesh : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - bool result = true; - return result; - } -}; -class LLNavMeshRenderingToggle : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - if ( LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->toggleRenderNavMeshState( ); - } - return true; - } -}; -class LLNavMeshShapeRenderingToggle : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - if ( LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->toggleRenderShapeState( ); - } - return true; - } -}; //prep# class LLPathingTools : public view_listener_t, LLNavMeshDownloadObserver { @@ -1342,7 +1312,5 @@ void init_menu_file() //prep# view_listener_t::addCommit(new LLPathingTools(), "PathingTools.RetrieveSrc"); - view_listener_t::addCommit(new LLNavMeshRenderingToggle(), "PathingTools.ToggleNavMeshView"); - view_listener_t::addCommit(new LLNavMeshShapeRenderingToggle(), "PathingTools.ToggleNavMeshShapeView"); // "File.SaveTexture" moved to llpanelmaininventory so that it can be properly handled. } 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 dfb2eca4c8..ff1cf81d4e 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -28,7 +28,7 @@ label="Navmesh" layout="topleft" left="20" - name="DisplayNavmeshOverlay" + name="show_navmesh_overlay" top_pad="5" width="90" /> - - - - - - - -- cgit v1.2.3