diff options
author | Todd Stinson <stinson@lindenlab.com> | 2011-12-16 17:30:12 -0800 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2011-12-16 17:30:12 -0800 |
commit | 64acf29c53639cbd3784f5bcc617b02985cbe412 (patch) | |
tree | be289059b8ce2a34fefb6d0436df67e7fdf483ab /indra | |
parent | 6b2df5d57a4d973dea8cac99feb47330ccaa2397 (diff) |
Hooking the navmesh and exclusion volumes render states up to the pathfinding console floater.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.cpp | 82 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingconsole.h | 14 | ||||
-rw-r--r-- | indra/newview/llviewermenufile.cpp | 32 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_console.xml | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 13 |
5 files changed, 92 insertions, 57 deletions
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<LLButton>("view_and_edit_linksets"); - llassert(linksetBtn != NULL); + childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + + mShowNavmeshCheckBox = findChild<LLCheckBoxCtrl>("show_navmesh_overlay"); + llassert(mShowNavmeshCheckBox != NULL); + mShowNavmeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavmeshToggle, this)); + + mShowExcludeVolumesCheckBox = findChild<LLCheckBoxCtrl>("show_exclusion_volumes"); + llassert(mShowExcludeVolumesCheckBox != NULL); + mShowExcludeVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExcludeVolumesToggle, this)); + + mShowPathCheckBox = findChild<LLCheckBoxCtrl>("show_path"); + llassert(mShowPathCheckBox != NULL); + mShowPathCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowPathToggle, this)); + + mShowWaterPlaneCheckBox = findChild<LLCheckBoxCtrl>("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 <boost/tokenizer.hpp>
-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" /> <check_box @@ -36,7 +36,7 @@ label="Exclusion volumes" layout="topleft" left="20" - name="DisplayExclusionVolumes" + name="show_exclusion_volumes" top_pad="0" width="90" /> <check_box @@ -44,7 +44,7 @@ label="Path" layout="topleft" left="20" - name="DisplayPath" + name="show_path" top_pad="0" width="90" /> <check_box @@ -52,7 +52,7 @@ label="Water plane" layout="topleft" left="20" - name="DisplayWaterPlane" + name="show_water_plane" top_pad="0" width="90" /> <text diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index d2a5556124..986f7b226e 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -971,19 +971,6 @@ function="PathingTools.RetrieveSrc" /> </menu_item_call> - <menu_item_call - label="Toggle Navigation Mesh Display" - name="Toggle Navigation Mesh View"> - <menu_item_call.on_click - function="PathingTools.ToggleNavMeshView" /> - </menu_item_call> - - <menu_item_call - label="Toggle Navigation Mesh Shape Display" - name="Toggle Navigation Mesh Shape View"> - <menu_item_call.on_click - function="PathingTools.ToggleNavMeshShapeView" /> - </menu_item_call> </menu> <menu_item_separator/> |