From 98a8057bdc661394e362ebd5c3f3f26d92dac12f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 13 Dec 2011 17:39:39 -0800 Subject: Introducing the initial hooks for building a pathfinding console floater. --- indra/newview/llfloaterpathfindingconsole.cpp | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 indra/newview/llfloaterpathfindingconsole.cpp (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp new file mode 100644 index 0000000000..4235228c08 --- /dev/null +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -0,0 +1,49 @@ +/** + * @file llfloaterpathfindingconsole.cpp + * @author William Todd Stinson + * @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" + +#include "llsd.h" + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingConsole +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingConsole::postBuild() +{ + return LLFloater::postBuild(); +} + +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& seed) + : LLFloater(seed) +{ +} + +LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() +{ +} -- cgit v1.2.3 From dcd945fc74b57313da96e97f7de4ee0b6b81ef70 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 16 Dec 2011 10:15:43 -0800 Subject: Adding functionality for the linksets button on the console to open the linksets floater. --- indra/newview/llfloaterpathfindingconsole.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 4235228c08..a2182a2551 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -27,8 +27,10 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" #include "llsd.h" +#include "llbutton.h" //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole @@ -36,6 +38,11 @@ BOOL LLFloaterPathfindingConsole::postBuild() { + LLButton *linksetBtn = getChild("view_and_edit_linksets"); + llassert(linksetBtn != NULL); + + linksetBtn->setClickedCallback(boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + return LLFloater::postBuild(); } @@ -47,3 +54,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& seed) LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() { } + +void LLFloaterPathfindingConsole::onViewEditLinksetClicked() +{ + LLFloaterPathfindingLinksets::openLinksetsEditor(); +} -- cgit v1.2.3 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 +++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') 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(); -- cgit v1.2.3 From 1598724b462b062670a94353e397b092c1dbb598 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 16 Dec 2011 18:11:43 -0800 Subject: Moving the call to initialize the LLPathingLib instance to the pathfinding console floater onOpen() callback. --- indra/newview/llfloaterpathfindingconsole.cpp | 262 +++++++++++++++----------- 1 file changed, 150 insertions(+), 112 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 129921d93e..a7195fee83 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,85 +1,123 @@ -/** - * @file llfloaterpathfindingconsole.cpp - * @author William Todd Stinson - * @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" - -#include "llsd.h" -#include "llbutton.h" -#include "llcheckboxctrl.h" - +/** + * @file llfloaterpathfindingconsole.cpp + * @author William Todd Stinson + * @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" + +#include "llsd.h" +#include "llagent.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llnavmeshstation.h" +#include "llviewerregion.h" + #include "llpathinglib.h" - -//--------------------------------------------------------------------------- -// LLFloaterPathfindingConsole -//--------------------------------------------------------------------------- - -BOOL LLFloaterPathfindingConsole::postBuild() -{ - 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)); - - return LLFloater::postBuild(); -} - -LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) - : LLFloater(pSeed), - mShowNavmeshCheckBox(NULL), - mShowExcludeVolumesCheckBox(NULL), - mShowPathCheckBox(NULL), - mShowWaterPlaneCheckBox(NULL) -{ -} - -LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() -{ -} - -void LLFloaterPathfindingConsole::onShowNavmeshToggle() -{ - BOOL checkBoxValue = mShowNavmeshCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingConsole +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingConsole::postBuild() +{ + 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)); + + return LLFloater::postBuild(); +} + +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) + : LLFloater(pSeed), + mShowNavmeshCheckBox(NULL), + mShowExcludeVolumesCheckBox(NULL), + mShowPathCheckBox(NULL), + mShowWaterPlaneCheckBox(NULL), + mNavmeshDownloadObserver() +{ +} + +LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() +{ +} + +void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) +{ + //make sure we have a pathing system + if ( !LLPathingLib::getInstance() ) + { + LLPathingLib::initSystem(); + } + //prep# test remove + //LLSD content; + //LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( content ); + //return true; + //prep# end test + if ( LLPathingLib::getInstance() == NULL ) + { + llinfos<<"No implementation of pathing library."<getCapability( capability ); + if ( !url.empty() ) + { + llinfos<<"Region has required caps of type ["<setNavMeshDownloadURL( url ); + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavmeshDownloadObserver.getObserverHandle() ); + } + else + { + llinfos<<"Region has does not required caps of type ["<get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { llPathingLibInstance->setRenderNavMesh(checkBoxValue); @@ -89,13 +127,13 @@ void LLFloaterPathfindingConsole::onShowNavmeshToggle() mShowNavmeshCheckBox->set(FALSE); llwarns << "cannot find LLPathingLib instance" << llendl; } -} - -void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() -{ - BOOL checkBoxValue = mShowExcludeVolumesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); +} + +void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() +{ + BOOL checkBoxValue = mShowExcludeVolumesCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { llPathingLibInstance->setRenderNavMeshandShapes(checkBoxValue); @@ -105,27 +143,27 @@ void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() 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(); -} +} + +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(); +} -- cgit v1.2.3 From 11bb14fe029a6764717475cdf53bb6eed8c1f9c9 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 19 Dec 2011 14:29:10 -0800 Subject: Stubbing out functionality for catching the overlay display render state switch. --- indra/newview/llfloaterpathfindingconsole.cpp | 53 +++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index a7195fee83..f713b09e88 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -33,6 +33,7 @@ #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" +#include "llradiogroup.h" #include "llnavmeshstation.h" #include "llviewerregion.h" @@ -62,6 +63,10 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mShowWaterPlaneCheckBox != NULL); mShowWaterPlaneCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWaterPlaneToggle, this)); + mRegionOverlayDisplayRadioGroup = findChild("region_overlay_display"); + llassert(mRegionOverlayDisplayRadioGroup != NULL); + mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch, this)); + return LLFloater::postBuild(); } @@ -71,6 +76,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowExcludeVolumesCheckBox(NULL), mShowPathCheckBox(NULL), mShowWaterPlaneCheckBox(NULL), + mRegionOverlayDisplayRadioGroup(NULL), mNavmeshDownloadObserver() { } @@ -150,8 +156,8 @@ void LLFloaterPathfindingConsole::onShowPathToggle() BOOL checkBoxValue = mShowPathCheckBox->get(); llwarns << "functionality has not yet been implemented to toggle '" - << mShowPathCheckBox->getLabel() << "' to " - << (checkBoxValue ? "ON" : "OFF") << llendl; + << mShowPathCheckBox->getLabel() << "' to " + << (checkBoxValue ? "ON" : "OFF") << llendl; } void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() @@ -159,11 +165,50 @@ void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); llwarns << "functionality has not yet been implemented to toggle '" - << mShowWaterPlaneCheckBox->getLabel() << "' to " - << (checkBoxValue ? "ON" : "OFF") << llendl; + << mShowWaterPlaneCheckBox->getLabel() << "' to " + << (checkBoxValue ? "ON" : "OFF") << llendl; +} + +void LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch() +{ + switch (getRegionOverlayDisplay()) + { + case kRenderOverlayOnFixedPhysicsGeometry : + llwarns << "functionality has not yet been implemented to toggle '" + << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnFixedPhysicsGeometry" + << llendl; + break; + case kRenderOverlayOnAllRenderableGeometry : + llwarns << "functionality has not yet been implemented to toggle '" + << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnAllRenderableGeometry" + << llendl; + break; + default : + llassert(0); + break; + } } void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); } + +LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const +{ + ERegionOverlayDisplay regionOverlayDisplay; + switch (mRegionOverlayDisplayRadioGroup->getSelectedIndex()) + { + case 0 : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + break; + case 1: + regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; + break; + default : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + break; + } + + return regionOverlayDisplay; +} -- cgit v1.2.3 From 101a674c73ad3007f9a40fc4593df1d0eaa4fd99 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 19 Dec 2011 16:04:48 -0800 Subject: Stubbing out functionality for catching the path selection state switch. --- indra/newview/llfloaterpathfindingconsole.cpp | 102 +++++++++++++++++++------- 1 file changed, 76 insertions(+), 26 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f713b09e88..5fa9d6f3a4 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,29 +1,29 @@ /** - * @file llfloaterpathfindingconsole.cpp - * @author William Todd Stinson - * @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ +* @file llfloaterpathfindingconsole.cpp +* @author William Todd Stinson +* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ #include "llviewerprecompiledheaders.h" #include "llfloaterpathfindingconsole.h" @@ -67,6 +67,10 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mRegionOverlayDisplayRadioGroup != NULL); mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch, this)); + mPathSelectionRadioGroup = findChild("path_selection"); + llassert(mPathSelectionRadioGroup != NULL); + mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onPathSelectionSwitch, this)); + return LLFloater::postBuild(); } @@ -77,6 +81,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowPathCheckBox(NULL), mShowWaterPlaneCheckBox(NULL), mRegionOverlayDisplayRadioGroup(NULL), + mPathSelectionRadioGroup(NULL), mNavmeshDownloadObserver() { } @@ -189,6 +194,31 @@ void LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch() } } +void LLFloaterPathfindingConsole::onPathSelectionSwitch() +{ + switch (getPathSelectionState()) + { + case kPathSelectNone : + llwarns << "functionality has not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" + << llendl; + break; + case kPathSelectStartPoint : + llwarns << "functionality has not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectStartPoint" + << llendl; + break; + case kPathSelectEndPoint : + llwarns << "functionality has not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectEndPoint" + << llendl; + break; + default : + llassert(0); + break; + } +} + void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); @@ -197,7 +227,7 @@ void LLFloaterPathfindingConsole::onViewEditLinksetClicked() LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const { ERegionOverlayDisplay regionOverlayDisplay; - switch (mRegionOverlayDisplayRadioGroup->getSelectedIndex()) + switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) { case 0 : regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; @@ -212,3 +242,23 @@ LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole:: return regionOverlayDisplay; } + +LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const +{ + EPathSelectionState pathSelectionState; + + switch (mPathSelectionRadioGroup->getValue().asInteger()) + { + case 1 : + pathSelectionState = kPathSelectStartPoint; + break; + case 2: + pathSelectionState = kPathSelectEndPoint; + break; + default : + pathSelectionState = kPathSelectNone; + break; + } + + return pathSelectionState; +} -- cgit v1.2.3 From 9897c4de69c57ddeae6b94a857e532c0552865cf Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 19 Dec 2011 16:36:00 -0800 Subject: Stubbing out functionality for catching the character width slider changes. --- indra/newview/llfloaterpathfindingconsole.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 5fa9d6f3a4..f045eba19b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -34,6 +34,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llradiogroup.h" +#include "llsliderctrl.h" #include "llnavmeshstation.h" #include "llviewerregion.h" @@ -71,6 +72,10 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mPathSelectionRadioGroup != NULL); mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onPathSelectionSwitch, this)); + mCharacterWidthSlider = findChild("character_width"); + llassert(mCharacterWidthSlider != NULL); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + return LLFloater::postBuild(); } @@ -82,6 +87,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowWaterPlaneCheckBox(NULL), mRegionOverlayDisplayRadioGroup(NULL), mPathSelectionRadioGroup(NULL), + mCharacterWidthSlider(NULL), mNavmeshDownloadObserver() { } @@ -219,6 +225,13 @@ void LLFloaterPathfindingConsole::onPathSelectionSwitch() } } +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + F32 characterWidth = getCharacterWidth(); + llwarns << "functionality has not yet been implemented to set " << mCharacterWidthSlider->getName() + << " to the value (" << characterWidth << ")" << llendl; +} + void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); @@ -262,3 +275,8 @@ LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::ge return pathSelectionState; } + +F32 LLFloaterPathfindingConsole::getCharacterWidth() const +{ + return mCharacterWidthSlider->getValueF32(); +} \ No newline at end of file -- cgit v1.2.3 From 6a078814cdd55105304fec41712dbd635e18d900 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 19 Dec 2011 17:01:23 -0800 Subject: Stubbing out functionality for catching the character type switch states. --- indra/newview/llfloaterpathfindingconsole.cpp | 74 +++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f045eba19b..c6613e4035 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -76,6 +76,10 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mCharacterWidthSlider != NULL); mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + mCharacterTypeRadioGroup = findChild("character_type"); + llassert(mCharacterTypeRadioGroup != NULL); + mCharacterTypeRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + return LLFloater::postBuild(); } @@ -88,6 +92,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mRegionOverlayDisplayRadioGroup(NULL), mPathSelectionRadioGroup(NULL), mCharacterWidthSlider(NULL), + mCharacterTypeRadioGroup(NULL), mNavmeshDownloadObserver() { } @@ -228,8 +233,39 @@ void LLFloaterPathfindingConsole::onPathSelectionSwitch() void LLFloaterPathfindingConsole::onCharacterWidthSet() { F32 characterWidth = getCharacterWidth(); - llwarns << "functionality has not yet been implemented to set " << mCharacterWidthSlider->getName() - << " to the value (" << characterWidth << ")" << llendl; + llwarns << "functionality has not yet been implemented to set '" << mCharacterWidthSlider->getName() + << "' to the value (" << characterWidth << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + switch (getCharacterType()) + { + case kCharacterTypeA : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" + << llendl; + break; + case kCharacterTypeB : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" + << llendl; + break; + case kCharacterTypeC : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" + << llendl; + break; + case kCharacterTypeD : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" + << llendl; + break; + default : + llassert(0); + break; + } + } void LLFloaterPathfindingConsole::onViewEditLinksetClicked() @@ -242,14 +278,15 @@ LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole:: ERegionOverlayDisplay regionOverlayDisplay; switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) { - case 0 : + case 1 : regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; break; - case 1: + case 2: regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; break; default : regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + llassert(0); break; } @@ -279,4 +316,31 @@ LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::ge F32 LLFloaterPathfindingConsole::getCharacterWidth() const { return mCharacterWidthSlider->getValueF32(); -} \ No newline at end of file +} + +LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const +{ + ECharacterType characterType; + + switch (mCharacterTypeRadioGroup->getValue().asInteger()) + { + case 1 : + characterType = kCharacterTypeA; + break; + case 2 : + characterType = kCharacterTypeB; + break; + case 3 : + characterType = kCharacterTypeC; + break; + case 4 : + characterType = kCharacterTypeD; + break; + default : + characterType = kCharacterTypeA; + llassert(0); + break; + } + + return characterType; +} -- cgit v1.2.3 From 34a847fabdfb42c7a6cf555c10fed095c6d8b2f2 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 19 Dec 2011 17:16:13 -0800 Subject: Stubbing out functionality for catching the rebuild and refresh navmesh button clicks. --- indra/newview/llfloaterpathfindingconsole.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c6613e4035..cd3794f5a9 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -47,6 +47,8 @@ BOOL LLFloaterPathfindingConsole::postBuild() { childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavmeshClicked, this)); + childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavmeshClicked, this)); mShowNavmeshCheckBox = findChild("show_navmesh_overlay"); llassert(mShowNavmeshCheckBox != NULL); @@ -273,6 +275,16 @@ void LLFloaterPathfindingConsole::onViewEditLinksetClicked() LLFloaterPathfindingLinksets::openLinksetsEditor(); } +void LLFloaterPathfindingConsole::onRebuildNavmeshClicked() +{ + llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; +} + +void LLFloaterPathfindingConsole::onRefreshNavmeshClicked() +{ + llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; +} + LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const { ERegionOverlayDisplay regionOverlayDisplay; -- cgit v1.2.3 From 32fe974ac272ac5f92dd4c5c84e482b0acb36fe2 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 19 Dec 2011 17:49:47 -0800 Subject: Stubbing out functionality for catching the terrain material properties changes. --- indra/newview/llfloaterpathfindingconsole.cpp | 76 ++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index cd3794f5a9..20ce7b8f0c 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -35,6 +35,8 @@ #include "llcheckboxctrl.h" #include "llradiogroup.h" #include "llsliderctrl.h" +#include "lllineeditor.h" +#include "lltextvalidate.h" #include "llnavmeshstation.h" #include "llviewerregion.h" @@ -80,7 +82,27 @@ BOOL LLFloaterPathfindingConsole::postBuild() mCharacterTypeRadioGroup = findChild("character_type"); llassert(mCharacterTypeRadioGroup != NULL); - mCharacterTypeRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + + mTerrainMaterialA = findChild("terrain_material_a"); + llassert(mTerrainMaterialA != NULL); + mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this)); + mTerrainMaterialA->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialB = findChild("terrain_material_b"); + llassert(mTerrainMaterialB != NULL); + mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialBSet, this)); + mTerrainMaterialB->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialC = findChild("terrain_material_c"); + llassert(mTerrainMaterialC != NULL); + mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialCSet, this)); + mTerrainMaterialC->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialD = findChild("terrain_material_d"); + llassert(mTerrainMaterialD != NULL); + mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialDSet, this)); + mTerrainMaterialD->setPrevalidate(LLTextValidate::validateFloat); return LLFloater::postBuild(); } @@ -95,6 +117,10 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathSelectionRadioGroup(NULL), mCharacterWidthSlider(NULL), mCharacterTypeRadioGroup(NULL), + mTerrainMaterialA(NULL), + mTerrainMaterialB(NULL), + mTerrainMaterialC(NULL), + mTerrainMaterialD(NULL), mNavmeshDownloadObserver() { } @@ -285,6 +311,34 @@ void LLFloaterPathfindingConsole::onRefreshNavmeshClicked() llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; } +void LLFloaterPathfindingConsole::onTerrainMaterialASet() +{ + F32 terrainMaterial = getTerrainMaterialA(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialA->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onTerrainMaterialBSet() +{ + F32 terrainMaterial = getTerrainMaterialB(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialB->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onTerrainMaterialCSet() +{ + F32 terrainMaterial = getTerrainMaterialC(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialC->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onTerrainMaterialDSet() +{ + F32 terrainMaterial = getTerrainMaterialD(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const { ERegionOverlayDisplay regionOverlayDisplay; @@ -356,3 +410,23 @@ LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getChar return characterType; } + +F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const +{ + return mTerrainMaterialA->getValue().asReal(); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const +{ + return mTerrainMaterialB->getValue().asReal(); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const +{ + return mTerrainMaterialC->getValue().asReal(); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const +{ + return mTerrainMaterialD->getValue().asReal(); +} -- cgit v1.2.3 From e9058099d0405ce89905bd2393fb0264327d4230 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 20 Dec 2011 12:57:32 -0500 Subject: Allow for the overlaying of an unblended navmesh ontop of the scenes normal renderables --- indra/newview/llfloaterpathfindingconsole.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 20ce7b8f0c..46017ccdfc 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -430,3 +430,7 @@ F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const { return mTerrainMaterialD->getValue().asReal(); } +BOOL LLFloaterPathfindingConsole::allowAllRenderables() +{ + return getRegionOverlayDisplay() == kRenderOverlayOnAllRenderableGeometry ? true : false; +} \ No newline at end of file -- cgit v1.2.3 From fd29df8c720b6c61680ecea002ecf5c116a69fde Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 20 Dec 2011 10:24:56 -0800 Subject: Adding functionality to set the console values from the console class. --- indra/newview/llfloaterpathfindingconsole.cpp | 289 ++++++++++++++++++-------- 1 file changed, 197 insertions(+), 92 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 20ce7b8f0c..9cf55ca7f9 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -42,6 +42,18 @@ #include "llpathinglib.h" +#define XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY 1 +#define XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY 2 + +#define XUI_PATH_SELECT_NONE 0 +#define XUI_PATH_SELECT_START_POINT 1 +#define XUI_PATH_SELECT_END_POINT 2 + +#define XUI_CHARACTER_TYPE_A 1 +#define XUI_CHARACTER_TYPE_B 2 +#define XUI_CHARACTER_TYPE_C 3 +#define XUI_CHARACTER_TYPE_D 4 + //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- @@ -107,6 +119,191 @@ BOOL LLFloaterPathfindingConsole::postBuild() return LLFloater::postBuild(); } +LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const +{ + ERegionOverlayDisplay regionOverlayDisplay; + switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) + { + case XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + break; + case XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY : + regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; + break; + default : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + llassert(0); + break; + } + + return regionOverlayDisplay; +} + +void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay regionOverlayDisplay) +{ + LLSD radioGroupValue; + + switch (regionOverlayDisplay) + { + case kRenderOverlayOnFixedPhysicsGeometry : + radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; + break; + case kRenderOverlayOnAllRenderableGeometry : + radioGroupValue = XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY; + break; + default : + radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; + llassert(0); + break; + } + + mRegionOverlayDisplayRadioGroup->setValue(radioGroupValue); +} + +LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const +{ + EPathSelectionState pathSelectionState; + + switch (mPathSelectionRadioGroup->getValue().asInteger()) + { + case XUI_PATH_SELECT_START_POINT : + pathSelectionState = kPathSelectStartPoint; + break; + case XUI_PATH_SELECT_END_POINT : + pathSelectionState = kPathSelectEndPoint; + break; + default : + pathSelectionState = kPathSelectNone; + break; + } + + return pathSelectionState; +} + +void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pathSelectionState) +{ + LLSD radioGroupValue; + + switch (pathSelectionState) + { + case kPathSelectStartPoint : + radioGroupValue = XUI_PATH_SELECT_START_POINT; + break; + case kPathSelectEndPoint : + radioGroupValue = XUI_PATH_SELECT_END_POINT; + break; + default : + radioGroupValue = XUI_PATH_SELECT_NONE; + break; + } + + mPathSelectionRadioGroup->setValue(radioGroupValue); +} + +F32 LLFloaterPathfindingConsole::getCharacterWidth() const +{ + return mCharacterWidthSlider->getValueF32(); +} + +void LLFloaterPathfindingConsole::setCharacterWidth(F32 characterWidth) +{ + mCharacterWidthSlider->setValue(LLSD(characterWidth)); +} + +LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const +{ + ECharacterType characterType; + + switch (mCharacterTypeRadioGroup->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_A : + characterType = kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = kCharacterTypeD; + break; + default : + characterType = kCharacterTypeA; + llassert(0); + break; + } + + return characterType; +} + +void LLFloaterPathfindingConsole::setCharacterType(ECharacterType characterType) +{ + LLSD radioGroupValue; + + switch (characterType) + { + case kCharacterTypeA : + radioGroupValue = XUI_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + radioGroupValue = XUI_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + radioGroupValue = XUI_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + radioGroupValue = XUI_CHARACTER_TYPE_D; + break; + default : + radioGroupValue = XUI_CHARACTER_TYPE_A; + llassert(0); + break; + } + + mCharacterTypeRadioGroup->setValue(radioGroupValue); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const +{ + return mTerrainMaterialA->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 terrainMaterial) +{ + mTerrainMaterialA->setValue(LLSD(terrainMaterial)); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const +{ + return mTerrainMaterialB->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 terrainMaterial) +{ + mTerrainMaterialB->setValue(LLSD(terrainMaterial)); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const +{ + return mTerrainMaterialC->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 terrainMaterial) +{ + mTerrainMaterialC->setValue(LLSD(terrainMaterial)); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const +{ + return mTerrainMaterialD->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 terrainMaterial) +{ + mTerrainMaterialD->setValue(LLSD(terrainMaterial)); +} + LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mShowNavmeshCheckBox(NULL), @@ -338,95 +535,3 @@ void LLFloaterPathfindingConsole::onTerrainMaterialDSet() llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() << "' to value (" << terrainMaterial << ")" << llendl; } - -LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const -{ - ERegionOverlayDisplay regionOverlayDisplay; - switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) - { - case 1 : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - break; - case 2: - regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; - break; - default : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - llassert(0); - break; - } - - return regionOverlayDisplay; -} - -LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const -{ - EPathSelectionState pathSelectionState; - - switch (mPathSelectionRadioGroup->getValue().asInteger()) - { - case 1 : - pathSelectionState = kPathSelectStartPoint; - break; - case 2: - pathSelectionState = kPathSelectEndPoint; - break; - default : - pathSelectionState = kPathSelectNone; - break; - } - - return pathSelectionState; -} - -F32 LLFloaterPathfindingConsole::getCharacterWidth() const -{ - return mCharacterWidthSlider->getValueF32(); -} - -LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const -{ - ECharacterType characterType; - - switch (mCharacterTypeRadioGroup->getValue().asInteger()) - { - case 1 : - characterType = kCharacterTypeA; - break; - case 2 : - characterType = kCharacterTypeB; - break; - case 3 : - characterType = kCharacterTypeC; - break; - case 4 : - characterType = kCharacterTypeD; - break; - default : - characterType = kCharacterTypeA; - llassert(0); - break; - } - - return characterType; -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const -{ - return mTerrainMaterialA->getValue().asReal(); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const -{ - return mTerrainMaterialB->getValue().asReal(); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const -{ - return mTerrainMaterialC->getValue().asReal(); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const -{ - return mTerrainMaterialD->getValue().asReal(); -} -- cgit v1.2.3 From 114509270ef592900a0df73390257537a0866e76 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 20 Dec 2011 17:10:09 -0800 Subject: Parameter name change. --- indra/newview/llfloaterpathfindingconsole.cpp | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 7ee9ac4d1b..abb8844544 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -139,11 +139,11 @@ LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole:: return regionOverlayDisplay; } -void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay regionOverlayDisplay) +void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) { LLSD radioGroupValue; - switch (regionOverlayDisplay) + switch (pRegionOverlayDisplay) { case kRenderOverlayOnFixedPhysicsGeometry : radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; @@ -180,11 +180,11 @@ LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::ge return pathSelectionState; } -void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pathSelectionState) +void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pPathSelectionState) { LLSD radioGroupValue; - switch (pathSelectionState) + switch (pPathSelectionState) { case kPathSelectStartPoint : radioGroupValue = XUI_PATH_SELECT_START_POINT; @@ -205,9 +205,9 @@ F32 LLFloaterPathfindingConsole::getCharacterWidth() const return mCharacterWidthSlider->getValueF32(); } -void LLFloaterPathfindingConsole::setCharacterWidth(F32 characterWidth) +void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) { - mCharacterWidthSlider->setValue(LLSD(characterWidth)); + mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); } LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const @@ -237,11 +237,11 @@ LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getChar return characterType; } -void LLFloaterPathfindingConsole::setCharacterType(ECharacterType characterType) +void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) { LLSD radioGroupValue; - switch (characterType) + switch (pCharacterType) { case kCharacterTypeA : radioGroupValue = XUI_CHARACTER_TYPE_A; @@ -269,9 +269,9 @@ F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const return mTerrainMaterialA->getValue().asReal(); } -void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 terrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 pTerrainMaterial) { - mTerrainMaterialA->setValue(LLSD(terrainMaterial)); + mTerrainMaterialA->setValue(LLSD(pTerrainMaterial)); } F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const @@ -279,9 +279,9 @@ F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const return mTerrainMaterialB->getValue().asReal(); } -void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 terrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 pTerrainMaterial) { - mTerrainMaterialB->setValue(LLSD(terrainMaterial)); + mTerrainMaterialB->setValue(LLSD(pTerrainMaterial)); } F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const @@ -289,9 +289,9 @@ F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const return mTerrainMaterialC->getValue().asReal(); } -void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 terrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 pTerrainMaterial) { - mTerrainMaterialC->setValue(LLSD(terrainMaterial)); + mTerrainMaterialC->setValue(LLSD(pTerrainMaterial)); } F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const @@ -299,9 +299,9 @@ F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const return mTerrainMaterialD->getValue().asReal(); } -void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 terrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) { - mTerrainMaterialD->setValue(LLSD(terrainMaterial)); + mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); } LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) @@ -535,6 +535,7 @@ void LLFloaterPathfindingConsole::onTerrainMaterialDSet() llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() << "' to value (" << terrainMaterial << ")" << llendl; } + BOOL LLFloaterPathfindingConsole::allowAllRenderables() { return getRegionOverlayDisplay() == kRenderOverlayOnAllRenderableGeometry ? true : false; -- cgit v1.2.3 From 6da6870e7df0b72ba3a67a0e87ee19a52d1c1547 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 21 Dec 2011 14:58:09 -0500 Subject: Support for generating a viewer side path from mouse input. --- indra/newview/llfloaterpathfindingconsole.cpp | 31 ++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 46017ccdfc..5a30da355e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -430,7 +430,36 @@ F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const { return mTerrainMaterialD->getValue().asReal(); } -BOOL LLFloaterPathfindingConsole::allowAllRenderables() + +BOOL LLFloaterPathfindingConsole::allowAllRenderables() const { return getRegionOverlayDisplay() == kRenderOverlayOnAllRenderableGeometry ? true : false; +} + +void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) +{ + switch (getPathSelectionState()) + { + case kPathSelectNone : + llwarns << "not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" + << llendl; + break; + + case kPathSelectStartPoint : + mPathData.mStartPointA = point1; + mPathData.mEndPointA = point2; + break; + + case kPathSelectEndPoint : + mPathData.mStartPointB = point1; + mPathData.mEndPointB = point2; + //prep#TODO# possibly consider an alternate behavior - perhaps add a "path" button to submit the data. + LLPathingLib::getInstance()->generatePath( mPathData ); + break; + + default : + llassert(0); + break; + } } \ No newline at end of file -- cgit v1.2.3 From 06bfbf61e16ffec0e54f131a7f3b37c475f10cd9 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 4 Jan 2012 13:12:46 -0500 Subject: Path-177. Updated to newest version of LLPathingLibrary --- indra/newview/llfloaterpathfindingconsole.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f66930da79..efa3a592e0 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -32,7 +32,6 @@ #include "llsd.h" #include "llagent.h" #include "llbutton.h" -#include "llcheckboxctrl.h" #include "llradiogroup.h" #include "llsliderctrl.h" #include "lllineeditor.h" -- cgit v1.2.3 From 88052ff168fa50ae2828745adda240cfd1c17f30 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 4 Jan 2012 14:31:23 -0500 Subject: path-150: supply characterwidth to LLPathingLibrary: --- indra/newview/llfloaterpathfindingconsole.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index efa3a592e0..3bf316fdf6 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -557,8 +557,9 @@ void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, c break; case kPathSelectEndPoint : - mPathData.mStartPointB = point1; - mPathData.mEndPointB = point2; + mPathData.mStartPointB = point1; + mPathData.mEndPointB = point2; + mPathData.mCharacterWidth = getCharacterWidth(); //prep#TODO# possibly consider an alternate behavior - perhaps add a "path" button to submit the data. LLPathingLib::getInstance()->generatePath( mPathData ); break; -- cgit v1.2.3 From 496fa2ea87fbfa835be18f6998475175a417ea52 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 18 Jan 2012 17:23:15 -0800 Subject: Changing the camel case of Navmesh to be NavMesh. --- indra/newview/llfloaterpathfindingconsole.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 3bf316fdf6..269bef22fe 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -60,12 +60,12 @@ BOOL LLFloaterPathfindingConsole::postBuild() { childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavmeshClicked, this)); - childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavmeshClicked, this)); + childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavMeshClicked, this)); + childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavMeshClicked, this)); - mShowNavmeshCheckBox = findChild("show_navmesh_overlay"); - llassert(mShowNavmeshCheckBox != NULL); - mShowNavmeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavmeshToggle, this)); + mShowNavMeshCheckBox = findChild("show_navmesh_overlay"); + llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshToggle, this)); mShowExcludeVolumesCheckBox = findChild("show_exclusion_volumes"); llassert(mShowExcludeVolumesCheckBox != NULL); @@ -305,7 +305,7 @@ void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), - mShowNavmeshCheckBox(NULL), + mShowNavMeshCheckBox(NULL), mShowExcludeVolumesCheckBox(NULL), mShowPathCheckBox(NULL), mShowWaterPlaneCheckBox(NULL), @@ -317,7 +317,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialB(NULL), mTerrainMaterialC(NULL), mTerrainMaterialD(NULL), - mNavmeshDownloadObserver() + mNavMeshDownloadObserver() { } @@ -350,7 +350,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { llinfos<<"Region has required caps of type ["<setNavMeshDownloadURL( url ); - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavmeshDownloadObserver.getObserverHandle() ); + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver.getObserverHandle() ); } else { @@ -359,9 +359,9 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } } -void LLFloaterPathfindingConsole::onShowNavmeshToggle() +void LLFloaterPathfindingConsole::onShowNavMeshToggle() { - BOOL checkBoxValue = mShowNavmeshCheckBox->get(); + BOOL checkBoxValue = mShowNavMeshCheckBox->get(); LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) @@ -370,7 +370,7 @@ void LLFloaterPathfindingConsole::onShowNavmeshToggle() } else { - mShowNavmeshCheckBox->set(FALSE); + mShowNavMeshCheckBox->set(FALSE); llwarns << "cannot find LLPathingLib instance" << llendl; } } @@ -497,12 +497,12 @@ void LLFloaterPathfindingConsole::onViewEditLinksetClicked() LLFloaterPathfindingLinksets::openLinksetsEditor(); } -void LLFloaterPathfindingConsole::onRebuildNavmeshClicked() +void LLFloaterPathfindingConsole::onRebuildNavMeshClicked() { llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; } -void LLFloaterPathfindingConsole::onRefreshNavmeshClicked() +void LLFloaterPathfindingConsole::onRefreshNavMeshClicked() { llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; } -- cgit v1.2.3 From 455899b242478518b181f94823332235950270dd Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 23 Jan 2012 17:36:22 -0800 Subject: Adding some initial reporting on the pathfinding console detailing the state of the navmesh download. --- indra/newview/llfloaterpathfindingconsole.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 269bef22fe..7b8ede410c 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -35,6 +35,7 @@ #include "llradiogroup.h" #include "llsliderctrl.h" #include "lllineeditor.h" +#include "lltextbase.h" #include "lltextvalidate.h" #include "llnavmeshstation.h" #include "llviewerregion.h" @@ -95,6 +96,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mCharacterTypeRadioGroup != NULL); mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + mPathfindingStatus = findChild("pathfinding_status"); + llassert(mPathfindingStatus != NULL); + mTerrainMaterialA = findChild("terrain_material_a"); llassert(mTerrainMaterialA != NULL); mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this)); @@ -313,6 +317,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathSelectionRadioGroup(NULL), mCharacterWidthSlider(NULL), mCharacterTypeRadioGroup(NULL), + mPathfindingStatus(NULL), mTerrainMaterialA(NULL), mTerrainMaterialB(NULL), mTerrainMaterialC(NULL), @@ -339,7 +344,11 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) //prep# end test if ( LLPathingLib::getInstance() == NULL ) { - llinfos<<"No implementation of pathing library."<setText((LLStringExplicit)str, styleParams); + llwarns <<"Errror: cannout find pathing library implementation."<getCapability( capability ); if ( !url.empty() ) { - llinfos<<"Region has required caps of type ["<setText((LLStringExplicit)str); LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver.getObserverHandle() ); } else { + std::string str = getString("navmesh_region_not_enabled"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); llinfos<<"Region has does not required caps of type ["< Date: Mon, 23 Jan 2012 18:27:10 -0800 Subject: Introducing a hacky way to get some reporting on the downloading status of the navmesh into the console. This needs to be seriously refactored. --- indra/newview/llfloaterpathfindingconsole.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 7b8ede410c..63b863937e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -307,6 +307,18 @@ void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); } +void LLFloaterPathfindingConsole::setHasNavMeshReceived() +{ + std::string str = getString("navmesh_fetch_complete_available"); + mPathfindingStatus->setText((LLStringExplicit)str); +} + +void LLFloaterPathfindingConsole::setHasNoNavMesh() +{ + std::string str = getString("navmesh_fetch_complete_none"); + mPathfindingStatus->setText((LLStringExplicit)str); +} + LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mShowNavMeshCheckBox(NULL), @@ -324,6 +336,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialD(NULL), mNavMeshDownloadObserver() { + mNavMeshDownloadObserver.setPathfindingConsole(this); } LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() -- cgit v1.2.3 From d4c0c127b62499b72745de7f9df135ec0286cc13 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 24 Jan 2012 16:09:26 -0500 Subject: WIP: path-118 --- indra/newview/llfloaterpathfindingconsole.cpp | 56 +++++++++++++++++++-------- 1 file changed, 39 insertions(+), 17 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 63b863937e..8556127051 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -54,6 +54,8 @@ #define XUI_CHARACTER_TYPE_C 3 #define XUI_CHARACTER_TYPE_D 4 +const int CURRENT_REGION = 99; +const int MAX_OBSERVERS = 10; //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- @@ -333,10 +335,12 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialA(NULL), mTerrainMaterialB(NULL), mTerrainMaterialC(NULL), - mTerrainMaterialD(NULL), - mNavMeshDownloadObserver() + mTerrainMaterialD(NULL) { - mNavMeshDownloadObserver.setPathfindingConsole(this); + for (int i=0;igetCapability( capability ); - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver.getObserverHandle() ); - } - else + + //prep# neighboring navmesh support proto + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector regions; + regions.push_back( pCurrentRegion ); + //pCurrentRegion->getNeighboringRegions( regions ); + + std::vector shift; + shift.push_back( CURRENT_REGION ); + //pCurrentRegion->getNeighboringRegionsStatus( shift ); + + int regionCnt = regions.size(); + for ( int i=0; isetText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["<getCapability( capability ); + + if ( !url.empty() ) + { + llinfos<<"Region has required caps of type ["<setNavMeshDownloadURL( url ); + int dir = shift[i]; + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); + ++mCurrentMDO; + } + else + { + std::string str = getString("navmesh_region_not_enabled"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llinfos<<"Region has does not required caps of type ["< Date: Tue, 24 Jan 2012 16:12:20 -0500 Subject: merge fix --- indra/newview/llfloaterpathfindingconsole.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 8556127051..d51f427c4e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -390,7 +390,8 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) if ( !url.empty() ) { - llinfos<<"Region has required caps of type ["<setText((LLStringExplicit)str); LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); int dir = shift[i]; LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); -- cgit v1.2.3 From 5726d13c241ed2d9289e5195ac2523ba5e46275f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 25 Jan 2012 18:54:00 -0800 Subject: Fixing issue with renamed header file in a pre-built package. --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index d51f427c4e..772f42860f 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -40,7 +40,7 @@ #include "llnavmeshstation.h" #include "llviewerregion.h" -#include "llpathinglib.h" +#include "llphysicsextensions.h" #define XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY 1 #define XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY 2 -- cgit v1.2.3 From f19a77047d10eca2bff07891375b7859b9e68e99 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 27 Jan 2012 15:09:20 -0500 Subject: PATH-192 FIX fixed last issues with convex decomp merge --- indra/newview/llfloaterpathfindingconsole.cpp | 1242 ++++++++++++------------- 1 file changed, 621 insertions(+), 621 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 772f42860f..fce67c4171 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,621 +1,621 @@ -/** -* @file llfloaterpathfindingconsole.cpp -* @author William Todd Stinson -* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. -* -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" -#include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" - -#include "llsd.h" -#include "llagent.h" -#include "llbutton.h" -#include "llradiogroup.h" -#include "llsliderctrl.h" -#include "lllineeditor.h" -#include "lltextbase.h" -#include "lltextvalidate.h" -#include "llnavmeshstation.h" -#include "llviewerregion.h" - -#include "llphysicsextensions.h" - -#define XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY 1 -#define XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY 2 - -#define XUI_PATH_SELECT_NONE 0 -#define XUI_PATH_SELECT_START_POINT 1 -#define XUI_PATH_SELECT_END_POINT 2 - -#define XUI_CHARACTER_TYPE_A 1 -#define XUI_CHARACTER_TYPE_B 2 -#define XUI_CHARACTER_TYPE_C 3 -#define XUI_CHARACTER_TYPE_D 4 - -const int CURRENT_REGION = 99; -const int MAX_OBSERVERS = 10; -//--------------------------------------------------------------------------- -// LLFloaterPathfindingConsole -//--------------------------------------------------------------------------- - -BOOL LLFloaterPathfindingConsole::postBuild() -{ - childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavMeshClicked, this)); - childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavMeshClicked, 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)); - - mRegionOverlayDisplayRadioGroup = findChild("region_overlay_display"); - llassert(mRegionOverlayDisplayRadioGroup != NULL); - mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch, this)); - - mPathSelectionRadioGroup = findChild("path_selection"); - llassert(mPathSelectionRadioGroup != NULL); - mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onPathSelectionSwitch, this)); - - mCharacterWidthSlider = findChild("character_width"); - llassert(mCharacterWidthSlider != NULL); - mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); - - mCharacterTypeRadioGroup = findChild("character_type"); - llassert(mCharacterTypeRadioGroup != NULL); - mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); - - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); - - mTerrainMaterialA = findChild("terrain_material_a"); - llassert(mTerrainMaterialA != NULL); - mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this)); - mTerrainMaterialA->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialB = findChild("terrain_material_b"); - llassert(mTerrainMaterialB != NULL); - mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialBSet, this)); - mTerrainMaterialB->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialC = findChild("terrain_material_c"); - llassert(mTerrainMaterialC != NULL); - mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialCSet, this)); - mTerrainMaterialC->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialD = findChild("terrain_material_d"); - llassert(mTerrainMaterialD != NULL); - mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialDSet, this)); - mTerrainMaterialD->setPrevalidate(LLTextValidate::validateFloat); - - return LLFloater::postBuild(); -} - -LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const -{ - ERegionOverlayDisplay regionOverlayDisplay; - switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) - { - case XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - break; - case XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY : - regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; - break; - default : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - llassert(0); - break; - } - - return regionOverlayDisplay; -} - -void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) -{ - LLSD radioGroupValue; - - switch (pRegionOverlayDisplay) - { - case kRenderOverlayOnFixedPhysicsGeometry : - radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; - break; - case kRenderOverlayOnAllRenderableGeometry : - radioGroupValue = XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY; - break; - default : - radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; - llassert(0); - break; - } - - mRegionOverlayDisplayRadioGroup->setValue(radioGroupValue); -} - -LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const -{ - EPathSelectionState pathSelectionState; - - switch (mPathSelectionRadioGroup->getValue().asInteger()) - { - case XUI_PATH_SELECT_START_POINT : - pathSelectionState = kPathSelectStartPoint; - break; - case XUI_PATH_SELECT_END_POINT : - pathSelectionState = kPathSelectEndPoint; - break; - default : - pathSelectionState = kPathSelectNone; - break; - } - - return pathSelectionState; -} - -void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pPathSelectionState) -{ - LLSD radioGroupValue; - - switch (pPathSelectionState) - { - case kPathSelectStartPoint : - radioGroupValue = XUI_PATH_SELECT_START_POINT; - break; - case kPathSelectEndPoint : - radioGroupValue = XUI_PATH_SELECT_END_POINT; - break; - default : - radioGroupValue = XUI_PATH_SELECT_NONE; - break; - } - - mPathSelectionRadioGroup->setValue(radioGroupValue); -} - -F32 LLFloaterPathfindingConsole::getCharacterWidth() const -{ - return mCharacterWidthSlider->getValueF32(); -} - -void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) -{ - mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); -} - -LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const -{ - ECharacterType characterType; - - switch (mCharacterTypeRadioGroup->getValue().asInteger()) - { - case XUI_CHARACTER_TYPE_A : - characterType = kCharacterTypeA; - break; - case XUI_CHARACTER_TYPE_B : - characterType = kCharacterTypeB; - break; - case XUI_CHARACTER_TYPE_C : - characterType = kCharacterTypeC; - break; - case XUI_CHARACTER_TYPE_D : - characterType = kCharacterTypeD; - break; - default : - characterType = kCharacterTypeA; - llassert(0); - break; - } - - return characterType; -} - -void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) -{ - LLSD radioGroupValue; - - switch (pCharacterType) - { - case kCharacterTypeA : - radioGroupValue = XUI_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - radioGroupValue = XUI_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - radioGroupValue = XUI_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - radioGroupValue = XUI_CHARACTER_TYPE_D; - break; - default : - radioGroupValue = XUI_CHARACTER_TYPE_A; - llassert(0); - break; - } - - mCharacterTypeRadioGroup->setValue(radioGroupValue); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const -{ - return mTerrainMaterialA->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 pTerrainMaterial) -{ - mTerrainMaterialA->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const -{ - return mTerrainMaterialB->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 pTerrainMaterial) -{ - mTerrainMaterialB->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const -{ - return mTerrainMaterialC->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 pTerrainMaterial) -{ - mTerrainMaterialC->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const -{ - return mTerrainMaterialD->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) -{ - mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); -} - -void LLFloaterPathfindingConsole::setHasNavMeshReceived() -{ - std::string str = getString("navmesh_fetch_complete_available"); - mPathfindingStatus->setText((LLStringExplicit)str); -} - -void LLFloaterPathfindingConsole::setHasNoNavMesh() -{ - std::string str = getString("navmesh_fetch_complete_none"); - mPathfindingStatus->setText((LLStringExplicit)str); -} - -LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) - : LLFloater(pSeed), - mShowNavMeshCheckBox(NULL), - mShowExcludeVolumesCheckBox(NULL), - mShowPathCheckBox(NULL), - mShowWaterPlaneCheckBox(NULL), - mRegionOverlayDisplayRadioGroup(NULL), - mPathSelectionRadioGroup(NULL), - mCharacterWidthSlider(NULL), - mCharacterTypeRadioGroup(NULL), - mPathfindingStatus(NULL), - mTerrainMaterialA(NULL), - mTerrainMaterialB(NULL), - mTerrainMaterialC(NULL), - mTerrainMaterialD(NULL) -{ - for (int i=0;iextractNavMeshSrcFromLLSD( content ); - //return true; - //prep# end test - if ( LLPathingLib::getInstance() == NULL ) - { - std::string str = getString("navmesh_library_not_implemented"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llwarns <<"Errror: cannout find pathing library implementation."< regions; - regions.push_back( pCurrentRegion ); - //pCurrentRegion->getNeighboringRegions( regions ); - - std::vector shift; - shift.push_back( CURRENT_REGION ); - //pCurrentRegion->getNeighboringRegionsStatus( shift ); - - int regionCnt = regions.size(); - for ( int i=0; igetCapability( capability ); - - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shift[i]; - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); - ++mCurrentMDO; - } - else - { - std::string str = getString("navmesh_region_not_enabled"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["<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::onRegionOverlayDisplaySwitch() -{ - switch (getRegionOverlayDisplay()) - { - case kRenderOverlayOnFixedPhysicsGeometry : - llwarns << "functionality has not yet been implemented to toggle '" - << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnFixedPhysicsGeometry" - << llendl; - break; - case kRenderOverlayOnAllRenderableGeometry : - llwarns << "functionality has not yet been implemented to toggle '" - << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnAllRenderableGeometry" - << llendl; - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::onPathSelectionSwitch() -{ - switch (getPathSelectionState()) - { - case kPathSelectNone : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" - << llendl; - break; - case kPathSelectStartPoint : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectStartPoint" - << llendl; - break; - case kPathSelectEndPoint : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectEndPoint" - << llendl; - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::onCharacterWidthSet() -{ - F32 characterWidth = getCharacterWidth(); - llwarns << "functionality has not yet been implemented to set '" << mCharacterWidthSlider->getName() - << "' to the value (" << characterWidth << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onCharacterTypeSwitch() -{ - switch (getCharacterType()) - { - case kCharacterTypeA : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" - << llendl; - break; - case kCharacterTypeB : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" - << llendl; - break; - case kCharacterTypeC : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" - << llendl; - break; - case kCharacterTypeD : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" - << llendl; - break; - default : - llassert(0); - break; - } - -} - -void LLFloaterPathfindingConsole::onViewEditLinksetClicked() -{ - LLFloaterPathfindingLinksets::openLinksetsEditor(); -} - -void LLFloaterPathfindingConsole::onRebuildNavMeshClicked() -{ - llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; -} - -void LLFloaterPathfindingConsole::onRefreshNavMeshClicked() -{ - llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialASet() -{ - F32 terrainMaterial = getTerrainMaterialA(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialA->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialBSet() -{ - F32 terrainMaterial = getTerrainMaterialB(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialB->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialCSet() -{ - F32 terrainMaterial = getTerrainMaterialC(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialC->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialDSet() -{ - F32 terrainMaterial = getTerrainMaterialD(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - - -BOOL LLFloaterPathfindingConsole::allowAllRenderables() const -{ - return getRegionOverlayDisplay() == kRenderOverlayOnAllRenderableGeometry ? true : false; -} - -void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) -{ - switch (getPathSelectionState()) - { - case kPathSelectNone : - llwarns << "not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" - << llendl; - break; - - case kPathSelectStartPoint : - mPathData.mStartPointA = point1; - mPathData.mEndPointA = point2; - break; - - case kPathSelectEndPoint : - mPathData.mStartPointB = point1; - mPathData.mEndPointB = point2; - mPathData.mCharacterWidth = getCharacterWidth(); - //prep#TODO# possibly consider an alternate behavior - perhaps add a "path" button to submit the data. - LLPathingLib::getInstance()->generatePath( mPathData ); - break; - - default : - llassert(0); - break; - } -} +/** +* @file llfloaterpathfindingconsole.cpp +* @author William Todd Stinson +* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" + +#include "llsd.h" +#include "llagent.h" +#include "llbutton.h" +#include "llradiogroup.h" +#include "llsliderctrl.h" +#include "lllineeditor.h" +#include "lltextbase.h" +#include "lltextvalidate.h" +#include "llnavmeshstation.h" +#include "llviewerregion.h" + +#include "LLPathingLib.h" + +#define XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY 1 +#define XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY 2 + +#define XUI_PATH_SELECT_NONE 0 +#define XUI_PATH_SELECT_START_POINT 1 +#define XUI_PATH_SELECT_END_POINT 2 + +#define XUI_CHARACTER_TYPE_A 1 +#define XUI_CHARACTER_TYPE_B 2 +#define XUI_CHARACTER_TYPE_C 3 +#define XUI_CHARACTER_TYPE_D 4 + +const int CURRENT_REGION = 99; +const int MAX_OBSERVERS = 10; +//--------------------------------------------------------------------------- +// LLFloaterPathfindingConsole +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingConsole::postBuild() +{ + childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavMeshClicked, this)); + childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavMeshClicked, 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)); + + mRegionOverlayDisplayRadioGroup = findChild("region_overlay_display"); + llassert(mRegionOverlayDisplayRadioGroup != NULL); + mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch, this)); + + mPathSelectionRadioGroup = findChild("path_selection"); + llassert(mPathSelectionRadioGroup != NULL); + mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onPathSelectionSwitch, this)); + + mCharacterWidthSlider = findChild("character_width"); + llassert(mCharacterWidthSlider != NULL); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + + mCharacterTypeRadioGroup = findChild("character_type"); + llassert(mCharacterTypeRadioGroup != NULL); + mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + + mPathfindingStatus = findChild("pathfinding_status"); + llassert(mPathfindingStatus != NULL); + + mTerrainMaterialA = findChild("terrain_material_a"); + llassert(mTerrainMaterialA != NULL); + mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this)); + mTerrainMaterialA->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialB = findChild("terrain_material_b"); + llassert(mTerrainMaterialB != NULL); + mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialBSet, this)); + mTerrainMaterialB->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialC = findChild("terrain_material_c"); + llassert(mTerrainMaterialC != NULL); + mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialCSet, this)); + mTerrainMaterialC->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialD = findChild("terrain_material_d"); + llassert(mTerrainMaterialD != NULL); + mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialDSet, this)); + mTerrainMaterialD->setPrevalidate(LLTextValidate::validateFloat); + + return LLFloater::postBuild(); +} + +LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const +{ + ERegionOverlayDisplay regionOverlayDisplay; + switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) + { + case XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + break; + case XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY : + regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; + break; + default : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + llassert(0); + break; + } + + return regionOverlayDisplay; +} + +void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) +{ + LLSD radioGroupValue; + + switch (pRegionOverlayDisplay) + { + case kRenderOverlayOnFixedPhysicsGeometry : + radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; + break; + case kRenderOverlayOnAllRenderableGeometry : + radioGroupValue = XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY; + break; + default : + radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; + llassert(0); + break; + } + + mRegionOverlayDisplayRadioGroup->setValue(radioGroupValue); +} + +LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const +{ + EPathSelectionState pathSelectionState; + + switch (mPathSelectionRadioGroup->getValue().asInteger()) + { + case XUI_PATH_SELECT_START_POINT : + pathSelectionState = kPathSelectStartPoint; + break; + case XUI_PATH_SELECT_END_POINT : + pathSelectionState = kPathSelectEndPoint; + break; + default : + pathSelectionState = kPathSelectNone; + break; + } + + return pathSelectionState; +} + +void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pPathSelectionState) +{ + LLSD radioGroupValue; + + switch (pPathSelectionState) + { + case kPathSelectStartPoint : + radioGroupValue = XUI_PATH_SELECT_START_POINT; + break; + case kPathSelectEndPoint : + radioGroupValue = XUI_PATH_SELECT_END_POINT; + break; + default : + radioGroupValue = XUI_PATH_SELECT_NONE; + break; + } + + mPathSelectionRadioGroup->setValue(radioGroupValue); +} + +F32 LLFloaterPathfindingConsole::getCharacterWidth() const +{ + return mCharacterWidthSlider->getValueF32(); +} + +void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) +{ + mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); +} + +LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const +{ + ECharacterType characterType; + + switch (mCharacterTypeRadioGroup->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_A : + characterType = kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = kCharacterTypeD; + break; + default : + characterType = kCharacterTypeA; + llassert(0); + break; + } + + return characterType; +} + +void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) +{ + LLSD radioGroupValue; + + switch (pCharacterType) + { + case kCharacterTypeA : + radioGroupValue = XUI_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + radioGroupValue = XUI_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + radioGroupValue = XUI_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + radioGroupValue = XUI_CHARACTER_TYPE_D; + break; + default : + radioGroupValue = XUI_CHARACTER_TYPE_A; + llassert(0); + break; + } + + mCharacterTypeRadioGroup->setValue(radioGroupValue); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const +{ + return mTerrainMaterialA->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 pTerrainMaterial) +{ + mTerrainMaterialA->setValue(LLSD(pTerrainMaterial)); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const +{ + return mTerrainMaterialB->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 pTerrainMaterial) +{ + mTerrainMaterialB->setValue(LLSD(pTerrainMaterial)); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const +{ + return mTerrainMaterialC->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 pTerrainMaterial) +{ + mTerrainMaterialC->setValue(LLSD(pTerrainMaterial)); +} + +F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const +{ + return mTerrainMaterialD->getValue().asReal(); +} + +void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) +{ + mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); +} + +void LLFloaterPathfindingConsole::setHasNavMeshReceived() +{ + std::string str = getString("navmesh_fetch_complete_available"); + mPathfindingStatus->setText((LLStringExplicit)str); +} + +void LLFloaterPathfindingConsole::setHasNoNavMesh() +{ + std::string str = getString("navmesh_fetch_complete_none"); + mPathfindingStatus->setText((LLStringExplicit)str); +} + +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) + : LLFloater(pSeed), + mShowNavMeshCheckBox(NULL), + mShowExcludeVolumesCheckBox(NULL), + mShowPathCheckBox(NULL), + mShowWaterPlaneCheckBox(NULL), + mRegionOverlayDisplayRadioGroup(NULL), + mPathSelectionRadioGroup(NULL), + mCharacterWidthSlider(NULL), + mCharacterTypeRadioGroup(NULL), + mPathfindingStatus(NULL), + mTerrainMaterialA(NULL), + mTerrainMaterialB(NULL), + mTerrainMaterialC(NULL), + mTerrainMaterialD(NULL) +{ + for (int i=0;iextractNavMeshSrcFromLLSD( content ); + //return true; + //prep# end test + if ( LLPathingLib::getInstance() == NULL ) + { + std::string str = getString("navmesh_library_not_implemented"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llwarns <<"Errror: cannout find pathing library implementation."< regions; + regions.push_back( pCurrentRegion ); + //pCurrentRegion->getNeighboringRegions( regions ); + + std::vector shift; + shift.push_back( CURRENT_REGION ); + //pCurrentRegion->getNeighboringRegionsStatus( shift ); + + int regionCnt = regions.size(); + for ( int i=0; igetCapability( capability ); + + if ( !url.empty() ) + { + std::string str = getString("navmesh_fetch_inprogress"); + mPathfindingStatus->setText((LLStringExplicit)str); + LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); + int dir = shift[i]; + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); + ++mCurrentMDO; + } + else + { + std::string str = getString("navmesh_region_not_enabled"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llinfos<<"Region has does not required caps of type ["<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::onRegionOverlayDisplaySwitch() +{ + switch (getRegionOverlayDisplay()) + { + case kRenderOverlayOnFixedPhysicsGeometry : + llwarns << "functionality has not yet been implemented to toggle '" + << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnFixedPhysicsGeometry" + << llendl; + break; + case kRenderOverlayOnAllRenderableGeometry : + llwarns << "functionality has not yet been implemented to toggle '" + << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnAllRenderableGeometry" + << llendl; + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::onPathSelectionSwitch() +{ + switch (getPathSelectionState()) + { + case kPathSelectNone : + llwarns << "functionality has not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" + << llendl; + break; + case kPathSelectStartPoint : + llwarns << "functionality has not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectStartPoint" + << llendl; + break; + case kPathSelectEndPoint : + llwarns << "functionality has not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectEndPoint" + << llendl; + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + F32 characterWidth = getCharacterWidth(); + llwarns << "functionality has not yet been implemented to set '" << mCharacterWidthSlider->getName() + << "' to the value (" << characterWidth << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + switch (getCharacterType()) + { + case kCharacterTypeA : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" + << llendl; + break; + case kCharacterTypeB : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" + << llendl; + break; + case kCharacterTypeC : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" + << llendl; + break; + case kCharacterTypeD : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" + << llendl; + break; + default : + llassert(0); + break; + } + +} + +void LLFloaterPathfindingConsole::onViewEditLinksetClicked() +{ + LLFloaterPathfindingLinksets::openLinksetsEditor(); +} + +void LLFloaterPathfindingConsole::onRebuildNavMeshClicked() +{ + llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; +} + +void LLFloaterPathfindingConsole::onRefreshNavMeshClicked() +{ + llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; +} + +void LLFloaterPathfindingConsole::onTerrainMaterialASet() +{ + F32 terrainMaterial = getTerrainMaterialA(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialA->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onTerrainMaterialBSet() +{ + F32 terrainMaterial = getTerrainMaterialB(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialB->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onTerrainMaterialCSet() +{ + F32 terrainMaterial = getTerrainMaterialC(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialC->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingConsole::onTerrainMaterialDSet() +{ + F32 terrainMaterial = getTerrainMaterialD(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + + +BOOL LLFloaterPathfindingConsole::allowAllRenderables() const +{ + return getRegionOverlayDisplay() == kRenderOverlayOnAllRenderableGeometry ? true : false; +} + +void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) +{ + switch (getPathSelectionState()) + { + case kPathSelectNone : + llwarns << "not yet been implemented to toggle '" + << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" + << llendl; + break; + + case kPathSelectStartPoint : + mPathData.mStartPointA = point1; + mPathData.mEndPointA = point2; + break; + + case kPathSelectEndPoint : + mPathData.mStartPointB = point1; + mPathData.mEndPointB = point2; + mPathData.mCharacterWidth = getCharacterWidth(); + //prep#TODO# possibly consider an alternate behavior - perhaps add a "path" button to submit the data. + LLPathingLib::getInstance()->generatePath( mPathData ); + break; + + default : + llassert(0); + break; + } +} -- cgit v1.2.3 From 8f6524d999d5153ff4b89abafb35bc96870d6230 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 31 Jan 2012 15:12:30 -0500 Subject: PATH-118: Build up of neighboring regions and commented out call to pathinglib navmehs stitching code. Minor cleanups. Currently only submits current region to pathinglib. --- indra/newview/llfloaterpathfindingconsole.cpp | 30 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fce67c4171..6c5e1f1f4b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -313,6 +313,12 @@ void LLFloaterPathfindingConsole::setHasNavMeshReceived() { std::string str = getString("navmesh_fetch_complete_available"); mPathfindingStatus->setText((LLStringExplicit)str); + //check to see if all regions are done loading and they are then stitch the navmeshes together + --mNavMeshCnt; + if ( mNavMeshCnt == 0 ) + { + //LLPathingLib::getInstance()->stitchNavMeshes(); + } } void LLFloaterPathfindingConsole::setHasNoNavMesh() @@ -335,7 +341,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialA(NULL), mTerrainMaterialB(NULL), mTerrainMaterialC(NULL), - mTerrainMaterialD(NULL) + mTerrainMaterialD(NULL), + mNavMeshCnt(0) { for (int i=0;iextractNavMeshSrcFromLLSD( content ); - //return true; - //prep# end test + } if ( LLPathingLib::getInstance() == NULL ) { std::string str = getString("navmesh_library_not_implemented"); @@ -370,6 +372,8 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) else { mCurrentMDO = 0; + mNavMeshCnt = 0; + //make sure the region is essentially enabled for navmesh support std::string capability = "RetrieveNavMeshSrc"; @@ -383,7 +387,15 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) shift.push_back( CURRENT_REGION ); //pCurrentRegion->getNeighboringRegionsStatus( shift ); + //If the navmesh shift ops and the total region counts do not match - use the current region, only. + if ( shift.size() != regions.size() ) + { + shift.clear();regions.clear(); + regions.push_back( pCurrentRegion ); + shift.push_back( CURRENT_REGION ); + } int regionCnt = regions.size(); + mNavMeshCnt = regionCnt; for ( int i=0; igetCapability( capability ); @@ -399,6 +411,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } else { + --mNavMeshCnt; std::string str = getString("navmesh_region_not_enabled"); LLStyle::Params styleParams; styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); @@ -610,7 +623,6 @@ void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, c mPathData.mStartPointB = point1; mPathData.mEndPointB = point2; mPathData.mCharacterWidth = getCharacterWidth(); - //prep#TODO# possibly consider an alternate behavior - perhaps add a "path" button to submit the data. LLPathingLib::getInstance()->generatePath( mPathData ); break; @@ -618,4 +630,4 @@ void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, c llassert(0); break; } -} +} \ No newline at end of file -- cgit v1.2.3 From a376d6314d0ce2a15858d2890534a8a010f0c5eb Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 31 Jan 2012 16:30:16 -0800 Subject: PATH-243: Refactoring the implementation for the render mode buttons on the console. Removing the warning messages for methods that now have implementations. --- indra/newview/llfloaterpathfindingconsole.cpp | 65 +++++++++++++++++---------- 1 file changed, 42 insertions(+), 23 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 6c5e1f1f4b..a39869eddd 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -445,7 +445,7 @@ void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - llPathingLibInstance->setRenderNavMeshandShapes(checkBoxValue); + llPathingLibInstance->setRenderShapes(checkBoxValue); } else { @@ -458,15 +458,33 @@ void LLFloaterPathfindingConsole::onShowPathToggle() { BOOL checkBoxValue = mShowPathCheckBox->get(); - llwarns << "functionality has not yet been implemented to toggle '" - << mShowPathCheckBox->getLabel() << "' to " - << (checkBoxValue ? "ON" : "OFF") << llendl; + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderPath(checkBoxValue); + } + else + { + mShowPathCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } } void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() { BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderWaterPlane(checkBoxValue); + } + else + { + mShowWaterPlaneCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } + llwarns << "functionality has not yet been implemented to toggle '" << mShowWaterPlaneCheckBox->getLabel() << "' to " << (checkBoxValue ? "ON" : "OFF") << llendl; @@ -474,21 +492,27 @@ void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() void LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch() { - switch (getRegionOverlayDisplay()) + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) { - case kRenderOverlayOnFixedPhysicsGeometry : - llwarns << "functionality has not yet been implemented to toggle '" - << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnFixedPhysicsGeometry" - << llendl; - break; - case kRenderOverlayOnAllRenderableGeometry : - llwarns << "functionality has not yet been implemented to toggle '" - << mRegionOverlayDisplayRadioGroup->getName() << "' to RenderOverlayOnAllRenderableGeometry" - << llendl; - break; - default : - llassert(0); - break; + switch (getRegionOverlayDisplay()) + { + case kRenderOverlayOnFixedPhysicsGeometry : + llPathingLibInstance->setRenderOverlayMode(false); + break; + case kRenderOverlayOnAllRenderableGeometry : + llPathingLibInstance->setRenderOverlayMode(true); + break; + default : + llPathingLibInstance->setRenderOverlayMode(false); + llassert(0); + break; + } + } + else + { + this->setRegionOverlayDisplay(kRenderOverlayOnFixedPhysicsGeometry); + llwarns << "cannot find LLPathingLib instance" << llendl; } } @@ -599,11 +623,6 @@ void LLFloaterPathfindingConsole::onTerrainMaterialDSet() } -BOOL LLFloaterPathfindingConsole::allowAllRenderables() const -{ - return getRegionOverlayDisplay() == kRenderOverlayOnAllRenderableGeometry ? true : false; -} - void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) { switch (getPathSelectionState()) -- cgit v1.2.3 From 2cd52d43e5b4e185922b76f3d070931d698f1213 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 1 Feb 2012 12:51:44 -0800 Subject: PATH-235: Rewiring a bit of the path generation code to remove extraneous error messages and to rebuild when the character width or the start point changes. --- indra/newview/llfloaterpathfindingconsole.cpp | 36 ++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index a39869eddd..50edc55d76 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -342,7 +342,9 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialB(NULL), mTerrainMaterialC(NULL), mTerrainMaterialD(NULL), - mNavMeshCnt(0) + mNavMeshCnt(0), + mHasStartPoint(false), + mHasEndPoint(false) { for (int i=0;igetName() << "' to PathSelectNone" - << llendl; break; case kPathSelectStartPoint : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectStartPoint" - << llendl; break; case kPathSelectEndPoint : - llwarns << "functionality has not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectEndPoint" - << llendl; break; default : llassert(0); @@ -543,9 +536,7 @@ void LLFloaterPathfindingConsole::onPathSelectionSwitch() void LLFloaterPathfindingConsole::onCharacterWidthSet() { - F32 characterWidth = getCharacterWidth(); - llwarns << "functionality has not yet been implemented to set '" << mCharacterWidthSlider->getName() - << "' to the value (" << characterWidth << ")" << llendl; + generatePath(); } void LLFloaterPathfindingConsole::onCharacterTypeSwitch() @@ -636,17 +627,28 @@ void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, c case kPathSelectStartPoint : mPathData.mStartPointA = point1; mPathData.mEndPointA = point2; + mHasStartPoint = true; break; case kPathSelectEndPoint : mPathData.mStartPointB = point1; mPathData.mEndPointB = point2; - mPathData.mCharacterWidth = getCharacterWidth(); - LLPathingLib::getInstance()->generatePath( mPathData ); + mHasEndPoint = true; break; default : llassert(0); break; - } -} \ No newline at end of file + } + + generatePath(); +} + +void LLFloaterPathfindingConsole::generatePath() +{ + if (mHasStartPoint && mHasEndPoint) + { + mPathData.mCharacterWidth = getCharacterWidth(); + LLPathingLib::getInstance()->generatePath(mPathData); + } +} -- cgit v1.2.3 From 125bdb31b05d2d8791f8ec5c3c5000c4d7a54060 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 1 Feb 2012 17:55:49 -0800 Subject: Renaming the pathfinding console to be pathfinding setup. --- indra/newview/llfloaterpathfindingconsole.cpp | 654 -------------------------- 1 file changed, 654 deletions(-) delete mode 100644 indra/newview/llfloaterpathfindingconsole.cpp (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp deleted file mode 100644 index 50edc55d76..0000000000 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ /dev/null @@ -1,654 +0,0 @@ -/** -* @file llfloaterpathfindingconsole.cpp -* @author William Todd Stinson -* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. -* -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" -#include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" - -#include "llsd.h" -#include "llagent.h" -#include "llbutton.h" -#include "llradiogroup.h" -#include "llsliderctrl.h" -#include "lllineeditor.h" -#include "lltextbase.h" -#include "lltextvalidate.h" -#include "llnavmeshstation.h" -#include "llviewerregion.h" - -#include "LLPathingLib.h" - -#define XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY 1 -#define XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY 2 - -#define XUI_PATH_SELECT_NONE 0 -#define XUI_PATH_SELECT_START_POINT 1 -#define XUI_PATH_SELECT_END_POINT 2 - -#define XUI_CHARACTER_TYPE_A 1 -#define XUI_CHARACTER_TYPE_B 2 -#define XUI_CHARACTER_TYPE_C 3 -#define XUI_CHARACTER_TYPE_D 4 - -const int CURRENT_REGION = 99; -const int MAX_OBSERVERS = 10; -//--------------------------------------------------------------------------- -// LLFloaterPathfindingConsole -//--------------------------------------------------------------------------- - -BOOL LLFloaterPathfindingConsole::postBuild() -{ - childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavMeshClicked, this)); - childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavMeshClicked, 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)); - - mRegionOverlayDisplayRadioGroup = findChild("region_overlay_display"); - llassert(mRegionOverlayDisplayRadioGroup != NULL); - mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch, this)); - - mPathSelectionRadioGroup = findChild("path_selection"); - llassert(mPathSelectionRadioGroup != NULL); - mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onPathSelectionSwitch, this)); - - mCharacterWidthSlider = findChild("character_width"); - llassert(mCharacterWidthSlider != NULL); - mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); - - mCharacterTypeRadioGroup = findChild("character_type"); - llassert(mCharacterTypeRadioGroup != NULL); - mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); - - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); - - mTerrainMaterialA = findChild("terrain_material_a"); - llassert(mTerrainMaterialA != NULL); - mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this)); - mTerrainMaterialA->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialB = findChild("terrain_material_b"); - llassert(mTerrainMaterialB != NULL); - mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialBSet, this)); - mTerrainMaterialB->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialC = findChild("terrain_material_c"); - llassert(mTerrainMaterialC != NULL); - mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialCSet, this)); - mTerrainMaterialC->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialD = findChild("terrain_material_d"); - llassert(mTerrainMaterialD != NULL); - mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialDSet, this)); - mTerrainMaterialD->setPrevalidate(LLTextValidate::validateFloat); - - return LLFloater::postBuild(); -} - -LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const -{ - ERegionOverlayDisplay regionOverlayDisplay; - switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) - { - case XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - break; - case XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY : - regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; - break; - default : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - llassert(0); - break; - } - - return regionOverlayDisplay; -} - -void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) -{ - LLSD radioGroupValue; - - switch (pRegionOverlayDisplay) - { - case kRenderOverlayOnFixedPhysicsGeometry : - radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; - break; - case kRenderOverlayOnAllRenderableGeometry : - radioGroupValue = XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY; - break; - default : - radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; - llassert(0); - break; - } - - mRegionOverlayDisplayRadioGroup->setValue(radioGroupValue); -} - -LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const -{ - EPathSelectionState pathSelectionState; - - switch (mPathSelectionRadioGroup->getValue().asInteger()) - { - case XUI_PATH_SELECT_START_POINT : - pathSelectionState = kPathSelectStartPoint; - break; - case XUI_PATH_SELECT_END_POINT : - pathSelectionState = kPathSelectEndPoint; - break; - default : - pathSelectionState = kPathSelectNone; - break; - } - - return pathSelectionState; -} - -void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pPathSelectionState) -{ - LLSD radioGroupValue; - - switch (pPathSelectionState) - { - case kPathSelectStartPoint : - radioGroupValue = XUI_PATH_SELECT_START_POINT; - break; - case kPathSelectEndPoint : - radioGroupValue = XUI_PATH_SELECT_END_POINT; - break; - default : - radioGroupValue = XUI_PATH_SELECT_NONE; - break; - } - - mPathSelectionRadioGroup->setValue(radioGroupValue); -} - -F32 LLFloaterPathfindingConsole::getCharacterWidth() const -{ - return mCharacterWidthSlider->getValueF32(); -} - -void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) -{ - mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); -} - -LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const -{ - ECharacterType characterType; - - switch (mCharacterTypeRadioGroup->getValue().asInteger()) - { - case XUI_CHARACTER_TYPE_A : - characterType = kCharacterTypeA; - break; - case XUI_CHARACTER_TYPE_B : - characterType = kCharacterTypeB; - break; - case XUI_CHARACTER_TYPE_C : - characterType = kCharacterTypeC; - break; - case XUI_CHARACTER_TYPE_D : - characterType = kCharacterTypeD; - break; - default : - characterType = kCharacterTypeA; - llassert(0); - break; - } - - return characterType; -} - -void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) -{ - LLSD radioGroupValue; - - switch (pCharacterType) - { - case kCharacterTypeA : - radioGroupValue = XUI_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - radioGroupValue = XUI_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - radioGroupValue = XUI_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - radioGroupValue = XUI_CHARACTER_TYPE_D; - break; - default : - radioGroupValue = XUI_CHARACTER_TYPE_A; - llassert(0); - break; - } - - mCharacterTypeRadioGroup->setValue(radioGroupValue); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const -{ - return mTerrainMaterialA->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 pTerrainMaterial) -{ - mTerrainMaterialA->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const -{ - return mTerrainMaterialB->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 pTerrainMaterial) -{ - mTerrainMaterialB->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const -{ - return mTerrainMaterialC->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 pTerrainMaterial) -{ - mTerrainMaterialC->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const -{ - return mTerrainMaterialD->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) -{ - mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); -} - -void LLFloaterPathfindingConsole::setHasNavMeshReceived() -{ - std::string str = getString("navmesh_fetch_complete_available"); - mPathfindingStatus->setText((LLStringExplicit)str); - //check to see if all regions are done loading and they are then stitch the navmeshes together - --mNavMeshCnt; - if ( mNavMeshCnt == 0 ) - { - //LLPathingLib::getInstance()->stitchNavMeshes(); - } -} - -void LLFloaterPathfindingConsole::setHasNoNavMesh() -{ - std::string str = getString("navmesh_fetch_complete_none"); - mPathfindingStatus->setText((LLStringExplicit)str); -} - -LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) - : LLFloater(pSeed), - mShowNavMeshCheckBox(NULL), - mShowExcludeVolumesCheckBox(NULL), - mShowPathCheckBox(NULL), - mShowWaterPlaneCheckBox(NULL), - mRegionOverlayDisplayRadioGroup(NULL), - mPathSelectionRadioGroup(NULL), - mCharacterWidthSlider(NULL), - mCharacterTypeRadioGroup(NULL), - mPathfindingStatus(NULL), - mTerrainMaterialA(NULL), - mTerrainMaterialB(NULL), - mTerrainMaterialC(NULL), - mTerrainMaterialD(NULL), - mNavMeshCnt(0), - mHasStartPoint(false), - mHasEndPoint(false) -{ - for (int i=0;isetText((LLStringExplicit)str, styleParams); - llwarns <<"Errror: cannout find pathing library implementation."< regions; - regions.push_back( pCurrentRegion ); - //pCurrentRegion->getNeighboringRegions( regions ); - - std::vector shift; - shift.push_back( CURRENT_REGION ); - //pCurrentRegion->getNeighboringRegionsStatus( shift ); - - //If the navmesh shift ops and the total region counts do not match - use the current region, only. - if ( shift.size() != regions.size() ) - { - shift.clear();regions.clear(); - regions.push_back( pCurrentRegion ); - shift.push_back( CURRENT_REGION ); - } - int regionCnt = regions.size(); - mNavMeshCnt = regionCnt; - for ( int i=0; igetCapability( capability ); - - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shift[i]; - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); - ++mCurrentMDO; - } - else - { - --mNavMeshCnt; - std::string str = getString("navmesh_region_not_enabled"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["<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->setRenderShapes(checkBoxValue); - } - else - { - mShowExcludeVolumesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowPathToggle() -{ - BOOL checkBoxValue = mShowPathCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderPath(checkBoxValue); - } - else - { - mShowPathCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() -{ - BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderWaterPlane(checkBoxValue); - } - else - { - mShowWaterPlaneCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } - - llwarns << "functionality has not yet been implemented to toggle '" - << mShowWaterPlaneCheckBox->getLabel() << "' to " - << (checkBoxValue ? "ON" : "OFF") << llendl; -} - -void LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch() -{ - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - switch (getRegionOverlayDisplay()) - { - case kRenderOverlayOnFixedPhysicsGeometry : - llPathingLibInstance->setRenderOverlayMode(false); - break; - case kRenderOverlayOnAllRenderableGeometry : - llPathingLibInstance->setRenderOverlayMode(true); - break; - default : - llPathingLibInstance->setRenderOverlayMode(false); - llassert(0); - break; - } - } - else - { - this->setRegionOverlayDisplay(kRenderOverlayOnFixedPhysicsGeometry); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onPathSelectionSwitch() -{ - switch (getPathSelectionState()) - { - case kPathSelectNone : - break; - case kPathSelectStartPoint : - break; - case kPathSelectEndPoint : - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::onCharacterWidthSet() -{ - generatePath(); -} - -void LLFloaterPathfindingConsole::onCharacterTypeSwitch() -{ - switch (getCharacterType()) - { - case kCharacterTypeA : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" - << llendl; - break; - case kCharacterTypeB : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" - << llendl; - break; - case kCharacterTypeC : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" - << llendl; - break; - case kCharacterTypeD : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" - << llendl; - break; - default : - llassert(0); - break; - } - -} - -void LLFloaterPathfindingConsole::onViewEditLinksetClicked() -{ - LLFloaterPathfindingLinksets::openLinksetsEditor(); -} - -void LLFloaterPathfindingConsole::onRebuildNavMeshClicked() -{ - llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; -} - -void LLFloaterPathfindingConsole::onRefreshNavMeshClicked() -{ - llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialASet() -{ - F32 terrainMaterial = getTerrainMaterialA(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialA->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialBSet() -{ - F32 terrainMaterial = getTerrainMaterialB(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialB->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialCSet() -{ - F32 terrainMaterial = getTerrainMaterialC(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialC->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialDSet() -{ - F32 terrainMaterial = getTerrainMaterialD(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - - -void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) -{ - switch (getPathSelectionState()) - { - case kPathSelectNone : - llwarns << "not yet been implemented to toggle '" - << mPathSelectionRadioGroup->getName() << "' to PathSelectNone" - << llendl; - break; - - case kPathSelectStartPoint : - mPathData.mStartPointA = point1; - mPathData.mEndPointA = point2; - mHasStartPoint = true; - break; - - case kPathSelectEndPoint : - mPathData.mStartPointB = point1; - mPathData.mEndPointB = point2; - mHasEndPoint = true; - break; - - default : - llassert(0); - break; - } - - generatePath(); -} - -void LLFloaterPathfindingConsole::generatePath() -{ - if (mHasStartPoint && mHasEndPoint) - { - mPathData.mCharacterWidth = getCharacterWidth(); - LLPathingLib::getInstance()->generatePath(mPathData); - } -} -- cgit v1.2.3 From 11259b37ee93e06fd61dac8e88180150c1fd63b8 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 10 Feb 2012 17:34:14 -0800 Subject: PATH-284: Moving files around in preparation for the new pathfinding console design. --- indra/newview/llfloaterpathfindingconsole.cpp | 653 ++++++++++++++++++++++++++ 1 file changed, 653 insertions(+) create mode 100644 indra/newview/llfloaterpathfindingconsole.cpp (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp new file mode 100644 index 0000000000..35f56a5625 --- /dev/null +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -0,0 +1,653 @@ +/** +* @file llfloaterpathfindingsetup.cpp +* @author William Todd Stinson +* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" + +#include "llsd.h" +#include "llagent.h" +#include "llbutton.h" +#include "llradiogroup.h" +#include "llsliderctrl.h" +#include "lllineeditor.h" +#include "lltextbase.h" +#include "lltextvalidate.h" +#include "llnavmeshstation.h" +#include "llviewerregion.h" + +#include "LLPathingLib.h" + +#define XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY 1 +#define XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY 2 + +#define XUI_PATH_SELECT_NONE 0 +#define XUI_PATH_SELECT_START_POINT 1 +#define XUI_PATH_SELECT_END_POINT 2 + +#define XUI_CHARACTER_TYPE_A 1 +#define XUI_CHARACTER_TYPE_B 2 +#define XUI_CHARACTER_TYPE_C 3 +#define XUI_CHARACTER_TYPE_D 4 + +const int CURRENT_REGION = 99; +const int MAX_OBSERVERS = 10; +//--------------------------------------------------------------------------- +// LLFloaterPathfindingSetup +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingSetup::postBuild() +{ + childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingSetup::onViewEditLinksetClicked, this)); + childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingSetup::onRebuildNavMeshClicked, this)); + childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingSetup::onRefreshNavMeshClicked, this)); + + mShowNavMeshCheckBox = findChild("show_navmesh_overlay"); + llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowNavMeshToggle, this)); + + mShowExcludeVolumesCheckBox = findChild("show_exclusion_volumes"); + llassert(mShowExcludeVolumesCheckBox != NULL); + mShowExcludeVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowExcludeVolumesToggle, this)); + + mShowPathCheckBox = findChild("show_path"); + llassert(mShowPathCheckBox != NULL); + mShowPathCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowPathToggle, this)); + + mShowWaterPlaneCheckBox = findChild("show_water_plane"); + llassert(mShowWaterPlaneCheckBox != NULL); + mShowWaterPlaneCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowWaterPlaneToggle, this)); + + mRegionOverlayDisplayRadioGroup = findChild("region_overlay_display"); + llassert(mRegionOverlayDisplayRadioGroup != NULL); + mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onRegionOverlayDisplaySwitch, this)); + + mPathSelectionRadioGroup = findChild("path_selection"); + llassert(mPathSelectionRadioGroup != NULL); + mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onPathSelectionSwitch, this)); + + mCharacterWidthSlider = findChild("character_width"); + llassert(mCharacterWidthSlider != NULL); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onCharacterWidthSet, this)); + + mCharacterTypeRadioGroup = findChild("character_type"); + llassert(mCharacterTypeRadioGroup != NULL); + mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onCharacterTypeSwitch, this)); + + mPathfindingStatus = findChild("pathfinding_status"); + llassert(mPathfindingStatus != NULL); + + mTerrainMaterialA = findChild("terrain_material_a"); + llassert(mTerrainMaterialA != NULL); + mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialASet, this)); + mTerrainMaterialA->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialB = findChild("terrain_material_b"); + llassert(mTerrainMaterialB != NULL); + mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialBSet, this)); + mTerrainMaterialB->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialC = findChild("terrain_material_c"); + llassert(mTerrainMaterialC != NULL); + mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialCSet, this)); + mTerrainMaterialC->setPrevalidate(LLTextValidate::validateFloat); + + mTerrainMaterialD = findChild("terrain_material_d"); + llassert(mTerrainMaterialD != NULL); + mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialDSet, this)); + mTerrainMaterialD->setPrevalidate(LLTextValidate::validateFloat); + + return LLFloater::postBuild(); +} + +LLFloaterPathfindingSetup::ERegionOverlayDisplay LLFloaterPathfindingSetup::getRegionOverlayDisplay() const +{ + ERegionOverlayDisplay regionOverlayDisplay; + switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) + { + case XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + break; + case XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY : + regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; + break; + default : + regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; + llassert(0); + break; + } + + return regionOverlayDisplay; +} + +void LLFloaterPathfindingSetup::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) +{ + LLSD radioGroupValue; + + switch (pRegionOverlayDisplay) + { + case kRenderOverlayOnFixedPhysicsGeometry : + radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; + break; + case kRenderOverlayOnAllRenderableGeometry : + radioGroupValue = XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY; + break; + default : + radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; + llassert(0); + break; + } + + mRegionOverlayDisplayRadioGroup->setValue(radioGroupValue); +} + +LLFloaterPathfindingSetup::EPathSelectionState LLFloaterPathfindingSetup::getPathSelectionState() const +{ + EPathSelectionState pathSelectionState; + + switch (mPathSelectionRadioGroup->getValue().asInteger()) + { + case XUI_PATH_SELECT_START_POINT : + pathSelectionState = kPathSelectStartPoint; + break; + case XUI_PATH_SELECT_END_POINT : + pathSelectionState = kPathSelectEndPoint; + break; + default : + pathSelectionState = kPathSelectNone; + break; + } + + return pathSelectionState; +} + +void LLFloaterPathfindingSetup::setPathSelectionState(EPathSelectionState pPathSelectionState) +{ + LLSD radioGroupValue; + + switch (pPathSelectionState) + { + case kPathSelectStartPoint : + radioGroupValue = XUI_PATH_SELECT_START_POINT; + break; + case kPathSelectEndPoint : + radioGroupValue = XUI_PATH_SELECT_END_POINT; + break; + default : + radioGroupValue = XUI_PATH_SELECT_NONE; + break; + } + + mPathSelectionRadioGroup->setValue(radioGroupValue); +} + +F32 LLFloaterPathfindingSetup::getCharacterWidth() const +{ + return mCharacterWidthSlider->getValueF32(); +} + +void LLFloaterPathfindingSetup::setCharacterWidth(F32 pCharacterWidth) +{ + mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); +} + +LLFloaterPathfindingSetup::ECharacterType LLFloaterPathfindingSetup::getCharacterType() const +{ + ECharacterType characterType; + + switch (mCharacterTypeRadioGroup->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_A : + characterType = kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = kCharacterTypeD; + break; + default : + characterType = kCharacterTypeA; + llassert(0); + break; + } + + return characterType; +} + +void LLFloaterPathfindingSetup::setCharacterType(ECharacterType pCharacterType) +{ + LLSD radioGroupValue; + + switch (pCharacterType) + { + case kCharacterTypeA : + radioGroupValue = XUI_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + radioGroupValue = XUI_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + radioGroupValue = XUI_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + radioGroupValue = XUI_CHARACTER_TYPE_D; + break; + default : + radioGroupValue = XUI_CHARACTER_TYPE_A; + llassert(0); + break; + } + + mCharacterTypeRadioGroup->setValue(radioGroupValue); +} + +F32 LLFloaterPathfindingSetup::getTerrainMaterialA() const +{ + return mTerrainMaterialA->getValue().asReal(); +} + +void LLFloaterPathfindingSetup::setTerrainMaterialA(F32 pTerrainMaterial) +{ + mTerrainMaterialA->setValue(LLSD(pTerrainMaterial)); +} + +F32 LLFloaterPathfindingSetup::getTerrainMaterialB() const +{ + return mTerrainMaterialB->getValue().asReal(); +} + +void LLFloaterPathfindingSetup::setTerrainMaterialB(F32 pTerrainMaterial) +{ + mTerrainMaterialB->setValue(LLSD(pTerrainMaterial)); +} + +F32 LLFloaterPathfindingSetup::getTerrainMaterialC() const +{ + return mTerrainMaterialC->getValue().asReal(); +} + +void LLFloaterPathfindingSetup::setTerrainMaterialC(F32 pTerrainMaterial) +{ + mTerrainMaterialC->setValue(LLSD(pTerrainMaterial)); +} + +F32 LLFloaterPathfindingSetup::getTerrainMaterialD() const +{ + return mTerrainMaterialD->getValue().asReal(); +} + +void LLFloaterPathfindingSetup::setTerrainMaterialD(F32 pTerrainMaterial) +{ + mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); +} + +void LLFloaterPathfindingSetup::setHasNavMeshReceived() +{ + std::string str = getString("navmesh_fetch_complete_available"); + mPathfindingStatus->setText((LLStringExplicit)str); + //check to see if all regions are done loading and they are then stitch the navmeshes together + --mNavMeshCnt; + if ( mNavMeshCnt == 0 ) + { + LLPathingLib::getInstance()->stitchNavMeshes(); + } +} + +void LLFloaterPathfindingSetup::setHasNoNavMesh() +{ + std::string str = getString("navmesh_fetch_complete_none"); + mPathfindingStatus->setText((LLStringExplicit)str); +} + +LLFloaterPathfindingSetup::LLFloaterPathfindingSetup(const LLSD& pSeed) + : LLFloater(pSeed), + mShowNavMeshCheckBox(NULL), + mShowExcludeVolumesCheckBox(NULL), + mShowPathCheckBox(NULL), + mShowWaterPlaneCheckBox(NULL), + mRegionOverlayDisplayRadioGroup(NULL), + mPathSelectionRadioGroup(NULL), + mCharacterWidthSlider(NULL), + mCharacterTypeRadioGroup(NULL), + mPathfindingStatus(NULL), + mTerrainMaterialA(NULL), + mTerrainMaterialB(NULL), + mTerrainMaterialC(NULL), + mTerrainMaterialD(NULL), + mNavMeshCnt(0), + mHasStartPoint(false), + mHasEndPoint(false) +{ + for (int i=0;isetText((LLStringExplicit)str, styleParams); + llwarns <<"Errror: cannout find pathing library implementation."<cleanupResidual(); + + mCurrentMDO = 0; + mNavMeshCnt = 0; + + //make sure the region is essentially enabled for navmesh support + std::string capability = "RetrieveNavMeshSrc"; + + //prep# neighboring navmesh support proto + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector regions; + regions.push_back( pCurrentRegion ); + pCurrentRegion->getNeighboringRegions( regions ); + + std::vector shift; + shift.push_back( CURRENT_REGION ); + pCurrentRegion->getNeighboringRegionsStatus( shift ); + + //If the navmesh shift ops and the total region counts do not match - use the current region, only. + if ( shift.size() != regions.size() ) + { + shift.clear();regions.clear(); + regions.push_back( pCurrentRegion ); + shift.push_back( CURRENT_REGION ); + } + int regionCnt = regions.size(); + mNavMeshCnt = regionCnt; + for ( int i=0; igetCapability( capability ); + + if ( !url.empty() ) + { + std::string str = getString("navmesh_fetch_inprogress"); + mPathfindingStatus->setText((LLStringExplicit)str); + LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); + int dir = shift[i]; + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); + ++mCurrentMDO; + } + else + { + --mNavMeshCnt; + std::string str = getString("navmesh_region_not_enabled"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llinfos<<"Region has does not required caps of type ["<get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderNavMesh(checkBoxValue); + } + else + { + mShowNavMeshCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingSetup::onShowExcludeVolumesToggle() +{ + BOOL checkBoxValue = mShowExcludeVolumesCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderShapes(checkBoxValue); + } + else + { + mShowExcludeVolumesCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingSetup::onShowPathToggle() +{ + BOOL checkBoxValue = mShowPathCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderPath(checkBoxValue); + } + else + { + mShowPathCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingSetup::onShowWaterPlaneToggle() +{ + BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderWaterPlane(checkBoxValue); + } + else + { + mShowWaterPlaneCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } + + llwarns << "functionality has not yet been implemented to toggle '" + << mShowWaterPlaneCheckBox->getLabel() << "' to " + << (checkBoxValue ? "ON" : "OFF") << llendl; +} + +void LLFloaterPathfindingSetup::onRegionOverlayDisplaySwitch() +{ + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + switch (getRegionOverlayDisplay()) + { + case kRenderOverlayOnFixedPhysicsGeometry : + llPathingLibInstance->setRenderOverlayMode(false); + break; + case kRenderOverlayOnAllRenderableGeometry : + llPathingLibInstance->setRenderOverlayMode(true); + break; + default : + llPathingLibInstance->setRenderOverlayMode(false); + llassert(0); + break; + } + } + else + { + this->setRegionOverlayDisplay(kRenderOverlayOnFixedPhysicsGeometry); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingSetup::onPathSelectionSwitch() +{ + switch (getPathSelectionState()) + { + case kPathSelectNone : + break; + case kPathSelectStartPoint : + break; + case kPathSelectEndPoint : + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingSetup::onCharacterWidthSet() +{ + generatePath(); +} + +void LLFloaterPathfindingSetup::onCharacterTypeSwitch() +{ + switch (getCharacterType()) + { + case kCharacterTypeA : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" + << llendl; + break; + case kCharacterTypeB : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" + << llendl; + break; + case kCharacterTypeC : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" + << llendl; + break; + case kCharacterTypeD : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" + << llendl; + break; + default : + llassert(0); + break; + } + +} + +void LLFloaterPathfindingSetup::onViewEditLinksetClicked() +{ + LLFloaterPathfindingLinksets::openLinksetsEditor(); +} + +void LLFloaterPathfindingSetup::onRebuildNavMeshClicked() +{ + llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; +} + +void LLFloaterPathfindingSetup::onRefreshNavMeshClicked() +{ + llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; +} + +void LLFloaterPathfindingSetup::onTerrainMaterialASet() +{ + F32 terrainMaterial = getTerrainMaterialA(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialA->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingSetup::onTerrainMaterialBSet() +{ + F32 terrainMaterial = getTerrainMaterialB(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialB->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingSetup::onTerrainMaterialCSet() +{ + F32 terrainMaterial = getTerrainMaterialC(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialC->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + +void LLFloaterPathfindingSetup::onTerrainMaterialDSet() +{ + F32 terrainMaterial = getTerrainMaterialD(); + llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() + << "' to value (" << terrainMaterial << ")" << llendl; +} + + +void LLFloaterPathfindingSetup::providePathingData( const LLVector3& point1, const LLVector3& point2 ) +{ + switch (getPathSelectionState()) + { + case kPathSelectNone : + break; + + case kPathSelectStartPoint : + mPathData.mStartPointA = point1; + mPathData.mEndPointA = point2; + mHasStartPoint = true; + break; + + case kPathSelectEndPoint : + mPathData.mStartPointB = point1; + mPathData.mEndPointB = point2; + mHasEndPoint = true; + break; + + default : + llassert(0); + break; + } + + generatePath(); +} + +void LLFloaterPathfindingSetup::generatePath() +{ + if (mHasStartPoint && mHasEndPoint) + { + mPathData.mCharacterWidth = getCharacterWidth(); + LLPathingLib::getInstance()->generatePath(mPathData); + } +} -- cgit v1.2.3 From db977bf85c9e7eb3afc98813dda13107672bb2f6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 10 Feb 2012 17:49:18 -0800 Subject: PATH-284: Updating the class names in preparation for the new pathfinding console design. --- indra/newview/llfloaterpathfindingconsole.cpp | 112 +++++++++++++------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 35f56a5625..51952d87b5 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,5 +1,5 @@ /** -* @file llfloaterpathfindingsetup.cpp +* @file llfloaterpathfindingconsole.cpp * @author William Todd Stinson * @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. * @@ -57,74 +57,74 @@ const int CURRENT_REGION = 99; const int MAX_OBSERVERS = 10; //--------------------------------------------------------------------------- -// LLFloaterPathfindingSetup +// LLFloaterPathfindingConsole //--------------------------------------------------------------------------- -BOOL LLFloaterPathfindingSetup::postBuild() +BOOL LLFloaterPathfindingConsole::postBuild() { - childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingSetup::onViewEditLinksetClicked, this)); - childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingSetup::onRebuildNavMeshClicked, this)); - childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingSetup::onRefreshNavMeshClicked, this)); + childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavMeshClicked, this)); + childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavMeshClicked, this)); mShowNavMeshCheckBox = findChild("show_navmesh_overlay"); llassert(mShowNavMeshCheckBox != NULL); - mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowNavMeshToggle, this)); + mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshToggle, this)); mShowExcludeVolumesCheckBox = findChild("show_exclusion_volumes"); llassert(mShowExcludeVolumesCheckBox != NULL); - mShowExcludeVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowExcludeVolumesToggle, this)); + mShowExcludeVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExcludeVolumesToggle, this)); mShowPathCheckBox = findChild("show_path"); llassert(mShowPathCheckBox != NULL); - mShowPathCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowPathToggle, this)); + mShowPathCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowPathToggle, this)); mShowWaterPlaneCheckBox = findChild("show_water_plane"); llassert(mShowWaterPlaneCheckBox != NULL); - mShowWaterPlaneCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onShowWaterPlaneToggle, this)); + mShowWaterPlaneCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWaterPlaneToggle, this)); mRegionOverlayDisplayRadioGroup = findChild("region_overlay_display"); llassert(mRegionOverlayDisplayRadioGroup != NULL); - mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onRegionOverlayDisplaySwitch, this)); + mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch, this)); mPathSelectionRadioGroup = findChild("path_selection"); llassert(mPathSelectionRadioGroup != NULL); - mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onPathSelectionSwitch, this)); + mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onPathSelectionSwitch, this)); mCharacterWidthSlider = findChild("character_width"); llassert(mCharacterWidthSlider != NULL); - mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onCharacterWidthSet, this)); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); mCharacterTypeRadioGroup = findChild("character_type"); llassert(mCharacterTypeRadioGroup != NULL); - mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onCharacterTypeSwitch, this)); + mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); mPathfindingStatus = findChild("pathfinding_status"); llassert(mPathfindingStatus != NULL); mTerrainMaterialA = findChild("terrain_material_a"); llassert(mTerrainMaterialA != NULL); - mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialASet, this)); + mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this)); mTerrainMaterialA->setPrevalidate(LLTextValidate::validateFloat); mTerrainMaterialB = findChild("terrain_material_b"); llassert(mTerrainMaterialB != NULL); - mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialBSet, this)); + mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialBSet, this)); mTerrainMaterialB->setPrevalidate(LLTextValidate::validateFloat); mTerrainMaterialC = findChild("terrain_material_c"); llassert(mTerrainMaterialC != NULL); - mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialCSet, this)); + mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialCSet, this)); mTerrainMaterialC->setPrevalidate(LLTextValidate::validateFloat); mTerrainMaterialD = findChild("terrain_material_d"); llassert(mTerrainMaterialD != NULL); - mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingSetup::onTerrainMaterialDSet, this)); + mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialDSet, this)); mTerrainMaterialD->setPrevalidate(LLTextValidate::validateFloat); return LLFloater::postBuild(); } -LLFloaterPathfindingSetup::ERegionOverlayDisplay LLFloaterPathfindingSetup::getRegionOverlayDisplay() const +LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const { ERegionOverlayDisplay regionOverlayDisplay; switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) @@ -144,7 +144,7 @@ LLFloaterPathfindingSetup::ERegionOverlayDisplay LLFloaterPathfindingSetup::getR return regionOverlayDisplay; } -void LLFloaterPathfindingSetup::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) +void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) { LLSD radioGroupValue; @@ -165,7 +165,7 @@ void LLFloaterPathfindingSetup::setRegionOverlayDisplay(ERegionOverlayDisplay pR mRegionOverlayDisplayRadioGroup->setValue(radioGroupValue); } -LLFloaterPathfindingSetup::EPathSelectionState LLFloaterPathfindingSetup::getPathSelectionState() const +LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const { EPathSelectionState pathSelectionState; @@ -185,7 +185,7 @@ LLFloaterPathfindingSetup::EPathSelectionState LLFloaterPathfindingSetup::getPat return pathSelectionState; } -void LLFloaterPathfindingSetup::setPathSelectionState(EPathSelectionState pPathSelectionState) +void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pPathSelectionState) { LLSD radioGroupValue; @@ -205,17 +205,17 @@ void LLFloaterPathfindingSetup::setPathSelectionState(EPathSelectionState pPathS mPathSelectionRadioGroup->setValue(radioGroupValue); } -F32 LLFloaterPathfindingSetup::getCharacterWidth() const +F32 LLFloaterPathfindingConsole::getCharacterWidth() const { return mCharacterWidthSlider->getValueF32(); } -void LLFloaterPathfindingSetup::setCharacterWidth(F32 pCharacterWidth) +void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) { mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); } -LLFloaterPathfindingSetup::ECharacterType LLFloaterPathfindingSetup::getCharacterType() const +LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const { ECharacterType characterType; @@ -242,7 +242,7 @@ LLFloaterPathfindingSetup::ECharacterType LLFloaterPathfindingSetup::getCharacte return characterType; } -void LLFloaterPathfindingSetup::setCharacterType(ECharacterType pCharacterType) +void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) { LLSD radioGroupValue; @@ -269,47 +269,47 @@ void LLFloaterPathfindingSetup::setCharacterType(ECharacterType pCharacterType) mCharacterTypeRadioGroup->setValue(radioGroupValue); } -F32 LLFloaterPathfindingSetup::getTerrainMaterialA() const +F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const { return mTerrainMaterialA->getValue().asReal(); } -void LLFloaterPathfindingSetup::setTerrainMaterialA(F32 pTerrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 pTerrainMaterial) { mTerrainMaterialA->setValue(LLSD(pTerrainMaterial)); } -F32 LLFloaterPathfindingSetup::getTerrainMaterialB() const +F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const { return mTerrainMaterialB->getValue().asReal(); } -void LLFloaterPathfindingSetup::setTerrainMaterialB(F32 pTerrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 pTerrainMaterial) { mTerrainMaterialB->setValue(LLSD(pTerrainMaterial)); } -F32 LLFloaterPathfindingSetup::getTerrainMaterialC() const +F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const { return mTerrainMaterialC->getValue().asReal(); } -void LLFloaterPathfindingSetup::setTerrainMaterialC(F32 pTerrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 pTerrainMaterial) { mTerrainMaterialC->setValue(LLSD(pTerrainMaterial)); } -F32 LLFloaterPathfindingSetup::getTerrainMaterialD() const +F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const { return mTerrainMaterialD->getValue().asReal(); } -void LLFloaterPathfindingSetup::setTerrainMaterialD(F32 pTerrainMaterial) +void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) { mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); } -void LLFloaterPathfindingSetup::setHasNavMeshReceived() +void LLFloaterPathfindingConsole::setHasNavMeshReceived() { std::string str = getString("navmesh_fetch_complete_available"); mPathfindingStatus->setText((LLStringExplicit)str); @@ -321,13 +321,13 @@ void LLFloaterPathfindingSetup::setHasNavMeshReceived() } } -void LLFloaterPathfindingSetup::setHasNoNavMesh() +void LLFloaterPathfindingConsole::setHasNoNavMesh() { std::string str = getString("navmesh_fetch_complete_none"); mPathfindingStatus->setText((LLStringExplicit)str); } -LLFloaterPathfindingSetup::LLFloaterPathfindingSetup(const LLSD& pSeed) +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mShowNavMeshCheckBox(NULL), mShowExcludeVolumesCheckBox(NULL), @@ -352,11 +352,11 @@ LLFloaterPathfindingSetup::LLFloaterPathfindingSetup(const LLSD& pSeed) } } -LLFloaterPathfindingSetup::~LLFloaterPathfindingSetup() +LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() { } -void LLFloaterPathfindingSetup::onOpen(const LLSD& pKey) +void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { //make sure we have a pathing system if ( !LLPathingLib::getInstance() ) @@ -426,7 +426,7 @@ void LLFloaterPathfindingSetup::onOpen(const LLSD& pKey) } } -void LLFloaterPathfindingSetup::onShowNavMeshToggle() +void LLFloaterPathfindingConsole::onShowNavMeshToggle() { BOOL checkBoxValue = mShowNavMeshCheckBox->get(); @@ -442,7 +442,7 @@ void LLFloaterPathfindingSetup::onShowNavMeshToggle() } } -void LLFloaterPathfindingSetup::onShowExcludeVolumesToggle() +void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() { BOOL checkBoxValue = mShowExcludeVolumesCheckBox->get(); @@ -458,7 +458,7 @@ void LLFloaterPathfindingSetup::onShowExcludeVolumesToggle() } } -void LLFloaterPathfindingSetup::onShowPathToggle() +void LLFloaterPathfindingConsole::onShowPathToggle() { BOOL checkBoxValue = mShowPathCheckBox->get(); @@ -474,7 +474,7 @@ void LLFloaterPathfindingSetup::onShowPathToggle() } } -void LLFloaterPathfindingSetup::onShowWaterPlaneToggle() +void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() { BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); @@ -494,7 +494,7 @@ void LLFloaterPathfindingSetup::onShowWaterPlaneToggle() << (checkBoxValue ? "ON" : "OFF") << llendl; } -void LLFloaterPathfindingSetup::onRegionOverlayDisplaySwitch() +void LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch() { LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) @@ -520,7 +520,7 @@ void LLFloaterPathfindingSetup::onRegionOverlayDisplaySwitch() } } -void LLFloaterPathfindingSetup::onPathSelectionSwitch() +void LLFloaterPathfindingConsole::onPathSelectionSwitch() { switch (getPathSelectionState()) { @@ -536,12 +536,12 @@ void LLFloaterPathfindingSetup::onPathSelectionSwitch() } } -void LLFloaterPathfindingSetup::onCharacterWidthSet() +void LLFloaterPathfindingConsole::onCharacterWidthSet() { generatePath(); } -void LLFloaterPathfindingSetup::onCharacterTypeSwitch() +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() { switch (getCharacterType()) { @@ -572,43 +572,43 @@ void LLFloaterPathfindingSetup::onCharacterTypeSwitch() } -void LLFloaterPathfindingSetup::onViewEditLinksetClicked() +void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); } -void LLFloaterPathfindingSetup::onRebuildNavMeshClicked() +void LLFloaterPathfindingConsole::onRebuildNavMeshClicked() { llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; } -void LLFloaterPathfindingSetup::onRefreshNavMeshClicked() +void LLFloaterPathfindingConsole::onRefreshNavMeshClicked() { llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; } -void LLFloaterPathfindingSetup::onTerrainMaterialASet() +void LLFloaterPathfindingConsole::onTerrainMaterialASet() { F32 terrainMaterial = getTerrainMaterialA(); llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialA->getName() << "' to value (" << terrainMaterial << ")" << llendl; } -void LLFloaterPathfindingSetup::onTerrainMaterialBSet() +void LLFloaterPathfindingConsole::onTerrainMaterialBSet() { F32 terrainMaterial = getTerrainMaterialB(); llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialB->getName() << "' to value (" << terrainMaterial << ")" << llendl; } -void LLFloaterPathfindingSetup::onTerrainMaterialCSet() +void LLFloaterPathfindingConsole::onTerrainMaterialCSet() { F32 terrainMaterial = getTerrainMaterialC(); llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialC->getName() << "' to value (" << terrainMaterial << ")" << llendl; } -void LLFloaterPathfindingSetup::onTerrainMaterialDSet() +void LLFloaterPathfindingConsole::onTerrainMaterialDSet() { F32 terrainMaterial = getTerrainMaterialD(); llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() @@ -616,7 +616,7 @@ void LLFloaterPathfindingSetup::onTerrainMaterialDSet() } -void LLFloaterPathfindingSetup::providePathingData( const LLVector3& point1, const LLVector3& point2 ) +void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) { switch (getPathSelectionState()) { @@ -643,7 +643,7 @@ void LLFloaterPathfindingSetup::providePathingData( const LLVector3& point1, con generatePath(); } -void LLFloaterPathfindingSetup::generatePath() +void LLFloaterPathfindingConsole::generatePath() { if (mHasStartPoint && mHasEndPoint) { -- cgit v1.2.3 From efdba568f60a8d939fcfd40ee0cf6a8e205a5e0b Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 10 Feb 2012 19:59:03 -0800 Subject: PATH-284: Altering the design toward the new layout. Starting to re-hookup the functionality to the new controls. NOTE: This DOES break the pathing floater functionality. --- indra/newview/llfloaterpathfindingconsole.cpp | 330 ++++++-------------------- 1 file changed, 71 insertions(+), 259 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 51952d87b5..ca39463b24 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -42,13 +42,6 @@ #include "LLPathingLib.h" -#define XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY 1 -#define XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY 2 - -#define XUI_PATH_SELECT_NONE 0 -#define XUI_PATH_SELECT_START_POINT 1 -#define XUI_PATH_SELECT_END_POINT 2 - #define XUI_CHARACTER_TYPE_A 1 #define XUI_CHARACTER_TYPE_B 2 #define XUI_CHARACTER_TYPE_C 3 @@ -63,32 +56,33 @@ const int MAX_OBSERVERS = 10; BOOL LLFloaterPathfindingConsole::postBuild() { childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - childSetAction("rebuild_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRebuildNavMeshClicked, this)); - childSetAction("refresh_navmesh", boost::bind(&LLFloaterPathfindingConsole::onRefreshNavMeshClicked, this)); - mShowNavMeshCheckBox = findChild("show_navmesh_overlay"); + mShowNavMeshCheckBox = findChild("show_navmesh"); 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)); + mShowWalkablesCheckBox = findChild("show_walkables"); + llassert(mShowWalkablesCheckBox != NULL); + mShowWalkablesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkablesToggle, this)); + + mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); + llassert(mShowStaticObstaclesCheckBox != NULL); + mShowStaticObstaclesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowStaticObstaclesToggle, this)); - mShowPathCheckBox = findChild("show_path"); - llassert(mShowPathCheckBox != NULL); - mShowPathCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowPathToggle, this)); + mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); + llassert(mShowMaterialVolumesCheckBox != NULL); + mShowMaterialVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowMaterialVolumesToggle, this)); - mShowWaterPlaneCheckBox = findChild("show_water_plane"); - llassert(mShowWaterPlaneCheckBox != NULL); - mShowWaterPlaneCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWaterPlaneToggle, this)); + mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); + llassert(mShowExclusionVolumesCheckBox != NULL); + mShowExclusionVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExclusionVolumesToggle, this)); - mRegionOverlayDisplayRadioGroup = findChild("region_overlay_display"); - llassert(mRegionOverlayDisplayRadioGroup != NULL); - mRegionOverlayDisplayRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch, this)); + mShowWorldCheckBox = findChild("show_world"); + llassert(mShowWorldCheckBox != NULL); + mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); - mPathSelectionRadioGroup = findChild("path_selection"); - llassert(mPathSelectionRadioGroup != NULL); - mPathSelectionRadioGroup ->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onPathSelectionSwitch, this)); + mPathfindingStatus = findChild("pathfinding_status"); + llassert(mPathfindingStatus != NULL); mCharacterWidthSlider = findChild("character_width"); llassert(mCharacterWidthSlider != NULL); @@ -98,113 +92,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mCharacterTypeRadioGroup != NULL); mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); - - mTerrainMaterialA = findChild("terrain_material_a"); - llassert(mTerrainMaterialA != NULL); - mTerrainMaterialA->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialASet, this)); - mTerrainMaterialA->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialB = findChild("terrain_material_b"); - llassert(mTerrainMaterialB != NULL); - mTerrainMaterialB->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialBSet, this)); - mTerrainMaterialB->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialC = findChild("terrain_material_c"); - llassert(mTerrainMaterialC != NULL); - mTerrainMaterialC->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialCSet, this)); - mTerrainMaterialC->setPrevalidate(LLTextValidate::validateFloat); - - mTerrainMaterialD = findChild("terrain_material_d"); - llassert(mTerrainMaterialD != NULL); - mTerrainMaterialD->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTerrainMaterialDSet, this)); - mTerrainMaterialD->setPrevalidate(LLTextValidate::validateFloat); - return LLFloater::postBuild(); } -LLFloaterPathfindingConsole::ERegionOverlayDisplay LLFloaterPathfindingConsole::getRegionOverlayDisplay() const -{ - ERegionOverlayDisplay regionOverlayDisplay; - switch (mRegionOverlayDisplayRadioGroup->getValue().asInteger()) - { - case XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - break; - case XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY : - regionOverlayDisplay = kRenderOverlayOnAllRenderableGeometry; - break; - default : - regionOverlayDisplay = kRenderOverlayOnFixedPhysicsGeometry; - llassert(0); - break; - } - - return regionOverlayDisplay; -} - -void LLFloaterPathfindingConsole::setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay) -{ - LLSD radioGroupValue; - - switch (pRegionOverlayDisplay) - { - case kRenderOverlayOnFixedPhysicsGeometry : - radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; - break; - case kRenderOverlayOnAllRenderableGeometry : - radioGroupValue = XUI_RENDER_OVERLAY_ON_ALL_RENDERABLE_GEOMETRY; - break; - default : - radioGroupValue = XUI_RENDER_OVERLAY_ON_FIXED_PHYSICS_GEOMETRY; - llassert(0); - break; - } - - mRegionOverlayDisplayRadioGroup->setValue(radioGroupValue); -} - -LLFloaterPathfindingConsole::EPathSelectionState LLFloaterPathfindingConsole::getPathSelectionState() const -{ - EPathSelectionState pathSelectionState; - - switch (mPathSelectionRadioGroup->getValue().asInteger()) - { - case XUI_PATH_SELECT_START_POINT : - pathSelectionState = kPathSelectStartPoint; - break; - case XUI_PATH_SELECT_END_POINT : - pathSelectionState = kPathSelectEndPoint; - break; - default : - pathSelectionState = kPathSelectNone; - break; - } - - return pathSelectionState; -} - -void LLFloaterPathfindingConsole::setPathSelectionState(EPathSelectionState pPathSelectionState) -{ - LLSD radioGroupValue; - - switch (pPathSelectionState) - { - case kPathSelectStartPoint : - radioGroupValue = XUI_PATH_SELECT_START_POINT; - break; - case kPathSelectEndPoint : - radioGroupValue = XUI_PATH_SELECT_END_POINT; - break; - default : - radioGroupValue = XUI_PATH_SELECT_NONE; - break; - } - - mPathSelectionRadioGroup->setValue(radioGroupValue); -} - F32 LLFloaterPathfindingConsole::getCharacterWidth() const { return mCharacterWidthSlider->getValueF32(); @@ -269,46 +159,6 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType mCharacterTypeRadioGroup->setValue(radioGroupValue); } -F32 LLFloaterPathfindingConsole::getTerrainMaterialA() const -{ - return mTerrainMaterialA->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialA(F32 pTerrainMaterial) -{ - mTerrainMaterialA->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialB() const -{ - return mTerrainMaterialB->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialB(F32 pTerrainMaterial) -{ - mTerrainMaterialB->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialC() const -{ - return mTerrainMaterialC->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialC(F32 pTerrainMaterial) -{ - mTerrainMaterialC->setValue(LLSD(pTerrainMaterial)); -} - -F32 LLFloaterPathfindingConsole::getTerrainMaterialD() const -{ - return mTerrainMaterialD->getValue().asReal(); -} - -void LLFloaterPathfindingConsole::setTerrainMaterialD(F32 pTerrainMaterial) -{ - mTerrainMaterialD->setValue(LLSD(pTerrainMaterial)); -} - void LLFloaterPathfindingConsole::setHasNavMeshReceived() { std::string str = getString("navmesh_fetch_complete_available"); @@ -330,18 +180,14 @@ void LLFloaterPathfindingConsole::setHasNoNavMesh() LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mShowNavMeshCheckBox(NULL), - mShowExcludeVolumesCheckBox(NULL), - mShowPathCheckBox(NULL), - mShowWaterPlaneCheckBox(NULL), - mRegionOverlayDisplayRadioGroup(NULL), - mPathSelectionRadioGroup(NULL), + mShowWalkablesCheckBox(NULL), + mShowStaticObstaclesCheckBox(NULL), + mShowMaterialVolumesCheckBox(NULL), + mShowExclusionVolumesCheckBox(NULL), + mShowWorldCheckBox(NULL), mCharacterWidthSlider(NULL), mCharacterTypeRadioGroup(NULL), mPathfindingStatus(NULL), - mTerrainMaterialA(NULL), - mTerrainMaterialB(NULL), - mTerrainMaterialC(NULL), - mTerrainMaterialD(NULL), mNavMeshCnt(0), mHasStartPoint(false), mHasEndPoint(false) @@ -423,9 +269,19 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) llinfos<<"Region has does not required caps of type ["<setRenderPath(true); } } +void LLFloaterPathfindingConsole::onClose(bool app_quitting) +{ + //make sure we have a pathing system + if ( !LLPathingLib::getInstance() ) + { + LLPathingLib::getInstance()->setRenderPath(false); + } +} + void LLFloaterPathfindingConsole::onShowNavMeshToggle() { BOOL checkBoxValue = mShowNavMeshCheckBox->get(); @@ -442,97 +298,90 @@ void LLFloaterPathfindingConsole::onShowNavMeshToggle() } } -void LLFloaterPathfindingConsole::onShowExcludeVolumesToggle() +void LLFloaterPathfindingConsole::onShowWalkablesToggle() { - BOOL checkBoxValue = mShowExcludeVolumesCheckBox->get(); + BOOL checkBoxValue = mShowWalkablesCheckBox->get(); LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - llPathingLibInstance->setRenderShapes(checkBoxValue); + //llPathingLibInstance->setRenderNavMesh(checkBoxValue); + llwarns << "functionality has not yet been implemented to set walkables to " + << (checkBoxValue ? "TRUE" : "FALSE") << llendl; + } else { - mShowExcludeVolumesCheckBox->set(FALSE); + mShowWalkablesCheckBox->set(FALSE); llwarns << "cannot find LLPathingLib instance" << llendl; } } -void LLFloaterPathfindingConsole::onShowPathToggle() +void LLFloaterPathfindingConsole::onShowStaticObstaclesToggle() { - BOOL checkBoxValue = mShowPathCheckBox->get(); + BOOL checkBoxValue = mShowStaticObstaclesCheckBox->get(); LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - llPathingLibInstance->setRenderPath(checkBoxValue); + //llPathingLibInstance->setRenderNavMesh(checkBoxValue); + llwarns << "functionality has not yet been implemented to set static obstacles to " + << (checkBoxValue ? "TRUE" : "FALSE") << llendl; } else { - mShowPathCheckBox->set(FALSE); + mShowStaticObstaclesCheckBox->set(FALSE); llwarns << "cannot find LLPathingLib instance" << llendl; } } -void LLFloaterPathfindingConsole::onShowWaterPlaneToggle() +void LLFloaterPathfindingConsole::onShowMaterialVolumesToggle() { - BOOL checkBoxValue = mShowWaterPlaneCheckBox->get(); + BOOL checkBoxValue = mShowMaterialVolumesCheckBox->get(); LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - llPathingLibInstance->setRenderWaterPlane(checkBoxValue); + //llPathingLibInstance->setRenderNavMesh(checkBoxValue); + llwarns << "functionality has not yet been implemented to set material volumes to " + << (checkBoxValue ? "TRUE" : "FALSE") << llendl; } else { - mShowWaterPlaneCheckBox->set(FALSE); + mShowMaterialVolumesCheckBox->set(FALSE); llwarns << "cannot find LLPathingLib instance" << llendl; } - - llwarns << "functionality has not yet been implemented to toggle '" - << mShowWaterPlaneCheckBox->getLabel() << "' to " - << (checkBoxValue ? "ON" : "OFF") << llendl; } -void LLFloaterPathfindingConsole::onRegionOverlayDisplaySwitch() +void LLFloaterPathfindingConsole::onShowExclusionVolumesToggle() { + BOOL checkBoxValue = mShowExclusionVolumesCheckBox->get(); + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - switch (getRegionOverlayDisplay()) - { - case kRenderOverlayOnFixedPhysicsGeometry : - llPathingLibInstance->setRenderOverlayMode(false); - break; - case kRenderOverlayOnAllRenderableGeometry : - llPathingLibInstance->setRenderOverlayMode(true); - break; - default : - llPathingLibInstance->setRenderOverlayMode(false); - llassert(0); - break; - } + llPathingLibInstance->setRenderShapes(checkBoxValue); } else { - this->setRegionOverlayDisplay(kRenderOverlayOnFixedPhysicsGeometry); + mShowExclusionVolumesCheckBox->set(FALSE); llwarns << "cannot find LLPathingLib instance" << llendl; } } -void LLFloaterPathfindingConsole::onPathSelectionSwitch() +void LLFloaterPathfindingConsole::onShowWorldToggle() { - switch (getPathSelectionState()) + BOOL checkBoxValue = mShowWorldCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) { - case kPathSelectNone : - break; - case kPathSelectStartPoint : - break; - case kPathSelectEndPoint : - break; - default : - llassert(0); - break; + llPathingLibInstance->setRenderOverlayMode(checkBoxValue); + } + else + { + mShowWorldCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; } } @@ -577,47 +426,10 @@ void LLFloaterPathfindingConsole::onViewEditLinksetClicked() LLFloaterPathfindingLinksets::openLinksetsEditor(); } -void LLFloaterPathfindingConsole::onRebuildNavMeshClicked() -{ - llwarns << "functionality has not yet been implemented to handle rebuilding of the navmesh" << llendl; -} - -void LLFloaterPathfindingConsole::onRefreshNavMeshClicked() -{ - llwarns << "functionality has not yet been implemented to handle refreshing of the navmesh" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialASet() -{ - F32 terrainMaterial = getTerrainMaterialA(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialA->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialBSet() -{ - F32 terrainMaterial = getTerrainMaterialB(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialB->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialCSet() -{ - F32 terrainMaterial = getTerrainMaterialC(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialC->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - -void LLFloaterPathfindingConsole::onTerrainMaterialDSet() -{ - F32 terrainMaterial = getTerrainMaterialD(); - llwarns << "functionality has not yet been implemented to setting '" << mTerrainMaterialD->getName() - << "' to value (" << terrainMaterial << ")" << llendl; -} - void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) { +#if 0 switch (getPathSelectionState()) { case kPathSelectNone : @@ -639,7 +451,7 @@ void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, c llassert(0); break; } - +#endif generatePath(); } -- cgit v1.2.3 From 666bd487bd8248bd05c87a437c06e18ed89b1153 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 13 Feb 2012 16:47:43 -0500 Subject: Disabled the ability to query neighboring regions for their navmeshes. We'll introduce a checkbox to the pathfinding floater and enable the code. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index ca39463b24..282cab6df5 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -231,11 +231,11 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) LLViewerRegion* pCurrentRegion = gAgent.getRegion(); std::vector regions; regions.push_back( pCurrentRegion ); - pCurrentRegion->getNeighboringRegions( regions ); + //pCurrentRegion->getNeighboringRegions( regions ); std::vector shift; shift.push_back( CURRENT_REGION ); - pCurrentRegion->getNeighboringRegionsStatus( shift ); + //pCurrentRegion->getNeighboringRegionsStatus( shift ); //If the navmesh shift ops and the total region counts do not match - use the current region, only. if ( shift.size() != regions.size() ) -- cgit v1.2.3 From 16fa78b1499b6bb68f5038c124953046af690d6c Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 13 Feb 2012 17:58:19 -0800 Subject: PATH-284: Implementing the functionality for the new path generation of the new pathfinding console floater design. --- indra/newview/llfloaterpathfindingconsole.cpp | 967 +++++++++++++------------- 1 file changed, 502 insertions(+), 465 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index ca39463b24..47bba82293 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,465 +1,502 @@ -/** -* @file llfloaterpathfindingconsole.cpp -* @author William Todd Stinson -* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. -* -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" -#include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" - -#include "llsd.h" -#include "llagent.h" -#include "llbutton.h" -#include "llradiogroup.h" -#include "llsliderctrl.h" -#include "lllineeditor.h" -#include "lltextbase.h" -#include "lltextvalidate.h" -#include "llnavmeshstation.h" -#include "llviewerregion.h" - -#include "LLPathingLib.h" - -#define XUI_CHARACTER_TYPE_A 1 -#define XUI_CHARACTER_TYPE_B 2 -#define XUI_CHARACTER_TYPE_C 3 -#define XUI_CHARACTER_TYPE_D 4 - -const int CURRENT_REGION = 99; -const int MAX_OBSERVERS = 10; -//--------------------------------------------------------------------------- -// LLFloaterPathfindingConsole -//--------------------------------------------------------------------------- - -BOOL LLFloaterPathfindingConsole::postBuild() -{ - childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); - - mShowNavMeshCheckBox = findChild("show_navmesh"); - llassert(mShowNavMeshCheckBox != NULL); - mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshToggle, this)); - - mShowWalkablesCheckBox = findChild("show_walkables"); - llassert(mShowWalkablesCheckBox != NULL); - mShowWalkablesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkablesToggle, this)); - - mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); - llassert(mShowStaticObstaclesCheckBox != NULL); - mShowStaticObstaclesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowStaticObstaclesToggle, this)); - - mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); - llassert(mShowMaterialVolumesCheckBox != NULL); - mShowMaterialVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowMaterialVolumesToggle, this)); - - mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); - llassert(mShowExclusionVolumesCheckBox != NULL); - mShowExclusionVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExclusionVolumesToggle, this)); - - mShowWorldCheckBox = findChild("show_world"); - llassert(mShowWorldCheckBox != NULL); - mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); - - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); - - mCharacterWidthSlider = findChild("character_width"); - llassert(mCharacterWidthSlider != NULL); - mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); - - mCharacterTypeRadioGroup = findChild("character_type"); - llassert(mCharacterTypeRadioGroup != NULL); - mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); - - return LLFloater::postBuild(); -} - -F32 LLFloaterPathfindingConsole::getCharacterWidth() const -{ - return mCharacterWidthSlider->getValueF32(); -} - -void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) -{ - mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); -} - -LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const -{ - ECharacterType characterType; - - switch (mCharacterTypeRadioGroup->getValue().asInteger()) - { - case XUI_CHARACTER_TYPE_A : - characterType = kCharacterTypeA; - break; - case XUI_CHARACTER_TYPE_B : - characterType = kCharacterTypeB; - break; - case XUI_CHARACTER_TYPE_C : - characterType = kCharacterTypeC; - break; - case XUI_CHARACTER_TYPE_D : - characterType = kCharacterTypeD; - break; - default : - characterType = kCharacterTypeA; - llassert(0); - break; - } - - return characterType; -} - -void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) -{ - LLSD radioGroupValue; - - switch (pCharacterType) - { - case kCharacterTypeA : - radioGroupValue = XUI_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - radioGroupValue = XUI_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - radioGroupValue = XUI_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - radioGroupValue = XUI_CHARACTER_TYPE_D; - break; - default : - radioGroupValue = XUI_CHARACTER_TYPE_A; - llassert(0); - break; - } - - mCharacterTypeRadioGroup->setValue(radioGroupValue); -} - -void LLFloaterPathfindingConsole::setHasNavMeshReceived() -{ - std::string str = getString("navmesh_fetch_complete_available"); - mPathfindingStatus->setText((LLStringExplicit)str); - //check to see if all regions are done loading and they are then stitch the navmeshes together - --mNavMeshCnt; - if ( mNavMeshCnt == 0 ) - { - LLPathingLib::getInstance()->stitchNavMeshes(); - } -} - -void LLFloaterPathfindingConsole::setHasNoNavMesh() -{ - std::string str = getString("navmesh_fetch_complete_none"); - mPathfindingStatus->setText((LLStringExplicit)str); -} - -LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) - : LLFloater(pSeed), - mShowNavMeshCheckBox(NULL), - mShowWalkablesCheckBox(NULL), - mShowStaticObstaclesCheckBox(NULL), - mShowMaterialVolumesCheckBox(NULL), - mShowExclusionVolumesCheckBox(NULL), - mShowWorldCheckBox(NULL), - mCharacterWidthSlider(NULL), - mCharacterTypeRadioGroup(NULL), - mPathfindingStatus(NULL), - mNavMeshCnt(0), - mHasStartPoint(false), - mHasEndPoint(false) -{ - for (int i=0;isetText((LLStringExplicit)str, styleParams); - llwarns <<"Errror: cannout find pathing library implementation."<cleanupResidual(); - - mCurrentMDO = 0; - mNavMeshCnt = 0; - - //make sure the region is essentially enabled for navmesh support - std::string capability = "RetrieveNavMeshSrc"; - - //prep# neighboring navmesh support proto - LLViewerRegion* pCurrentRegion = gAgent.getRegion(); - std::vector regions; - regions.push_back( pCurrentRegion ); - pCurrentRegion->getNeighboringRegions( regions ); - - std::vector shift; - shift.push_back( CURRENT_REGION ); - pCurrentRegion->getNeighboringRegionsStatus( shift ); - - //If the navmesh shift ops and the total region counts do not match - use the current region, only. - if ( shift.size() != regions.size() ) - { - shift.clear();regions.clear(); - regions.push_back( pCurrentRegion ); - shift.push_back( CURRENT_REGION ); - } - int regionCnt = regions.size(); - mNavMeshCnt = regionCnt; - for ( int i=0; igetCapability( capability ); - - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shift[i]; - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); - ++mCurrentMDO; - } - else - { - --mNavMeshCnt; - std::string str = getString("navmesh_region_not_enabled"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["<setRenderPath(true); - } -} - -void LLFloaterPathfindingConsole::onClose(bool app_quitting) -{ - //make sure we have a pathing system - if ( !LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->setRenderPath(false); - } -} - -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::onShowWalkablesToggle() -{ - BOOL checkBoxValue = mShowWalkablesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set walkables to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - - } - else - { - mShowWalkablesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowStaticObstaclesToggle() -{ - BOOL checkBoxValue = mShowStaticObstaclesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set static obstacles to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - } - else - { - mShowStaticObstaclesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowMaterialVolumesToggle() -{ - BOOL checkBoxValue = mShowMaterialVolumesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set material volumes to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - } - else - { - mShowMaterialVolumesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowExclusionVolumesToggle() -{ - BOOL checkBoxValue = mShowExclusionVolumesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderShapes(checkBoxValue); - } - else - { - mShowExclusionVolumesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowWorldToggle() -{ - BOOL checkBoxValue = mShowWorldCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderOverlayMode(checkBoxValue); - } - else - { - mShowWorldCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onCharacterWidthSet() -{ - generatePath(); -} - -void LLFloaterPathfindingConsole::onCharacterTypeSwitch() -{ - switch (getCharacterType()) - { - case kCharacterTypeA : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" - << llendl; - break; - case kCharacterTypeB : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" - << llendl; - break; - case kCharacterTypeC : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" - << llendl; - break; - case kCharacterTypeD : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" - << llendl; - break; - default : - llassert(0); - break; - } - -} - -void LLFloaterPathfindingConsole::onViewEditLinksetClicked() -{ - LLFloaterPathfindingLinksets::openLinksetsEditor(); -} - - -void LLFloaterPathfindingConsole::providePathingData( const LLVector3& point1, const LLVector3& point2 ) -{ -#if 0 - switch (getPathSelectionState()) - { - case kPathSelectNone : - break; - - case kPathSelectStartPoint : - mPathData.mStartPointA = point1; - mPathData.mEndPointA = point2; - mHasStartPoint = true; - break; - - case kPathSelectEndPoint : - mPathData.mStartPointB = point1; - mPathData.mEndPointB = point2; - mHasEndPoint = true; - break; - - default : - llassert(0); - break; - } -#endif - generatePath(); -} - -void LLFloaterPathfindingConsole::generatePath() -{ - if (mHasStartPoint && mHasEndPoint) - { - mPathData.mCharacterWidth = getCharacterWidth(); - LLPathingLib::getInstance()->generatePath(mPathData); - } -} +/** +* @file llfloaterpathfindingconsole.cpp +* @author William Todd Stinson +* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" + +#include "llsd.h" +#include "llhandle.h" +#include "llagent.h" +#include "llbutton.h" +#include "llradiogroup.h" +#include "llsliderctrl.h" +#include "lllineeditor.h" +#include "lltextbase.h" +#include "lltabcontainer.h" +#include "llnavmeshstation.h" +#include "llfloaterreg.h" +#include "llviewerregion.h" +#include "llviewerwindow.h" +#include "llviewercamera.h" + +#include "LLPathingLib.h" + +#define XUI_CHARACTER_TYPE_A 1 +#define XUI_CHARACTER_TYPE_B 2 +#define XUI_CHARACTER_TYPE_C 3 +#define XUI_CHARACTER_TYPE_D 4 + +const int CURRENT_REGION = 99; +const int MAX_OBSERVERS = 10; + +LLHandle LLFloaterPathfindingConsole::sInstanceHandle; + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingConsole +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingConsole::postBuild() +{ + childSetAction("view_and_edit_linksets", boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this)); + + mShowNavMeshCheckBox = findChild("show_navmesh"); + llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshToggle, this)); + + mShowWalkablesCheckBox = findChild("show_walkables"); + llassert(mShowWalkablesCheckBox != NULL); + mShowWalkablesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkablesToggle, this)); + + mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); + llassert(mShowStaticObstaclesCheckBox != NULL); + mShowStaticObstaclesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowStaticObstaclesToggle, this)); + + mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); + llassert(mShowMaterialVolumesCheckBox != NULL); + mShowMaterialVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowMaterialVolumesToggle, this)); + + mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); + llassert(mShowExclusionVolumesCheckBox != NULL); + mShowExclusionVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExclusionVolumesToggle, this)); + + mShowWorldCheckBox = findChild("show_world"); + llassert(mShowWorldCheckBox != NULL); + mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); + + mPathfindingStatus = findChild("pathfinding_status"); + llassert(mPathfindingStatus != NULL); + + mEditTestTabContainer = findChild("edit_test_tab_container"); + llassert(mEditTestTabContainer != NULL); + + mCharacterWidthSlider = findChild("character_width"); + llassert(mCharacterWidthSlider != NULL); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + + mCharacterTypeRadioGroup = findChild("character_type"); + llassert(mCharacterTypeRadioGroup != NULL); + mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + + return LLFloater::postBuild(); +} + +BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) +{ + if (down && (clicktype == LLMouseHandler::CLICK_LEFT) && + (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || + ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))) + { + LLVector3 dv = gViewerWindow->mouseDirectionGlobal(x, y); + LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 rayStart = mousePos; + LLVector3 rayEnd = mousePos + dv * 150; + + if (mask & MASK_CONTROL) + { + mPathData.mStartPointA = rayStart; + mPathData.mEndPointA = rayEnd; + mHasStartPoint = true; + } + else if (mask & MASK_SHIFT) + { + mPathData.mStartPointB = rayStart; + mPathData.mEndPointB = rayEnd; + mHasEndPoint = true; + } + generatePath(); + + return TRUE; + } + else + { + return LLFloater::handleAnyMouseClick(x, y, mask, clicktype, down); + } +} + +BOOL LLFloaterPathfindingConsole::isGeneratePathMode() const +{ + return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1)); +} + +LLHandle LLFloaterPathfindingConsole::getInstanceHandle() +{ + if (sInstanceHandle.isDead()) + { + LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::getTypedInstance("pathfinding_console"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} + +F32 LLFloaterPathfindingConsole::getCharacterWidth() const +{ + return mCharacterWidthSlider->getValueF32(); +} + +void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) +{ + mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); +} + +LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const +{ + ECharacterType characterType; + + switch (mCharacterTypeRadioGroup->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_A : + characterType = kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = kCharacterTypeD; + break; + default : + characterType = kCharacterTypeA; + llassert(0); + break; + } + + return characterType; +} + +void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) +{ + LLSD radioGroupValue; + + switch (pCharacterType) + { + case kCharacterTypeA : + radioGroupValue = XUI_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + radioGroupValue = XUI_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + radioGroupValue = XUI_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + radioGroupValue = XUI_CHARACTER_TYPE_D; + break; + default : + radioGroupValue = XUI_CHARACTER_TYPE_A; + llassert(0); + break; + } + + mCharacterTypeRadioGroup->setValue(radioGroupValue); +} + +void LLFloaterPathfindingConsole::setHasNavMeshReceived() +{ + std::string str = getString("navmesh_fetch_complete_available"); + mPathfindingStatus->setText((LLStringExplicit)str); + //check to see if all regions are done loading and they are then stitch the navmeshes together + --mNavMeshCnt; + if ( mNavMeshCnt == 0 ) + { + LLPathingLib::getInstance()->stitchNavMeshes(); + } +} + +void LLFloaterPathfindingConsole::setHasNoNavMesh() +{ + std::string str = getString("navmesh_fetch_complete_none"); + mPathfindingStatus->setText((LLStringExplicit)str); +} + +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) + : LLFloater(pSeed), + mSelfHandle(), + mShowNavMeshCheckBox(NULL), + mShowWalkablesCheckBox(NULL), + mShowStaticObstaclesCheckBox(NULL), + mShowMaterialVolumesCheckBox(NULL), + mShowExclusionVolumesCheckBox(NULL), + mShowWorldCheckBox(NULL), + mPathfindingStatus(NULL), + mEditTestTabContainer(NULL), + mCharacterWidthSlider(NULL), + mCharacterTypeRadioGroup(NULL), + mNavMeshCnt(0), + mHasStartPoint(false), + mHasEndPoint(false) +{ + mSelfHandle.bind(this); + + for (int i=0;isetText((LLStringExplicit)str, styleParams); + llwarns <<"Errror: cannout find pathing library implementation."<cleanupResidual(); + + mCurrentMDO = 0; + mNavMeshCnt = 0; + + //make sure the region is essentially enabled for navmesh support + std::string capability = "RetrieveNavMeshSrc"; + + //prep# neighboring navmesh support proto + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector regions; + regions.push_back( pCurrentRegion ); + pCurrentRegion->getNeighboringRegions( regions ); + + std::vector shift; + shift.push_back( CURRENT_REGION ); + pCurrentRegion->getNeighboringRegionsStatus( shift ); + + //If the navmesh shift ops and the total region counts do not match - use the current region, only. + if ( shift.size() != regions.size() ) + { + shift.clear();regions.clear(); + regions.push_back( pCurrentRegion ); + shift.push_back( CURRENT_REGION ); + } + int regionCnt = regions.size(); + mNavMeshCnt = regionCnt; + for ( int i=0; igetCapability( capability ); + + if ( !url.empty() ) + { + std::string str = getString("navmesh_fetch_inprogress"); + mPathfindingStatus->setText((LLStringExplicit)str); + LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); + int dir = shift[i]; + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); + ++mCurrentMDO; + } + else + { + --mNavMeshCnt; + std::string str = getString("navmesh_region_not_enabled"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llinfos<<"Region has does not required caps of type ["<setRenderPath(true); + } +} + +void LLFloaterPathfindingConsole::onClose(bool app_quitting) +{ + //make sure we have a pathing system + if ( !LLPathingLib::getInstance() ) + { + LLPathingLib::getInstance()->setRenderPath(false); + } +} + +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::onShowWalkablesToggle() +{ + BOOL checkBoxValue = mShowWalkablesCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + //llPathingLibInstance->setRenderNavMesh(checkBoxValue); + llwarns << "functionality has not yet been implemented to set walkables to " + << (checkBoxValue ? "TRUE" : "FALSE") << llendl; + + } + else + { + mShowWalkablesCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onShowStaticObstaclesToggle() +{ + BOOL checkBoxValue = mShowStaticObstaclesCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + //llPathingLibInstance->setRenderNavMesh(checkBoxValue); + llwarns << "functionality has not yet been implemented to set static obstacles to " + << (checkBoxValue ? "TRUE" : "FALSE") << llendl; + } + else + { + mShowStaticObstaclesCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onShowMaterialVolumesToggle() +{ + BOOL checkBoxValue = mShowMaterialVolumesCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + //llPathingLibInstance->setRenderNavMesh(checkBoxValue); + llwarns << "functionality has not yet been implemented to set material volumes to " + << (checkBoxValue ? "TRUE" : "FALSE") << llendl; + } + else + { + mShowMaterialVolumesCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onShowExclusionVolumesToggle() +{ + BOOL checkBoxValue = mShowExclusionVolumesCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderShapes(checkBoxValue); + } + else + { + mShowExclusionVolumesCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onShowWorldToggle() +{ + BOOL checkBoxValue = mShowWorldCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderOverlayMode(checkBoxValue); + } + else + { + mShowWorldCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + generatePath(); +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + switch (getCharacterType()) + { + case kCharacterTypeA : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" + << llendl; + break; + case kCharacterTypeB : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" + << llendl; + break; + case kCharacterTypeC : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" + << llendl; + break; + case kCharacterTypeD : + llwarns << "functionality has not yet been implemented to toggle '" + << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" + << llendl; + break; + default : + llassert(0); + break; + } + +} + +void LLFloaterPathfindingConsole::onViewEditLinksetClicked() +{ + LLFloaterPathfindingLinksets::openLinksetsEditor(); +} + +void LLFloaterPathfindingConsole::generatePath() +{ + if (mHasStartPoint && mHasEndPoint) + { + mPathData.mCharacterWidth = getCharacterWidth(); + LLPathingLib::getInstance()->generatePath(mPathData); + } +} -- cgit v1.2.3 From 76959fdb455e5fc3f08b0e1f61f13f14c0d87303 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 13 Feb 2012 18:32:06 -0800 Subject: PATH-284: Hooking up the characters button to open the characters floater. --- indra/newview/llfloaterpathfindingconsole.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index e361b62a6e..9a1651f537 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterpathfindingconsole.h" #include "llfloaterpathfindinglinksets.h" +#include "llfloaterpathfindingcharacters.h" #include "llsd.h" #include "llhandle.h" @@ -62,6 +63,7 @@ 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)); mShowNavMeshCheckBox = findChild("show_navmesh"); @@ -487,6 +489,11 @@ void LLFloaterPathfindingConsole::onCharacterTypeSwitch() } +void LLFloaterPathfindingConsole::onViewCharactersClicked() +{ + LLFloaterPathfindingCharacters::openCharactersViewer(); +} + void LLFloaterPathfindingConsole::onViewEditLinksetClicked() { LLFloaterPathfindingLinksets::openLinksetsEditor(); -- cgit v1.2.3 From e5d59b3c2ae99c7e6cfb0312dd8842e8d948aad0 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Feb 2012 16:41:53 -0800 Subject: Moving the bulk of the display settings into the viewer. --- indra/newview/llfloaterpathfindingconsole.cpp | 169 ++++++++++---------------- 1 file changed, 66 insertions(+), 103 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 9a1651f537..26e1ff3963 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -68,23 +68,18 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); - mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshToggle, this)); mShowWalkablesCheckBox = findChild("show_walkables"); llassert(mShowWalkablesCheckBox != NULL); - mShowWalkablesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkablesToggle, this)); mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); llassert(mShowStaticObstaclesCheckBox != NULL); - mShowStaticObstaclesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowStaticObstaclesToggle, this)); mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); llassert(mShowMaterialVolumesCheckBox != NULL); - mShowMaterialVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowMaterialVolumesToggle, this)); mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); llassert(mShowExclusionVolumesCheckBox != NULL); - mShowExclusionVolumesCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowExclusionVolumesToggle, this)); mShowWorldCheckBox = findChild("show_world"); llassert(mShowWorldCheckBox != NULL); @@ -159,6 +154,71 @@ LLHandle LLFloaterPathfindingConsole::getInstanceHa return sInstanceHandle; } +BOOL LLFloaterPathfindingConsole::isRenderPath() const +{ + return (mHasStartPoint && mHasEndPoint); +} + +BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const +{ + return mShowNavMeshCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) +{ + mShowNavMeshCheckBox->set(pIsRenderNavMesh); +} + +BOOL LLFloaterPathfindingConsole::isRenderWalkables() const +{ + return mShowWalkablesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) +{ + mShowWalkablesCheckBox->set(pIsRenderWalkables); +} + +BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const +{ + return mShowStaticObstaclesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) +{ + mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); +} + +BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const +{ + return mShowMaterialVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) +{ + mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const +{ + return mShowExclusionVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) +{ + mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorld() const +{ + return mShowWorldCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) +{ + mShowWorldCheckBox->set(pIsRenderWorld); +} + F32 LLFloaterPathfindingConsole::getCharacterWidth() const { return mCharacterWidthSlider->getValueF32(); @@ -337,106 +397,9 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) llinfos<<"Region has does not required caps of type ["<setRenderPath(true); } } -void LLFloaterPathfindingConsole::onClose(bool app_quitting) -{ - //make sure we have a pathing system - if ( !LLPathingLib::getInstance() ) - { - LLPathingLib::getInstance()->setRenderPath(false); - } -} - -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::onShowWalkablesToggle() -{ - BOOL checkBoxValue = mShowWalkablesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set walkables to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - - } - else - { - mShowWalkablesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowStaticObstaclesToggle() -{ - BOOL checkBoxValue = mShowStaticObstaclesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set static obstacles to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - } - else - { - mShowStaticObstaclesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowMaterialVolumesToggle() -{ - BOOL checkBoxValue = mShowMaterialVolumesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - //llPathingLibInstance->setRenderNavMesh(checkBoxValue); - llwarns << "functionality has not yet been implemented to set material volumes to " - << (checkBoxValue ? "TRUE" : "FALSE") << llendl; - } - else - { - mShowMaterialVolumesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onShowExclusionVolumesToggle() -{ - BOOL checkBoxValue = mShowExclusionVolumesCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderShapes(checkBoxValue); - } - else - { - mShowExclusionVolumesCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - void LLFloaterPathfindingConsole::onShowWorldToggle() { BOOL checkBoxValue = mShowWorldCheckBox->get(); @@ -444,7 +407,7 @@ void LLFloaterPathfindingConsole::onShowWorldToggle() LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if (llPathingLibInstance != NULL) { - llPathingLibInstance->setRenderOverlayMode(checkBoxValue); + llPathingLibInstance->setRenderWorld(checkBoxValue); } else { -- cgit v1.2.3 From d2bd4e4d108acae5473c28936b04bd19055e97e8 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Feb 2012 16:52:54 -0800 Subject: PATH-284: Adding functionality for the Clear Path button. --- indra/newview/llfloaterpathfindingconsole.cpp | 97 ++++++++++++++------------- 1 file changed, 52 insertions(+), 45 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 26e1ff3963..e46a454e70 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -65,6 +65,7 @@ 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); @@ -164,56 +165,56 @@ BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const return mShowNavMeshCheckBox->get(); } -void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) -{ - mShowNavMeshCheckBox->set(pIsRenderNavMesh); -} - -BOOL LLFloaterPathfindingConsole::isRenderWalkables() const -{ - return mShowWalkablesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) -{ - mShowWalkablesCheckBox->set(pIsRenderWalkables); -} - -BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const -{ - return mShowStaticObstaclesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) -{ - mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); -} - -BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const -{ - return mShowMaterialVolumesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) -{ - mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); -} - -BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const -{ - return mShowExclusionVolumesCheckBox->get(); -} - +void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) +{ + mShowNavMeshCheckBox->set(pIsRenderNavMesh); +} + +BOOL LLFloaterPathfindingConsole::isRenderWalkables() const +{ + return mShowWalkablesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) +{ + mShowWalkablesCheckBox->set(pIsRenderWalkables); +} + +BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const +{ + return mShowStaticObstaclesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) +{ + mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); +} + +BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const +{ + return mShowMaterialVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) +{ + mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const +{ + return mShowExclusionVolumesCheckBox->get(); +} + void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) { mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); } -BOOL LLFloaterPathfindingConsole::isRenderWorld() const -{ - return mShowWorldCheckBox->get(); -} - +BOOL LLFloaterPathfindingConsole::isRenderWorld() const +{ + return mShowWorldCheckBox->get(); +} + void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) { mShowWorldCheckBox->set(pIsRenderWorld); @@ -462,6 +463,12 @@ void LLFloaterPathfindingConsole::onViewEditLinksetClicked() LLFloaterPathfindingLinksets::openLinksetsEditor(); } +void LLFloaterPathfindingConsole::onClearPathClicked() +{ + mHasStartPoint = false; + mHasEndPoint = false; +} + void LLFloaterPathfindingConsole::generatePath() { if (mHasStartPoint && mHasEndPoint) -- cgit v1.2.3 From d62017ddaaf8430e3f6887e687aa232578261b5e Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Feb 2012 17:14:11 -0800 Subject: PATH-284: Refactoring the code for determining whether in path creation mode. --- indra/newview/llfloaterpathfindingconsole.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index e46a454e70..62f7b9c85c 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -105,9 +105,7 @@ BOOL LLFloaterPathfindingConsole::postBuild() BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) { - if (down && (clicktype == LLMouseHandler::CLICK_LEFT) && - (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || - ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))) + if (isGeneratePathMode(mask, clicktype, down)) { LLVector3 dv = gViewerWindow->mouseDirectionGlobal(x, y); LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); @@ -136,9 +134,12 @@ BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, E } } -BOOL LLFloaterPathfindingConsole::isGeneratePathMode() const +BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const { - return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1)); + return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1) && + (clicktype == LLMouseHandler::CLICK_LEFT) && down && + (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || + ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))); } LLHandle LLFloaterPathfindingConsole::getInstanceHandle() -- cgit v1.2.3 From 69b732185ea7176d6ca0e8c1f239cd6fa0e426c2 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 14 Feb 2012 17:41:35 -0800 Subject: PATH-198: Hooking up the path status indicator to some existing state information. --- indra/newview/llfloaterpathfindingconsole.cpp | 42 +++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 62f7b9c85c..eccea867c7 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -97,9 +97,13 @@ BOOL LLFloaterPathfindingConsole::postBuild() mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); mCharacterTypeRadioGroup = findChild("character_type"); - llassert(mCharacterTypeRadioGroup != NULL); + llassert(mCharacterTypeRadioGroup != NULL); mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + mPathTestingStatus = findChild("path_test_status"); + llassert(mPathTestingStatus != NULL); + updatePathTestStatus(); + return LLFloater::postBuild(); } @@ -125,6 +129,7 @@ BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, E mHasEndPoint = true; } generatePath(); + updatePathTestStatus(); return TRUE; } @@ -316,6 +321,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mEditTestTabContainer(NULL), mCharacterWidthSlider(NULL), mCharacterTypeRadioGroup(NULL), + mPathTestingStatus(NULL), mNavMeshCnt(0), mHasStartPoint(false), mHasEndPoint(false) @@ -421,6 +427,7 @@ void LLFloaterPathfindingConsole::onShowWorldToggle() void LLFloaterPathfindingConsole::onCharacterWidthSet() { generatePath(); + updatePathTestStatus(); } void LLFloaterPathfindingConsole::onCharacterTypeSwitch() @@ -451,7 +458,7 @@ void LLFloaterPathfindingConsole::onCharacterTypeSwitch() llassert(0); break; } - + updatePathTestStatus(); } void LLFloaterPathfindingConsole::onViewCharactersClicked() @@ -468,6 +475,7 @@ void LLFloaterPathfindingConsole::onClearPathClicked() { mHasStartPoint = false; mHasEndPoint = false; + updatePathTestStatus(); } void LLFloaterPathfindingConsole::generatePath() @@ -478,3 +486,33 @@ void LLFloaterPathfindingConsole::generatePath() LLPathingLib::getInstance()->generatePath(mPathData); } } + +void LLFloaterPathfindingConsole::updatePathTestStatus() +{ + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); + + std::string statusText(""); + LLStyle::Params styleParams; + + if (!mHasStartPoint && !mHasEndPoint) + { + statusText = getString("pathing_choose_start_and_end_points"); + styleParams.color = warningColor; + } + else if (!mHasStartPoint && mHasEndPoint) + { + statusText = getString("pathing_choose_start_point"); + styleParams.color = warningColor; + } + else if (mHasStartPoint && !mHasEndPoint) + { + statusText = getString("pathing_choose_end_point"); + styleParams.color = warningColor; + } + else + { + statusText = getString("pathing_path_valid"); + } + + mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); +} -- cgit v1.2.3 From fb96262c47d9eb022f9291637c6a9ebaec833dca Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 15 Feb 2012 11:51:49 -0800 Subject: PATH-284: Stubbing functionality for the walkability heatmap drop-down. --- indra/newview/llfloaterpathfindingconsole.cpp | 111 +++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index eccea867c7..728efc52a4 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -39,6 +39,7 @@ #include "lllineeditor.h" #include "lltextbase.h" #include "lltabcontainer.h" +#include "llcombobox.h" #include "llnavmeshstation.h" #include "llfloaterreg.h" #include "llviewerregion.h" @@ -47,6 +48,12 @@ #include "LLPathingLib.h" +#define XUI_RENDER_HEATMAP_NONE 0 +#define XUI_RENDER_HEATMAP_A 1 +#define XUI_RENDER_HEATMAP_B 2 +#define XUI_RENDER_HEATMAP_C 3 +#define XUI_RENDER_HEATMAP_D 4 + #define XUI_CHARACTER_TYPE_A 1 #define XUI_CHARACTER_TYPE_B 2 #define XUI_CHARACTER_TYPE_C 3 @@ -70,6 +77,10 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshWalkabilityComboBox = findChild("show_heatmap_mode"); + llassert(mShowNavMeshWalkabilityComboBox != NULL); + mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this)); + mShowWalkablesCheckBox = findChild("show_walkables"); llassert(mShowWalkablesCheckBox != NULL); @@ -142,8 +153,8 @@ BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, E BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const { return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1) && - (clicktype == LLMouseHandler::CLICK_LEFT) && down && - (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || + (clicktype == LLMouseHandler::CLICK_LEFT) && down && + (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))); } @@ -226,6 +237,66 @@ void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) mShowWorldCheckBox->set(pIsRenderWorld); } +LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const +{ + ERenderHeatmapType renderHeatmapType; + + switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) + { + case XUI_RENDER_HEATMAP_NONE : + renderHeatmapType = kRenderHeatmapNone; + break; + case XUI_RENDER_HEATMAP_A : + renderHeatmapType = kRenderHeatmapA; + break; + case XUI_RENDER_HEATMAP_B : + renderHeatmapType = kRenderHeatmapB; + break; + case XUI_RENDER_HEATMAP_C : + renderHeatmapType = kRenderHeatmapC; + break; + case XUI_RENDER_HEATMAP_D : + renderHeatmapType = kRenderHeatmapD; + break; + default : + renderHeatmapType = kRenderHeatmapNone; + llassert(0); + break; + } + + return renderHeatmapType; +} + +void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) +{ + LLSD comboBoxValue; + + switch (pRenderHeatmapType) + { + case kRenderHeatmapNone : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + break; + case kRenderHeatmapA : + comboBoxValue = XUI_RENDER_HEATMAP_A; + break; + case kRenderHeatmapB : + comboBoxValue = XUI_RENDER_HEATMAP_B; + break; + case kRenderHeatmapC : + comboBoxValue = XUI_RENDER_HEATMAP_C; + break; + case kRenderHeatmapD : + comboBoxValue = XUI_RENDER_HEATMAP_D; + break; + default : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + llassert(0); + break; + } + + return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); +} + F32 LLFloaterPathfindingConsole::getCharacterWidth() const { return mCharacterWidthSlider->getValueF32(); @@ -312,6 +383,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), mShowNavMeshCheckBox(NULL), + mShowNavMeshWalkabilityComboBox(NULL), mShowWalkablesCheckBox(NULL), mShowStaticObstaclesCheckBox(NULL), mShowMaterialVolumesCheckBox(NULL), @@ -408,6 +480,41 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } } +void LLFloaterPathfindingConsole::onShowWalkabilitySet() +{ + switch (getRenderHeatmapType()) + { + case kRenderHeatmapNone : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapNone" + << llendl; + break; + case kRenderHeatmapA : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapA" + << llendl; + break; + case kRenderHeatmapB : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapB" + << llendl; + break; + case kRenderHeatmapC : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapC" + << llendl; + break; + case kRenderHeatmapD : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapD" + << llendl; + break; + default : + llassert(0); + break; + } +} + void LLFloaterPathfindingConsole::onShowWorldToggle() { BOOL checkBoxValue = mShowWorldCheckBox->get(); -- cgit v1.2.3 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 +++++++++++++++++++++++--- 1 file changed, 141 insertions(+), 14 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') 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) -- cgit v1.2.3 From 41d9bd0e6d018af9201f376a17ce52f59463e7b9 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 16 Feb 2012 15:59:54 -0500 Subject: Path-278 Debug option to download multiple navmeshes to the viewer. --- indra/newview/llfloaterpathfindingconsole.cpp | 43 +++++++++++++++++++-------- 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 1b948c442b..c54f6a1ffe 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -45,6 +45,7 @@ #include "llviewerregion.h" #include "llviewerwindow.h" #include "llviewercamera.h" +#include "llviewercontrol.h" #include "LLPathingLib.h" @@ -432,7 +433,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mNavMeshCnt(0), mHasStartPoint(false), mHasEndPoint(false), - mIsRegionFrozen(false) + mIsRegionFrozen(false), + mNeighboringRegion( CURRENT_REGION ) { mSelfHandle.bind(this); @@ -470,26 +472,43 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) //make sure the region is essentially enabled for navmesh support std::string capability = "RetrieveNavMeshSrc"; - - //prep# neighboring navmesh support proto + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); std::vector regions; regions.push_back( pCurrentRegion ); - //pCurrentRegion->getNeighboringRegions( regions ); - - std::vector shift; - shift.push_back( CURRENT_REGION ); - //pCurrentRegion->getNeighboringRegionsStatus( shift ); + std::vector shiftDirections; + shiftDirections.push_back( CURRENT_REGION ); + mNeighboringRegion = gSavedSettings.getU32("RetrieveNeighboringRegion"); + if ( mNeighboringRegion != CURRENT_REGION ) + { + //User wants to pull in a neighboring region + std::vector availableRegions; + pCurrentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mNeighboringRegion); + if ( foundElem != availableRegions.end() ) + { + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector regionPtrs; + pCurrentRegion->getNeighboringRegions( regionPtrs ); + regions.push_back( regionPtrs[mNeighboringRegion] ); + shiftDirections.push_back( mNeighboringRegion ); + } + } + + //If the navmesh shift ops and the total region counts do not match - use the current region, only. - if ( shift.size() != regions.size() ) + if ( shiftDirections.size() != regions.size() ) { - shift.clear();regions.clear(); + shiftDirections.clear();regions.clear(); regions.push_back( pCurrentRegion ); - shift.push_back( CURRENT_REGION ); + shiftDirections.push_back( CURRENT_REGION ); } + int regionCnt = regions.size(); mNavMeshCnt = regionCnt; + for ( int i=0; igetCapability( capability ); @@ -499,7 +518,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) std::string str = getString("navmesh_fetch_inprogress"); mPathfindingStatus->setText((LLStringExplicit)str); LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shift[i]; + int dir = shiftDirections[i]; LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); ++mCurrentMDO; } -- cgit v1.2.3 From 399d0da9ef5802e85894e8d7e6e52e893653e24c Mon Sep 17 00:00:00 2001 From: prep Date: Fri, 17 Feb 2012 11:01:48 -0500 Subject: Path-317: debug option to enable vbo rendering of navmeshes --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c54f6a1ffe..5db052e448 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -397,7 +397,7 @@ void LLFloaterPathfindingConsole::setHasNavMeshReceived() --mNavMeshCnt; if ( mNavMeshCnt == 0 ) { - LLPathingLib::getInstance()->stitchNavMeshes(); + LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); } } -- cgit v1.2.3 From 4db56b229f37dc4637bf403baa684ed57db9e30d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 17 Feb 2012 10:42:06 -0800 Subject: PATH-284: Ensuring that path testing only occurs when the console window is show with the testing panel visible. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 5db052e448..cdd96b8b8e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -60,6 +60,8 @@ #define XUI_CHARACTER_TYPE_C 3 #define XUI_CHARACTER_TYPE_D 4 +#define XUI_TEST_TAB_INDEX 1 + const int CURRENT_REGION = 99; const int MAX_OBSERVERS = 10; @@ -180,7 +182,7 @@ BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, E BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const { - return (getVisible() && (mEditTestTabContainer->getCurrentPanelIndex() == 1) && + return (isShown() && (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) && (clicktype == LLMouseHandler::CLICK_LEFT) && down && (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))); -- cgit v1.2.3 From 06970dd907db7a7c5ebe950c0e74e10bab13483d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 21 Feb 2012 19:29:28 -0800 Subject: PATH-296: Pulling the freeze/unfreeze functionality into the pathfinding console. --- indra/newview/llfloaterpathfindingconsole.cpp | 286 ++++++++++++++------------ 1 file changed, 157 insertions(+), 129 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index cdd96b8b8e..7795397803 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -45,7 +45,8 @@ #include "llviewerregion.h" #include "llviewerwindow.h" #include "llviewercamera.h" -#include "llviewercontrol.h" +#include "llviewercontrol.h" +#include "llpathfindingmanager.h" #include "LLPathingLib.h" @@ -142,10 +143,113 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mClearPathButton != NULL); mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); - updateOnPathfindingServerStatus(); + return LLFloater::postBuild(); +} + +void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) +{ + LLFloater::onOpen(pKey); + + //make sure we have a pathing system + if ( !LLPathingLib::getInstance() ) + { + LLPathingLib::initSystem(); + } + if ( LLPathingLib::getInstance() == NULL ) + { + std::string str = getString("navmesh_library_not_implemented"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llwarns <<"Errror: cannout find pathing library implementation."<cleanupResidual(); + + mCurrentMDO = 0; + mNavMeshCnt = 0; + + //make sure the region is essentially enabled for navmesh support + std::string capability = "RetrieveNavMeshSrc"; + + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector regions; + regions.push_back( pCurrentRegion ); + std::vector shiftDirections; + shiftDirections.push_back( CURRENT_REGION ); + + mNeighboringRegion = gSavedSettings.getU32("RetrieveNeighboringRegion"); + if ( mNeighboringRegion != CURRENT_REGION ) + { + //User wants to pull in a neighboring region + std::vector availableRegions; + pCurrentRegion->getNeighboringRegionsStatus( availableRegions ); + //Is the desired region in the available list + std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mNeighboringRegion); + if ( foundElem != availableRegions.end() ) + { + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector regionPtrs; + pCurrentRegion->getNeighboringRegions( regionPtrs ); + regions.push_back( regionPtrs[mNeighboringRegion] ); + shiftDirections.push_back( mNeighboringRegion ); + } + } + + + //If the navmesh shift ops and the total region counts do not match - use the current region, only. + if ( shiftDirections.size() != regions.size() ) + { + shiftDirections.clear();regions.clear(); + regions.push_back( pCurrentRegion ); + shiftDirections.push_back( CURRENT_REGION ); + } + + int regionCnt = regions.size(); + mNavMeshCnt = regionCnt; + + for ( int i=0; igetCapability( capability ); + + if ( !url.empty() ) + { + std::string str = getString("navmesh_fetch_inprogress"); + mPathfindingStatus->setText((LLStringExplicit)str); + LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); + int dir = shiftDirections[i]; + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); + ++mCurrentMDO; + } + else + { + --mNavMeshCnt; + std::string str = getString("navmesh_region_not_enabled"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llinfos<<"Region has does not required caps of type ["<registerAgentStateSignal(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); + } + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); updatePathTestStatus(); +} - return LLFloater::postBuild(); +void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) +{ + if (mAgentStateSlot.connected()) + { + mAgentStateSlot.disconnect(); + } + + LLFloater::onClose(pIsAppQuitting); } BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) @@ -432,10 +536,10 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mCharacterTypeRadioGroup(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), + mAgentStateSlot(), mNavMeshCnt(0), mHasStartPoint(false), mHasEndPoint(false), - mIsRegionFrozen(false), mNeighboringRegion( CURRENT_REGION ) { mSelfHandle.bind(this); @@ -450,95 +554,6 @@ LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() { } -void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) -{ - //make sure we have a pathing system - if ( !LLPathingLib::getInstance() ) - { - LLPathingLib::initSystem(); - } - if ( LLPathingLib::getInstance() == NULL ) - { - std::string str = getString("navmesh_library_not_implemented"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llwarns <<"Errror: cannout find pathing library implementation."<cleanupResidual(); - - mCurrentMDO = 0; - mNavMeshCnt = 0; - - //make sure the region is essentially enabled for navmesh support - std::string capability = "RetrieveNavMeshSrc"; - - LLViewerRegion* pCurrentRegion = gAgent.getRegion(); - std::vector regions; - regions.push_back( pCurrentRegion ); - std::vector shiftDirections; - shiftDirections.push_back( CURRENT_REGION ); - - mNeighboringRegion = gSavedSettings.getU32("RetrieveNeighboringRegion"); - if ( mNeighboringRegion != CURRENT_REGION ) - { - //User wants to pull in a neighboring region - std::vector availableRegions; - pCurrentRegion->getNeighboringRegionsStatus( availableRegions ); - //Is the desired region in the available list - std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mNeighboringRegion); - if ( foundElem != availableRegions.end() ) - { - LLViewerRegion* pCurrentRegion = gAgent.getRegion(); - std::vector regionPtrs; - pCurrentRegion->getNeighboringRegions( regionPtrs ); - regions.push_back( regionPtrs[mNeighboringRegion] ); - shiftDirections.push_back( mNeighboringRegion ); - } - } - - - //If the navmesh shift ops and the total region counts do not match - use the current region, only. - if ( shiftDirections.size() != regions.size() ) - { - shiftDirections.clear();regions.clear(); - regions.push_back( pCurrentRegion ); - shiftDirections.push_back( CURRENT_REGION ); - } - - int regionCnt = regions.size(); - mNavMeshCnt = regionCnt; - - for ( int i=0; igetCapability( capability ); - - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shiftDirections[i]; - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); - ++mCurrentMDO; - } - else - { - --mNavMeshCnt; - std::string str = getString("navmesh_region_not_enabled"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["<setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); } void LLFloaterPathfindingConsole::onFreezeClicked() { - mIsRegionFrozen = true; - updateOnPathfindingServerStatus(); - llwarns << "functionality has not yet been implemented to set frozen state" << llendl; + mFreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); } void LLFloaterPathfindingConsole::onViewEditLinksetClicked() @@ -671,12 +684,17 @@ void LLFloaterPathfindingConsole::onClearPathClicked() updatePathTestStatus(); } -void LLFloaterPathfindingConsole::updateOnPathfindingServerStatus() +void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) { - std::string capURL = getCurrentRegionCapabilityURL(); + setAgentState(pAgentState); +} - if (capURL.empty()) +void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) +{ + switch (pAgentState) { + case LLPathfindingManager::kAgentStateUnknown : + case LLPathfindingManager::kAgentStateNotEnabled : mShowNavMeshCheckBox->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); mShowWalkablesCheckBox->setEnabled(FALSE); @@ -686,20 +704,15 @@ void LLFloaterPathfindingConsole::updateOnPathfindingServerStatus() 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 - { + mHasStartPoint = false; + mHasEndPoint = false; + break; + default : mShowNavMeshCheckBox->setEnabled(TRUE); mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); mShowWalkablesCheckBox->setEnabled(TRUE); @@ -712,24 +725,39 @@ void LLFloaterPathfindingConsole::updateOnPathfindingServerStatus() 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); - } + break; + } + + switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) + { + case LLPathfindingManager::kAgentStateUnknown : + case LLPathfindingManager::kAgentStateNotEnabled : + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateFrozen : + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateUnfrozen : + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(TRUE); + mLinksetsButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + break; + default : + llassert(0); + break; } } -- cgit v1.2.3 From b7d93d8adf9f604a2f345336bd0e37c08a0d10cb Mon Sep 17 00:00:00 2001 From: prep Date: Fri, 24 Feb 2012 13:16:35 -0500 Subject: Path-267: Add support for rendering of walkable objects, obstacles and material phantoms. --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 7795397803..e09bc028ce 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -248,7 +248,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { mAgentStateSlot.disconnect(); } - + LLPathingLib::getInstance()->cleanupResidual(); LLFloater::onClose(pIsAppQuitting); } -- cgit v1.2.3 From 5f2ed985aba01155ffb24a3bfe42e3444af735d5 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 27 Feb 2012 13:42:14 -0500 Subject: Path-267: Support for rendering of new shape types an ui hookup. --- indra/newview/llfloaterpathfindingconsole.cpp | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index e09bc028ce..862f4d2fda 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -799,3 +799,38 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); } + + +BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const +{ + if ( isRenderWalkables() || isRenderStaticObstacles() || + isRenderMaterialVolumes() || isRenderExclusionVolumes() ) + { + return true; + } + + return false; +} + +U32 LLFloaterPathfindingConsole::getRenderShapeFlags() +{ + resetShapeRenderFlags(); + + if ( isRenderWalkables() ) + { + setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects ); + } + if ( isRenderStaticObstacles() ) + { + setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects ); + } + if ( isRenderMaterialVolumes() ) + { + setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms ); + } + if ( isRenderExclusionVolumes() ) + { + setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms ); + } + return mShapeRenderFlags; +} -- cgit v1.2.3 From c4ddaf67cb31517c3d5e379d0237a21d1d7b2c9d Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 1 Mar 2012 17:33:45 -0500 Subject: path-264: Locking avatar in place when pathing floater is up. --- indra/newview/llfloaterpathfindingconsole.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 862f4d2fda..2bf46175ee 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -149,7 +149,7 @@ BOOL LLFloaterPathfindingConsole::postBuild() void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { LLFloater::onOpen(pKey); - + setHeartBeat( true ); //make sure we have a pathing system if ( !LLPathingLib::getInstance() ) { @@ -250,6 +250,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) } LLPathingLib::getInstance()->cleanupResidual(); LLFloater::onClose(pIsAppQuitting); + setHeartBeat( false ); } BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) @@ -540,7 +541,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mNavMeshCnt(0), mHasStartPoint(false), mHasEndPoint(false), - mNeighboringRegion( CURRENT_REGION ) + mNeighboringRegion( CURRENT_REGION ), + mHeartBeat( false ) { mSelfHandle.bind(this); -- cgit v1.2.3 From a33e24413ea74aaad91d9eeaa685d1c523c5d210 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 2 Mar 2012 19:17:16 -0800 Subject: PATH-304,PATH-205: Initial reworking of the navmesh download functionality. --- indra/newview/llfloaterpathfindingconsole.cpp | 281 ++++++++++++++++++++------ 1 file changed, 217 insertions(+), 64 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 2bf46175ee..02f2bf8d72 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -33,6 +33,7 @@ #include "llsd.h" #include "llhandle.h" #include "llagent.h" +#include "llpanel.h" #include "llbutton.h" #include "llradiogroup.h" #include "llsliderctrl.h" @@ -40,12 +41,12 @@ #include "lltextbase.h" #include "lltabcontainer.h" #include "llcombobox.h" -#include "llnavmeshstation.h" #include "llfloaterreg.h" #include "llviewerregion.h" #include "llviewerwindow.h" #include "llviewercamera.h" #include "llviewercontrol.h" +#include "llpathfindingnavmesh.h" #include "llpathfindingmanager.h" #include "LLPathingLib.h" @@ -104,6 +105,12 @@ BOOL LLFloaterPathfindingConsole::postBuild() mEditTestTabContainer = findChild("edit_test_tab_container"); llassert(mEditTestTabContainer != NULL); + mEditTab = findChild("edit_panel"); + llassert(mEditTab != NULL); + + mTestTab = findChild("test_panel"); + llassert(mTestTab != NULL); + mUnfreezeLabel = findChild("unfreeze_label"); llassert(mUnfreezeLabel != NULL); @@ -157,14 +164,18 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } if ( LLPathingLib::getInstance() == NULL ) { - std::string str = getString("navmesh_library_not_implemented"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + setConsoleState(kConsoleStateLibraryNotImplemented); llwarns <<"Errror: cannout find pathing library implementation."<registerNavMeshListenerForCurrentRegion(boost::bind(&LLFloaterPathfindingConsole::onNavMeshDownloadCB, this, _1, _2, _3, _4)); + } + pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); +#if 0 LLPathingLib::getInstance()->cleanupResidual(); mCurrentMDO = 0; @@ -232,12 +243,14 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) llinfos<<"Region has does not required caps of type ["<registerAgentStateSignal(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); + LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); } + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); updatePathTestStatus(); } @@ -248,9 +261,16 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { mAgentStateSlot.disconnect(); } - LLPathingLib::getInstance()->cleanupResidual(); + + if (mNavMeshSlot.connected()) + { + mNavMeshSlot.disconnect(); + } + + clearNavMesh(); LLFloater::onClose(pIsAppQuitting); setHeartBeat( false ); + setConsoleState(kConsoleStateUnknown); } BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) @@ -496,6 +516,7 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType mCharacterTypeRadioGroup->setValue(radioGroupValue); } +#if 0 void LLFloaterPathfindingConsole::setHasNavMeshReceived() { std::string str = getString("navmesh_fetch_complete_available"); @@ -513,6 +534,7 @@ void LLFloaterPathfindingConsole::setHasNoNavMesh() std::string str = getString("navmesh_fetch_complete_none"); mPathfindingStatus->setText((LLStringExplicit)str); } +#endif LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), @@ -527,6 +549,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathfindingStatus(NULL), mViewCharactersButton(NULL), mEditTestTabContainer(NULL), + mEditTab(NULL), + mTestTab(NULL), mUnfreezeLabel(NULL), mUnfreezeButton(NULL), mLinksetsLabel(NULL), @@ -537,38 +561,33 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mCharacterTypeRadioGroup(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), + mNavMeshSlot(), mAgentStateSlot(), + mConsoleState(kConsoleStateUnknown), + mHasNavMesh(false), + mNavMeshRegionVersion(0U), + mNavMeshRegionUUID(), +#if 0 mNavMeshCnt(0), + mNeighboringRegion( CURRENT_REGION ), +#endif mHasStartPoint(false), mHasEndPoint(false), - mNeighboringRegion( CURRENT_REGION ), mHeartBeat( false ) { mSelfHandle.bind(this); - +#if 0 for (int i=0;igetCapability("RetrieveNavMeshSrc"); - } - - return capURL; -} - void LLFloaterPathfindingConsole::onShowWalkabilitySet() { switch (getRenderHeatmapType()) @@ -686,17 +705,76 @@ void LLFloaterPathfindingConsole::onClearPathClicked() updatePathTestStatus(); } +void LLFloaterPathfindingConsole::onNavMeshDownloadCB(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +{ + + switch (pNavMeshRequestStatus) + { + case LLPathfindingNavMesh::kNavMeshRequestStarted : + setConsoleState(kConsoleStateDownloading); + break; + case LLPathfindingNavMesh::kNavMeshRequestCompleted : + updateNavMesh(pRegionUUID, pNavMeshVersion, pNavMeshData); + setConsoleState(kConsoleStateHasNavMesh); + break; + case LLPathfindingNavMesh::kNavMeshRequestNotEnabled : + clearNavMesh(); + setConsoleState(kConsoleStateRegionNotEnabled); + break; + case LLPathfindingNavMesh::kNavMeshRequestMessageError : + clearNavMesh(); + setConsoleState(kConsoleStateDownloadError); + break; + case LLPathfindingNavMesh::kNavMeshRequestFormatError : + clearNavMesh(); + setConsoleState(kConsoleStateNavMeshError); + break; + case LLPathfindingNavMesh::kNavMeshRequestUnknown : + default: + clearNavMesh(); + setConsoleState(kConsoleStateUnknown); + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::updateNavMesh(const LLUUID &pRegionUUID, U32 pNavMeshVersion, const LLSD::Binary &pNavMeshData) +{ + if (!mHasNavMesh || (mNavMeshRegionUUID != pRegionUUID) || (mNavMeshRegionVersion != pNavMeshVersion)) + { + llassert(!pNavMeshData.empty()); + mHasNavMesh = true; + mNavMeshRegionUUID = pRegionUUID; + mNavMeshRegionVersion = pNavMeshVersion; + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, CURRENT_REGION); + } +} + +void LLFloaterPathfindingConsole::clearNavMesh() +{ + mHasNavMesh = false; + LLPathingLib::getInstance()->cleanupResidual(); +} + void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) { setAgentState(pAgentState); } -void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) +void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) +{ + mConsoleState = pConsoleState; + updateControlsOnConsoleState(); + updateStatusOnConsoleState(); +} + +void LLFloaterPathfindingConsole::updateControlsOnConsoleState() { - switch (pAgentState) + switch (mConsoleState) { - case LLPathfindingManager::kAgentStateUnknown : - case LLPathfindingManager::kAgentStateNotEnabled : + case kConsoleStateUnknown : + case kConsoleStateLibraryNotImplemented : + case kConsoleStateRegionNotEnabled : mShowNavMeshCheckBox->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); mShowWalkablesCheckBox->setEnabled(FALSE); @@ -705,16 +783,35 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mShowExclusionVolumesCheckBox->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(FALSE); - mEditTestTabContainer->setEnabled(FALSE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); mCharacterWidthSlider->setEnabled(FALSE); mCharacterTypeRadioGroup->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); - + mHasStartPoint = false; + mHasEndPoint = false; + break; + case kConsoleStateDownloading : + case kConsoleStateDownloadError : + case kConsoleStateNavMeshError : + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(TRUE); mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeRadioGroup->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); mHasStartPoint = false; mHasEndPoint = false; break; - default : + case kConsoleStateHasNavMesh : + case kConsoleStateHasNavMeshDownloading : mShowNavMeshCheckBox->setEnabled(TRUE); mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); mShowWalkablesCheckBox->setEnabled(TRUE); @@ -723,17 +820,71 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mShowExclusionVolumesCheckBox->setEnabled(TRUE); mShowWorldCheckBox->setEnabled(TRUE); mViewCharactersButton->setEnabled(TRUE); - mEditTestTabContainer->setEnabled(TRUE); + mTestTab->setEnabled(TRUE); mCharacterWidthSlider->setEnabled(TRUE); mCharacterTypeRadioGroup->setEnabled(TRUE); mClearPathButton->setEnabled(TRUE); + mTestTab->setEnabled(TRUE); + break; + default : + llassert(0); break; } +} +void LLFloaterPathfindingConsole::updateStatusOnConsoleState() +{ + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); + + std::string statusText(""); + LLStyle::Params styleParams; + + switch (mConsoleState) + { + case kConsoleStateUnknown : + statusText = getString("navmesh_status_unknown"); + break; + case kConsoleStateLibraryNotImplemented : + statusText = getString("navmesh_status_library_not_implemented"); + styleParams.color = warningColor; + break; + case kConsoleStateRegionNotEnabled : + statusText = getString("navmesh_status_region_not_enabled"); + styleParams.color = warningColor; + break; + case kConsoleStateDownloading : + statusText = getString("navmesh_status_downloading"); + break; + case kConsoleStateHasNavMesh : + statusText = getString("navmesh_status_has_navmesh"); + break; + case kConsoleStateHasNavMeshDownloading : + statusText = getString("navmesh_status_has_navmesh_downloading"); + break; + case kConsoleStateDownloadError : + statusText = getString("navmesh_status_download_error"); + styleParams.color = warningColor; + break; + case kConsoleStateNavMeshError : + statusText = getString("navmesh_status_navmesh_error"); + styleParams.color = warningColor; + break; + default : + statusText = getString("navmesh_status_unknown"); + llassert(0); + break; + } + + mPathfindingStatus->setText((LLStringExplicit)statusText, styleParams); +} + +void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) +{ switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) { case LLPathfindingManager::kAgentStateUnknown : case LLPathfindingManager::kAgentStateNotEnabled : + mEditTab->setEnabled(FALSE); mUnfreezeLabel->setEnabled(FALSE); mUnfreezeButton->setEnabled(FALSE); mLinksetsLabel->setEnabled(FALSE); @@ -742,6 +893,7 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mFreezeButton->setEnabled(FALSE); break; case LLPathfindingManager::kAgentStateFrozen : + mEditTab->setEnabled(TRUE); mUnfreezeLabel->setEnabled(TRUE); mUnfreezeButton->setEnabled(TRUE); mLinksetsLabel->setEnabled(FALSE); @@ -750,6 +902,7 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat mFreezeButton->setEnabled(FALSE); break; case LLPathfindingManager::kAgentStateUnfrozen : + mEditTab->setEnabled(TRUE); mUnfreezeLabel->setEnabled(FALSE); mUnfreezeButton->setEnabled(FALSE); mLinksetsLabel->setEnabled(TRUE); @@ -803,36 +956,36 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() } -BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const -{ - if ( isRenderWalkables() || isRenderStaticObstacles() || - isRenderMaterialVolumes() || isRenderExclusionVolumes() ) - { - return true; - } - - return false; -} - -U32 LLFloaterPathfindingConsole::getRenderShapeFlags() -{ - resetShapeRenderFlags(); - - if ( isRenderWalkables() ) - { - setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects ); - } - if ( isRenderStaticObstacles() ) - { - setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects ); - } - if ( isRenderMaterialVolumes() ) - { - setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms ); - } - if ( isRenderExclusionVolumes() ) - { - setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms ); - } - return mShapeRenderFlags; -} +BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const +{ + if ( isRenderWalkables() || isRenderStaticObstacles() || + isRenderMaterialVolumes() || isRenderExclusionVolumes() ) + { + return true; + } + + return false; +} + +U32 LLFloaterPathfindingConsole::getRenderShapeFlags() +{ + resetShapeRenderFlags(); + + if ( isRenderWalkables() ) + { + setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects ); + } + if ( isRenderStaticObstacles() ) + { + setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects ); + } + if ( isRenderMaterialVolumes() ) + { + setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms ); + } + if ( isRenderExclusionVolumes() ) + { + setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms ); + } + return mShapeRenderFlags; +} -- cgit v1.2.3 From 4370d0263301a60988335e99d37f4b584f160f77 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 5 Mar 2012 14:24:25 -0500 Subject: Crash fix on teleport --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 2bf46175ee..5ac79668d2 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -248,7 +248,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { mAgentStateSlot.disconnect(); } - LLPathingLib::getInstance()->cleanupResidual(); + if ( LLPathingLib::getInstance() ) { LLPathingLib::getInstance()->cleanupResidual(); } LLFloater::onClose(pIsAppQuitting); setHeartBeat( false ); } -- cgit v1.2.3 From 581de7c7b8025c48e585c1af80e060af94aca328 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 5 Mar 2012 17:20:35 -0800 Subject: PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes. --- indra/newview/llfloaterpathfindingconsole.cpp | 114 ++++++-------------------- 1 file changed, 25 insertions(+), 89 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 02f2bf8d72..094f7749c1 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -46,7 +46,7 @@ #include "llviewerwindow.h" #include "llviewercamera.h" #include "llviewercontrol.h" -#include "llpathfindingnavmesh.h" +#include "llpathfindingnavmeshzone.h" #include "llpathfindingmanager.h" #include "LLPathingLib.h" @@ -64,9 +64,6 @@ #define XUI_TEST_TAB_INDEX 1 -const int CURRENT_REGION = 99; -const int MAX_OBSERVERS = 10; - LLHandle LLFloaterPathfindingConsole::sInstanceHandle; //--------------------------------------------------------------------------- @@ -165,16 +162,17 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) if ( LLPathingLib::getInstance() == NULL ) { setConsoleState(kConsoleStateLibraryNotImplemented); - llwarns <<"Errror: cannout find pathing library implementation."<registerNavMeshListenerForCurrentRegion(boost::bind(&LLFloaterPathfindingConsole::onNavMeshDownloadCB, this, _1, _2, _3, _4)); + mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); } - pathfindingManagerInstance->requestGetNavMeshForCurrentRegion(); + + mNavMeshZone.setCurrentRegionAsCenter(); + mNavMeshZone.refresh(); #if 0 LLPathingLib::getInstance()->cleanupResidual(); @@ -262,12 +260,13 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) mAgentStateSlot.disconnect(); } - if (mNavMeshSlot.connected()) + if (mNavMeshZoneSlot.connected()) { - mNavMeshSlot.disconnect(); + mNavMeshZoneSlot.disconnect(); } - clearNavMesh(); + //mNavMeshZone.disable(); + LLFloater::onClose(pIsAppQuitting); setHeartBeat( false ); setConsoleState(kConsoleStateUnknown); @@ -516,26 +515,6 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType mCharacterTypeRadioGroup->setValue(radioGroupValue); } -#if 0 -void LLFloaterPathfindingConsole::setHasNavMeshReceived() -{ - std::string str = getString("navmesh_fetch_complete_available"); - mPathfindingStatus->setText((LLStringExplicit)str); - //check to see if all regions are done loading and they are then stitch the navmeshes together - --mNavMeshCnt; - if ( mNavMeshCnt == 0 ) - { - LLPathingLib::getInstance()->stitchNavMeshes( gSavedSettings.getBOOL("EnableVBOForNavMeshVisualization") ); - } -} - -void LLFloaterPathfindingConsole::setHasNoNavMesh() -{ - std::string str = getString("navmesh_fetch_complete_none"); - mPathfindingStatus->setText((LLStringExplicit)str); -} -#endif - LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), @@ -561,27 +540,16 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mCharacterTypeRadioGroup(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), - mNavMeshSlot(), + mNavMeshZoneSlot(), + mNavMeshZone(), mAgentStateSlot(), mConsoleState(kConsoleStateUnknown), - mHasNavMesh(false), - mNavMeshRegionVersion(0U), - mNavMeshRegionUUID(), -#if 0 - mNavMeshCnt(0), - mNeighboringRegion( CURRENT_REGION ), -#endif + mPathData(), mHasStartPoint(false), mHasEndPoint(false), mHeartBeat( false ) { mSelfHandle.bind(this); -#if 0 - for (int i=0;iextractNavMeshSrcFromLLSD(pNavMeshData, CURRENT_REGION); - } -} - -void LLFloaterPathfindingConsole::clearNavMesh() -{ - mHasNavMesh = false; - LLPathingLib::getInstance()->cleanupResidual(); -} - void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) { setAgentState(pAgentState); @@ -792,8 +733,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mHasEndPoint = false; break; case kConsoleStateDownloading : - case kConsoleStateDownloadError : - case kConsoleStateNavMeshError : + case kConsoleStateError : mShowNavMeshCheckBox->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); mShowWalkablesCheckBox->setEnabled(FALSE); @@ -861,12 +801,8 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() case kConsoleStateHasNavMeshDownloading : statusText = getString("navmesh_status_has_navmesh_downloading"); break; - case kConsoleStateDownloadError : - statusText = getString("navmesh_status_download_error"); - styleParams.color = warningColor; - break; - case kConsoleStateNavMeshError : - statusText = getString("navmesh_status_navmesh_error"); + case kConsoleStateError : + statusText = getString("navmesh_status_error"); styleParams.color = warningColor; break; default : -- cgit v1.2.3 From 8ad01dd79a2c215895017475bcfd62808f8893be Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 5 Mar 2012 17:55:33 -0800 Subject: Wrapping all cases of LLPathingLib::getInstance in null pointer checks. --- indra/newview/llfloaterpathfindingconsole.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index eee5d6860d..37bf937cd1 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -265,7 +265,10 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) mNavMeshZoneSlot.disconnect(); } - //mNavMeshZone.disable(); + if (LLPathingLib::getInstance() != NULL) + { + mNavMeshZone.disable(); + } LLFloater::onClose(pIsAppQuitting); setHeartBeat( false ); -- cgit v1.2.3 From 6c9561c882cf0d5bb0cb547852e95daec19f559c Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 6 Mar 2012 15:57:28 -0800 Subject: Storing the slots for the registered signal listeners. Before, this was creating the artifact of crashing the Viewer on the second close of the pathfinding console. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 37bf937cd1..f2404dcb6b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -168,7 +168,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { if (!mNavMeshZoneSlot.connected()) { - mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); + mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); } mNavMeshZone.setCurrentRegionAsCenter(); @@ -246,7 +246,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) if (!mAgentStateSlot.connected()) { - LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); + mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); } setAgentState(LLPathfindingManager::getInstance()->getAgentState()); -- cgit v1.2.3 From a0c626fe411336871505c2c414143ae4b2f73259 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 6 Mar 2012 18:40:37 -0800 Subject: PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes. --- indra/newview/llfloaterpathfindingconsole.cpp | 73 ++------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f2404dcb6b..fe5c6b8d44 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -171,77 +171,10 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); } - mNavMeshZone.setCurrentRegionAsCenter(); - mNavMeshZone.refresh(); -#if 0 - LLPathingLib::getInstance()->cleanupResidual(); - - mCurrentMDO = 0; - mNavMeshCnt = 0; - - //make sure the region is essentially enabled for navmesh support - std::string capability = "RetrieveNavMeshSrc"; - - LLViewerRegion* pCurrentRegion = gAgent.getRegion(); - std::vector regions; - regions.push_back( pCurrentRegion ); - std::vector shiftDirections; - shiftDirections.push_back( CURRENT_REGION ); - - mNeighboringRegion = gSavedSettings.getU32("RetrieveNeighboringRegion"); - if ( mNeighboringRegion != CURRENT_REGION ) - { - //User wants to pull in a neighboring region - std::vector availableRegions; - pCurrentRegion->getNeighboringRegionsStatus( availableRegions ); - //Is the desired region in the available list - std::vector::iterator foundElem = std::find(availableRegions.begin(),availableRegions.end(),mNeighboringRegion); - if ( foundElem != availableRegions.end() ) - { - LLViewerRegion* pCurrentRegion = gAgent.getRegion(); - std::vector regionPtrs; - pCurrentRegion->getNeighboringRegions( regionPtrs ); - regions.push_back( regionPtrs[mNeighboringRegion] ); - shiftDirections.push_back( mNeighboringRegion ); - } - } - - - //If the navmesh shift ops and the total region counts do not match - use the current region, only. - if ( shiftDirections.size() != regions.size() ) - { - shiftDirections.clear();regions.clear(); - regions.push_back( pCurrentRegion ); - shiftDirections.push_back( CURRENT_REGION ); - } + mNavMeshZone.initialize(); - int regionCnt = regions.size(); - mNavMeshCnt = regionCnt; - - for ( int i=0; igetCapability( capability ); - - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - int dir = shiftDirections[i]; - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); - ++mCurrentMDO; - } - else - { - --mNavMeshCnt; - std::string str = getString("navmesh_region_not_enabled"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["< Date: Wed, 7 Mar 2012 14:39:27 -0800 Subject: PATH-205,PATh-304: Fixing a crash issue with loading multiple navmeshes during the second refresh. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fe5c6b8d44..6824e629c9 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -613,6 +613,9 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav { switch (pNavMeshZoneRequestStatus) { + case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : + setConsoleState(kConsoleStateUnknown); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : setConsoleState(kConsoleStateDownloading); break; @@ -625,7 +628,6 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestError : setConsoleState(kConsoleStateError); break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : default: setConsoleState(kConsoleStateUnknown); llassert(0); -- cgit v1.2.3 From f578181af9cbe3277374578c27487e2e72956079 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 8 Mar 2012 12:34:11 -0800 Subject: PATH-304: Adding functionality to handle the reloading of out-of-date navmeshes. --- indra/newview/llfloaterpathfindingconsole.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 6824e629c9..493b4617b5 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -171,6 +171,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); } + mIsNavMeshUpdating = false; mNavMeshZone.initialize(); mNavMeshZone.enable(); @@ -478,6 +479,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mClearPathButton(NULL), mNavMeshZoneSlot(), mNavMeshZone(), + mIsNavMeshUpdating(false), mAgentStateSlot(), mConsoleState(kConsoleStateUnknown), mPathData(), @@ -616,10 +618,15 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : setConsoleState(kConsoleStateUnknown); break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : + mIsNavMeshUpdating = true; + mNavMeshZone.refresh(); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : setConsoleState(kConsoleStateDownloading); break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted : + mIsNavMeshUpdating = false; setConsoleState(kConsoleStateHasNavMesh); break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled : @@ -689,7 +696,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mHasEndPoint = false; break; case kConsoleStateHasNavMesh : - case kConsoleStateHasNavMeshDownloading : mShowNavMeshCheckBox->setEnabled(TRUE); mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); mShowWalkablesCheckBox->setEnabled(TRUE); @@ -731,14 +737,18 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() styleParams.color = warningColor; break; case kConsoleStateDownloading : - statusText = getString("navmesh_status_downloading"); + if (mIsNavMeshUpdating) + { + statusText = getString("navmesh_status_updating"); + } + else + { + statusText = getString("navmesh_status_downloading"); + } break; case kConsoleStateHasNavMesh : statusText = getString("navmesh_status_has_navmesh"); break; - case kConsoleStateHasNavMeshDownloading : - statusText = getString("navmesh_status_has_navmesh_downloading"); - break; case kConsoleStateError : statusText = getString("navmesh_status_error"); styleParams.color = warningColor; -- cgit v1.2.3 From e558f5cb0b8c0937da0f08a1af149afbc497462c Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 12 Mar 2012 15:04:09 -0400 Subject: path-405: Avatar is no longer frozen when pathing window is up and when avatar crosses a region boundary the resident is informed with a message in the pathing window. --- indra/newview/llfloaterpathfindingconsole.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 493b4617b5..c336a30bc9 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -873,3 +873,12 @@ U32 LLFloaterPathfindingConsole::getRenderShapeFlags() } return mShapeRenderFlags; } + +void LLFloaterPathfindingConsole::regionCrossingOccured() +{ + std::string statusText(""); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + statusText = getString("navmesh_update_needed"); + mPathfindingStatus->setText((LLStringExplicit)statusText, styleParams); +} \ No newline at end of file -- cgit v1.2.3 From 87b414c4934d0d52eef0b323245568bb1e95ec70 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 12 Mar 2012 15:24:30 -0400 Subject: path-396: rendering options are reset when pathing window is closed. --- indra/newview/llfloaterpathfindingconsole.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c336a30bc9..405b089155 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -207,6 +207,13 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) LLFloater::onClose(pIsAppQuitting); setHeartBeat( false ); setConsoleState(kConsoleStateUnknown); + //Reset all the checkboxes to default + mShowNavMeshCheckBox->set( false ); + mShowWalkablesCheckBox->set( false ); + mShowMaterialVolumesCheckBox->set( false ); + mShowStaticObstaclesCheckBox->set( false ); + mShowExclusionVolumesCheckBox->set( false ); + mShowWorldCheckBox->set( false ); } BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) -- cgit v1.2.3 From c990cc71ce124059a072c7778ac962253bacb199 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 12 Mar 2012 19:18:19 -0700 Subject: PATH-304: Adding an extra state for the pathfinding console to report that the status of the navmesh is being checked. --- indra/newview/llfloaterpathfindingconsole.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 493b4617b5..487ef0933a 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -618,6 +618,9 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : setConsoleState(kConsoleStateUnknown); break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : + setConsoleState(kConsoleStateCheckingVersion); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : mIsNavMeshUpdating = true; mNavMeshZone.refresh(); @@ -677,6 +680,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mHasStartPoint = false; mHasEndPoint = false; break; + case kConsoleStateCheckingVersion : case kConsoleStateDownloading : case kConsoleStateError : mShowNavMeshCheckBox->setEnabled(FALSE); @@ -736,6 +740,9 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() statusText = getString("navmesh_status_region_not_enabled"); styleParams.color = warningColor; break; + case kConsoleStateCheckingVersion : + statusText = getString("navmesh_status_checking_version"); + break; case kConsoleStateDownloading : if (mIsNavMeshUpdating) { -- cgit v1.2.3 From d4fb7c99febf07b4eb7f3a9d2eab485e356d1439 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 14 Mar 2012 14:09:36 -0700 Subject: PATH-302: Adding in status reporting for the simulator navmesh status. Separating the viewer status messaging from the simulator status. --- indra/newview/llfloaterpathfindingconsole.cpp | 118 +++++++++++++++++++++----- 1 file changed, 99 insertions(+), 19 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 7e86819568..65a558b778 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -129,8 +129,11 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mFreezeButton != NULL); mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onFreezeClicked, this)); - mPathfindingStatus = findChild("pathfinding_status"); - llassert(mPathfindingStatus != NULL); + mPathfindingViewerStatus = findChild("pathfinding_viewer_status"); + llassert(mPathfindingViewerStatus != NULL); + + mPathfindingSimulatorStatus = findChild("pathfinding_simulator_status"); + llassert(mPathfindingSimulatorStatus != NULL); mCharacterWidthSlider = findChild("character_width"); llassert(mCharacterWidthSlider != NULL); @@ -469,7 +472,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowMaterialVolumesCheckBox(NULL), mShowExclusionVolumesCheckBox(NULL), mShowWorldCheckBox(NULL), - mPathfindingStatus(NULL), + mPathfindingViewerStatus(NULL), + mPathfindingSimulatorStatus(NULL), mViewCharactersButton(NULL), mEditTestTabContainer(NULL), mEditTab(NULL), @@ -731,50 +735,126 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() { static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); - std::string statusText(""); - LLStyle::Params styleParams; + std::string simulatorStatusText(""); + std::string viewerStatusText(""); + LLStyle::Params viewerStyleParams; switch (mConsoleState) { case kConsoleStateUnknown : - statusText = getString("navmesh_status_unknown"); + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); break; case kConsoleStateLibraryNotImplemented : - statusText = getString("navmesh_status_library_not_implemented"); - styleParams.color = warningColor; + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); + viewerStyleParams.color = warningColor; break; case kConsoleStateRegionNotEnabled : - statusText = getString("navmesh_status_region_not_enabled"); - styleParams.color = warningColor; + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); + viewerStyleParams.color = warningColor; break; case kConsoleStateCheckingVersion : - statusText = getString("navmesh_status_checking_version"); + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_checking_version"); break; case kConsoleStateDownloading : + simulatorStatusText = getSimulatorStatusText(); if (mIsNavMeshUpdating) { - statusText = getString("navmesh_status_updating"); + viewerStatusText = getString("navmesh_viewer_status_updating"); } else { - statusText = getString("navmesh_status_downloading"); + viewerStatusText = getString("navmesh_viewer_status_downloading"); } break; case kConsoleStateHasNavMesh : - statusText = getString("navmesh_status_has_navmesh"); + simulatorStatusText = getSimulatorStatusText(); + viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); break; case kConsoleStateError : - statusText = getString("navmesh_status_error"); - styleParams.color = warningColor; + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_error"); + viewerStyleParams.color = warningColor; break; default : - statusText = getString("navmesh_status_unknown"); + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); llassert(0); break; } - mPathfindingStatus->setText((LLStringExplicit)statusText, styleParams); + mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); + mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); } + +std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +{ + std::string simulatorStatusText(""); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) + { + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } + } + else + { + simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + return simulatorStatusText; +} void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) { @@ -894,5 +974,5 @@ void LLFloaterPathfindingConsole::regionCrossingOccured() LLStyle::Params styleParams; styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); statusText = getString("navmesh_update_needed"); - mPathfindingStatus->setText((LLStringExplicit)statusText, styleParams); + mPathfindingViewerStatus->setText((LLStringExplicit)statusText, styleParams); } \ No newline at end of file -- cgit v1.2.3 From cc69e6df38cdaaa347dc28b0640420a704ed9783 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 15 Mar 2012 13:24:50 -0700 Subject: BUILDFIX: Correcting line spacing at end-of-file. --- indra/newview/llfloaterpathfindingconsole.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 65a558b778..ae08a166a1 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -789,9 +789,9 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); } - -std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const -{ + +std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +{ std::string simulatorStatusText(""); #ifdef DEPRECATED_UNVERSIONED_NAVMESH @@ -854,7 +854,7 @@ std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const #endif // DEPRECATED_UNVERSIONED_NAVMESH return simulatorStatusText; -} +} void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) { @@ -975,4 +975,4 @@ void LLFloaterPathfindingConsole::regionCrossingOccured() styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); statusText = getString("navmesh_update_needed"); mPathfindingViewerStatus->setText((LLStringExplicit)statusText, styleParams); -} \ No newline at end of file +} -- cgit v1.2.3 From 154e569923d0caf99fb0d24af8475731f5ceaf33 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 21 Mar 2012 09:53:32 -0400 Subject: Path-282: Added support for viewing the walkability map for various character types --- indra/newview/llfloaterpathfindingconsole.cpp | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index ae08a166a1..f830dc1fac 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -368,6 +368,35 @@ LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::get return renderHeatmapType; } +int LLFloaterPathfindingConsole::getHeatMapType() const +{ + //converts the pathfinding console values to the navmesh filter values + + int renderHeatmapType = 4; //none + + switch ( mShowNavMeshWalkabilityComboBox->getValue().asInteger() ) + { + case XUI_RENDER_HEATMAP_A : + renderHeatmapType = 0; + break; + case XUI_RENDER_HEATMAP_B : + renderHeatmapType = 1; + break; + case XUI_RENDER_HEATMAP_C : + renderHeatmapType = 2; + break; + case XUI_RENDER_HEATMAP_D : + renderHeatmapType = 3; + break; + default : + renderHeatmapType = 4; + break; + } + + return renderHeatmapType; +} + + void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) { LLSD comboBoxValue; -- cgit v1.2.3 From 083c81f53f79f53aafdb380a178be081ae461018 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 27 Mar 2012 13:38:51 -0700 Subject: PATH-433: Pumping the character type selection from the console floater into the generatePath call of the pathing library. --- indra/newview/llfloaterpathfindingconsole.cpp | 79 ++++++++++++++------------- 1 file changed, 41 insertions(+), 38 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f830dc1fac..c83153a15d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -35,7 +35,7 @@ #include "llagent.h" #include "llpanel.h" #include "llbutton.h" -#include "llradiogroup.h" +#include "llcheckboxctrl.h" #include "llsliderctrl.h" #include "lllineeditor.h" #include "lltextbase.h" @@ -57,6 +57,7 @@ #define XUI_RENDER_HEATMAP_C 3 #define XUI_RENDER_HEATMAP_D 4 +#define XUI_CHARACTER_TYPE_NONE 0 #define XUI_CHARACTER_TYPE_A 1 #define XUI_CHARACTER_TYPE_B 2 #define XUI_CHARACTER_TYPE_C 3 @@ -139,9 +140,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mCharacterWidthSlider != NULL); mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); - mCharacterTypeRadioGroup = findChild("character_type"); - llassert(mCharacterTypeRadioGroup != NULL); - mCharacterTypeRadioGroup->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + mCharacterTypeComboBox = findChild("path_character_type"); + llassert(mCharacterTypeComboBox != NULL); + mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); mPathTestingStatus = findChild("path_test_status"); llassert(mPathTestingStatus != NULL); @@ -441,8 +442,11 @@ LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getChar { ECharacterType characterType; - switch (mCharacterTypeRadioGroup->getValue().asInteger()) + switch (mCharacterTypeComboBox->getValue().asInteger()) { + case XUI_CHARACTER_TYPE_NONE : + characterType = kCharacterTypeNone; + break; case XUI_CHARACTER_TYPE_A : characterType = kCharacterTypeA; break; @@ -456,7 +460,7 @@ LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getChar characterType = kCharacterTypeD; break; default : - characterType = kCharacterTypeA; + characterType = kCharacterTypeNone; llassert(0); break; } @@ -470,6 +474,9 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType switch (pCharacterType) { + case kCharacterTypeNone : + radioGroupValue = XUI_CHARACTER_TYPE_NONE; + break; case kCharacterTypeA : radioGroupValue = XUI_CHARACTER_TYPE_A; break; @@ -483,12 +490,12 @@ void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType radioGroupValue = XUI_CHARACTER_TYPE_D; break; default : - radioGroupValue = XUI_CHARACTER_TYPE_A; + radioGroupValue = XUI_CHARACTER_TYPE_NONE; llassert(0); break; } - mCharacterTypeRadioGroup->setValue(radioGroupValue); + mCharacterTypeComboBox->setValue(radioGroupValue); } LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) @@ -514,7 +521,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mFreezeLabel(NULL), mFreezeButton(NULL), mCharacterWidthSlider(NULL), - mCharacterTypeRadioGroup(NULL), + mCharacterTypeComboBox(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), mNavMeshZoneSlot(), @@ -593,32 +600,7 @@ void LLFloaterPathfindingConsole::onCharacterWidthSet() void LLFloaterPathfindingConsole::onCharacterTypeSwitch() { - switch (getCharacterType()) - { - case kCharacterTypeA : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeA" - << llendl; - break; - case kCharacterTypeB : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeB" - << llendl; - break; - case kCharacterTypeC : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeC" - << llendl; - break; - case kCharacterTypeD : - llwarns << "functionality has not yet been implemented to toggle '" - << mCharacterTypeRadioGroup->getName() << "' to CharacterTypeD" - << llendl; - break; - default : - llassert(0); - break; - } + generatePath(); updatePathTestStatus(); } @@ -715,7 +697,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeRadioGroup->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); mHasStartPoint = false; mHasEndPoint = false; @@ -734,7 +716,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeRadioGroup->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); mHasStartPoint = false; mHasEndPoint = false; @@ -750,7 +732,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); mCharacterWidthSlider->setEnabled(TRUE); - mCharacterTypeRadioGroup->setEnabled(TRUE); + mCharacterTypeComboBox->setEnabled(TRUE); mClearPathButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); break; @@ -928,6 +910,27 @@ void LLFloaterPathfindingConsole::generatePath() if (mHasStartPoint && mHasEndPoint) { mPathData.mCharacterWidth = getCharacterWidth(); + switch (getCharacterType()) + { + case kCharacterTypeNone : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + case kCharacterTypeA : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_D; + break; + default : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + } LLPathingLib::getInstance()->generatePath(mPathData); } } -- cgit v1.2.3 From 901ed57e6bc1fae1c3c0a6f6790c0361298c5744 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 28 Mar 2012 13:11:45 -0400 Subject: Added support for customizing the colors used in the navmesh visualizer. --- indra/newview/llfloaterpathfindingconsole.cpp | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c83153a15d..0af16052d0 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -170,6 +170,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } else { + fillInColorsForNavMeshVisualization(); if (!mNavMeshZoneSlot.connected()) { mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); @@ -1008,3 +1009,53 @@ void LLFloaterPathfindingConsole::regionCrossingOccured() statusText = getString("navmesh_update_needed"); mPathfindingViewerStatus->setText((LLStringExplicit)statusText, styleParams); } + +void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() +{ + LLPathingLib::NavMeshColors colors; + + LLVector3 in = gSavedSettings.getVector3("WalkableRGB"); + F32 a = gSavedSettings.getF32("WalkableA"); + colors.mWalkable= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("ObstacleRGB"); + a = gSavedSettings.getF32("ObstacleA"); + colors.mObstacle= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("MaterialRGB"); + a = gSavedSettings.getF32("MaterialA"); + colors.mMaterial= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("ExclusionRGB"); + a = gSavedSettings.getF32("ExclusionA"); + colors.mExclusion= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("ConnectedEdgeRGB"); + a = gSavedSettings.getF32("ConnectedEdgeA"); + colors.mConnectedEdge= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("BoundaryEdgeRGB"); + a = gSavedSettings.getF32("BoundaryEdgeA"); + colors.mBoundaryEdge= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("HeatColorBase"); + a = gSavedSettings.getF32("HeatColorBaseA"); + colors.mHeatColorBase= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("HeatColorMax"); + a = gSavedSettings.getF32("HeatColorMaxA"); + colors.mHeatColorMax= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("FaceColorRGB"); + a = gSavedSettings.getF32("FaceColorA"); + colors.mFaceColor= LLColor4U( in[0],in[1],in[2],a ); + + in = gSavedSettings.getVector3("NavMeshClearRGB"); + colors.mNavMeshClear= LLColor4U( in[0],in[1],in[2],0 ); + + mNavMeshColors = colors; + + LLPathingLib::getInstance()->setNavMeshColors( colors ); +} + + -- cgit v1.2.3 From acaa680940b6c6e6df4844be3f4c1646dc88491f Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 28 Mar 2012 13:54:06 -0400 Subject: Linux build fix - cast incoming color values to U8's. --- indra/newview/llfloaterpathfindingconsole.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 0af16052d0..40e4ab67e2 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1012,46 +1012,47 @@ void LLFloaterPathfindingConsole::regionCrossingOccured() void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() { + LLPathingLib::NavMeshColors colors; LLVector3 in = gSavedSettings.getVector3("WalkableRGB"); F32 a = gSavedSettings.getF32("WalkableA"); - colors.mWalkable= LLColor4U( in[0],in[1],in[2],a ); + colors.mWalkable= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("ObstacleRGB"); a = gSavedSettings.getF32("ObstacleA"); - colors.mObstacle= LLColor4U( in[0],in[1],in[2],a ); + colors.mObstacle= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("MaterialRGB"); a = gSavedSettings.getF32("MaterialA"); - colors.mMaterial= LLColor4U( in[0],in[1],in[2],a ); + colors.mMaterial= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("ExclusionRGB"); a = gSavedSettings.getF32("ExclusionA"); - colors.mExclusion= LLColor4U( in[0],in[1],in[2],a ); + colors.mExclusion= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("ConnectedEdgeRGB"); a = gSavedSettings.getF32("ConnectedEdgeA"); - colors.mConnectedEdge= LLColor4U( in[0],in[1],in[2],a ); + colors.mConnectedEdge= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("BoundaryEdgeRGB"); a = gSavedSettings.getF32("BoundaryEdgeA"); - colors.mBoundaryEdge= LLColor4U( in[0],in[1],in[2],a ); + colors.mBoundaryEdge= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("HeatColorBase"); a = gSavedSettings.getF32("HeatColorBaseA"); - colors.mHeatColorBase= LLColor4U( in[0],in[1],in[2],a ); + colors.mHeatColorBase= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("HeatColorMax"); a = gSavedSettings.getF32("HeatColorMaxA"); - colors.mHeatColorMax= LLColor4U( in[0],in[1],in[2],a ); + colors.mHeatColorMax= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("FaceColorRGB"); a = gSavedSettings.getF32("FaceColorA"); - colors.mFaceColor= LLColor4U( in[0],in[1],in[2],a ); + colors.mFaceColor= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("NavMeshClearRGB"); - colors.mNavMeshClear= LLColor4U( in[0],in[1],in[2],0 ); + colors.mNavMeshClear= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2], 0 ); mNavMeshColors = colors; -- cgit v1.2.3 From f9a0f79838d2431894bd6cc1e244f743e8581ccb Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 28 Mar 2012 18:26:00 -0700 Subject: Updating the navmesh colors based on discussions with Leo. --- indra/newview/llfloaterpathfindingconsole.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 40e4ab67e2..fd50b4370e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1041,18 +1041,18 @@ void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() in = gSavedSettings.getVector3("HeatColorBase"); a = gSavedSettings.getF32("HeatColorBaseA"); - colors.mHeatColorBase= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); + colors.mHeatColorBase= LLVector4(in, a); in = gSavedSettings.getVector3("HeatColorMax"); a = gSavedSettings.getF32("HeatColorMaxA"); - colors.mHeatColorMax= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); + colors.mHeatColorMax= LLVector4( in, a ); in = gSavedSettings.getVector3("FaceColorRGB"); a = gSavedSettings.getF32("FaceColorA"); colors.mFaceColor= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); in = gSavedSettings.getVector3("NavMeshClearRGB"); - colors.mNavMeshClear= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2], 0 ); + colors.mNavMeshClear= LLColor4(in[0], in[1], in[2], 0); mNavMeshColors = colors; -- cgit v1.2.3 From 0e7311caa73e598e8a2df626c67a74bdff23446e Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 29 Mar 2012 11:20:32 -0400 Subject: Exposed star(valid/invalid) and test path colors. Refactored path drawing code to use ll f()'s --- indra/newview/llfloaterpathfindingconsole.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fd50b4370e..1f73f10b9b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1051,6 +1051,18 @@ void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() a = gSavedSettings.getF32("FaceColorA"); colors.mFaceColor= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); + in = gSavedSettings.getVector3("StarValidColorRGB"); + a = gSavedSettings.getF32("StarValidColorA"); + colors.mStarValid= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); + + in = gSavedSettings.getVector3("StarInvalidRGB"); + a = gSavedSettings.getF32("StarInvalidA"); + colors.mStarInvalid= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); + + in = gSavedSettings.getVector3("TestPathColorRGB"); + a = gSavedSettings.getF32("TestPathColorA"); + colors.mTestPath= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); + in = gSavedSettings.getVector3("NavMeshClearRGB"); colors.mNavMeshClear= LLColor4(in[0], in[1], in[2], 0); -- cgit v1.2.3 From 6e184e33018a5395bfbb2c92812229d115944ab5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 2 Apr 2012 17:55:04 -0500 Subject: Cleaner render of walkables and materials. Convert Vector3 color parameters to Color4. --- indra/newview/llfloaterpathfindingconsole.cpp | 2136 ++++++++++++------------- 1 file changed, 1062 insertions(+), 1074 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 1f73f10b9b..a274251fb8 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,1074 +1,1062 @@ -/** -* @file llfloaterpathfindingconsole.cpp -* @author William Todd Stinson -* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. -* -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" -#include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" -#include "llfloaterpathfindingcharacters.h" - -#include "llsd.h" -#include "llhandle.h" -#include "llagent.h" -#include "llpanel.h" -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llsliderctrl.h" -#include "lllineeditor.h" -#include "lltextbase.h" -#include "lltabcontainer.h" -#include "llcombobox.h" -#include "llfloaterreg.h" -#include "llviewerregion.h" -#include "llviewerwindow.h" -#include "llviewercamera.h" -#include "llviewercontrol.h" -#include "llpathfindingnavmeshzone.h" -#include "llpathfindingmanager.h" - -#include "LLPathingLib.h" - -#define XUI_RENDER_HEATMAP_NONE 0 -#define XUI_RENDER_HEATMAP_A 1 -#define XUI_RENDER_HEATMAP_B 2 -#define XUI_RENDER_HEATMAP_C 3 -#define XUI_RENDER_HEATMAP_D 4 - -#define XUI_CHARACTER_TYPE_NONE 0 -#define XUI_CHARACTER_TYPE_A 1 -#define XUI_CHARACTER_TYPE_B 2 -#define XUI_CHARACTER_TYPE_C 3 -#define XUI_CHARACTER_TYPE_D 4 - -#define XUI_TEST_TAB_INDEX 1 - -LLHandle LLFloaterPathfindingConsole::sInstanceHandle; - -//--------------------------------------------------------------------------- -// LLFloaterPathfindingConsole -//--------------------------------------------------------------------------- - -BOOL LLFloaterPathfindingConsole::postBuild() -{ - mShowNavMeshCheckBox = findChild("show_navmesh"); - llassert(mShowNavMeshCheckBox != NULL); - - mShowNavMeshWalkabilityComboBox = findChild("show_heatmap_mode"); - llassert(mShowNavMeshWalkabilityComboBox != NULL); - mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this)); - - mShowWalkablesCheckBox = findChild("show_walkables"); - llassert(mShowWalkablesCheckBox != NULL); - - mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); - llassert(mShowStaticObstaclesCheckBox != NULL); - - mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); - llassert(mShowMaterialVolumesCheckBox != NULL); - - mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); - llassert(mShowExclusionVolumesCheckBox != NULL); - - mShowWorldCheckBox = findChild("show_world"); - llassert(mShowWorldCheckBox != NULL); - mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); - - mViewCharactersButton = findChild("view_characters_floater"); - llassert(mViewCharactersButton != NULL); - mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); - - mEditTestTabContainer = findChild("edit_test_tab_container"); - llassert(mEditTestTabContainer != NULL); - - mEditTab = findChild("edit_panel"); - llassert(mEditTab != NULL); - - mTestTab = findChild("test_panel"); - llassert(mTestTab != 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)); - - mPathfindingViewerStatus = findChild("pathfinding_viewer_status"); - llassert(mPathfindingViewerStatus != NULL); - - mPathfindingSimulatorStatus = findChild("pathfinding_simulator_status"); - llassert(mPathfindingSimulatorStatus != NULL); - - mCharacterWidthSlider = findChild("character_width"); - llassert(mCharacterWidthSlider != NULL); - mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); - - mCharacterTypeComboBox = findChild("path_character_type"); - llassert(mCharacterTypeComboBox != NULL); - mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); - - mPathTestingStatus = findChild("path_test_status"); - llassert(mPathTestingStatus != NULL); - - mClearPathButton = findChild("clear_path"); - llassert(mClearPathButton != NULL); - mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); - - return LLFloater::postBuild(); -} - -void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) -{ - LLFloater::onOpen(pKey); - setHeartBeat( true ); - //make sure we have a pathing system - if ( !LLPathingLib::getInstance() ) - { - LLPathingLib::initSystem(); - } - if ( LLPathingLib::getInstance() == NULL ) - { - setConsoleState(kConsoleStateLibraryNotImplemented); - llwarns <<"Errror: cannot find pathing library implementation."<registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); - } - - setAgentState(LLPathfindingManager::getInstance()->getAgentState()); - updatePathTestStatus(); -} - -void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) -{ - if (mAgentStateSlot.connected()) - { - mAgentStateSlot.disconnect(); - } - - if (mNavMeshZoneSlot.connected()) - { - mNavMeshZoneSlot.disconnect(); - } - - if (LLPathingLib::getInstance() != NULL) - { - mNavMeshZone.disable(); - } - - LLFloater::onClose(pIsAppQuitting); - setHeartBeat( false ); - setConsoleState(kConsoleStateUnknown); - //Reset all the checkboxes to default - mShowNavMeshCheckBox->set( false ); - mShowWalkablesCheckBox->set( false ); - mShowMaterialVolumesCheckBox->set( false ); - mShowStaticObstaclesCheckBox->set( false ); - mShowExclusionVolumesCheckBox->set( false ); - mShowWorldCheckBox->set( false ); -} - -BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) -{ - if (isGeneratePathMode(mask, clicktype, down)) - { - LLVector3 dv = gViewerWindow->mouseDirectionGlobal(x, y); - LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); - LLVector3 rayStart = mousePos; - LLVector3 rayEnd = mousePos + dv * 150; - - if (mask & MASK_CONTROL) - { - mPathData.mStartPointA = rayStart; - mPathData.mEndPointA = rayEnd; - mHasStartPoint = true; - } - else if (mask & MASK_SHIFT) - { - mPathData.mStartPointB = rayStart; - mPathData.mEndPointB = rayEnd; - mHasEndPoint = true; - } - generatePath(); - updatePathTestStatus(); - - return TRUE; - } - else - { - return LLFloater::handleAnyMouseClick(x, y, mask, clicktype, down); - } -} - -BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const -{ - return (isShown() && (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) && - (clicktype == LLMouseHandler::CLICK_LEFT) && down && - (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || - ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))); -} - -LLHandle LLFloaterPathfindingConsole::getInstanceHandle() -{ - if (sInstanceHandle.isDead()) - { - LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::getTypedInstance("pathfinding_console"); - if (floaterInstance != NULL) - { - sInstanceHandle = floaterInstance->mSelfHandle; - } - } - - return sInstanceHandle; -} - -BOOL LLFloaterPathfindingConsole::isRenderPath() const -{ - return (mHasStartPoint && mHasEndPoint); -} - -BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const -{ - return mShowNavMeshCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) -{ - mShowNavMeshCheckBox->set(pIsRenderNavMesh); -} - -BOOL LLFloaterPathfindingConsole::isRenderWalkables() const -{ - return mShowWalkablesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) -{ - mShowWalkablesCheckBox->set(pIsRenderWalkables); -} - -BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const -{ - return mShowStaticObstaclesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) -{ - mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); -} - -BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const -{ - return mShowMaterialVolumesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) -{ - mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); -} - -BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const -{ - return mShowExclusionVolumesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) -{ - mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); -} - -BOOL LLFloaterPathfindingConsole::isRenderWorld() const -{ - return mShowWorldCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) -{ - mShowWorldCheckBox->set(pIsRenderWorld); -} - -LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const -{ - ERenderHeatmapType renderHeatmapType; - - switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) - { - case XUI_RENDER_HEATMAP_NONE : - renderHeatmapType = kRenderHeatmapNone; - break; - case XUI_RENDER_HEATMAP_A : - renderHeatmapType = kRenderHeatmapA; - break; - case XUI_RENDER_HEATMAP_B : - renderHeatmapType = kRenderHeatmapB; - break; - case XUI_RENDER_HEATMAP_C : - renderHeatmapType = kRenderHeatmapC; - break; - case XUI_RENDER_HEATMAP_D : - renderHeatmapType = kRenderHeatmapD; - break; - default : - renderHeatmapType = kRenderHeatmapNone; - llassert(0); - break; - } - - return renderHeatmapType; -} - -int LLFloaterPathfindingConsole::getHeatMapType() const -{ - //converts the pathfinding console values to the navmesh filter values - - int renderHeatmapType = 4; //none - - switch ( mShowNavMeshWalkabilityComboBox->getValue().asInteger() ) - { - case XUI_RENDER_HEATMAP_A : - renderHeatmapType = 0; - break; - case XUI_RENDER_HEATMAP_B : - renderHeatmapType = 1; - break; - case XUI_RENDER_HEATMAP_C : - renderHeatmapType = 2; - break; - case XUI_RENDER_HEATMAP_D : - renderHeatmapType = 3; - break; - default : - renderHeatmapType = 4; - break; - } - - return renderHeatmapType; -} - - -void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) -{ - LLSD comboBoxValue; - - switch (pRenderHeatmapType) - { - case kRenderHeatmapNone : - comboBoxValue = XUI_RENDER_HEATMAP_NONE; - break; - case kRenderHeatmapA : - comboBoxValue = XUI_RENDER_HEATMAP_A; - break; - case kRenderHeatmapB : - comboBoxValue = XUI_RENDER_HEATMAP_B; - break; - case kRenderHeatmapC : - comboBoxValue = XUI_RENDER_HEATMAP_C; - break; - case kRenderHeatmapD : - comboBoxValue = XUI_RENDER_HEATMAP_D; - break; - default : - comboBoxValue = XUI_RENDER_HEATMAP_NONE; - llassert(0); - break; - } - - return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); -} - -F32 LLFloaterPathfindingConsole::getCharacterWidth() const -{ - return mCharacterWidthSlider->getValueF32(); -} - -void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) -{ - mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); -} - -LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const -{ - ECharacterType characterType; - - switch (mCharacterTypeComboBox->getValue().asInteger()) - { - case XUI_CHARACTER_TYPE_NONE : - characterType = kCharacterTypeNone; - break; - case XUI_CHARACTER_TYPE_A : - characterType = kCharacterTypeA; - break; - case XUI_CHARACTER_TYPE_B : - characterType = kCharacterTypeB; - break; - case XUI_CHARACTER_TYPE_C : - characterType = kCharacterTypeC; - break; - case XUI_CHARACTER_TYPE_D : - characterType = kCharacterTypeD; - break; - default : - characterType = kCharacterTypeNone; - llassert(0); - break; - } - - return characterType; -} - -void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) -{ - LLSD radioGroupValue; - - switch (pCharacterType) - { - case kCharacterTypeNone : - radioGroupValue = XUI_CHARACTER_TYPE_NONE; - break; - case kCharacterTypeA : - radioGroupValue = XUI_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - radioGroupValue = XUI_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - radioGroupValue = XUI_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - radioGroupValue = XUI_CHARACTER_TYPE_D; - break; - default : - radioGroupValue = XUI_CHARACTER_TYPE_NONE; - llassert(0); - break; - } - - mCharacterTypeComboBox->setValue(radioGroupValue); -} - -LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) - : LLFloater(pSeed), - mSelfHandle(), - mShowNavMeshCheckBox(NULL), - mShowNavMeshWalkabilityComboBox(NULL), - mShowWalkablesCheckBox(NULL), - mShowStaticObstaclesCheckBox(NULL), - mShowMaterialVolumesCheckBox(NULL), - mShowExclusionVolumesCheckBox(NULL), - mShowWorldCheckBox(NULL), - mPathfindingViewerStatus(NULL), - mPathfindingSimulatorStatus(NULL), - mViewCharactersButton(NULL), - mEditTestTabContainer(NULL), - mEditTab(NULL), - mTestTab(NULL), - mUnfreezeLabel(NULL), - mUnfreezeButton(NULL), - mLinksetsLabel(NULL), - mLinksetsButton(NULL), - mFreezeLabel(NULL), - mFreezeButton(NULL), - mCharacterWidthSlider(NULL), - mCharacterTypeComboBox(NULL), - mPathTestingStatus(NULL), - mClearPathButton(NULL), - mNavMeshZoneSlot(), - mNavMeshZone(), - mIsNavMeshUpdating(false), - mAgentStateSlot(), - mConsoleState(kConsoleStateUnknown), - mPathData(), - mHasStartPoint(false), - mHasEndPoint(false), - mHeartBeat( false ) -{ - mSelfHandle.bind(this); -} - -LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() -{ -} - -void LLFloaterPathfindingConsole::onShowWalkabilitySet() -{ - switch (getRenderHeatmapType()) - { - case kRenderHeatmapNone : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapNone" - << llendl; - break; - case kRenderHeatmapA : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapA" - << llendl; - break; - case kRenderHeatmapB : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapB" - << llendl; - break; - case kRenderHeatmapC : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapC" - << llendl; - break; - case kRenderHeatmapD : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapD" - << llendl; - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::onShowWorldToggle() -{ - BOOL checkBoxValue = mShowWorldCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderWorld(checkBoxValue); - } - else - { - mShowWorldCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - -void LLFloaterPathfindingConsole::onCharacterWidthSet() -{ - generatePath(); - updatePathTestStatus(); -} - -void LLFloaterPathfindingConsole::onCharacterTypeSwitch() -{ - generatePath(); - updatePathTestStatus(); -} - -void LLFloaterPathfindingConsole::onViewCharactersClicked() -{ - LLFloaterPathfindingCharacters::openCharactersViewer(); -} - -void LLFloaterPathfindingConsole::onUnfreezeClicked() -{ - mUnfreezeButton->setEnabled(FALSE); - LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); -} - -void LLFloaterPathfindingConsole::onFreezeClicked() -{ - mFreezeButton->setEnabled(FALSE); - LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); -} - -void LLFloaterPathfindingConsole::onViewEditLinksetClicked() -{ - LLFloaterPathfindingLinksets::openLinksetsEditor(); -} - -void LLFloaterPathfindingConsole::onClearPathClicked() -{ - mHasStartPoint = false; - mHasEndPoint = false; - updatePathTestStatus(); -} - -void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) -{ - switch (pNavMeshZoneRequestStatus) - { - case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : - setConsoleState(kConsoleStateUnknown); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : - setConsoleState(kConsoleStateCheckingVersion); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : - mIsNavMeshUpdating = true; - mNavMeshZone.refresh(); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : - setConsoleState(kConsoleStateDownloading); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted : - mIsNavMeshUpdating = false; - setConsoleState(kConsoleStateHasNavMesh); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled : - setConsoleState(kConsoleStateRegionNotEnabled); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestError : - setConsoleState(kConsoleStateError); - break; - default: - setConsoleState(kConsoleStateUnknown); - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) -{ - setAgentState(pAgentState); -} - -void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) -{ - mConsoleState = pConsoleState; - updateControlsOnConsoleState(); - updateStatusOnConsoleState(); -} - -void LLFloaterPathfindingConsole::updateControlsOnConsoleState() -{ - switch (mConsoleState) - { - case kConsoleStateUnknown : - case kConsoleStateLibraryNotImplemented : - case kConsoleStateRegionNotEnabled : - 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->selectTab(0); - mTestTab->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); - mHasStartPoint = false; - mHasEndPoint = false; - break; - case kConsoleStateCheckingVersion : - case kConsoleStateDownloading : - case kConsoleStateError : - mShowNavMeshCheckBox->setEnabled(FALSE); - mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); - mShowWalkablesCheckBox->setEnabled(FALSE); - mShowStaticObstaclesCheckBox->setEnabled(FALSE); - mShowMaterialVolumesCheckBox->setEnabled(FALSE); - mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); - mViewCharactersButton->setEnabled(TRUE); - mEditTestTabContainer->selectTab(0); - mTestTab->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); - mHasStartPoint = false; - mHasEndPoint = false; - break; - case kConsoleStateHasNavMesh : - mShowNavMeshCheckBox->setEnabled(TRUE); - mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); - mShowWalkablesCheckBox->setEnabled(TRUE); - mShowStaticObstaclesCheckBox->setEnabled(TRUE); - mShowMaterialVolumesCheckBox->setEnabled(TRUE); - mShowExclusionVolumesCheckBox->setEnabled(TRUE); - mShowWorldCheckBox->setEnabled(TRUE); - mViewCharactersButton->setEnabled(TRUE); - mTestTab->setEnabled(TRUE); - mCharacterWidthSlider->setEnabled(TRUE); - mCharacterTypeComboBox->setEnabled(TRUE); - mClearPathButton->setEnabled(TRUE); - mTestTab->setEnabled(TRUE); - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::updateStatusOnConsoleState() -{ - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); - - std::string simulatorStatusText(""); - std::string viewerStatusText(""); - LLStyle::Params viewerStyleParams; - - switch (mConsoleState) - { - case kConsoleStateUnknown : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_unknown"); - break; - case kConsoleStateLibraryNotImplemented : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); - viewerStyleParams.color = warningColor; - break; - case kConsoleStateRegionNotEnabled : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); - viewerStyleParams.color = warningColor; - break; - case kConsoleStateCheckingVersion : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_checking_version"); - break; - case kConsoleStateDownloading : - simulatorStatusText = getSimulatorStatusText(); - if (mIsNavMeshUpdating) - { - viewerStatusText = getString("navmesh_viewer_status_updating"); - } - else - { - viewerStatusText = getString("navmesh_viewer_status_downloading"); - } - break; - case kConsoleStateHasNavMesh : - simulatorStatusText = getSimulatorStatusText(); - viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); - break; - case kConsoleStateError : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_error"); - viewerStyleParams.color = warningColor; - break; - default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_unknown"); - llassert(0); - break; - } - - mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); - mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); -} - -std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const -{ - std::string simulatorStatusText(""); - -#ifdef DEPRECATED_UNVERSIONED_NAVMESH - if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) - { - switch (mNavMeshZone.getNavMeshZoneStatus()) - { - case LLPathfindingNavMeshZone::kNavMeshZonePending : - simulatorStatusText = getString("navmesh_simulator_status_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : - simulatorStatusText = getString("navmesh_simulator_status_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : - simulatorStatusText = getString("navmesh_simulator_status_some_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : - simulatorStatusText = getString("navmesh_simulator_status_some_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : - simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneComplete : - simulatorStatusText = getString("navmesh_simulator_status_complete"); - break; - default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - break; - } - } - else - { - simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); - } -#else // DEPRECATED_UNVERSIONED_NAVMESH - switch (mNavMeshZone.getNavMeshZoneStatus()) - { - case LLPathfindingNavMeshZone::kNavMeshZonePending : - simulatorStatusText = getString("navmesh_simulator_status_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : - simulatorStatusText = getString("navmesh_simulator_status_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : - simulatorStatusText = getString("navmesh_simulator_status_some_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : - simulatorStatusText = getString("navmesh_simulator_status_some_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : - simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneComplete : - simulatorStatusText = getString("navmesh_simulator_status_complete"); - break; - default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - break; - } -#endif // DEPRECATED_UNVERSIONED_NAVMESH - - return simulatorStatusText; -} - -void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) -{ - switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) - { - case LLPathfindingManager::kAgentStateUnknown : - case LLPathfindingManager::kAgentStateNotEnabled : - mEditTab->setEnabled(FALSE); - mUnfreezeLabel->setEnabled(FALSE); - mUnfreezeButton->setEnabled(FALSE); - mLinksetsLabel->setEnabled(FALSE); - mLinksetsButton->setEnabled(FALSE); - mFreezeLabel->setEnabled(FALSE); - mFreezeButton->setEnabled(FALSE); - break; - case LLPathfindingManager::kAgentStateFrozen : - mEditTab->setEnabled(TRUE); - mUnfreezeLabel->setEnabled(TRUE); - mUnfreezeButton->setEnabled(TRUE); - mLinksetsLabel->setEnabled(FALSE); - mLinksetsButton->setEnabled(FALSE); - mFreezeLabel->setEnabled(FALSE); - mFreezeButton->setEnabled(FALSE); - break; - case LLPathfindingManager::kAgentStateUnfrozen : - mEditTab->setEnabled(TRUE); - mUnfreezeLabel->setEnabled(FALSE); - mUnfreezeButton->setEnabled(FALSE); - mLinksetsLabel->setEnabled(TRUE); - mLinksetsButton->setEnabled(TRUE); - mFreezeLabel->setEnabled(TRUE); - mFreezeButton->setEnabled(TRUE); - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::generatePath() -{ - if (mHasStartPoint && mHasEndPoint) - { - mPathData.mCharacterWidth = getCharacterWidth(); - switch (getCharacterType()) - { - case kCharacterTypeNone : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - break; - case kCharacterTypeA : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_D; - break; - default : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - break; - } - LLPathingLib::getInstance()->generatePath(mPathData); - } -} - -void LLFloaterPathfindingConsole::updatePathTestStatus() -{ - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); - - std::string statusText(""); - LLStyle::Params styleParams; - - if (!mHasStartPoint && !mHasEndPoint) - { - statusText = getString("pathing_choose_start_and_end_points"); - styleParams.color = warningColor; - } - else if (!mHasStartPoint && mHasEndPoint) - { - statusText = getString("pathing_choose_start_point"); - styleParams.color = warningColor; - } - else if (mHasStartPoint && !mHasEndPoint) - { - statusText = getString("pathing_choose_end_point"); - styleParams.color = warningColor; - } - else - { - statusText = getString("pathing_path_valid"); - } - - mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); -} - - -BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const -{ - if ( isRenderWalkables() || isRenderStaticObstacles() || - isRenderMaterialVolumes() || isRenderExclusionVolumes() ) - { - return true; - } - - return false; -} - -U32 LLFloaterPathfindingConsole::getRenderShapeFlags() -{ - resetShapeRenderFlags(); - - if ( isRenderWalkables() ) - { - setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects ); - } - if ( isRenderStaticObstacles() ) - { - setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects ); - } - if ( isRenderMaterialVolumes() ) - { - setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms ); - } - if ( isRenderExclusionVolumes() ) - { - setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms ); - } - return mShapeRenderFlags; -} - -void LLFloaterPathfindingConsole::regionCrossingOccured() -{ - std::string statusText(""); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - statusText = getString("navmesh_update_needed"); - mPathfindingViewerStatus->setText((LLStringExplicit)statusText, styleParams); -} - -void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() -{ - - LLPathingLib::NavMeshColors colors; - - LLVector3 in = gSavedSettings.getVector3("WalkableRGB"); - F32 a = gSavedSettings.getF32("WalkableA"); - colors.mWalkable= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("ObstacleRGB"); - a = gSavedSettings.getF32("ObstacleA"); - colors.mObstacle= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("MaterialRGB"); - a = gSavedSettings.getF32("MaterialA"); - colors.mMaterial= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("ExclusionRGB"); - a = gSavedSettings.getF32("ExclusionA"); - colors.mExclusion= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("ConnectedEdgeRGB"); - a = gSavedSettings.getF32("ConnectedEdgeA"); - colors.mConnectedEdge= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("BoundaryEdgeRGB"); - a = gSavedSettings.getF32("BoundaryEdgeA"); - colors.mBoundaryEdge= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("HeatColorBase"); - a = gSavedSettings.getF32("HeatColorBaseA"); - colors.mHeatColorBase= LLVector4(in, a); - - in = gSavedSettings.getVector3("HeatColorMax"); - a = gSavedSettings.getF32("HeatColorMaxA"); - colors.mHeatColorMax= LLVector4( in, a ); - - in = gSavedSettings.getVector3("FaceColorRGB"); - a = gSavedSettings.getF32("FaceColorA"); - colors.mFaceColor= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("StarValidColorRGB"); - a = gSavedSettings.getF32("StarValidColorA"); - colors.mStarValid= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("StarInvalidRGB"); - a = gSavedSettings.getF32("StarInvalidA"); - colors.mStarInvalid= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("TestPathColorRGB"); - a = gSavedSettings.getF32("TestPathColorA"); - colors.mTestPath= LLColor4U( (U8)in[0],(U8)in[1],(U8)in[2],(U8)a ); - - in = gSavedSettings.getVector3("NavMeshClearRGB"); - colors.mNavMeshClear= LLColor4(in[0], in[1], in[2], 0); - - mNavMeshColors = colors; - - LLPathingLib::getInstance()->setNavMeshColors( colors ); -} - - +/** +* @file llfloaterpathfindingconsole.cpp +* @author William Todd Stinson +* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" +#include "llfloaterpathfindingcharacters.h" + +#include "llsd.h" +#include "llhandle.h" +#include "llagent.h" +#include "llpanel.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llsliderctrl.h" +#include "lllineeditor.h" +#include "lltextbase.h" +#include "lltabcontainer.h" +#include "llcombobox.h" +#include "llfloaterreg.h" +#include "llviewerregion.h" +#include "llviewerwindow.h" +#include "llviewercamera.h" +#include "llviewercontrol.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingmanager.h" + +#include "LLPathingLib.h" + +#define XUI_RENDER_HEATMAP_NONE 0 +#define XUI_RENDER_HEATMAP_A 1 +#define XUI_RENDER_HEATMAP_B 2 +#define XUI_RENDER_HEATMAP_C 3 +#define XUI_RENDER_HEATMAP_D 4 + +#define XUI_CHARACTER_TYPE_NONE 0 +#define XUI_CHARACTER_TYPE_A 1 +#define XUI_CHARACTER_TYPE_B 2 +#define XUI_CHARACTER_TYPE_C 3 +#define XUI_CHARACTER_TYPE_D 4 + +#define XUI_TEST_TAB_INDEX 1 + +LLHandle LLFloaterPathfindingConsole::sInstanceHandle; + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingConsole +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingConsole::postBuild() +{ + mShowNavMeshCheckBox = findChild("show_navmesh"); + llassert(mShowNavMeshCheckBox != NULL); + + mShowNavMeshWalkabilityComboBox = findChild("show_heatmap_mode"); + llassert(mShowNavMeshWalkabilityComboBox != NULL); + mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this)); + + mShowWalkablesCheckBox = findChild("show_walkables"); + llassert(mShowWalkablesCheckBox != NULL); + + mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); + llassert(mShowStaticObstaclesCheckBox != NULL); + + mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); + llassert(mShowMaterialVolumesCheckBox != NULL); + + mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); + llassert(mShowExclusionVolumesCheckBox != NULL); + + mShowWorldCheckBox = findChild("show_world"); + llassert(mShowWorldCheckBox != NULL); + mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); + + mViewCharactersButton = findChild("view_characters_floater"); + llassert(mViewCharactersButton != NULL); + mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); + + mEditTestTabContainer = findChild("edit_test_tab_container"); + llassert(mEditTestTabContainer != NULL); + + mEditTab = findChild("edit_panel"); + llassert(mEditTab != NULL); + + mTestTab = findChild("test_panel"); + llassert(mTestTab != 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)); + + mPathfindingViewerStatus = findChild("pathfinding_viewer_status"); + llassert(mPathfindingViewerStatus != NULL); + + mPathfindingSimulatorStatus = findChild("pathfinding_simulator_status"); + llassert(mPathfindingSimulatorStatus != NULL); + + mCharacterWidthSlider = findChild("character_width"); + llassert(mCharacterWidthSlider != NULL); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + + mCharacterTypeComboBox = findChild("path_character_type"); + llassert(mCharacterTypeComboBox != NULL); + mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + + mPathTestingStatus = findChild("path_test_status"); + llassert(mPathTestingStatus != NULL); + + mClearPathButton = findChild("clear_path"); + llassert(mClearPathButton != NULL); + mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + + return LLFloater::postBuild(); +} + +void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) +{ + LLFloater::onOpen(pKey); + setHeartBeat( true ); + //make sure we have a pathing system + if ( !LLPathingLib::getInstance() ) + { + LLPathingLib::initSystem(); + } + if ( LLPathingLib::getInstance() == NULL ) + { + setConsoleState(kConsoleStateLibraryNotImplemented); + llwarns <<"Errror: cannot find pathing library implementation."<registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); + } + + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); + updatePathTestStatus(); +} + +void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) +{ + if (mAgentStateSlot.connected()) + { + mAgentStateSlot.disconnect(); + } + + if (mNavMeshZoneSlot.connected()) + { + mNavMeshZoneSlot.disconnect(); + } + + if (LLPathingLib::getInstance() != NULL) + { + mNavMeshZone.disable(); + } + + LLFloater::onClose(pIsAppQuitting); + setHeartBeat( false ); + setConsoleState(kConsoleStateUnknown); + //Reset all the checkboxes to default + mShowNavMeshCheckBox->set( false ); + mShowWalkablesCheckBox->set( false ); + mShowMaterialVolumesCheckBox->set( false ); + mShowStaticObstaclesCheckBox->set( false ); + mShowExclusionVolumesCheckBox->set( false ); + mShowWorldCheckBox->set( false ); +} + +BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) +{ + if (isGeneratePathMode(mask, clicktype, down)) + { + LLVector3 dv = gViewerWindow->mouseDirectionGlobal(x, y); + LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 rayStart = mousePos; + LLVector3 rayEnd = mousePos + dv * 150; + + if (mask & MASK_CONTROL) + { + mPathData.mStartPointA = rayStart; + mPathData.mEndPointA = rayEnd; + mHasStartPoint = true; + } + else if (mask & MASK_SHIFT) + { + mPathData.mStartPointB = rayStart; + mPathData.mEndPointB = rayEnd; + mHasEndPoint = true; + } + generatePath(); + updatePathTestStatus(); + + return TRUE; + } + else + { + return LLFloater::handleAnyMouseClick(x, y, mask, clicktype, down); + } +} + +BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const +{ + return (isShown() && (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) && + (clicktype == LLMouseHandler::CLICK_LEFT) && down && + (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || + ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))); +} + +LLHandle LLFloaterPathfindingConsole::getInstanceHandle() +{ + if (sInstanceHandle.isDead()) + { + LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::getTypedInstance("pathfinding_console"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} + +BOOL LLFloaterPathfindingConsole::isRenderPath() const +{ + return (mHasStartPoint && mHasEndPoint); +} + +BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const +{ + return mShowNavMeshCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) +{ + mShowNavMeshCheckBox->set(pIsRenderNavMesh); +} + +BOOL LLFloaterPathfindingConsole::isRenderWalkables() const +{ + return mShowWalkablesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) +{ + mShowWalkablesCheckBox->set(pIsRenderWalkables); +} + +BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const +{ + return mShowStaticObstaclesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) +{ + mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); +} + +BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const +{ + return mShowMaterialVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) +{ + mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const +{ + return mShowExclusionVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) +{ + mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorld() const +{ + return mShowWorldCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) +{ + mShowWorldCheckBox->set(pIsRenderWorld); +} + +LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const +{ + ERenderHeatmapType renderHeatmapType; + + switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) + { + case XUI_RENDER_HEATMAP_NONE : + renderHeatmapType = kRenderHeatmapNone; + break; + case XUI_RENDER_HEATMAP_A : + renderHeatmapType = kRenderHeatmapA; + break; + case XUI_RENDER_HEATMAP_B : + renderHeatmapType = kRenderHeatmapB; + break; + case XUI_RENDER_HEATMAP_C : + renderHeatmapType = kRenderHeatmapC; + break; + case XUI_RENDER_HEATMAP_D : + renderHeatmapType = kRenderHeatmapD; + break; + default : + renderHeatmapType = kRenderHeatmapNone; + llassert(0); + break; + } + + return renderHeatmapType; +} + +int LLFloaterPathfindingConsole::getHeatMapType() const +{ + //converts the pathfinding console values to the navmesh filter values + + int renderHeatmapType = 4; //none + + switch ( mShowNavMeshWalkabilityComboBox->getValue().asInteger() ) + { + case XUI_RENDER_HEATMAP_A : + renderHeatmapType = 0; + break; + case XUI_RENDER_HEATMAP_B : + renderHeatmapType = 1; + break; + case XUI_RENDER_HEATMAP_C : + renderHeatmapType = 2; + break; + case XUI_RENDER_HEATMAP_D : + renderHeatmapType = 3; + break; + default : + renderHeatmapType = 4; + break; + } + + return renderHeatmapType; +} + + +void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) +{ + LLSD comboBoxValue; + + switch (pRenderHeatmapType) + { + case kRenderHeatmapNone : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + break; + case kRenderHeatmapA : + comboBoxValue = XUI_RENDER_HEATMAP_A; + break; + case kRenderHeatmapB : + comboBoxValue = XUI_RENDER_HEATMAP_B; + break; + case kRenderHeatmapC : + comboBoxValue = XUI_RENDER_HEATMAP_C; + break; + case kRenderHeatmapD : + comboBoxValue = XUI_RENDER_HEATMAP_D; + break; + default : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + llassert(0); + break; + } + + return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); +} + +F32 LLFloaterPathfindingConsole::getCharacterWidth() const +{ + return mCharacterWidthSlider->getValueF32(); +} + +void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) +{ + mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); +} + +LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const +{ + ECharacterType characterType; + + switch (mCharacterTypeComboBox->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_NONE : + characterType = kCharacterTypeNone; + break; + case XUI_CHARACTER_TYPE_A : + characterType = kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = kCharacterTypeD; + break; + default : + characterType = kCharacterTypeNone; + llassert(0); + break; + } + + return characterType; +} + +void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) +{ + LLSD radioGroupValue; + + switch (pCharacterType) + { + case kCharacterTypeNone : + radioGroupValue = XUI_CHARACTER_TYPE_NONE; + break; + case kCharacterTypeA : + radioGroupValue = XUI_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + radioGroupValue = XUI_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + radioGroupValue = XUI_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + radioGroupValue = XUI_CHARACTER_TYPE_D; + break; + default : + radioGroupValue = XUI_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + + mCharacterTypeComboBox->setValue(radioGroupValue); +} + +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) + : LLFloater(pSeed), + mSelfHandle(), + mShowNavMeshCheckBox(NULL), + mShowNavMeshWalkabilityComboBox(NULL), + mShowWalkablesCheckBox(NULL), + mShowStaticObstaclesCheckBox(NULL), + mShowMaterialVolumesCheckBox(NULL), + mShowExclusionVolumesCheckBox(NULL), + mShowWorldCheckBox(NULL), + mPathfindingViewerStatus(NULL), + mPathfindingSimulatorStatus(NULL), + mViewCharactersButton(NULL), + mEditTestTabContainer(NULL), + mEditTab(NULL), + mTestTab(NULL), + mUnfreezeLabel(NULL), + mUnfreezeButton(NULL), + mLinksetsLabel(NULL), + mLinksetsButton(NULL), + mFreezeLabel(NULL), + mFreezeButton(NULL), + mCharacterWidthSlider(NULL), + mCharacterTypeComboBox(NULL), + mPathTestingStatus(NULL), + mClearPathButton(NULL), + mNavMeshZoneSlot(), + mNavMeshZone(), + mIsNavMeshUpdating(false), + mAgentStateSlot(), + mConsoleState(kConsoleStateUnknown), + mPathData(), + mHasStartPoint(false), + mHasEndPoint(false), + mHeartBeat( false ) +{ + mSelfHandle.bind(this); +} + +LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() +{ +} + +void LLFloaterPathfindingConsole::onShowWalkabilitySet() +{ + switch (getRenderHeatmapType()) + { + case kRenderHeatmapNone : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapNone" + << llendl; + break; + case kRenderHeatmapA : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapA" + << llendl; + break; + case kRenderHeatmapB : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapB" + << llendl; + break; + case kRenderHeatmapC : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapC" + << llendl; + break; + case kRenderHeatmapD : + llwarns << "functionality has not yet been implemented to toggle '" + << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapD" + << llendl; + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::onShowWorldToggle() +{ + BOOL checkBoxValue = mShowWorldCheckBox->get(); + + LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); + if (llPathingLibInstance != NULL) + { + llPathingLibInstance->setRenderWorld(checkBoxValue); + } + else + { + mShowWorldCheckBox->set(FALSE); + llwarns << "cannot find LLPathingLib instance" << llendl; + } +} + +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + generatePath(); + updatePathTestStatus(); +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + generatePath(); + updatePathTestStatus(); +} + +void LLFloaterPathfindingConsole::onViewCharactersClicked() +{ + LLFloaterPathfindingCharacters::openCharactersViewer(); +} + +void LLFloaterPathfindingConsole::onUnfreezeClicked() +{ + mUnfreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); +} + +void LLFloaterPathfindingConsole::onFreezeClicked() +{ + mFreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); +} + +void LLFloaterPathfindingConsole::onViewEditLinksetClicked() +{ + LLFloaterPathfindingLinksets::openLinksetsEditor(); +} + +void LLFloaterPathfindingConsole::onClearPathClicked() +{ + mHasStartPoint = false; + mHasEndPoint = false; + updatePathTestStatus(); +} + +void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) +{ + switch (pNavMeshZoneRequestStatus) + { + case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : + setConsoleState(kConsoleStateUnknown); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : + setConsoleState(kConsoleStateCheckingVersion); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : + mIsNavMeshUpdating = true; + mNavMeshZone.refresh(); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : + setConsoleState(kConsoleStateDownloading); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted : + mIsNavMeshUpdating = false; + setConsoleState(kConsoleStateHasNavMesh); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled : + setConsoleState(kConsoleStateRegionNotEnabled); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestError : + setConsoleState(kConsoleStateError); + break; + default: + setConsoleState(kConsoleStateUnknown); + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) +{ + setAgentState(pAgentState); +} + +void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) +{ + mConsoleState = pConsoleState; + updateControlsOnConsoleState(); + updateStatusOnConsoleState(); +} + +void LLFloaterPathfindingConsole::updateControlsOnConsoleState() +{ + switch (mConsoleState) + { + case kConsoleStateUnknown : + case kConsoleStateLibraryNotImplemented : + case kConsoleStateRegionNotEnabled : + 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->selectTab(0); + mTestTab->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + mHasStartPoint = false; + mHasEndPoint = false; + break; + case kConsoleStateCheckingVersion : + case kConsoleStateDownloading : + case kConsoleStateError : + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + mHasStartPoint = false; + mHasEndPoint = false; + break; + case kConsoleStateHasNavMesh : + mShowNavMeshCheckBox->setEnabled(TRUE); + mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); + mShowWalkablesCheckBox->setEnabled(TRUE); + mShowStaticObstaclesCheckBox->setEnabled(TRUE); + mShowMaterialVolumesCheckBox->setEnabled(TRUE); + mShowExclusionVolumesCheckBox->setEnabled(TRUE); + mShowWorldCheckBox->setEnabled(TRUE); + mViewCharactersButton->setEnabled(TRUE); + mTestTab->setEnabled(TRUE); + mCharacterWidthSlider->setEnabled(TRUE); + mCharacterTypeComboBox->setEnabled(TRUE); + mClearPathButton->setEnabled(TRUE); + mTestTab->setEnabled(TRUE); + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::updateStatusOnConsoleState() +{ + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); + + std::string simulatorStatusText(""); + std::string viewerStatusText(""); + LLStyle::Params viewerStyleParams; + + switch (mConsoleState) + { + case kConsoleStateUnknown : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); + break; + case kConsoleStateLibraryNotImplemented : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); + viewerStyleParams.color = warningColor; + break; + case kConsoleStateRegionNotEnabled : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); + viewerStyleParams.color = warningColor; + break; + case kConsoleStateCheckingVersion : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_checking_version"); + break; + case kConsoleStateDownloading : + simulatorStatusText = getSimulatorStatusText(); + if (mIsNavMeshUpdating) + { + viewerStatusText = getString("navmesh_viewer_status_updating"); + } + else + { + viewerStatusText = getString("navmesh_viewer_status_downloading"); + } + break; + case kConsoleStateHasNavMesh : + simulatorStatusText = getSimulatorStatusText(); + viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); + break; + case kConsoleStateError : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_error"); + viewerStyleParams.color = warningColor; + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); + llassert(0); + break; + } + + mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); + mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); +} + +std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +{ + std::string simulatorStatusText(""); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) + { + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } + } + else + { + simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + return simulatorStatusText; +} + +void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) +{ + switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) + { + case LLPathfindingManager::kAgentStateUnknown : + case LLPathfindingManager::kAgentStateNotEnabled : + mEditTab->setEnabled(FALSE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateFrozen : + mEditTab->setEnabled(TRUE); + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateUnfrozen : + mEditTab->setEnabled(TRUE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(TRUE); + mLinksetsButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::generatePath() +{ + if (mHasStartPoint && mHasEndPoint) + { + mPathData.mCharacterWidth = getCharacterWidth(); + switch (getCharacterType()) + { + case kCharacterTypeNone : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + case kCharacterTypeA : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_A; + break; + case kCharacterTypeB : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_B; + break; + case kCharacterTypeC : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_C; + break; + case kCharacterTypeD : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_D; + break; + default : + mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + } + LLPathingLib::getInstance()->generatePath(mPathData); + } +} + +void LLFloaterPathfindingConsole::updatePathTestStatus() +{ + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); + + std::string statusText(""); + LLStyle::Params styleParams; + + if (!mHasStartPoint && !mHasEndPoint) + { + statusText = getString("pathing_choose_start_and_end_points"); + styleParams.color = warningColor; + } + else if (!mHasStartPoint && mHasEndPoint) + { + statusText = getString("pathing_choose_start_point"); + styleParams.color = warningColor; + } + else if (mHasStartPoint && !mHasEndPoint) + { + statusText = getString("pathing_choose_end_point"); + styleParams.color = warningColor; + } + else + { + statusText = getString("pathing_path_valid"); + } + + mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); +} + + +BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const +{ + if ( isRenderWalkables() || isRenderStaticObstacles() || + isRenderMaterialVolumes() || isRenderExclusionVolumes() ) + { + return true; + } + + return false; +} + +U32 LLFloaterPathfindingConsole::getRenderShapeFlags() +{ + resetShapeRenderFlags(); + + if ( isRenderWalkables() ) + { + setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects ); + } + if ( isRenderStaticObstacles() ) + { + setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects ); + } + if ( isRenderMaterialVolumes() ) + { + setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms ); + } + if ( isRenderExclusionVolumes() ) + { + setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms ); + } + return mShapeRenderFlags; +} + +void LLFloaterPathfindingConsole::regionCrossingOccured() +{ + std::string statusText(""); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + statusText = getString("navmesh_update_needed"); + mPathfindingViewerStatus->setText((LLStringExplicit)statusText, styleParams); +} + +void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() +{ + + LLPathingLib::NavMeshColors colors; + + LLColor4 in = gSavedSettings.getColor4("PathfindingWalkable"); + colors.mWalkable= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingObstacle"); + colors.mObstacle= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingMaterial"); + colors.mMaterial= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingExclusion"); + colors.mExclusion= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingConnectedEdge"); + colors.mConnectedEdge= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingBoundaryEdge"); + colors.mBoundaryEdge= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingHeatColorBase"); + colors.mHeatColorBase= LLVector4(in.mV); + + in = gSavedSettings.getColor4("PathfindingHeatColorMax"); + colors.mHeatColorMax= LLVector4( in.mV ); + + in = gSavedSettings.getColor4("PathfindingFaceColor"); + colors.mFaceColor= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingStarValidColor"); + colors.mStarValid= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingStarInvalidColor"); + colors.mStarInvalid= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingTestPathColor"); + colors.mTestPath= LLColor4U(in); + + in = gSavedSettings.getColor4("PathfindingNavMeshClear"); + colors.mNavMeshClear= LLColor4(in); + + mNavMeshColors = colors; + + LLPathingLib::getInstance()->setNavMeshColors( colors ); +} + + -- cgit v1.2.3 From 817f1629bdafd6c28efa2a868a7aad75eb8a9514 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 3 Apr 2012 02:52:34 -0500 Subject: Pathfinding visualization WIP -- add many controls for x-ray render, add lighting, and better combat z-fighting and noise from wireframes and overlays --- indra/newview/llfloaterpathfindingconsole.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index a274251fb8..c981ca6c5d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -96,6 +96,10 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mShowWorldCheckBox != NULL); mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); + mShowXRayCheckBox = findChild("x-ray"); + llassert(mShowXRayCheckBox != NULL); + mShowXRayCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowXRayToggle, this)); + mViewCharactersButton = findChild("view_characters_floater"); llassert(mViewCharactersButton != NULL); mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); @@ -219,6 +223,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) mShowStaticObstaclesCheckBox->set( false ); mShowExclusionVolumesCheckBox->set( false ); mShowWorldCheckBox->set( false ); + mShowXRayCheckBox->set(false); } BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) @@ -340,6 +345,17 @@ void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) mShowWorldCheckBox->set(pIsRenderWorld); } +BOOL LLFloaterPathfindingConsole::isRenderXRay() const +{ + return mShowXRayCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) +{ + mShowXRayCheckBox->set(pIsRenderXRay); +} + + LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const { ERenderHeatmapType renderHeatmapType; @@ -593,6 +609,12 @@ void LLFloaterPathfindingConsole::onShowWorldToggle() } } +void LLFloaterPathfindingConsole::onShowXRayToggle() +{ + //nothing to do (xray parameter not stored in pathing lib +} + + void LLFloaterPathfindingConsole::onCharacterWidthSet() { generatePath(); -- cgit v1.2.3 From 59f57a7b67ba200135b8a2d2c8904b4168edbb32 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 4 Apr 2012 11:35:45 -0400 Subject: Support for navmesh vbo. Navmesh vb supports heat map. --- indra/newview/llfloaterpathfindingconsole.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c981ca6c5d..6422e3cbf4 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -382,7 +382,8 @@ LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::get llassert(0); break; } - + //prep# + LLPathingLib::getInstance()->rebuildNavMesh( getHeatMapType() ); return renderHeatmapType; } -- cgit v1.2.3 From 2ded81109ca32d88cffe86df25879250f657f187 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 4 Apr 2012 16:09:55 -0400 Subject: remove debug comment --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 6422e3cbf4..4e7217735a 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -382,7 +382,7 @@ LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::get llassert(0); break; } - //prep# + LLPathingLib::getInstance()->rebuildNavMesh( getHeatMapType() ); return renderHeatmapType; } -- cgit v1.2.3 From 4e9d9ebe8a480ffdd9e069388c1e9845477f5f66 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 4 Apr 2012 17:19:57 -0700 Subject: PATH-445,PATH-452: Adding functionality to reload the navmesh on region boundary crossing. Also, correcting how the region boundary crossing is detected to make it more accurate. --- indra/newview/llfloaterpathfindingconsole.cpp | 46 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 1f73f10b9b..d1606cbd49 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -48,6 +48,7 @@ #include "llviewercontrol.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingmanager.h" +#include "llenvmanager.h" #include "LLPathingLib.h" @@ -157,7 +158,6 @@ BOOL LLFloaterPathfindingConsole::postBuild() void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { LLFloater::onOpen(pKey); - setHeartBeat( true ); //make sure we have a pathing system if ( !LLPathingLib::getInstance() ) { @@ -177,10 +177,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } mIsNavMeshUpdating = false; - mNavMeshZone.initialize(); - - mNavMeshZone.enable(); - mNavMeshZone.refresh(); + initializeNavMeshZoneForCurrentRegion(); } if (!mAgentStateSlot.connected()) @@ -188,12 +185,22 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); } + if (!mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); + } + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); updatePathTestStatus(); } void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { + if (mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot.disconnect(); + } + if (mAgentStateSlot.connected()) { mAgentStateSlot.disconnect(); @@ -210,7 +217,6 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) } LLFloater::onClose(pIsAppQuitting); - setHeartBeat( false ); setConsoleState(kConsoleStateUnknown); //Reset all the checkboxes to default mShowNavMeshCheckBox->set( false ); @@ -529,11 +535,11 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mNavMeshZone(), mIsNavMeshUpdating(false), mAgentStateSlot(), + mRegionBoundarySlot(), mConsoleState(kConsoleStateUnknown), mPathData(), mHasStartPoint(false), - mHasEndPoint(false), - mHeartBeat( false ) + mHasEndPoint(false) { mSelfHandle.bind(this); } @@ -673,6 +679,11 @@ void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentSta setAgentState(pAgentState); } +void LLFloaterPathfindingConsole::onRegionBoundaryCross() +{ + initializeNavMeshZoneForCurrentRegion(); +} + void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) { mConsoleState = pConsoleState; @@ -868,6 +879,14 @@ std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const return simulatorStatusText; } +void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() +{ + mNavMeshZone.disable(); + mNavMeshZone.initialize(); + mNavMeshZone.enable(); + mNavMeshZone.refresh(); +} + void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) { switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) @@ -1001,15 +1020,6 @@ U32 LLFloaterPathfindingConsole::getRenderShapeFlags() return mShapeRenderFlags; } -void LLFloaterPathfindingConsole::regionCrossingOccured() -{ - std::string statusText(""); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - statusText = getString("navmesh_update_needed"); - mPathfindingViewerStatus->setText((LLStringExplicit)statusText, styleParams); -} - void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() { @@ -1070,5 +1080,3 @@ void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() LLPathingLib::getInstance()->setNavMeshColors( colors ); } - - -- cgit v1.2.3 From 490e487ab113202b05381b713e49f2196e54ce20 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 5 Apr 2012 16:19:05 -0700 Subject: PATH-500: Updating the pathfinding console defaults following the integration of the xray code. --- indra/newview/llfloaterpathfindingconsole.cpp | 30 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index d0e047d48b..0c44399840 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -195,6 +195,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } setAgentState(LLPathfindingManager::getInstance()->getAgentState()); + setDefaultInputs(); updatePathTestStatus(); } @@ -220,16 +221,10 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) mNavMeshZone.disable(); } - LLFloater::onClose(pIsAppQuitting); + setDefaultInputs(); setConsoleState(kConsoleStateUnknown); - //Reset all the checkboxes to default - mShowNavMeshCheckBox->set( false ); - mShowWalkablesCheckBox->set( false ); - mShowMaterialVolumesCheckBox->set( false ); - mShowStaticObstaclesCheckBox->set( false ); - mShowExclusionVolumesCheckBox->set( false ); - mShowWorldCheckBox->set( false ); - mShowXRayCheckBox->set(false); + + LLFloater::onClose(pIsAppQuitting); } BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) @@ -361,7 +356,6 @@ void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) mShowXRayCheckBox->set(pIsRenderXRay); } - LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const { ERenderHeatmapType renderHeatmapType; @@ -532,6 +526,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowMaterialVolumesCheckBox(NULL), mShowExclusionVolumesCheckBox(NULL), mShowWorldCheckBox(NULL), + mShowXRayCheckBox(NULL), mPathfindingViewerStatus(NULL), mPathfindingSimulatorStatus(NULL), mViewCharactersButton(NULL), @@ -707,6 +702,18 @@ void LLFloaterPathfindingConsole::onRegionBoundaryCross() initializeNavMeshZoneForCurrentRegion(); } +void LLFloaterPathfindingConsole::setDefaultInputs() +{ + mEditTestTabContainer->selectTab(0); + mShowNavMeshCheckBox->set(FALSE); + mShowWalkablesCheckBox->set(FALSE); + mShowMaterialVolumesCheckBox->set(FALSE); + mShowStaticObstaclesCheckBox->set(FALSE); + mShowExclusionVolumesCheckBox->set(FALSE); + mShowWorldCheckBox->set(TRUE); + mShowXRayCheckBox->set(FALSE); +} + void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) { mConsoleState = pConsoleState; @@ -728,6 +735,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowMaterialVolumesCheckBox->setEnabled(FALSE); mShowExclusionVolumesCheckBox->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(FALSE); mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); @@ -747,6 +755,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowMaterialVolumesCheckBox->setEnabled(FALSE); mShowExclusionVolumesCheckBox->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(TRUE); mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); @@ -764,6 +773,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowMaterialVolumesCheckBox->setEnabled(TRUE); mShowExclusionVolumesCheckBox->setEnabled(TRUE); mShowWorldCheckBox->setEnabled(TRUE); + mShowXRayCheckBox->setEnabled(TRUE); mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); mCharacterWidthSlider->setEnabled(TRUE); -- cgit v1.2.3 From 0693defb80489a48f776fc73ee9bba7034d3d2b1 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 5 Apr 2012 17:17:06 -0700 Subject: Removing the onShowWorldToggle callback as it is no longer required. --- indra/newview/llfloaterpathfindingconsole.cpp | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 0c44399840..8a37082fc6 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -95,7 +95,6 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowWorldCheckBox = findChild("show_world"); llassert(mShowWorldCheckBox != NULL); - mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldToggle, this)); mShowXRayCheckBox = findChild("x-ray"); llassert(mShowXRayCheckBox != NULL); @@ -595,22 +594,6 @@ void LLFloaterPathfindingConsole::onShowWalkabilitySet() } } -void LLFloaterPathfindingConsole::onShowWorldToggle() -{ - BOOL checkBoxValue = mShowWorldCheckBox->get(); - - LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); - if (llPathingLibInstance != NULL) - { - llPathingLibInstance->setRenderWorld(checkBoxValue); - } - else - { - mShowWorldCheckBox->set(FALSE); - llwarns << "cannot find LLPathingLib instance" << llendl; - } -} - void LLFloaterPathfindingConsole::onShowXRayToggle() { //nothing to do (xray parameter not stored in pathing lib -- cgit v1.2.3 From 9abc73c4556c1f7d2e0a04dc40b52ba7634bb150 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 5 Apr 2012 18:00:01 -0700 Subject: Removing the onShowXRayToggle callback as it is no longer required. --- indra/newview/llfloaterpathfindingconsole.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 8a37082fc6..84ed1d3db5 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -98,7 +98,6 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowXRayCheckBox = findChild("x-ray"); llassert(mShowXRayCheckBox != NULL); - mShowXRayCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowXRayToggle, this)); mViewCharactersButton = findChild("view_characters_floater"); llassert(mViewCharactersButton != NULL); @@ -594,12 +593,6 @@ void LLFloaterPathfindingConsole::onShowWalkabilitySet() } } -void LLFloaterPathfindingConsole::onShowXRayToggle() -{ - //nothing to do (xray parameter not stored in pathing lib -} - - void LLFloaterPathfindingConsole::onCharacterWidthSet() { generatePath(); -- cgit v1.2.3 From 2ddae4e363fb84c8d755ae006a8f5d025c8077d3 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 5 Apr 2012 18:13:49 -0700 Subject: Enabling the Show World checkbox when crossing region boundaries so that users do not suddenly end up lost in blackness as the navmesh downloads. --- indra/newview/llfloaterpathfindingconsole.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 84ed1d3db5..fd5403a7b7 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -676,6 +676,7 @@ void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentSta void LLFloaterPathfindingConsole::onRegionBoundaryCross() { initializeNavMeshZoneForCurrentRegion(); + mShowWorldCheckBox->set(TRUE); } void LLFloaterPathfindingConsole::setDefaultInputs() -- cgit v1.2.3 From 8d9863f4ef039af4f6af7f41909e212b9101ce0f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 6 Apr 2012 13:37:11 -0700 Subject: Altering the layout of the pathfinding console based on feedback. --- indra/newview/llfloaterpathfindingconsole.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fd5403a7b7..d173764fd1 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -766,7 +766,8 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() void LLFloaterPathfindingConsole::updateStatusOnConsoleState() { - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); + static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); std::string simulatorStatusText(""); std::string viewerStatusText(""); @@ -777,20 +778,22 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() case kConsoleStateUnknown : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_unknown"); + viewerStyleParams.color = errorColor; break; case kConsoleStateLibraryNotImplemented : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); - viewerStyleParams.color = warningColor; + viewerStyleParams.color = errorColor; break; case kConsoleStateRegionNotEnabled : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); - viewerStyleParams.color = warningColor; + viewerStyleParams.color = errorColor; break; case kConsoleStateCheckingVersion : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_checking_version"); + viewerStyleParams.color = warningColor; break; case kConsoleStateDownloading : simulatorStatusText = getSimulatorStatusText(); @@ -802,6 +805,7 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() { viewerStatusText = getString("navmesh_viewer_status_downloading"); } + viewerStyleParams.color = warningColor; break; case kConsoleStateHasNavMesh : simulatorStatusText = getSimulatorStatusText(); @@ -810,11 +814,12 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() case kConsoleStateError : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_error"); - viewerStyleParams.color = warningColor; + viewerStyleParams.color = errorColor; break; default : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_unknown"); + viewerStyleParams.color = errorColor; llassert(0); break; } @@ -967,7 +972,7 @@ void LLFloaterPathfindingConsole::generatePath() void LLFloaterPathfindingConsole::updatePathTestStatus() { - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow"); + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); std::string statusText(""); LLStyle::Params styleParams; -- cgit v1.2.3 From 4888f7d34969b596e2b37ef72576118e1c0c27ac Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 6 Apr 2012 18:00:52 -0700 Subject: PATH-265: Adding an error message to the testing tab of the pathfinding floater console to indicate when a path cannot be found. --- indra/newview/llfloaterpathfindingconsole.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index d173764fd1..c59f960d3f 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -549,7 +549,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mConsoleState(kConsoleStateUnknown), mPathData(), mHasStartPoint(false), - mHasEndPoint(false) + mHasEndPoint(false), + mHasValidPath(false) { mSelfHandle.bind(this); } @@ -631,6 +632,7 @@ void LLFloaterPathfindingConsole::onClearPathClicked() { mHasStartPoint = false; mHasEndPoint = false; + mHasValidPath = false; updatePathTestStatus(); } @@ -721,6 +723,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mClearPathButton->setEnabled(FALSE); mHasStartPoint = false; mHasEndPoint = false; + mHasValidPath = false; break; case kConsoleStateCheckingVersion : case kConsoleStateDownloading : @@ -741,6 +744,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mClearPathButton->setEnabled(FALSE); mHasStartPoint = false; mHasEndPoint = false; + mHasValidPath = false; break; case kConsoleStateHasNavMesh : mShowNavMeshCheckBox->setEnabled(TRUE); @@ -966,12 +970,14 @@ void LLFloaterPathfindingConsole::generatePath() mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; break; } - LLPathingLib::getInstance()->generatePath(mPathData); + LLPathingLib::LLPLResult pathingResult = LLPathingLib::getInstance()->generatePath(mPathData); + mHasValidPath = (pathingResult == LLPathingLib::LLPL_PATH_GENERATED_OK); } } void LLFloaterPathfindingConsole::updatePathTestStatus() { + static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); std::string statusText(""); @@ -992,10 +998,15 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() statusText = getString("pathing_choose_end_point"); styleParams.color = warningColor; } - else + else if (mHasValidPath) { statusText = getString("pathing_path_valid"); } + else + { + statusText = getString("pathing_path_invalid"); + styleParams.color = errorColor; + } mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); } -- cgit v1.2.3 From 2115211328261d875dc0ccacdc2021f1c501a36d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 9 Apr 2012 18:53:52 -0700 Subject: Re-implementing the path testing functionality as a proper LLTool. --- indra/newview/llfloaterpathfindingconsole.cpp | 361 +++++++++++++------------- 1 file changed, 175 insertions(+), 186 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c59f960d3f..7941fd52af 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -32,7 +32,6 @@ #include "llsd.h" #include "llhandle.h" -#include "llagent.h" #include "llpanel.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -42,13 +41,12 @@ #include "lltabcontainer.h" #include "llcombobox.h" #include "llfloaterreg.h" -#include "llviewerregion.h" -#include "llviewerwindow.h" -#include "llviewercamera.h" -#include "llviewercontrol.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingmanager.h" #include "llenvmanager.h" +#include "llpathfindingpathtool.h" +#include "lltoolmgr.h" +#include "lltoolfocus.h" #include "LLPathingLib.h" @@ -64,6 +62,7 @@ #define XUI_CHARACTER_TYPE_C 3 #define XUI_CHARACTER_TYPE_D 4 +#define XUI_EDIT_TAB_INDEX 0 #define XUI_TEST_TAB_INDEX 1 LLHandle LLFloaterPathfindingConsole::sInstanceHandle; @@ -105,6 +104,7 @@ BOOL LLFloaterPathfindingConsole::postBuild() mEditTestTabContainer = findChild("edit_test_tab_container"); llassert(mEditTestTabContainer != NULL); + mEditTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this)); mEditTab = findChild("edit_panel"); llassert(mEditTab != NULL); @@ -154,6 +154,11 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mClearPathButton != NULL); mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + mPathfindingToolset = new LLToolset(); + mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); + mPathfindingToolset->addTool(LLToolCamera::getInstance()); + mPathfindingToolset->setShowFloaterTools(false); + return LLFloater::postBuild(); } @@ -192,13 +197,30 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); } + if (!mPathEventSlot.connected()) + { + mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this)); + } + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); setDefaultInputs(); updatePathTestStatus(); + + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } } void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { + switchOutOfTestPathMode(); + + if (mPathEventSlot.connected()) + { + mPathEventSlot.disconnect(); + } + if (mRegionBoundarySlot.connected()) { mRegionBoundarySlot.disconnect(); @@ -225,46 +247,6 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) LLFloater::onClose(pIsAppQuitting); } -BOOL LLFloaterPathfindingConsole::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down) -{ - if (isGeneratePathMode(mask, clicktype, down)) - { - LLVector3 dv = gViewerWindow->mouseDirectionGlobal(x, y); - LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin(); - LLVector3 rayStart = mousePos; - LLVector3 rayEnd = mousePos + dv * 150; - - if (mask & MASK_CONTROL) - { - mPathData.mStartPointA = rayStart; - mPathData.mEndPointA = rayEnd; - mHasStartPoint = true; - } - else if (mask & MASK_SHIFT) - { - mPathData.mStartPointB = rayStart; - mPathData.mEndPointB = rayEnd; - mHasEndPoint = true; - } - generatePath(); - updatePathTestStatus(); - - return TRUE; - } - else - { - return LLFloater::handleAnyMouseClick(x, y, mask, clicktype, down); - } -} - -BOOL LLFloaterPathfindingConsole::isGeneratePathMode(MASK mask, EClickType clicktype, BOOL down) const -{ - return (isShown() && (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) && - (clicktype == LLMouseHandler::CLICK_LEFT) && down && - (((mask & MASK_CONTROL) && !(mask & (~MASK_CONTROL))) || - ((mask & MASK_SHIFT) && !(mask & (~MASK_SHIFT))))); -} - LLHandle LLFloaterPathfindingConsole::getInstanceHandle() { if (sInstanceHandle.isDead()) @@ -279,11 +261,6 @@ LLHandle LLFloaterPathfindingConsole::getInstanceHa return sInstanceHandle; } -BOOL LLFloaterPathfindingConsole::isRenderPath() const -{ - return (mHasStartPoint && mHasEndPoint); -} - BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const { return mShowNavMeshCheckBox->get(); @@ -444,76 +421,6 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRende return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); } -F32 LLFloaterPathfindingConsole::getCharacterWidth() const -{ - return mCharacterWidthSlider->getValueF32(); -} - -void LLFloaterPathfindingConsole::setCharacterWidth(F32 pCharacterWidth) -{ - mCharacterWidthSlider->setValue(LLSD(pCharacterWidth)); -} - -LLFloaterPathfindingConsole::ECharacterType LLFloaterPathfindingConsole::getCharacterType() const -{ - ECharacterType characterType; - - switch (mCharacterTypeComboBox->getValue().asInteger()) - { - case XUI_CHARACTER_TYPE_NONE : - characterType = kCharacterTypeNone; - break; - case XUI_CHARACTER_TYPE_A : - characterType = kCharacterTypeA; - break; - case XUI_CHARACTER_TYPE_B : - characterType = kCharacterTypeB; - break; - case XUI_CHARACTER_TYPE_C : - characterType = kCharacterTypeC; - break; - case XUI_CHARACTER_TYPE_D : - characterType = kCharacterTypeD; - break; - default : - characterType = kCharacterTypeNone; - llassert(0); - break; - } - - return characterType; -} - -void LLFloaterPathfindingConsole::setCharacterType(ECharacterType pCharacterType) -{ - LLSD radioGroupValue; - - switch (pCharacterType) - { - case kCharacterTypeNone : - radioGroupValue = XUI_CHARACTER_TYPE_NONE; - break; - case kCharacterTypeA : - radioGroupValue = XUI_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - radioGroupValue = XUI_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - radioGroupValue = XUI_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - radioGroupValue = XUI_CHARACTER_TYPE_D; - break; - default : - radioGroupValue = XUI_CHARACTER_TYPE_NONE; - llassert(0); - break; - } - - mCharacterTypeComboBox->setValue(radioGroupValue); -} - LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), @@ -546,11 +453,11 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mIsNavMeshUpdating(false), mAgentStateSlot(), mRegionBoundarySlot(), + mPathEventSlot(), + mPathfindingToolset(NULL), + mSavedToolset(NULL), mConsoleState(kConsoleStateUnknown), - mPathData(), - mHasStartPoint(false), - mHasEndPoint(false), - mHasValidPath(false) + mShapeRenderFlags(0U) { mSelfHandle.bind(this); } @@ -594,21 +501,21 @@ void LLFloaterPathfindingConsole::onShowWalkabilitySet() } } -void LLFloaterPathfindingConsole::onCharacterWidthSet() -{ - generatePath(); - updatePathTestStatus(); -} - -void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +void LLFloaterPathfindingConsole::onViewCharactersClicked() { - generatePath(); - updatePathTestStatus(); + LLFloaterPathfindingCharacters::openCharactersViewer(); } -void LLFloaterPathfindingConsole::onViewCharactersClicked() +void LLFloaterPathfindingConsole::onTabSwitch() { - LLFloaterPathfindingCharacters::openCharactersViewer(); + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } + else + { + switchOutOfTestPathMode(); + } } void LLFloaterPathfindingConsole::onUnfreezeClicked() @@ -628,12 +535,19 @@ void LLFloaterPathfindingConsole::onViewEditLinksetClicked() LLFloaterPathfindingLinksets::openLinksetsEditor(); } +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + updateCharacterWidth(); +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + updateCharacterType(); +} + void LLFloaterPathfindingConsole::onClearPathClicked() { - mHasStartPoint = false; - mHasEndPoint = false; - mHasValidPath = false; - updatePathTestStatus(); + clearPath(); } void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) @@ -681,9 +595,43 @@ void LLFloaterPathfindingConsole::onRegionBoundaryCross() mShowWorldCheckBox->set(TRUE); } +void LLFloaterPathfindingConsole::onPathEvent() +{ + const LLPathfindingPathTool *pathToolInstance = LLPathfindingPathTool::getInstance(); + + mCharacterWidthSlider->setValue(LLSD(pathToolInstance->getCharacterWidth())); + + LLSD characterType; + switch (pathToolInstance->getCharacterType()) + { + case LLPathfindingPathTool::kCharacterTypeNone : + characterType = XUI_CHARACTER_TYPE_NONE; + break; + case LLPathfindingPathTool::kCharacterTypeA : + characterType = XUI_CHARACTER_TYPE_A; + break; + case LLPathfindingPathTool::kCharacterTypeB : + characterType = XUI_CHARACTER_TYPE_B; + break; + case LLPathfindingPathTool::kCharacterTypeC : + characterType = XUI_CHARACTER_TYPE_C; + break; + case LLPathfindingPathTool::kCharacterTypeD : + characterType = XUI_CHARACTER_TYPE_D; + break; + default : + characterType = XUI_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + mCharacterTypeComboBox->setValue(characterType); + + updatePathTestStatus(); +} + void LLFloaterPathfindingConsole::setDefaultInputs() { - mEditTestTabContainer->selectTab(0); + mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX); mShowNavMeshCheckBox->set(FALSE); mShowWalkablesCheckBox->set(FALSE); mShowMaterialVolumesCheckBox->set(FALSE); @@ -721,9 +669,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mCharacterWidthSlider->setEnabled(FALSE); mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); - mHasStartPoint = false; - mHasEndPoint = false; - mHasValidPath = false; + clearPath(); break; case kConsoleStateCheckingVersion : case kConsoleStateDownloading : @@ -742,9 +688,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mCharacterWidthSlider->setEnabled(FALSE); mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); - mHasStartPoint = false; - mHasEndPoint = false; - mHasValidPath = false; + clearPath(); break; case kConsoleStateHasNavMesh : mShowNavMeshCheckBox->setEnabled(TRUE); @@ -943,36 +887,63 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat break; } } - -void LLFloaterPathfindingConsole::generatePath() + +void LLFloaterPathfindingConsole::switchIntoTestPathMode() +{ + llassert(mPathfindingToolset != NULL); + llassert(mSavedToolset == NULL); + mSavedToolset = LLToolMgr::getInstance()->getCurrentToolset(); + LLToolMgr::getInstance()->setCurrentToolset(mPathfindingToolset); +} + +void LLFloaterPathfindingConsole::switchOutOfTestPathMode() { - if (mHasStartPoint && mHasEndPoint) + llassert(mPathfindingToolset != NULL); + if (mSavedToolset != NULL) { - mPathData.mCharacterWidth = getCharacterWidth(); - switch (getCharacterType()) - { - case kCharacterTypeNone : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - break; - case kCharacterTypeA : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_A; - break; - case kCharacterTypeB : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_B; - break; - case kCharacterTypeC : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_C; - break; - case kCharacterTypeD : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_D; - break; - default : - mPathData.mCharacterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - break; - } - LLPathingLib::LLPLResult pathingResult = LLPathingLib::getInstance()->generatePath(mPathData); - mHasValidPath = (pathingResult == LLPathingLib::LLPL_PATH_GENERATED_OK); + LLToolMgr::getInstance()->setCurrentToolset(mSavedToolset); + mSavedToolset = NULL; + } +} + +void LLFloaterPathfindingConsole::updateCharacterWidth() +{ + LLPathfindingPathTool::getInstance()->setCharacterWidth(mCharacterWidthSlider->getValueF32()); +} + +void LLFloaterPathfindingConsole::updateCharacterType() +{ + LLPathfindingPathTool::ECharacterType characterType; + + switch (mCharacterTypeComboBox->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_NONE : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + break; + case XUI_CHARACTER_TYPE_A : + characterType = LLPathfindingPathTool::kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = LLPathfindingPathTool::kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = LLPathfindingPathTool::kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = LLPathfindingPathTool::kCharacterTypeD; + break; + default : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + llassert(0); + break; } + + LLPathfindingPathTool::getInstance()->setCharacterType(characterType); +} + +void LLFloaterPathfindingConsole::clearPath() +{ + LLPathfindingPathTool::getInstance()->clearPath(); } void LLFloaterPathfindingConsole::updatePathTestStatus() @@ -983,29 +954,47 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() std::string statusText(""); LLStyle::Params styleParams; - if (!mHasStartPoint && !mHasEndPoint) + switch (LLPathfindingPathTool::getInstance()->getPathStatus()) { + case LLPathfindingPathTool::kPathStatusUnknown : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints : statusText = getString("pathing_choose_start_and_end_points"); styleParams.color = warningColor; - } - else if (!mHasStartPoint && mHasEndPoint) - { + break; + case LLPathfindingPathTool::kPathStatusChooseStartPoint : statusText = getString("pathing_choose_start_point"); styleParams.color = warningColor; - } - else if (mHasStartPoint && !mHasEndPoint) - { + break; + case LLPathfindingPathTool::kPathStatusChooseEndPoint : statusText = getString("pathing_choose_end_point"); styleParams.color = warningColor; - } - else if (mHasValidPath) - { + break; + case LLPathfindingPathTool::kPathStatusHasValidPath : statusText = getString("pathing_path_valid"); - } - else - { + break; + case LLPathfindingPathTool::kPathStatusHasInvalidPath : statusText = getString("pathing_path_invalid"); styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotEnabled : + statusText = getString("pathing_region_not_enabled"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotImplemented : + statusText = getString("pathing_library_not_implemented"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusError : + statusText = getString("pathing_error"); + styleParams.color = errorColor; + break; + default : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; } mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); -- cgit v1.2.3 From df47f35d8fce6eb84ca4b26112e7af506616f4a5 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 10 Apr 2012 11:09:28 -0700 Subject: Altering how the toolset is swapped into and out-of test path mode. --- indra/newview/llfloaterpathfindingconsole.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 7941fd52af..afbf589e5e 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -891,17 +891,21 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat void LLFloaterPathfindingConsole::switchIntoTestPathMode() { llassert(mPathfindingToolset != NULL); - llassert(mSavedToolset == NULL); - mSavedToolset = LLToolMgr::getInstance()->getCurrentToolset(); - LLToolMgr::getInstance()->setCurrentToolset(mPathfindingToolset); + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset) + { + mSavedToolset = toolMgrInstance->getCurrentToolset(); + toolMgrInstance->setCurrentToolset(mPathfindingToolset); + } } void LLFloaterPathfindingConsole::switchOutOfTestPathMode() { llassert(mPathfindingToolset != NULL); - if (mSavedToolset != NULL) + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset) { - LLToolMgr::getInstance()->setCurrentToolset(mSavedToolset); + toolMgrInstance->setCurrentToolset(mSavedToolset); mSavedToolset = NULL; } } -- cgit v1.2.3 From ba2a9aa8ca4c690a051269b973a20bbba0c0b572 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 10 Apr 2012 12:34:03 -0700 Subject: Ensuring that the defaults are synced after building the pathfinding console and pathfinding path tool. --- indra/newview/llfloaterpathfindingconsole.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index afbf589e5e..fec26f9722 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -158,6 +158,8 @@ BOOL LLFloaterPathfindingConsole::postBuild() mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); mPathfindingToolset->addTool(LLToolCamera::getInstance()); mPathfindingToolset->setShowFloaterTools(false); + updateCharacterWidth(); + updateCharacterType(); return LLFloater::postBuild(); } -- cgit v1.2.3 From 1cdef4903daea1622923550b1328b659a594b029 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 18 Apr 2012 16:03:33 -0700 Subject: Updating to the latest llphysicextensions pre-built package with the now lowercased version of the header file names. --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index fec26f9722..59f72edc61 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -48,7 +48,7 @@ #include "lltoolmgr.h" #include "lltoolfocus.h" -#include "LLPathingLib.h" +#include "llpathinglib.h" #define XUI_RENDER_HEATMAP_NONE 0 #define XUI_RENDER_HEATMAP_A 1 -- cgit v1.2.3 From d2850572a452d74625a9b736563c479bc5f1e4cc Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 18 Apr 2012 18:22:06 -0700 Subject: Updating llpathinglibrary method calls to cleaned-up version of the library interface. --- indra/newview/llfloaterpathfindingconsole.cpp | 90 +++++---------------------- 1 file changed, 15 insertions(+), 75 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 59f72edc61..92011a9524 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -333,85 +333,55 @@ void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) mShowXRayCheckBox->set(pIsRenderXRay); } -LLFloaterPathfindingConsole::ERenderHeatmapType LLFloaterPathfindingConsole::getRenderHeatmapType() const +LLPathingLib::LLPLCharacterType LLFloaterPathfindingConsole::getRenderHeatmapType() const { - ERenderHeatmapType renderHeatmapType; + LLPathingLib::LLPLCharacterType renderHeatmapType; switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) { case XUI_RENDER_HEATMAP_NONE : - renderHeatmapType = kRenderHeatmapNone; + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; break; case XUI_RENDER_HEATMAP_A : - renderHeatmapType = kRenderHeatmapA; + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_A; break; case XUI_RENDER_HEATMAP_B : - renderHeatmapType = kRenderHeatmapB; + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_B; break; case XUI_RENDER_HEATMAP_C : - renderHeatmapType = kRenderHeatmapC; + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_C; break; case XUI_RENDER_HEATMAP_D : - renderHeatmapType = kRenderHeatmapD; + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_D; break; default : - renderHeatmapType = kRenderHeatmapNone; + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; llassert(0); break; } - LLPathingLib::getInstance()->rebuildNavMesh( getHeatMapType() ); return renderHeatmapType; } -int LLFloaterPathfindingConsole::getHeatMapType() const -{ - //converts the pathfinding console values to the navmesh filter values - - int renderHeatmapType = 4; //none - - switch ( mShowNavMeshWalkabilityComboBox->getValue().asInteger() ) - { - case XUI_RENDER_HEATMAP_A : - renderHeatmapType = 0; - break; - case XUI_RENDER_HEATMAP_B : - renderHeatmapType = 1; - break; - case XUI_RENDER_HEATMAP_C : - renderHeatmapType = 2; - break; - case XUI_RENDER_HEATMAP_D : - renderHeatmapType = 3; - break; - default : - renderHeatmapType = 4; - break; - } - - return renderHeatmapType; -} - - -void LLFloaterPathfindingConsole::setRenderHeatmapType(ERenderHeatmapType pRenderHeatmapType) +void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType) { LLSD comboBoxValue; switch (pRenderHeatmapType) { - case kRenderHeatmapNone : + case LLPathingLib::LLPL_CHARACTER_TYPE_NONE : comboBoxValue = XUI_RENDER_HEATMAP_NONE; break; - case kRenderHeatmapA : + case LLPathingLib::LLPL_CHARACTER_TYPE_A : comboBoxValue = XUI_RENDER_HEATMAP_A; break; - case kRenderHeatmapB : + case LLPathingLib::LLPL_CHARACTER_TYPE_B : comboBoxValue = XUI_RENDER_HEATMAP_B; break; - case kRenderHeatmapC : + case LLPathingLib::LLPL_CHARACTER_TYPE_C : comboBoxValue = XUI_RENDER_HEATMAP_C; break; - case kRenderHeatmapD : + case LLPathingLib::LLPL_CHARACTER_TYPE_D : comboBoxValue = XUI_RENDER_HEATMAP_D; break; default : @@ -470,37 +440,7 @@ LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() void LLFloaterPathfindingConsole::onShowWalkabilitySet() { - switch (getRenderHeatmapType()) - { - case kRenderHeatmapNone : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapNone" - << llendl; - break; - case kRenderHeatmapA : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapA" - << llendl; - break; - case kRenderHeatmapB : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapB" - << llendl; - break; - case kRenderHeatmapC : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapC" - << llendl; - break; - case kRenderHeatmapD : - llwarns << "functionality has not yet been implemented to toggle '" - << mShowNavMeshWalkabilityComboBox->getName() << "' to RenderHeatmapD" - << llendl; - break; - default : - llassert(0); - break; - } + LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); } void LLFloaterPathfindingConsole::onViewCharactersClicked() -- cgit v1.2.3 From 12207b5f2ce14503064ea0af273303eec0cb2ce7 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 18 Apr 2012 18:34:54 -0700 Subject: Ensuring that the pathfinding console member variables are private with accessor functions where need be. --- indra/newview/llfloaterpathfindingconsole.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 92011a9524..9c2725e7e8 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -390,7 +390,12 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharact break; } - return mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); + mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); +} + +const LLColor4 &LLFloaterPathfindingConsole::getNavMeshBackgroundColor() const +{ + return mNavMeshColors.mNavMeshClear; } LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) -- cgit v1.2.3 From b025bc0c2a68fa75df23373a1836e22a347f539e Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 18 Apr 2012 18:50:30 -0700 Subject: Cleaning up how the shape flags are being computed and removing an unneeded member variable from the pathfinding console class in the process. --- indra/newview/llfloaterpathfindingconsole.cpp | 68 ++++++++++++--------------- 1 file changed, 30 insertions(+), 38 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 9c2725e7e8..e729fad5a2 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -65,6 +65,8 @@ #define XUI_EDIT_TAB_INDEX 0 #define XUI_TEST_TAB_INDEX 1 +#define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) + LLHandle LLFloaterPathfindingConsole::sInstanceHandle; //--------------------------------------------------------------------------- @@ -433,8 +435,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathEventSlot(), mPathfindingToolset(NULL), mSavedToolset(NULL), - mConsoleState(kConsoleStateUnknown), - mShapeRenderFlags(0U) + mConsoleState(kConsoleStateUnknown) { mSelfHandle.bind(this); } @@ -954,83 +955,74 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const { - if ( isRenderWalkables() || isRenderStaticObstacles() || - isRenderMaterialVolumes() || isRenderExclusionVolumes() ) - { - return true; - } - - return false; + return (isRenderWalkables() || isRenderStaticObstacles() || + isRenderMaterialVolumes() || isRenderExclusionVolumes()); } U32 LLFloaterPathfindingConsole::getRenderShapeFlags() { - resetShapeRenderFlags(); + U32 shapeRenderFlag; - if ( isRenderWalkables() ) + if (isRenderWalkables()) { - setShapeRenderFlag( LLPathingLib::LLST_WalkableObjects ); + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_WalkableObjects); } - if ( isRenderStaticObstacles() ) + if (isRenderStaticObstacles()) { - setShapeRenderFlag( LLPathingLib::LLST_ObstacleObjects ); + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ObstacleObjects); } - if ( isRenderMaterialVolumes() ) + if (isRenderMaterialVolumes()) { - setShapeRenderFlag( LLPathingLib::LLST_MaterialPhantoms ); + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_MaterialPhantoms); } - if ( isRenderExclusionVolumes() ) + if (isRenderExclusionVolumes()) { - setShapeRenderFlag( LLPathingLib::LLST_ExclusionPhantoms ); + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ExclusionPhantoms); } - return mShapeRenderFlags; + + return shapeRenderFlag; } void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() { - - LLPathingLib::NavMeshColors colors; - LLColor4 in = gSavedSettings.getColor4("PathfindingWalkable"); - colors.mWalkable= LLColor4U(in); + mNavMeshColors.mWalkable= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingObstacle"); - colors.mObstacle= LLColor4U(in); + mNavMeshColors.mObstacle= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingMaterial"); - colors.mMaterial= LLColor4U(in); + mNavMeshColors.mMaterial= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingExclusion"); - colors.mExclusion= LLColor4U(in); + mNavMeshColors.mExclusion= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingConnectedEdge"); - colors.mConnectedEdge= LLColor4U(in); + mNavMeshColors.mConnectedEdge= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingBoundaryEdge"); - colors.mBoundaryEdge= LLColor4U(in); + mNavMeshColors.mBoundaryEdge= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingHeatColorBase"); - colors.mHeatColorBase= LLVector4(in.mV); + mNavMeshColors.mHeatColorBase= LLVector4(in.mV); in = gSavedSettings.getColor4("PathfindingHeatColorMax"); - colors.mHeatColorMax= LLVector4( in.mV ); + mNavMeshColors.mHeatColorMax= LLVector4( in.mV ); in = gSavedSettings.getColor4("PathfindingFaceColor"); - colors.mFaceColor= LLColor4U(in); + mNavMeshColors.mFaceColor= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingStarValidColor"); - colors.mStarValid= LLColor4U(in); + mNavMeshColors.mStarValid= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingStarInvalidColor"); - colors.mStarInvalid= LLColor4U(in); + mNavMeshColors.mStarInvalid= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingTestPathColor"); - colors.mTestPath= LLColor4U(in); + mNavMeshColors.mTestPath= LLColor4U(in); in = gSavedSettings.getColor4("PathfindingNavMeshClear"); - colors.mNavMeshClear= LLColor4(in); - - mNavMeshColors = colors; + mNavMeshColors.mNavMeshClear= LLColor4(in); - LLPathingLib::getInstance()->setNavMeshColors( colors ); + LLPathingLib::getInstance()->setNavMeshColors(mNavMeshColors); } -- cgit v1.2.3 From 4f2584aaac5f748530695dc1f150188b69318676 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 19 Apr 2012 10:38:05 -0700 Subject: BUILDFIX: Correcting a linux/mac build issue. --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index e729fad5a2..962ff74459 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -961,7 +961,7 @@ BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const U32 LLFloaterPathfindingConsole::getRenderShapeFlags() { - U32 shapeRenderFlag; + U32 shapeRenderFlag = 0U; if (isRenderWalkables()) { -- cgit v1.2.3 From 2d011abb6b09e35ab64b6133fbed8d617d2add88 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 19 Apr 2012 12:32:17 -0700 Subject: Cleaning up the navmesh colors a bit. --- indra/newview/llfloaterpathfindingconsole.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 962ff74459..1e10e346a8 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -395,11 +395,6 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharact mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); } -const LLColor4 &LLFloaterPathfindingConsole::getNavMeshBackgroundColor() const -{ - return mNavMeshColors.mNavMeshClear; -} - LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), @@ -1003,11 +998,9 @@ void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() in = gSavedSettings.getColor4("PathfindingBoundaryEdge"); mNavMeshColors.mBoundaryEdge= LLColor4U(in); - in = gSavedSettings.getColor4("PathfindingHeatColorBase"); - mNavMeshColors.mHeatColorBase= LLVector4(in.mV); + mNavMeshColors.mHeatColorBase = gSavedSettings.getColor4("PathfindingHeatColorBase"); - in = gSavedSettings.getColor4("PathfindingHeatColorMax"); - mNavMeshColors.mHeatColorMax= LLVector4( in.mV ); + mNavMeshColors.mHeatColorMax = gSavedSettings.getColor4("PathfindingHeatColorMax"); in = gSavedSettings.getColor4("PathfindingFaceColor"); mNavMeshColors.mFaceColor= LLColor4U(in); @@ -1021,8 +1014,5 @@ void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() in = gSavedSettings.getColor4("PathfindingTestPathColor"); mNavMeshColors.mTestPath= LLColor4U(in); - in = gSavedSettings.getColor4("PathfindingNavMeshClear"); - mNavMeshColors.mNavMeshClear= LLColor4(in); - LLPathingLib::getInstance()->setNavMeshColors(mNavMeshColors); } -- cgit v1.2.3 From 01906a6ce44b9ff995625756abab78dcb6b369ec Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 19 Apr 2012 16:08:24 -0700 Subject: Making the pathfinding color settings automatically adjust the current display without reloading. --- indra/newview/llfloaterpathfindingconsole.cpp | 203 ++++++++++++++++++++++---- 1 file changed, 173 insertions(+), 30 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 1e10e346a8..1c7e336375 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -32,6 +32,7 @@ #include "llsd.h" #include "llhandle.h" +#include "llcontrol.h" #include "llpanel.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -67,6 +68,19 @@ #define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) +#define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable" +#define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle" +#define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial" +#define CONTROL_NAME_EXCLUSION_VOLUMES "PathfindingExclusion" +#define CONTROL_NAME_INTERIOR_EDGE "PathfindingConnectedEdge" +#define CONTROL_NAME_EXTERIOR_EDGE "PathfindingBoundaryEdge" +#define CONTROL_NAME_HEATMAP_MIN "PathfindingHeatColorBase" +#define CONTROL_NAME_HEATMAP_MAX "PathfindingHeatColorMax" +#define CONTROL_NAME_NAVMESH_FACE "PathfindingFaceColor" +#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingStarValidColor" +#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingStarInvalidColor" +#define CONTROL_NAME_TEST_PATH "PathfindingTestPathColor" + LLHandle LLFloaterPathfindingConsole::sInstanceHandle; //--------------------------------------------------------------------------- @@ -163,6 +177,11 @@ BOOL LLFloaterPathfindingConsole::postBuild() updateCharacterWidth(); updateCharacterType(); + if ( !LLPathingLib::getInstance() ) + { + LLPathingLib::initSystem(); + } + return LLFloater::postBuild(); } @@ -170,10 +189,6 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { LLFloater::onOpen(pKey); //make sure we have a pathing system - if ( !LLPathingLib::getInstance() ) - { - LLPathingLib::initSystem(); - } if ( LLPathingLib::getInstance() == NULL ) { setConsoleState(kConsoleStateLibraryNotImplemented); @@ -181,7 +196,6 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } else { - fillInColorsForNavMeshVisualization(); if (!mNavMeshZoneSlot.connected()) { mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); @@ -189,6 +203,8 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mIsNavMeshUpdating = false; initializeNavMeshZoneForCurrentRegion(); + registerNavMeshColorListeners(); + fillInColorsForNavMeshVisualization(); } if (!mAgentStateSlot.connected()) @@ -244,6 +260,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { mNavMeshZone.disable(); } + deregisterNavMeshColorListeners(); setDefaultInputs(); setConsoleState(kConsoleStateUnknown); @@ -430,6 +447,18 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathEventSlot(), mPathfindingToolset(NULL), mSavedToolset(NULL), + mSavedSettingWalkableSlot(), + mSavedSettingStaticObstacleSlot(), + mSavedSettingMaterialVolumeSlot(), + mSavedSettingExclusionVolumeSlot(), + mSavedSettingInteriorEdgeSlot(), + mSavedSettingExteriorEdgeSlot(), + mSavedSettingHeatmapMinSlot(), + mSavedSettingHeatmapMaxSlot(), + mSavedSettingNavMeshFaceSlot(), + mSavedSettingTestPathValidEndSlot(), + mSavedSettingTestPathInvalidEndSlot(), + mSavedSettingTestPathSlot(), mConsoleState(kConsoleStateUnknown) { mSelfHandle.bind(this); @@ -978,41 +1007,155 @@ U32 LLFloaterPathfindingConsole::getRenderShapeFlags() return shapeRenderFlag; } +void LLFloaterPathfindingConsole::registerNavMeshColorListeners() +{ + if (!mSavedSettingWalkableSlot.connected()) + { + mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingStaticObstacleSlot.connected()) + { + mSavedSettingStaticObstacleSlot = gSavedSettings.getControl(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingMaterialVolumeSlot.connected()) + { + mSavedSettingMaterialVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_MATERIAL_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingExclusionVolumeSlot.connected()) + { + mSavedSettingExclusionVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_EXCLUSION_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingInteriorEdgeSlot.connected()) + { + mSavedSettingInteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_INTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingExteriorEdgeSlot.connected()) + { + mSavedSettingExteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_EXTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingHeatmapMinSlot.connected()) + { + mSavedSettingHeatmapMinSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MIN)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingHeatmapMaxSlot.connected()) + { + mSavedSettingHeatmapMaxSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MAX)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingNavMeshFaceSlot.connected()) + { + mSavedSettingNavMeshFaceSlot = gSavedSettings.getControl(CONTROL_NAME_NAVMESH_FACE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathValidEndSlot.connected()) + { + mSavedSettingTestPathValidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_VALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathInvalidEndSlot.connected()) + { + mSavedSettingTestPathInvalidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_INVALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathSlot.connected()) + { + mSavedSettingTestPathSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } +} + +void LLFloaterPathfindingConsole::deregisterNavMeshColorListeners() +{ + if (mSavedSettingWalkableSlot.connected()) + { + mSavedSettingWalkableSlot.disconnect(); + } + if (mSavedSettingStaticObstacleSlot.connected()) + { + mSavedSettingStaticObstacleSlot.disconnect(); + } + if (mSavedSettingMaterialVolumeSlot.connected()) + { + mSavedSettingMaterialVolumeSlot.disconnect(); + } + if (mSavedSettingExclusionVolumeSlot.connected()) + { + mSavedSettingExclusionVolumeSlot.disconnect(); + } + if (mSavedSettingInteriorEdgeSlot.connected()) + { + mSavedSettingInteriorEdgeSlot.disconnect(); + } + if (mSavedSettingExteriorEdgeSlot.connected()) + { + mSavedSettingExteriorEdgeSlot.disconnect(); + } + if (mSavedSettingHeatmapMinSlot.connected()) + { + mSavedSettingHeatmapMinSlot.disconnect(); + } + if (mSavedSettingHeatmapMaxSlot.connected()) + { + mSavedSettingHeatmapMaxSlot.disconnect(); + } + if (mSavedSettingNavMeshFaceSlot.connected()) + { + mSavedSettingNavMeshFaceSlot.disconnect(); + } + if (mSavedSettingTestPathValidEndSlot.connected()) + { + mSavedSettingTestPathValidEndSlot.disconnect(); + } + if (mSavedSettingTestPathInvalidEndSlot.connected()) + { + mSavedSettingTestPathInvalidEndSlot.disconnect(); + } + if (mSavedSettingTestPathSlot.connected()) + { + mSavedSettingTestPathSlot.disconnect(); + } +} + +void LLFloaterPathfindingConsole::handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue) +{ + fillInColorsForNavMeshVisualization(); +} + void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() { - LLColor4 in = gSavedSettings.getColor4("PathfindingWalkable"); - mNavMeshColors.mWalkable= LLColor4U(in); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::NavMeshColors navMeshColors; - in = gSavedSettings.getColor4("PathfindingObstacle"); - mNavMeshColors.mObstacle= LLColor4U(in); + LLColor4 in = gSavedSettings.getColor4(CONTROL_NAME_WALKABLE_OBJECTS); + navMeshColors.mWalkable= LLColor4U(in); - in = gSavedSettings.getColor4("PathfindingMaterial"); - mNavMeshColors.mMaterial= LLColor4U(in); + in = gSavedSettings.getColor4(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS); + navMeshColors.mObstacle= LLColor4U(in); - in = gSavedSettings.getColor4("PathfindingExclusion"); - mNavMeshColors.mExclusion= LLColor4U(in); - - in = gSavedSettings.getColor4("PathfindingConnectedEdge"); - mNavMeshColors.mConnectedEdge= LLColor4U(in); + in = gSavedSettings.getColor4(CONTROL_NAME_MATERIAL_VOLUMES); + navMeshColors.mMaterial= LLColor4U(in); - in = gSavedSettings.getColor4("PathfindingBoundaryEdge"); - mNavMeshColors.mBoundaryEdge= LLColor4U(in); + in = gSavedSettings.getColor4(CONTROL_NAME_EXCLUSION_VOLUMES); + navMeshColors.mExclusion= LLColor4U(in); - mNavMeshColors.mHeatColorBase = gSavedSettings.getColor4("PathfindingHeatColorBase"); + in = gSavedSettings.getColor4(CONTROL_NAME_INTERIOR_EDGE); + navMeshColors.mConnectedEdge= LLColor4U(in); - mNavMeshColors.mHeatColorMax = gSavedSettings.getColor4("PathfindingHeatColorMax"); - - in = gSavedSettings.getColor4("PathfindingFaceColor"); - mNavMeshColors.mFaceColor= LLColor4U(in); + in = gSavedSettings.getColor4(CONTROL_NAME_EXTERIOR_EDGE); + navMeshColors.mBoundaryEdge= LLColor4U(in); - in = gSavedSettings.getColor4("PathfindingStarValidColor"); - mNavMeshColors.mStarValid= LLColor4U(in); + navMeshColors.mHeatColorBase = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MIN); - in = gSavedSettings.getColor4("PathfindingStarInvalidColor"); - mNavMeshColors.mStarInvalid= LLColor4U(in); + navMeshColors.mHeatColorMax = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MAX); - in = gSavedSettings.getColor4("PathfindingTestPathColor"); - mNavMeshColors.mTestPath= LLColor4U(in); + in = gSavedSettings.getColor4(CONTROL_NAME_NAVMESH_FACE); + navMeshColors.mFaceColor= LLColor4U(in); - LLPathingLib::getInstance()->setNavMeshColors(mNavMeshColors); + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_VALID_END); + navMeshColors.mStarValid= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_INVALID_END); + navMeshColors.mStarInvalid= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH); + navMeshColors.mTestPath= LLColor4U(in); + + LLPathingLib::getInstance()->setNavMeshColors(navMeshColors); + } } -- cgit v1.2.3 From e73f5ef5620d9774187575610aeaf16b917b7337 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 19 Apr 2012 18:09:53 -0700 Subject: Ensuring that the view characters button is active in builds with stubbed pathing libraries. Also, adding extra label fields to better indicate enabled/disabled controls on the console. --- indra/newview/llfloaterpathfindingconsole.cpp | 122 +++++++++++++++++++++----- 1 file changed, 102 insertions(+), 20 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 1c7e336375..0b86c2a617 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -89,9 +89,15 @@ LLHandle LLFloaterPathfindingConsole::sInstanceHand BOOL LLFloaterPathfindingConsole::postBuild() { + mShowLabel = findChild("show_label"); + llassert(mShowLabel != NULL); + mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshWalkabilityLabel = findChild("show_walkability_label"); + llassert(mShowNavMeshWalkabilityLabel != NULL); + mShowNavMeshWalkabilityComboBox = findChild("show_heatmap_mode"); llassert(mShowNavMeshWalkabilityComboBox != NULL); mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this)); @@ -155,10 +161,25 @@ BOOL LLFloaterPathfindingConsole::postBuild() mPathfindingSimulatorStatus = findChild("pathfinding_simulator_status"); llassert(mPathfindingSimulatorStatus != NULL); + mCtrlClickLabel = findChild("ctrl_click_label"); + llassert(mCtrlClickLabel != NULL); + + mShiftClickLabel = findChild("shift_click_label"); + llassert(mShiftClickLabel != NULL); + + mCharacterWidthLabel = findChild("character_width_label"); + llassert(mCharacterWidthLabel != NULL); + mCharacterWidthSlider = findChild("character_width"); llassert(mCharacterWidthSlider != NULL); mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + mCharacterWidthUnitLabel = findChild("character_width_unit_label"); + llassert(mCharacterWidthUnitLabel != NULL); + + mCharacterTypeLabel = findChild("character_type_label"); + llassert(mCharacterTypeLabel != NULL); + mCharacterTypeComboBox = findChild("path_character_type"); llassert(mCharacterTypeComboBox != NULL); mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); @@ -170,17 +191,21 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mClearPathButton != NULL); mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); - mPathfindingToolset = new LLToolset(); - mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); - mPathfindingToolset->addTool(LLToolCamera::getInstance()); - mPathfindingToolset->setShowFloaterTools(false); - updateCharacterWidth(); - updateCharacterType(); - - if ( !LLPathingLib::getInstance() ) + if (LLPathingLib::getInstance() == NULL) { LLPathingLib::initSystem(); - } + } + + if (LLPathingLib::getInstance() != NULL) + { + mPathfindingToolset = new LLToolset(); + mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); + mPathfindingToolset->addTool(LLToolCamera::getInstance()); + mPathfindingToolset->setShowFloaterTools(false); + } + + updateCharacterWidth(); + updateCharacterType(); return LLFloater::postBuild(); } @@ -415,7 +440,9 @@ void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharact LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), + mShowLabel(), mShowNavMeshCheckBox(NULL), + mShowNavMeshWalkabilityLabel(), mShowNavMeshWalkabilityComboBox(NULL), mShowWalkablesCheckBox(NULL), mShowStaticObstaclesCheckBox(NULL), @@ -435,7 +462,12 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mLinksetsButton(NULL), mFreezeLabel(NULL), mFreezeButton(NULL), + mCtrlClickLabel(), + mShiftClickLabel(), + mCharacterWidthLabel(), + mCharacterWidthUnitLabel(), mCharacterWidthSlider(NULL), + mCharacterTypeLabel(), mCharacterTypeComboBox(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), @@ -625,9 +657,10 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() switch (mConsoleState) { case kConsoleStateUnknown : - case kConsoleStateLibraryNotImplemented : case kConsoleStateRegionNotEnabled : + mShowLabel->setEnabled(FALSE); mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); mShowWalkablesCheckBox->setEnabled(FALSE); mShowStaticObstaclesCheckBox->setEnabled(FALSE); @@ -638,7 +671,36 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mViewCharactersButton->setEnabled(FALSE); mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + clearPath(); + break; + case kConsoleStateLibraryNotImplemented : + mShowLabel->setEnabled(FALSE); + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); clearPath(); @@ -646,7 +708,9 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() case kConsoleStateCheckingVersion : case kConsoleStateDownloading : case kConsoleStateError : + mShowLabel->setEnabled(FALSE); mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); mShowWalkablesCheckBox->setEnabled(FALSE); mShowStaticObstaclesCheckBox->setEnabled(FALSE); @@ -657,13 +721,20 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mViewCharactersButton->setEnabled(TRUE); mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); mCharacterTypeComboBox->setEnabled(FALSE); mClearPathButton->setEnabled(FALSE); clearPath(); break; case kConsoleStateHasNavMesh : + mShowLabel->setEnabled(TRUE); mShowNavMeshCheckBox->setEnabled(TRUE); + mShowNavMeshWalkabilityLabel->setEnabled(TRUE); mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); mShowWalkablesCheckBox->setEnabled(TRUE); mShowStaticObstaclesCheckBox->setEnabled(TRUE); @@ -673,7 +744,12 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowXRayCheckBox->setEnabled(TRUE); mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); + mCtrlClickLabel->setEnabled(TRUE); + mShiftClickLabel->setEnabled(TRUE); + mCharacterWidthLabel->setEnabled(TRUE); + mCharacterWidthUnitLabel->setEnabled(TRUE); mCharacterWidthSlider->setEnabled(TRUE); + mCharacterTypeLabel->setEnabled(TRUE); mCharacterTypeComboBox->setEnabled(TRUE); mClearPathButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); @@ -862,23 +938,29 @@ void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentStat void LLFloaterPathfindingConsole::switchIntoTestPathMode() { - llassert(mPathfindingToolset != NULL); - LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); - if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset) + if (LLPathingLib::getInstance() != NULL) { - mSavedToolset = toolMgrInstance->getCurrentToolset(); - toolMgrInstance->setCurrentToolset(mPathfindingToolset); + llassert(mPathfindingToolset != NULL); + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset) + { + mSavedToolset = toolMgrInstance->getCurrentToolset(); + toolMgrInstance->setCurrentToolset(mPathfindingToolset); + } } } void LLFloaterPathfindingConsole::switchOutOfTestPathMode() { - llassert(mPathfindingToolset != NULL); - LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); - if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset) + if (LLPathingLib::getInstance() != NULL) { - toolMgrInstance->setCurrentToolset(mSavedToolset); - mSavedToolset = NULL; + llassert(mPathfindingToolset != NULL); + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset) + { + toolMgrInstance->setCurrentToolset(mSavedToolset); + mSavedToolset = NULL; + } } } -- cgit v1.2.3 From de71961b0d400d4989181ee7419942955a775741 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 20 Apr 2012 18:15:55 -0700 Subject: Adding new controls to the console for showing waterplane and world movables only. Also, re-arranging the sorting of the check boxes. --- indra/newview/llfloaterpathfindingconsole.cpp | 107 +++++++++++++++++++++----- 1 file changed, 88 insertions(+), 19 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 0b86c2a617..6b3bc29519 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -92,8 +92,16 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowLabel = findChild("show_label"); llassert(mShowLabel != NULL); + mShowWorldCheckBox = findChild("show_world"); + llassert(mShowWorldCheckBox != NULL); + mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this)); + + mShowWorldMovablesOnlyCheckBox = findChild("show_world_movables_only"); + llassert(mShowWorldMovablesOnlyCheckBox != NULL); + mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshSet, this)); mShowNavMeshWalkabilityLabel = findChild("show_walkability_label"); llassert(mShowNavMeshWalkabilityLabel != NULL); @@ -114,10 +122,10 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); llassert(mShowExclusionVolumesCheckBox != NULL); - mShowWorldCheckBox = findChild("show_world"); - llassert(mShowWorldCheckBox != NULL); + mShowRenderWaterPlaneCheckBox = findChild("show_water_plane"); + llassert(mShowRenderWaterPlaneCheckBox != NULL); - mShowXRayCheckBox = findChild("x-ray"); + mShowXRayCheckBox = findChild("show_xray"); llassert(mShowXRayCheckBox != NULL); mViewCharactersButton = findChild("view_characters_floater"); @@ -315,6 +323,7 @@ BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) { mShowNavMeshCheckBox->set(pIsRenderNavMesh); + setNavMeshRenderState(); } BOOL LLFloaterPathfindingConsole::isRenderWalkables() const @@ -365,6 +374,27 @@ BOOL LLFloaterPathfindingConsole::isRenderWorld() const void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) { mShowWorldCheckBox->set(pIsRenderWorld); + setWorldRenderState(); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorldMovablesOnly() const +{ + return (mShowWorldCheckBox->get() && mShowWorldMovablesOnlyCheckBox->get()); +} + +void LLFloaterPathfindingConsole::setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly) +{ + mShowWorldMovablesOnlyCheckBox->set(pIsRenderWorldMovablesOnly); +} + +BOOL LLFloaterPathfindingConsole::isRenderWaterPlane() const +{ + return mShowRenderWaterPlaneCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWaterPlane(BOOL pIsRenderWaterPlane) +{ + mShowRenderWaterPlaneCheckBox->set(pIsRenderWaterPlane); } BOOL LLFloaterPathfindingConsole::isRenderXRay() const @@ -441,6 +471,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) : LLFloater(pSeed), mSelfHandle(), mShowLabel(), + mShowWorldCheckBox(NULL), + mShowWorldMovablesOnlyCheckBox(NULL), mShowNavMeshCheckBox(NULL), mShowNavMeshWalkabilityLabel(), mShowNavMeshWalkabilityComboBox(NULL), @@ -448,7 +480,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mShowStaticObstaclesCheckBox(NULL), mShowMaterialVolumesCheckBox(NULL), mShowExclusionVolumesCheckBox(NULL), - mShowWorldCheckBox(NULL), + mShowRenderWaterPlaneCheckBox(NULL), mShowXRayCheckBox(NULL), mPathfindingViewerStatus(NULL), mPathfindingSimulatorStatus(NULL), @@ -500,6 +532,16 @@ LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() { } +void LLFloaterPathfindingConsole::onShowWorldSet() +{ + setWorldRenderState(); +} + +void LLFloaterPathfindingConsole::onShowNavMeshSet() +{ + setNavMeshRenderState(); +} + void LLFloaterPathfindingConsole::onShowWalkabilitySet() { LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); @@ -596,7 +638,8 @@ void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentSta void LLFloaterPathfindingConsole::onRegionBoundaryCross() { initializeNavMeshZoneForCurrentRegion(); - mShowWorldCheckBox->set(TRUE); + setRenderWorld(TRUE); + setRenderWorldMovablesOnly(FALSE); } void LLFloaterPathfindingConsole::onPathEvent() @@ -636,13 +679,14 @@ void LLFloaterPathfindingConsole::onPathEvent() void LLFloaterPathfindingConsole::setDefaultInputs() { mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX); - mShowNavMeshCheckBox->set(FALSE); - mShowWalkablesCheckBox->set(FALSE); - mShowMaterialVolumesCheckBox->set(FALSE); - mShowStaticObstaclesCheckBox->set(FALSE); - mShowExclusionVolumesCheckBox->set(FALSE); - mShowWorldCheckBox->set(TRUE); - mShowXRayCheckBox->set(FALSE); + setRenderWorld(TRUE); + setRenderNavMesh(FALSE); + setRenderWalkables(FALSE); + setRenderMaterialVolumes(FALSE); + setRenderStaticObstacles(FALSE); + setRenderExclusionVolumes(FALSE); + setRenderWaterPlane(FALSE); + setRenderXRay(FALSE); } void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) @@ -652,6 +696,25 @@ void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) updateStatusOnConsoleState(); } +void LLFloaterPathfindingConsole::setWorldRenderState() +{ + BOOL renderWorld = isRenderWorld(); + + mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld); + if (!renderWorld) + { + mShowWorldMovablesOnlyCheckBox->set(FALSE); + } +} + +void LLFloaterPathfindingConsole::setNavMeshRenderState() +{ + BOOL renderNavMesh = isRenderNavMesh(); + + mShowNavMeshWalkabilityLabel->setEnabled(renderNavMesh); + mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh); +} + void LLFloaterPathfindingConsole::updateControlsOnConsoleState() { switch (mConsoleState) @@ -659,6 +722,8 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() case kConsoleStateUnknown : case kConsoleStateRegionNotEnabled : mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); mShowNavMeshCheckBox->setEnabled(FALSE); mShowNavMeshWalkabilityLabel->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); @@ -666,7 +731,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowStaticObstaclesCheckBox->setEnabled(FALSE); mShowMaterialVolumesCheckBox->setEnabled(FALSE); mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(FALSE); mEditTestTabContainer->selectTab(0); @@ -683,6 +748,8 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() break; case kConsoleStateLibraryNotImplemented : mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); mShowNavMeshCheckBox->setEnabled(FALSE); mShowNavMeshWalkabilityLabel->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); @@ -690,7 +757,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowStaticObstaclesCheckBox->setEnabled(FALSE); mShowMaterialVolumesCheckBox->setEnabled(FALSE); mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(TRUE); mEditTestTabContainer->selectTab(0); @@ -709,6 +776,8 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() case kConsoleStateDownloading : case kConsoleStateError : mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); mShowNavMeshCheckBox->setEnabled(FALSE); mShowNavMeshWalkabilityLabel->setEnabled(FALSE); mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); @@ -716,7 +785,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowStaticObstaclesCheckBox->setEnabled(FALSE); mShowMaterialVolumesCheckBox->setEnabled(FALSE); mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(TRUE); mEditTestTabContainer->selectTab(0); @@ -733,14 +802,15 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() break; case kConsoleStateHasNavMesh : mShowLabel->setEnabled(TRUE); + mShowWorldCheckBox->setEnabled(TRUE); + setWorldRenderState(); mShowNavMeshCheckBox->setEnabled(TRUE); - mShowNavMeshWalkabilityLabel->setEnabled(TRUE); - mShowNavMeshWalkabilityComboBox->setEnabled(TRUE); + setNavMeshRenderState(); mShowWalkablesCheckBox->setEnabled(TRUE); mShowStaticObstaclesCheckBox->setEnabled(TRUE); mShowMaterialVolumesCheckBox->setEnabled(TRUE); mShowExclusionVolumesCheckBox->setEnabled(TRUE); - mShowWorldCheckBox->setEnabled(TRUE); + mShowRenderWaterPlaneCheckBox->setEnabled(TRUE); mShowXRayCheckBox->setEnabled(TRUE); mViewCharactersButton->setEnabled(TRUE); mTestTab->setEnabled(TRUE); @@ -752,7 +822,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mCharacterTypeLabel->setEnabled(TRUE); mCharacterTypeComboBox->setEnabled(TRUE); mClearPathButton->setEnabled(TRUE); - mTestTab->setEnabled(TRUE); break; default : llassert(0); -- cgit v1.2.3 From c32f12afd3e6d22614a84a81918c26b5f82e5efa Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 24 Apr 2012 12:14:17 -0400 Subject: Added support for rendering the regions water height. Also added initial support for a simple shape vb which allows us to create and expand from for one off shapes --- indra/newview/llfloaterpathfindingconsole.cpp | 2633 +++++++++++++------------ 1 file changed, 1321 insertions(+), 1312 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 6b3bc29519..e89d0c2cab 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,1312 +1,1321 @@ -/** -* @file llfloaterpathfindingconsole.cpp -* @author William Todd Stinson -* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. -* -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" -#include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" -#include "llfloaterpathfindingcharacters.h" - -#include "llsd.h" -#include "llhandle.h" -#include "llcontrol.h" -#include "llpanel.h" -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llsliderctrl.h" -#include "lllineeditor.h" -#include "lltextbase.h" -#include "lltabcontainer.h" -#include "llcombobox.h" -#include "llfloaterreg.h" -#include "llpathfindingnavmeshzone.h" -#include "llpathfindingmanager.h" -#include "llenvmanager.h" -#include "llpathfindingpathtool.h" -#include "lltoolmgr.h" -#include "lltoolfocus.h" - -#include "llpathinglib.h" - -#define XUI_RENDER_HEATMAP_NONE 0 -#define XUI_RENDER_HEATMAP_A 1 -#define XUI_RENDER_HEATMAP_B 2 -#define XUI_RENDER_HEATMAP_C 3 -#define XUI_RENDER_HEATMAP_D 4 - -#define XUI_CHARACTER_TYPE_NONE 0 -#define XUI_CHARACTER_TYPE_A 1 -#define XUI_CHARACTER_TYPE_B 2 -#define XUI_CHARACTER_TYPE_C 3 -#define XUI_CHARACTER_TYPE_D 4 - -#define XUI_EDIT_TAB_INDEX 0 -#define XUI_TEST_TAB_INDEX 1 - -#define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) - -#define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable" -#define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle" -#define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial" -#define CONTROL_NAME_EXCLUSION_VOLUMES "PathfindingExclusion" -#define CONTROL_NAME_INTERIOR_EDGE "PathfindingConnectedEdge" -#define CONTROL_NAME_EXTERIOR_EDGE "PathfindingBoundaryEdge" -#define CONTROL_NAME_HEATMAP_MIN "PathfindingHeatColorBase" -#define CONTROL_NAME_HEATMAP_MAX "PathfindingHeatColorMax" -#define CONTROL_NAME_NAVMESH_FACE "PathfindingFaceColor" -#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingStarValidColor" -#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingStarInvalidColor" -#define CONTROL_NAME_TEST_PATH "PathfindingTestPathColor" - -LLHandle LLFloaterPathfindingConsole::sInstanceHandle; - -//--------------------------------------------------------------------------- -// LLFloaterPathfindingConsole -//--------------------------------------------------------------------------- - -BOOL LLFloaterPathfindingConsole::postBuild() -{ - mShowLabel = findChild("show_label"); - llassert(mShowLabel != NULL); - - mShowWorldCheckBox = findChild("show_world"); - llassert(mShowWorldCheckBox != NULL); - mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this)); - - mShowWorldMovablesOnlyCheckBox = findChild("show_world_movables_only"); - llassert(mShowWorldMovablesOnlyCheckBox != NULL); - - mShowNavMeshCheckBox = findChild("show_navmesh"); - llassert(mShowNavMeshCheckBox != NULL); - mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshSet, this)); - - mShowNavMeshWalkabilityLabel = findChild("show_walkability_label"); - llassert(mShowNavMeshWalkabilityLabel != NULL); - - mShowNavMeshWalkabilityComboBox = findChild("show_heatmap_mode"); - llassert(mShowNavMeshWalkabilityComboBox != NULL); - mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this)); - - mShowWalkablesCheckBox = findChild("show_walkables"); - llassert(mShowWalkablesCheckBox != NULL); - - mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); - llassert(mShowStaticObstaclesCheckBox != NULL); - - mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); - llassert(mShowMaterialVolumesCheckBox != NULL); - - mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); - llassert(mShowExclusionVolumesCheckBox != NULL); - - mShowRenderWaterPlaneCheckBox = findChild("show_water_plane"); - llassert(mShowRenderWaterPlaneCheckBox != NULL); - - mShowXRayCheckBox = findChild("show_xray"); - llassert(mShowXRayCheckBox != 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); - mEditTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this)); - - mEditTab = findChild("edit_panel"); - llassert(mEditTab != NULL); - - mTestTab = findChild("test_panel"); - llassert(mTestTab != 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)); - - mPathfindingViewerStatus = findChild("pathfinding_viewer_status"); - llassert(mPathfindingViewerStatus != NULL); - - mPathfindingSimulatorStatus = findChild("pathfinding_simulator_status"); - llassert(mPathfindingSimulatorStatus != NULL); - - mCtrlClickLabel = findChild("ctrl_click_label"); - llassert(mCtrlClickLabel != NULL); - - mShiftClickLabel = findChild("shift_click_label"); - llassert(mShiftClickLabel != NULL); - - mCharacterWidthLabel = findChild("character_width_label"); - llassert(mCharacterWidthLabel != NULL); - - mCharacterWidthSlider = findChild("character_width"); - llassert(mCharacterWidthSlider != NULL); - mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); - - mCharacterWidthUnitLabel = findChild("character_width_unit_label"); - llassert(mCharacterWidthUnitLabel != NULL); - - mCharacterTypeLabel = findChild("character_type_label"); - llassert(mCharacterTypeLabel != NULL); - - mCharacterTypeComboBox = findChild("path_character_type"); - llassert(mCharacterTypeComboBox != NULL); - mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); - - mPathTestingStatus = findChild("path_test_status"); - llassert(mPathTestingStatus != NULL); - - mClearPathButton = findChild("clear_path"); - llassert(mClearPathButton != NULL); - mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); - - if (LLPathingLib::getInstance() == NULL) - { - LLPathingLib::initSystem(); - } - - if (LLPathingLib::getInstance() != NULL) - { - mPathfindingToolset = new LLToolset(); - mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); - mPathfindingToolset->addTool(LLToolCamera::getInstance()); - mPathfindingToolset->setShowFloaterTools(false); - } - - updateCharacterWidth(); - updateCharacterType(); - - return LLFloater::postBuild(); -} - -void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) -{ - LLFloater::onOpen(pKey); - //make sure we have a pathing system - if ( LLPathingLib::getInstance() == NULL ) - { - setConsoleState(kConsoleStateLibraryNotImplemented); - llwarns <<"Errror: cannot find pathing library implementation."<registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); - } - - if (!mRegionBoundarySlot.connected()) - { - mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); - } - - if (!mPathEventSlot.connected()) - { - mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this)); - } - - setAgentState(LLPathfindingManager::getInstance()->getAgentState()); - setDefaultInputs(); - updatePathTestStatus(); - - if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) - { - switchIntoTestPathMode(); - } -} - -void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) -{ - switchOutOfTestPathMode(); - - if (mPathEventSlot.connected()) - { - mPathEventSlot.disconnect(); - } - - if (mRegionBoundarySlot.connected()) - { - mRegionBoundarySlot.disconnect(); - } - - if (mAgentStateSlot.connected()) - { - mAgentStateSlot.disconnect(); - } - - if (mNavMeshZoneSlot.connected()) - { - mNavMeshZoneSlot.disconnect(); - } - - if (LLPathingLib::getInstance() != NULL) - { - mNavMeshZone.disable(); - } - deregisterNavMeshColorListeners(); - - setDefaultInputs(); - setConsoleState(kConsoleStateUnknown); - - LLFloater::onClose(pIsAppQuitting); -} - -LLHandle LLFloaterPathfindingConsole::getInstanceHandle() -{ - if (sInstanceHandle.isDead()) - { - LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::getTypedInstance("pathfinding_console"); - if (floaterInstance != NULL) - { - sInstanceHandle = floaterInstance->mSelfHandle; - } - } - - return sInstanceHandle; -} - -BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const -{ - return mShowNavMeshCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) -{ - mShowNavMeshCheckBox->set(pIsRenderNavMesh); - setNavMeshRenderState(); -} - -BOOL LLFloaterPathfindingConsole::isRenderWalkables() const -{ - return mShowWalkablesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) -{ - mShowWalkablesCheckBox->set(pIsRenderWalkables); -} - -BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const -{ - return mShowStaticObstaclesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) -{ - mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); -} - -BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const -{ - return mShowMaterialVolumesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) -{ - mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); -} - -BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const -{ - return mShowExclusionVolumesCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) -{ - mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); -} - -BOOL LLFloaterPathfindingConsole::isRenderWorld() const -{ - return mShowWorldCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) -{ - mShowWorldCheckBox->set(pIsRenderWorld); - setWorldRenderState(); -} - -BOOL LLFloaterPathfindingConsole::isRenderWorldMovablesOnly() const -{ - return (mShowWorldCheckBox->get() && mShowWorldMovablesOnlyCheckBox->get()); -} - -void LLFloaterPathfindingConsole::setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly) -{ - mShowWorldMovablesOnlyCheckBox->set(pIsRenderWorldMovablesOnly); -} - -BOOL LLFloaterPathfindingConsole::isRenderWaterPlane() const -{ - return mShowRenderWaterPlaneCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderWaterPlane(BOOL pIsRenderWaterPlane) -{ - mShowRenderWaterPlaneCheckBox->set(pIsRenderWaterPlane); -} - -BOOL LLFloaterPathfindingConsole::isRenderXRay() const -{ - return mShowXRayCheckBox->get(); -} - -void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) -{ - mShowXRayCheckBox->set(pIsRenderXRay); -} - -LLPathingLib::LLPLCharacterType LLFloaterPathfindingConsole::getRenderHeatmapType() const -{ - LLPathingLib::LLPLCharacterType renderHeatmapType; - - switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) - { - case XUI_RENDER_HEATMAP_NONE : - renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - break; - case XUI_RENDER_HEATMAP_A : - renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_A; - break; - case XUI_RENDER_HEATMAP_B : - renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_B; - break; - case XUI_RENDER_HEATMAP_C : - renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_C; - break; - case XUI_RENDER_HEATMAP_D : - renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_D; - break; - default : - renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; - llassert(0); - break; - } - - return renderHeatmapType; -} - -void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType) -{ - LLSD comboBoxValue; - - switch (pRenderHeatmapType) - { - case LLPathingLib::LLPL_CHARACTER_TYPE_NONE : - comboBoxValue = XUI_RENDER_HEATMAP_NONE; - break; - case LLPathingLib::LLPL_CHARACTER_TYPE_A : - comboBoxValue = XUI_RENDER_HEATMAP_A; - break; - case LLPathingLib::LLPL_CHARACTER_TYPE_B : - comboBoxValue = XUI_RENDER_HEATMAP_B; - break; - case LLPathingLib::LLPL_CHARACTER_TYPE_C : - comboBoxValue = XUI_RENDER_HEATMAP_C; - break; - case LLPathingLib::LLPL_CHARACTER_TYPE_D : - comboBoxValue = XUI_RENDER_HEATMAP_D; - break; - default : - comboBoxValue = XUI_RENDER_HEATMAP_NONE; - llassert(0); - break; - } - - mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); -} - -LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) - : LLFloater(pSeed), - mSelfHandle(), - mShowLabel(), - mShowWorldCheckBox(NULL), - mShowWorldMovablesOnlyCheckBox(NULL), - mShowNavMeshCheckBox(NULL), - mShowNavMeshWalkabilityLabel(), - mShowNavMeshWalkabilityComboBox(NULL), - mShowWalkablesCheckBox(NULL), - mShowStaticObstaclesCheckBox(NULL), - mShowMaterialVolumesCheckBox(NULL), - mShowExclusionVolumesCheckBox(NULL), - mShowRenderWaterPlaneCheckBox(NULL), - mShowXRayCheckBox(NULL), - mPathfindingViewerStatus(NULL), - mPathfindingSimulatorStatus(NULL), - mViewCharactersButton(NULL), - mEditTestTabContainer(NULL), - mEditTab(NULL), - mTestTab(NULL), - mUnfreezeLabel(NULL), - mUnfreezeButton(NULL), - mLinksetsLabel(NULL), - mLinksetsButton(NULL), - mFreezeLabel(NULL), - mFreezeButton(NULL), - mCtrlClickLabel(), - mShiftClickLabel(), - mCharacterWidthLabel(), - mCharacterWidthUnitLabel(), - mCharacterWidthSlider(NULL), - mCharacterTypeLabel(), - mCharacterTypeComboBox(NULL), - mPathTestingStatus(NULL), - mClearPathButton(NULL), - mNavMeshZoneSlot(), - mNavMeshZone(), - mIsNavMeshUpdating(false), - mAgentStateSlot(), - mRegionBoundarySlot(), - mPathEventSlot(), - mPathfindingToolset(NULL), - mSavedToolset(NULL), - mSavedSettingWalkableSlot(), - mSavedSettingStaticObstacleSlot(), - mSavedSettingMaterialVolumeSlot(), - mSavedSettingExclusionVolumeSlot(), - mSavedSettingInteriorEdgeSlot(), - mSavedSettingExteriorEdgeSlot(), - mSavedSettingHeatmapMinSlot(), - mSavedSettingHeatmapMaxSlot(), - mSavedSettingNavMeshFaceSlot(), - mSavedSettingTestPathValidEndSlot(), - mSavedSettingTestPathInvalidEndSlot(), - mSavedSettingTestPathSlot(), - mConsoleState(kConsoleStateUnknown) -{ - mSelfHandle.bind(this); -} - -LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() -{ -} - -void LLFloaterPathfindingConsole::onShowWorldSet() -{ - setWorldRenderState(); -} - -void LLFloaterPathfindingConsole::onShowNavMeshSet() -{ - setNavMeshRenderState(); -} - -void LLFloaterPathfindingConsole::onShowWalkabilitySet() -{ - LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); -} - -void LLFloaterPathfindingConsole::onViewCharactersClicked() -{ - LLFloaterPathfindingCharacters::openCharactersViewer(); -} - -void LLFloaterPathfindingConsole::onTabSwitch() -{ - if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) - { - switchIntoTestPathMode(); - } - else - { - switchOutOfTestPathMode(); - } -} - -void LLFloaterPathfindingConsole::onUnfreezeClicked() -{ - mUnfreezeButton->setEnabled(FALSE); - LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); -} - -void LLFloaterPathfindingConsole::onFreezeClicked() -{ - mFreezeButton->setEnabled(FALSE); - LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); -} - -void LLFloaterPathfindingConsole::onViewEditLinksetClicked() -{ - LLFloaterPathfindingLinksets::openLinksetsEditor(); -} - -void LLFloaterPathfindingConsole::onCharacterWidthSet() -{ - updateCharacterWidth(); -} - -void LLFloaterPathfindingConsole::onCharacterTypeSwitch() -{ - updateCharacterType(); -} - -void LLFloaterPathfindingConsole::onClearPathClicked() -{ - clearPath(); -} - -void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) -{ - switch (pNavMeshZoneRequestStatus) - { - case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : - setConsoleState(kConsoleStateUnknown); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : - setConsoleState(kConsoleStateCheckingVersion); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : - mIsNavMeshUpdating = true; - mNavMeshZone.refresh(); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : - setConsoleState(kConsoleStateDownloading); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted : - mIsNavMeshUpdating = false; - setConsoleState(kConsoleStateHasNavMesh); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled : - setConsoleState(kConsoleStateRegionNotEnabled); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneRequestError : - setConsoleState(kConsoleStateError); - break; - default: - setConsoleState(kConsoleStateUnknown); - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) -{ - setAgentState(pAgentState); -} - -void LLFloaterPathfindingConsole::onRegionBoundaryCross() -{ - initializeNavMeshZoneForCurrentRegion(); - setRenderWorld(TRUE); - setRenderWorldMovablesOnly(FALSE); -} - -void LLFloaterPathfindingConsole::onPathEvent() -{ - const LLPathfindingPathTool *pathToolInstance = LLPathfindingPathTool::getInstance(); - - mCharacterWidthSlider->setValue(LLSD(pathToolInstance->getCharacterWidth())); - - LLSD characterType; - switch (pathToolInstance->getCharacterType()) - { - case LLPathfindingPathTool::kCharacterTypeNone : - characterType = XUI_CHARACTER_TYPE_NONE; - break; - case LLPathfindingPathTool::kCharacterTypeA : - characterType = XUI_CHARACTER_TYPE_A; - break; - case LLPathfindingPathTool::kCharacterTypeB : - characterType = XUI_CHARACTER_TYPE_B; - break; - case LLPathfindingPathTool::kCharacterTypeC : - characterType = XUI_CHARACTER_TYPE_C; - break; - case LLPathfindingPathTool::kCharacterTypeD : - characterType = XUI_CHARACTER_TYPE_D; - break; - default : - characterType = XUI_CHARACTER_TYPE_NONE; - llassert(0); - break; - } - mCharacterTypeComboBox->setValue(characterType); - - updatePathTestStatus(); -} - -void LLFloaterPathfindingConsole::setDefaultInputs() -{ - mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX); - setRenderWorld(TRUE); - setRenderNavMesh(FALSE); - setRenderWalkables(FALSE); - setRenderMaterialVolumes(FALSE); - setRenderStaticObstacles(FALSE); - setRenderExclusionVolumes(FALSE); - setRenderWaterPlane(FALSE); - setRenderXRay(FALSE); -} - -void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) -{ - mConsoleState = pConsoleState; - updateControlsOnConsoleState(); - updateStatusOnConsoleState(); -} - -void LLFloaterPathfindingConsole::setWorldRenderState() -{ - BOOL renderWorld = isRenderWorld(); - - mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld); - if (!renderWorld) - { - mShowWorldMovablesOnlyCheckBox->set(FALSE); - } -} - -void LLFloaterPathfindingConsole::setNavMeshRenderState() -{ - BOOL renderNavMesh = isRenderNavMesh(); - - mShowNavMeshWalkabilityLabel->setEnabled(renderNavMesh); - mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh); -} - -void LLFloaterPathfindingConsole::updateControlsOnConsoleState() -{ - switch (mConsoleState) - { - case kConsoleStateUnknown : - case kConsoleStateRegionNotEnabled : - mShowLabel->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); - mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); - mShowNavMeshCheckBox->setEnabled(FALSE); - mShowNavMeshWalkabilityLabel->setEnabled(FALSE); - mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); - mShowWalkablesCheckBox->setEnabled(FALSE); - mShowStaticObstaclesCheckBox->setEnabled(FALSE); - mShowMaterialVolumesCheckBox->setEnabled(FALSE); - mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); - mShowXRayCheckBox->setEnabled(FALSE); - mViewCharactersButton->setEnabled(FALSE); - mEditTestTabContainer->selectTab(0); - mTestTab->setEnabled(FALSE); - mCtrlClickLabel->setEnabled(FALSE); - mShiftClickLabel->setEnabled(FALSE); - mCharacterWidthLabel->setEnabled(FALSE); - mCharacterWidthUnitLabel->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeLabel->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); - clearPath(); - break; - case kConsoleStateLibraryNotImplemented : - mShowLabel->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); - mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); - mShowNavMeshCheckBox->setEnabled(FALSE); - mShowNavMeshWalkabilityLabel->setEnabled(FALSE); - mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); - mShowWalkablesCheckBox->setEnabled(FALSE); - mShowStaticObstaclesCheckBox->setEnabled(FALSE); - mShowMaterialVolumesCheckBox->setEnabled(FALSE); - mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); - mShowXRayCheckBox->setEnabled(FALSE); - mViewCharactersButton->setEnabled(TRUE); - mEditTestTabContainer->selectTab(0); - mTestTab->setEnabled(FALSE); - mCtrlClickLabel->setEnabled(FALSE); - mShiftClickLabel->setEnabled(FALSE); - mCharacterWidthLabel->setEnabled(FALSE); - mCharacterWidthUnitLabel->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeLabel->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); - clearPath(); - break; - case kConsoleStateCheckingVersion : - case kConsoleStateDownloading : - case kConsoleStateError : - mShowLabel->setEnabled(FALSE); - mShowWorldCheckBox->setEnabled(FALSE); - mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); - mShowNavMeshCheckBox->setEnabled(FALSE); - mShowNavMeshWalkabilityLabel->setEnabled(FALSE); - mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); - mShowWalkablesCheckBox->setEnabled(FALSE); - mShowStaticObstaclesCheckBox->setEnabled(FALSE); - mShowMaterialVolumesCheckBox->setEnabled(FALSE); - mShowExclusionVolumesCheckBox->setEnabled(FALSE); - mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); - mShowXRayCheckBox->setEnabled(FALSE); - mViewCharactersButton->setEnabled(TRUE); - mEditTestTabContainer->selectTab(0); - mTestTab->setEnabled(FALSE); - mCtrlClickLabel->setEnabled(FALSE); - mShiftClickLabel->setEnabled(FALSE); - mCharacterWidthLabel->setEnabled(FALSE); - mCharacterWidthUnitLabel->setEnabled(FALSE); - mCharacterWidthSlider->setEnabled(FALSE); - mCharacterTypeLabel->setEnabled(FALSE); - mCharacterTypeComboBox->setEnabled(FALSE); - mClearPathButton->setEnabled(FALSE); - clearPath(); - break; - case kConsoleStateHasNavMesh : - mShowLabel->setEnabled(TRUE); - mShowWorldCheckBox->setEnabled(TRUE); - setWorldRenderState(); - mShowNavMeshCheckBox->setEnabled(TRUE); - setNavMeshRenderState(); - mShowWalkablesCheckBox->setEnabled(TRUE); - mShowStaticObstaclesCheckBox->setEnabled(TRUE); - mShowMaterialVolumesCheckBox->setEnabled(TRUE); - mShowExclusionVolumesCheckBox->setEnabled(TRUE); - mShowRenderWaterPlaneCheckBox->setEnabled(TRUE); - mShowXRayCheckBox->setEnabled(TRUE); - mViewCharactersButton->setEnabled(TRUE); - mTestTab->setEnabled(TRUE); - mCtrlClickLabel->setEnabled(TRUE); - mShiftClickLabel->setEnabled(TRUE); - mCharacterWidthLabel->setEnabled(TRUE); - mCharacterWidthUnitLabel->setEnabled(TRUE); - mCharacterWidthSlider->setEnabled(TRUE); - mCharacterTypeLabel->setEnabled(TRUE); - mCharacterTypeComboBox->setEnabled(TRUE); - mClearPathButton->setEnabled(TRUE); - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::updateStatusOnConsoleState() -{ - static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); - - std::string simulatorStatusText(""); - std::string viewerStatusText(""); - LLStyle::Params viewerStyleParams; - - switch (mConsoleState) - { - case kConsoleStateUnknown : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_unknown"); - viewerStyleParams.color = errorColor; - break; - case kConsoleStateLibraryNotImplemented : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); - viewerStyleParams.color = errorColor; - break; - case kConsoleStateRegionNotEnabled : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); - viewerStyleParams.color = errorColor; - break; - case kConsoleStateCheckingVersion : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_checking_version"); - viewerStyleParams.color = warningColor; - break; - case kConsoleStateDownloading : - simulatorStatusText = getSimulatorStatusText(); - if (mIsNavMeshUpdating) - { - viewerStatusText = getString("navmesh_viewer_status_updating"); - } - else - { - viewerStatusText = getString("navmesh_viewer_status_downloading"); - } - viewerStyleParams.color = warningColor; - break; - case kConsoleStateHasNavMesh : - simulatorStatusText = getSimulatorStatusText(); - viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); - break; - case kConsoleStateError : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_error"); - viewerStyleParams.color = errorColor; - break; - default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - viewerStatusText = getString("navmesh_viewer_status_unknown"); - viewerStyleParams.color = errorColor; - llassert(0); - break; - } - - mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); - mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); -} - -std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const -{ - std::string simulatorStatusText(""); - -#ifdef DEPRECATED_UNVERSIONED_NAVMESH - if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) - { - switch (mNavMeshZone.getNavMeshZoneStatus()) - { - case LLPathfindingNavMeshZone::kNavMeshZonePending : - simulatorStatusText = getString("navmesh_simulator_status_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : - simulatorStatusText = getString("navmesh_simulator_status_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : - simulatorStatusText = getString("navmesh_simulator_status_some_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : - simulatorStatusText = getString("navmesh_simulator_status_some_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : - simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneComplete : - simulatorStatusText = getString("navmesh_simulator_status_complete"); - break; - default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - break; - } - } - else - { - simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); - } -#else // DEPRECATED_UNVERSIONED_NAVMESH - switch (mNavMeshZone.getNavMeshZoneStatus()) - { - case LLPathfindingNavMeshZone::kNavMeshZonePending : - simulatorStatusText = getString("navmesh_simulator_status_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : - simulatorStatusText = getString("navmesh_simulator_status_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : - simulatorStatusText = getString("navmesh_simulator_status_some_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : - simulatorStatusText = getString("navmesh_simulator_status_some_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : - simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneComplete : - simulatorStatusText = getString("navmesh_simulator_status_complete"); - break; - default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - break; - } -#endif // DEPRECATED_UNVERSIONED_NAVMESH - - return simulatorStatusText; -} - -void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() -{ - mNavMeshZone.disable(); - mNavMeshZone.initialize(); - mNavMeshZone.enable(); - mNavMeshZone.refresh(); -} - -void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) -{ - switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) - { - case LLPathfindingManager::kAgentStateUnknown : - case LLPathfindingManager::kAgentStateNotEnabled : - mEditTab->setEnabled(FALSE); - mUnfreezeLabel->setEnabled(FALSE); - mUnfreezeButton->setEnabled(FALSE); - mLinksetsLabel->setEnabled(FALSE); - mLinksetsButton->setEnabled(FALSE); - mFreezeLabel->setEnabled(FALSE); - mFreezeButton->setEnabled(FALSE); - break; - case LLPathfindingManager::kAgentStateFrozen : - mEditTab->setEnabled(TRUE); - mUnfreezeLabel->setEnabled(TRUE); - mUnfreezeButton->setEnabled(TRUE); - mLinksetsLabel->setEnabled(FALSE); - mLinksetsButton->setEnabled(FALSE); - mFreezeLabel->setEnabled(FALSE); - mFreezeButton->setEnabled(FALSE); - break; - case LLPathfindingManager::kAgentStateUnfrozen : - mEditTab->setEnabled(TRUE); - mUnfreezeLabel->setEnabled(FALSE); - mUnfreezeButton->setEnabled(FALSE); - mLinksetsLabel->setEnabled(TRUE); - mLinksetsButton->setEnabled(TRUE); - mFreezeLabel->setEnabled(TRUE); - mFreezeButton->setEnabled(TRUE); - break; - default : - llassert(0); - break; - } -} - -void LLFloaterPathfindingConsole::switchIntoTestPathMode() -{ - if (LLPathingLib::getInstance() != NULL) - { - llassert(mPathfindingToolset != NULL); - LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); - if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset) - { - mSavedToolset = toolMgrInstance->getCurrentToolset(); - toolMgrInstance->setCurrentToolset(mPathfindingToolset); - } - } -} - -void LLFloaterPathfindingConsole::switchOutOfTestPathMode() -{ - if (LLPathingLib::getInstance() != NULL) - { - llassert(mPathfindingToolset != NULL); - LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); - if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset) - { - toolMgrInstance->setCurrentToolset(mSavedToolset); - mSavedToolset = NULL; - } - } -} - -void LLFloaterPathfindingConsole::updateCharacterWidth() -{ - LLPathfindingPathTool::getInstance()->setCharacterWidth(mCharacterWidthSlider->getValueF32()); -} - -void LLFloaterPathfindingConsole::updateCharacterType() -{ - LLPathfindingPathTool::ECharacterType characterType; - - switch (mCharacterTypeComboBox->getValue().asInteger()) - { - case XUI_CHARACTER_TYPE_NONE : - characterType = LLPathfindingPathTool::kCharacterTypeNone; - break; - case XUI_CHARACTER_TYPE_A : - characterType = LLPathfindingPathTool::kCharacterTypeA; - break; - case XUI_CHARACTER_TYPE_B : - characterType = LLPathfindingPathTool::kCharacterTypeB; - break; - case XUI_CHARACTER_TYPE_C : - characterType = LLPathfindingPathTool::kCharacterTypeC; - break; - case XUI_CHARACTER_TYPE_D : - characterType = LLPathfindingPathTool::kCharacterTypeD; - break; - default : - characterType = LLPathfindingPathTool::kCharacterTypeNone; - llassert(0); - break; - } - - LLPathfindingPathTool::getInstance()->setCharacterType(characterType); -} - -void LLFloaterPathfindingConsole::clearPath() -{ - LLPathfindingPathTool::getInstance()->clearPath(); -} - -void LLFloaterPathfindingConsole::updatePathTestStatus() -{ - static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); - - std::string statusText(""); - LLStyle::Params styleParams; - - switch (LLPathfindingPathTool::getInstance()->getPathStatus()) - { - case LLPathfindingPathTool::kPathStatusUnknown : - statusText = getString("pathing_unknown"); - styleParams.color = errorColor; - break; - case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints : - statusText = getString("pathing_choose_start_and_end_points"); - styleParams.color = warningColor; - break; - case LLPathfindingPathTool::kPathStatusChooseStartPoint : - statusText = getString("pathing_choose_start_point"); - styleParams.color = warningColor; - break; - case LLPathfindingPathTool::kPathStatusChooseEndPoint : - statusText = getString("pathing_choose_end_point"); - styleParams.color = warningColor; - break; - case LLPathfindingPathTool::kPathStatusHasValidPath : - statusText = getString("pathing_path_valid"); - break; - case LLPathfindingPathTool::kPathStatusHasInvalidPath : - statusText = getString("pathing_path_invalid"); - styleParams.color = errorColor; - break; - case LLPathfindingPathTool::kPathStatusNotEnabled : - statusText = getString("pathing_region_not_enabled"); - styleParams.color = errorColor; - break; - case LLPathfindingPathTool::kPathStatusNotImplemented : - statusText = getString("pathing_library_not_implemented"); - styleParams.color = errorColor; - break; - case LLPathfindingPathTool::kPathStatusError : - statusText = getString("pathing_error"); - styleParams.color = errorColor; - break; - default : - statusText = getString("pathing_unknown"); - styleParams.color = errorColor; - break; - } - - mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); -} - - -BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const -{ - return (isRenderWalkables() || isRenderStaticObstacles() || - isRenderMaterialVolumes() || isRenderExclusionVolumes()); -} - -U32 LLFloaterPathfindingConsole::getRenderShapeFlags() -{ - U32 shapeRenderFlag = 0U; - - if (isRenderWalkables()) - { - SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_WalkableObjects); - } - if (isRenderStaticObstacles()) - { - SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ObstacleObjects); - } - if (isRenderMaterialVolumes()) - { - SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_MaterialPhantoms); - } - if (isRenderExclusionVolumes()) - { - SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ExclusionPhantoms); - } - - return shapeRenderFlag; -} - -void LLFloaterPathfindingConsole::registerNavMeshColorListeners() -{ - if (!mSavedSettingWalkableSlot.connected()) - { - mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingStaticObstacleSlot.connected()) - { - mSavedSettingStaticObstacleSlot = gSavedSettings.getControl(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingMaterialVolumeSlot.connected()) - { - mSavedSettingMaterialVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_MATERIAL_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingExclusionVolumeSlot.connected()) - { - mSavedSettingExclusionVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_EXCLUSION_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingInteriorEdgeSlot.connected()) - { - mSavedSettingInteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_INTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingExteriorEdgeSlot.connected()) - { - mSavedSettingExteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_EXTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingHeatmapMinSlot.connected()) - { - mSavedSettingHeatmapMinSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MIN)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingHeatmapMaxSlot.connected()) - { - mSavedSettingHeatmapMaxSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MAX)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingNavMeshFaceSlot.connected()) - { - mSavedSettingNavMeshFaceSlot = gSavedSettings.getControl(CONTROL_NAME_NAVMESH_FACE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingTestPathValidEndSlot.connected()) - { - mSavedSettingTestPathValidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_VALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingTestPathInvalidEndSlot.connected()) - { - mSavedSettingTestPathInvalidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_INVALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } - if (!mSavedSettingTestPathSlot.connected()) - { - mSavedSettingTestPathSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); - } -} - -void LLFloaterPathfindingConsole::deregisterNavMeshColorListeners() -{ - if (mSavedSettingWalkableSlot.connected()) - { - mSavedSettingWalkableSlot.disconnect(); - } - if (mSavedSettingStaticObstacleSlot.connected()) - { - mSavedSettingStaticObstacleSlot.disconnect(); - } - if (mSavedSettingMaterialVolumeSlot.connected()) - { - mSavedSettingMaterialVolumeSlot.disconnect(); - } - if (mSavedSettingExclusionVolumeSlot.connected()) - { - mSavedSettingExclusionVolumeSlot.disconnect(); - } - if (mSavedSettingInteriorEdgeSlot.connected()) - { - mSavedSettingInteriorEdgeSlot.disconnect(); - } - if (mSavedSettingExteriorEdgeSlot.connected()) - { - mSavedSettingExteriorEdgeSlot.disconnect(); - } - if (mSavedSettingHeatmapMinSlot.connected()) - { - mSavedSettingHeatmapMinSlot.disconnect(); - } - if (mSavedSettingHeatmapMaxSlot.connected()) - { - mSavedSettingHeatmapMaxSlot.disconnect(); - } - if (mSavedSettingNavMeshFaceSlot.connected()) - { - mSavedSettingNavMeshFaceSlot.disconnect(); - } - if (mSavedSettingTestPathValidEndSlot.connected()) - { - mSavedSettingTestPathValidEndSlot.disconnect(); - } - if (mSavedSettingTestPathInvalidEndSlot.connected()) - { - mSavedSettingTestPathInvalidEndSlot.disconnect(); - } - if (mSavedSettingTestPathSlot.connected()) - { - mSavedSettingTestPathSlot.disconnect(); - } -} - -void LLFloaterPathfindingConsole::handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue) -{ - fillInColorsForNavMeshVisualization(); -} - -void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() -{ - if (LLPathingLib::getInstance() != NULL) - { - LLPathingLib::NavMeshColors navMeshColors; - - LLColor4 in = gSavedSettings.getColor4(CONTROL_NAME_WALKABLE_OBJECTS); - navMeshColors.mWalkable= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS); - navMeshColors.mObstacle= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_MATERIAL_VOLUMES); - navMeshColors.mMaterial= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_EXCLUSION_VOLUMES); - navMeshColors.mExclusion= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_INTERIOR_EDGE); - navMeshColors.mConnectedEdge= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_EXTERIOR_EDGE); - navMeshColors.mBoundaryEdge= LLColor4U(in); - - navMeshColors.mHeatColorBase = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MIN); - - navMeshColors.mHeatColorMax = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MAX); - - in = gSavedSettings.getColor4(CONTROL_NAME_NAVMESH_FACE); - navMeshColors.mFaceColor= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_VALID_END); - navMeshColors.mStarValid= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_INVALID_END); - navMeshColors.mStarInvalid= LLColor4U(in); - - in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH); - navMeshColors.mTestPath= LLColor4U(in); - - LLPathingLib::getInstance()->setNavMeshColors(navMeshColors); - } -} +/** +* @file llfloaterpathfindingconsole.cpp +* @author William Todd Stinson +* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" +#include "llfloaterpathfindingcharacters.h" + +#include "llsd.h" +#include "llhandle.h" +#include "llcontrol.h" +#include "llpanel.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llsliderctrl.h" +#include "lllineeditor.h" +#include "lltextbase.h" +#include "lltabcontainer.h" +#include "llcombobox.h" +#include "llfloaterreg.h" +#include "llpathfindingnavmeshzone.h" +#include "llpathfindingmanager.h" +#include "llenvmanager.h" +#include "llpathfindingpathtool.h" +#include "lltoolmgr.h" +#include "lltoolfocus.h" + +#include "llpathinglib.h" + +#define XUI_RENDER_HEATMAP_NONE 0 +#define XUI_RENDER_HEATMAP_A 1 +#define XUI_RENDER_HEATMAP_B 2 +#define XUI_RENDER_HEATMAP_C 3 +#define XUI_RENDER_HEATMAP_D 4 + +#define XUI_CHARACTER_TYPE_NONE 0 +#define XUI_CHARACTER_TYPE_A 1 +#define XUI_CHARACTER_TYPE_B 2 +#define XUI_CHARACTER_TYPE_C 3 +#define XUI_CHARACTER_TYPE_D 4 + +#define XUI_EDIT_TAB_INDEX 0 +#define XUI_TEST_TAB_INDEX 1 + +#define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) + +#define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable" +#define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle" +#define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial" +#define CONTROL_NAME_EXCLUSION_VOLUMES "PathfindingExclusion" +#define CONTROL_NAME_INTERIOR_EDGE "PathfindingConnectedEdge" +#define CONTROL_NAME_EXTERIOR_EDGE "PathfindingBoundaryEdge" +#define CONTROL_NAME_HEATMAP_MIN "PathfindingHeatColorBase" +#define CONTROL_NAME_HEATMAP_MAX "PathfindingHeatColorMax" +#define CONTROL_NAME_NAVMESH_FACE "PathfindingFaceColor" +#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingStarValidColor" +#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingStarInvalidColor" +#define CONTROL_NAME_TEST_PATH "PathfindingTestPathColor" +#define CONTROL_NAME_WATER "PathfindingWaterColor" + +LLHandle LLFloaterPathfindingConsole::sInstanceHandle; + +//--------------------------------------------------------------------------- +// LLFloaterPathfindingConsole +//--------------------------------------------------------------------------- + +BOOL LLFloaterPathfindingConsole::postBuild() +{ + mShowLabel = findChild("show_label"); + llassert(mShowLabel != NULL); + + mShowWorldCheckBox = findChild("show_world"); + llassert(mShowWorldCheckBox != NULL); + mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this)); + + mShowWorldMovablesOnlyCheckBox = findChild("show_world_movables_only"); + llassert(mShowWorldMovablesOnlyCheckBox != NULL); + + mShowNavMeshCheckBox = findChild("show_navmesh"); + llassert(mShowNavMeshCheckBox != NULL); + mShowNavMeshCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowNavMeshSet, this)); + + mShowNavMeshWalkabilityLabel = findChild("show_walkability_label"); + llassert(mShowNavMeshWalkabilityLabel != NULL); + + mShowNavMeshWalkabilityComboBox = findChild("show_heatmap_mode"); + llassert(mShowNavMeshWalkabilityComboBox != NULL); + mShowNavMeshWalkabilityComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWalkabilitySet, this)); + + mShowWalkablesCheckBox = findChild("show_walkables"); + llassert(mShowWalkablesCheckBox != NULL); + + mShowStaticObstaclesCheckBox = findChild("show_static_obstacles"); + llassert(mShowStaticObstaclesCheckBox != NULL); + + mShowMaterialVolumesCheckBox = findChild("show_material_volumes"); + llassert(mShowMaterialVolumesCheckBox != NULL); + + mShowExclusionVolumesCheckBox = findChild("show_exclusion_volumes"); + llassert(mShowExclusionVolumesCheckBox != NULL); + + mShowRenderWaterPlaneCheckBox = findChild("show_water_plane"); + llassert(mShowRenderWaterPlaneCheckBox != NULL); + + mShowXRayCheckBox = findChild("show_xray"); + llassert(mShowXRayCheckBox != 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); + mEditTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this)); + + mEditTab = findChild("edit_panel"); + llassert(mEditTab != NULL); + + mTestTab = findChild("test_panel"); + llassert(mTestTab != 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)); + + mPathfindingViewerStatus = findChild("pathfinding_viewer_status"); + llassert(mPathfindingViewerStatus != NULL); + + mPathfindingSimulatorStatus = findChild("pathfinding_simulator_status"); + llassert(mPathfindingSimulatorStatus != NULL); + + mCtrlClickLabel = findChild("ctrl_click_label"); + llassert(mCtrlClickLabel != NULL); + + mShiftClickLabel = findChild("shift_click_label"); + llassert(mShiftClickLabel != NULL); + + mCharacterWidthLabel = findChild("character_width_label"); + llassert(mCharacterWidthLabel != NULL); + + mCharacterWidthSlider = findChild("character_width"); + llassert(mCharacterWidthSlider != NULL); + mCharacterWidthSlider->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterWidthSet, this)); + + mCharacterWidthUnitLabel = findChild("character_width_unit_label"); + llassert(mCharacterWidthUnitLabel != NULL); + + mCharacterTypeLabel = findChild("character_type_label"); + llassert(mCharacterTypeLabel != NULL); + + mCharacterTypeComboBox = findChild("path_character_type"); + llassert(mCharacterTypeComboBox != NULL); + mCharacterTypeComboBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onCharacterTypeSwitch, this)); + + mPathTestingStatus = findChild("path_test_status"); + llassert(mPathTestingStatus != NULL); + + mClearPathButton = findChild("clear_path"); + llassert(mClearPathButton != NULL); + mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + + if (LLPathingLib::getInstance() == NULL) + { + LLPathingLib::initSystem(); + } + + if (LLPathingLib::getInstance() != NULL) + { + mPathfindingToolset = new LLToolset(); + mPathfindingToolset->addTool(LLPathfindingPathTool::getInstance()); + mPathfindingToolset->addTool(LLToolCamera::getInstance()); + mPathfindingToolset->setShowFloaterTools(false); + } + + updateCharacterWidth(); + updateCharacterType(); + + return LLFloater::postBuild(); +} + +void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) +{ + LLFloater::onOpen(pKey); + //make sure we have a pathing system + if ( LLPathingLib::getInstance() == NULL ) + { + setConsoleState(kConsoleStateLibraryNotImplemented); + llwarns <<"Errror: cannot find pathing library implementation."<registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); + } + + if (!mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); + } + + if (!mPathEventSlot.connected()) + { + mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this)); + } + + setAgentState(LLPathfindingManager::getInstance()->getAgentState()); + setDefaultInputs(); + updatePathTestStatus(); + + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } +} + +void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) +{ + switchOutOfTestPathMode(); + + if (mPathEventSlot.connected()) + { + mPathEventSlot.disconnect(); + } + + if (mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot.disconnect(); + } + + if (mAgentStateSlot.connected()) + { + mAgentStateSlot.disconnect(); + } + + if (mNavMeshZoneSlot.connected()) + { + mNavMeshZoneSlot.disconnect(); + } + + if (LLPathingLib::getInstance() != NULL) + { + mNavMeshZone.disable(); + } + deregisterNavMeshColorListeners(); + + setDefaultInputs(); + setConsoleState(kConsoleStateUnknown); + + LLFloater::onClose(pIsAppQuitting); +} + +LLHandle LLFloaterPathfindingConsole::getInstanceHandle() +{ + if (sInstanceHandle.isDead()) + { + LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::getTypedInstance("pathfinding_console"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} + +BOOL LLFloaterPathfindingConsole::isRenderNavMesh() const +{ + return mShowNavMeshCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderNavMesh(BOOL pIsRenderNavMesh) +{ + mShowNavMeshCheckBox->set(pIsRenderNavMesh); + setNavMeshRenderState(); +} + +BOOL LLFloaterPathfindingConsole::isRenderWalkables() const +{ + return mShowWalkablesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWalkables(BOOL pIsRenderWalkables) +{ + mShowWalkablesCheckBox->set(pIsRenderWalkables); +} + +BOOL LLFloaterPathfindingConsole::isRenderStaticObstacles() const +{ + return mShowStaticObstaclesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderStaticObstacles(BOOL pIsRenderStaticObstacles) +{ + mShowStaticObstaclesCheckBox->set(pIsRenderStaticObstacles); +} + +BOOL LLFloaterPathfindingConsole::isRenderMaterialVolumes() const +{ + return mShowMaterialVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderMaterialVolumes(BOOL pIsRenderMaterialVolumes) +{ + mShowMaterialVolumesCheckBox->set(pIsRenderMaterialVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderExclusionVolumes() const +{ + return mShowExclusionVolumesCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderExclusionVolumes(BOOL pIsRenderExclusionVolumes) +{ + mShowExclusionVolumesCheckBox->set(pIsRenderExclusionVolumes); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorld() const +{ + return mShowWorldCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWorld(BOOL pIsRenderWorld) +{ + mShowWorldCheckBox->set(pIsRenderWorld); + setWorldRenderState(); +} + +BOOL LLFloaterPathfindingConsole::isRenderWorldMovablesOnly() const +{ + return (mShowWorldCheckBox->get() && mShowWorldMovablesOnlyCheckBox->get()); +} + +void LLFloaterPathfindingConsole::setRenderWorldMovablesOnly(BOOL pIsRenderWorldMovablesOnly) +{ + mShowWorldMovablesOnlyCheckBox->set(pIsRenderWorldMovablesOnly); +} + +BOOL LLFloaterPathfindingConsole::isRenderWaterPlane() const +{ + return mShowRenderWaterPlaneCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderWaterPlane(BOOL pIsRenderWaterPlane) +{ + mShowRenderWaterPlaneCheckBox->set(pIsRenderWaterPlane); +} + +BOOL LLFloaterPathfindingConsole::isRenderXRay() const +{ + return mShowXRayCheckBox->get(); +} + +void LLFloaterPathfindingConsole::setRenderXRay(BOOL pIsRenderXRay) +{ + mShowXRayCheckBox->set(pIsRenderXRay); +} + +LLPathingLib::LLPLCharacterType LLFloaterPathfindingConsole::getRenderHeatmapType() const +{ + LLPathingLib::LLPLCharacterType renderHeatmapType; + + switch (mShowNavMeshWalkabilityComboBox->getValue().asInteger()) + { + case XUI_RENDER_HEATMAP_NONE : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + break; + case XUI_RENDER_HEATMAP_A : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_A; + break; + case XUI_RENDER_HEATMAP_B : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_B; + break; + case XUI_RENDER_HEATMAP_C : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_C; + break; + case XUI_RENDER_HEATMAP_D : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_D; + break; + default : + renderHeatmapType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + + return renderHeatmapType; +} + +void LLFloaterPathfindingConsole::setRenderHeatmapType(LLPathingLib::LLPLCharacterType pRenderHeatmapType) +{ + LLSD comboBoxValue; + + switch (pRenderHeatmapType) + { + case LLPathingLib::LLPL_CHARACTER_TYPE_NONE : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_A : + comboBoxValue = XUI_RENDER_HEATMAP_A; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_B : + comboBoxValue = XUI_RENDER_HEATMAP_B; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_C : + comboBoxValue = XUI_RENDER_HEATMAP_C; + break; + case LLPathingLib::LLPL_CHARACTER_TYPE_D : + comboBoxValue = XUI_RENDER_HEATMAP_D; + break; + default : + comboBoxValue = XUI_RENDER_HEATMAP_NONE; + llassert(0); + break; + } + + mShowNavMeshWalkabilityComboBox->setValue(comboBoxValue); +} + +LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) + : LLFloater(pSeed), + mSelfHandle(), + mShowLabel(), + mShowWorldCheckBox(NULL), + mShowWorldMovablesOnlyCheckBox(NULL), + mShowNavMeshCheckBox(NULL), + mShowNavMeshWalkabilityLabel(), + mShowNavMeshWalkabilityComboBox(NULL), + mShowWalkablesCheckBox(NULL), + mShowStaticObstaclesCheckBox(NULL), + mShowMaterialVolumesCheckBox(NULL), + mShowExclusionVolumesCheckBox(NULL), + mShowRenderWaterPlaneCheckBox(NULL), + mShowXRayCheckBox(NULL), + mPathfindingViewerStatus(NULL), + mPathfindingSimulatorStatus(NULL), + mViewCharactersButton(NULL), + mEditTestTabContainer(NULL), + mEditTab(NULL), + mTestTab(NULL), + mUnfreezeLabel(NULL), + mUnfreezeButton(NULL), + mLinksetsLabel(NULL), + mLinksetsButton(NULL), + mFreezeLabel(NULL), + mFreezeButton(NULL), + mCtrlClickLabel(), + mShiftClickLabel(), + mCharacterWidthLabel(), + mCharacterWidthUnitLabel(), + mCharacterWidthSlider(NULL), + mCharacterTypeLabel(), + mCharacterTypeComboBox(NULL), + mPathTestingStatus(NULL), + mClearPathButton(NULL), + mNavMeshZoneSlot(), + mNavMeshZone(), + mIsNavMeshUpdating(false), + mAgentStateSlot(), + mRegionBoundarySlot(), + mPathEventSlot(), + mPathfindingToolset(NULL), + mSavedToolset(NULL), + mSavedSettingWalkableSlot(), + mSavedSettingStaticObstacleSlot(), + mSavedSettingMaterialVolumeSlot(), + mSavedSettingExclusionVolumeSlot(), + mSavedSettingInteriorEdgeSlot(), + mSavedSettingExteriorEdgeSlot(), + mSavedSettingHeatmapMinSlot(), + mSavedSettingHeatmapMaxSlot(), + mSavedSettingNavMeshFaceSlot(), + mSavedSettingTestPathValidEndSlot(), + mSavedSettingTestPathInvalidEndSlot(), + mSavedSettingWaterSlot(), + mSavedSettingTestPathSlot(), + mConsoleState(kConsoleStateUnknown) +{ + mSelfHandle.bind(this); +} + +LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() +{ +} + +void LLFloaterPathfindingConsole::onShowWorldSet() +{ + setWorldRenderState(); +} + +void LLFloaterPathfindingConsole::onShowNavMeshSet() +{ + setNavMeshRenderState(); +} + +void LLFloaterPathfindingConsole::onShowWalkabilitySet() +{ + LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); +} + +void LLFloaterPathfindingConsole::onViewCharactersClicked() +{ + LLFloaterPathfindingCharacters::openCharactersViewer(); +} + +void LLFloaterPathfindingConsole::onTabSwitch() +{ + if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) + { + switchIntoTestPathMode(); + } + else + { + switchOutOfTestPathMode(); + } +} + +void LLFloaterPathfindingConsole::onUnfreezeClicked() +{ + mUnfreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); +} + +void LLFloaterPathfindingConsole::onFreezeClicked() +{ + mFreezeButton->setEnabled(FALSE); + LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); +} + +void LLFloaterPathfindingConsole::onViewEditLinksetClicked() +{ + LLFloaterPathfindingLinksets::openLinksetsEditor(); +} + +void LLFloaterPathfindingConsole::onCharacterWidthSet() +{ + updateCharacterWidth(); +} + +void LLFloaterPathfindingConsole::onCharacterTypeSwitch() +{ + updateCharacterType(); +} + +void LLFloaterPathfindingConsole::onClearPathClicked() +{ + clearPath(); +} + +void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) +{ + switch (pNavMeshZoneRequestStatus) + { + case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : + setConsoleState(kConsoleStateUnknown); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : + setConsoleState(kConsoleStateCheckingVersion); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNeedsUpdate : + mIsNavMeshUpdating = true; + mNavMeshZone.refresh(); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestStarted : + setConsoleState(kConsoleStateDownloading); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestCompleted : + mIsNavMeshUpdating = false; + setConsoleState(kConsoleStateHasNavMesh); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestNotEnabled : + setConsoleState(kConsoleStateRegionNotEnabled); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestError : + setConsoleState(kConsoleStateError); + break; + default: + setConsoleState(kConsoleStateUnknown); + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) +{ + setAgentState(pAgentState); +} + +void LLFloaterPathfindingConsole::onRegionBoundaryCross() +{ + initializeNavMeshZoneForCurrentRegion(); + setRenderWorld(TRUE); + setRenderWorldMovablesOnly(FALSE); +} + +void LLFloaterPathfindingConsole::onPathEvent() +{ + const LLPathfindingPathTool *pathToolInstance = LLPathfindingPathTool::getInstance(); + + mCharacterWidthSlider->setValue(LLSD(pathToolInstance->getCharacterWidth())); + + LLSD characterType; + switch (pathToolInstance->getCharacterType()) + { + case LLPathfindingPathTool::kCharacterTypeNone : + characterType = XUI_CHARACTER_TYPE_NONE; + break; + case LLPathfindingPathTool::kCharacterTypeA : + characterType = XUI_CHARACTER_TYPE_A; + break; + case LLPathfindingPathTool::kCharacterTypeB : + characterType = XUI_CHARACTER_TYPE_B; + break; + case LLPathfindingPathTool::kCharacterTypeC : + characterType = XUI_CHARACTER_TYPE_C; + break; + case LLPathfindingPathTool::kCharacterTypeD : + characterType = XUI_CHARACTER_TYPE_D; + break; + default : + characterType = XUI_CHARACTER_TYPE_NONE; + llassert(0); + break; + } + mCharacterTypeComboBox->setValue(characterType); + + updatePathTestStatus(); +} + +void LLFloaterPathfindingConsole::setDefaultInputs() +{ + mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX); + setRenderWorld(TRUE); + setRenderNavMesh(FALSE); + setRenderWalkables(FALSE); + setRenderMaterialVolumes(FALSE); + setRenderStaticObstacles(FALSE); + setRenderExclusionVolumes(FALSE); + setRenderWaterPlane(FALSE); + setRenderXRay(FALSE); +} + +void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) +{ + mConsoleState = pConsoleState; + updateControlsOnConsoleState(); + updateStatusOnConsoleState(); +} + +void LLFloaterPathfindingConsole::setWorldRenderState() +{ + BOOL renderWorld = isRenderWorld(); + + mShowWorldMovablesOnlyCheckBox->setEnabled(renderWorld); + if (!renderWorld) + { + mShowWorldMovablesOnlyCheckBox->set(FALSE); + } +} + +void LLFloaterPathfindingConsole::setNavMeshRenderState() +{ + BOOL renderNavMesh = isRenderNavMesh(); + + mShowNavMeshWalkabilityLabel->setEnabled(renderNavMesh); + mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh); +} + +void LLFloaterPathfindingConsole::updateControlsOnConsoleState() +{ + switch (mConsoleState) + { + case kConsoleStateUnknown : + case kConsoleStateRegionNotEnabled : + mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(FALSE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + clearPath(); + break; + case kConsoleStateLibraryNotImplemented : + mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + clearPath(); + break; + case kConsoleStateCheckingVersion : + case kConsoleStateDownloading : + case kConsoleStateError : + mShowLabel->setEnabled(FALSE); + mShowWorldCheckBox->setEnabled(FALSE); + mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); + mShowNavMeshCheckBox->setEnabled(FALSE); + mShowNavMeshWalkabilityLabel->setEnabled(FALSE); + mShowNavMeshWalkabilityComboBox->setEnabled(FALSE); + mShowWalkablesCheckBox->setEnabled(FALSE); + mShowStaticObstaclesCheckBox->setEnabled(FALSE); + mShowMaterialVolumesCheckBox->setEnabled(FALSE); + mShowExclusionVolumesCheckBox->setEnabled(FALSE); + mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); + mShowXRayCheckBox->setEnabled(FALSE); + mViewCharactersButton->setEnabled(TRUE); + mEditTestTabContainer->selectTab(0); + mTestTab->setEnabled(FALSE); + mCtrlClickLabel->setEnabled(FALSE); + mShiftClickLabel->setEnabled(FALSE); + mCharacterWidthLabel->setEnabled(FALSE); + mCharacterWidthUnitLabel->setEnabled(FALSE); + mCharacterWidthSlider->setEnabled(FALSE); + mCharacterTypeLabel->setEnabled(FALSE); + mCharacterTypeComboBox->setEnabled(FALSE); + mClearPathButton->setEnabled(FALSE); + clearPath(); + break; + case kConsoleStateHasNavMesh : + mShowLabel->setEnabled(TRUE); + mShowWorldCheckBox->setEnabled(TRUE); + setWorldRenderState(); + mShowNavMeshCheckBox->setEnabled(TRUE); + setNavMeshRenderState(); + mShowWalkablesCheckBox->setEnabled(TRUE); + mShowStaticObstaclesCheckBox->setEnabled(TRUE); + mShowMaterialVolumesCheckBox->setEnabled(TRUE); + mShowExclusionVolumesCheckBox->setEnabled(TRUE); + mShowRenderWaterPlaneCheckBox->setEnabled(TRUE); + mShowXRayCheckBox->setEnabled(TRUE); + mViewCharactersButton->setEnabled(TRUE); + mTestTab->setEnabled(TRUE); + mCtrlClickLabel->setEnabled(TRUE); + mShiftClickLabel->setEnabled(TRUE); + mCharacterWidthLabel->setEnabled(TRUE); + mCharacterWidthUnitLabel->setEnabled(TRUE); + mCharacterWidthSlider->setEnabled(TRUE); + mCharacterTypeLabel->setEnabled(TRUE); + mCharacterTypeComboBox->setEnabled(TRUE); + mClearPathButton->setEnabled(TRUE); + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::updateStatusOnConsoleState() +{ + static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); + + std::string simulatorStatusText(""); + std::string viewerStatusText(""); + LLStyle::Params viewerStyleParams; + + switch (mConsoleState) + { + case kConsoleStateUnknown : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); + viewerStyleParams.color = errorColor; + break; + case kConsoleStateLibraryNotImplemented : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); + viewerStyleParams.color = errorColor; + break; + case kConsoleStateRegionNotEnabled : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); + viewerStyleParams.color = errorColor; + break; + case kConsoleStateCheckingVersion : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_checking_version"); + viewerStyleParams.color = warningColor; + break; + case kConsoleStateDownloading : + simulatorStatusText = getSimulatorStatusText(); + if (mIsNavMeshUpdating) + { + viewerStatusText = getString("navmesh_viewer_status_updating"); + } + else + { + viewerStatusText = getString("navmesh_viewer_status_downloading"); + } + viewerStyleParams.color = warningColor; + break; + case kConsoleStateHasNavMesh : + simulatorStatusText = getSimulatorStatusText(); + viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); + break; + case kConsoleStateError : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_error"); + viewerStyleParams.color = errorColor; + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_unknown"); + viewerStyleParams.color = errorColor; + llassert(0); + break; + } + + mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); + mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); +} + +std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +{ + std::string simulatorStatusText(""); + +#ifdef DEPRECATED_UNVERSIONED_NAVMESH + if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) + { + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } + } + else + { + simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); + } +#else // DEPRECATED_UNVERSIONED_NAVMESH + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + break; + } +#endif // DEPRECATED_UNVERSIONED_NAVMESH + + return simulatorStatusText; +} + +void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() +{ + mNavMeshZone.disable(); + mNavMeshZone.initialize(); + mNavMeshZone.enable(); + mNavMeshZone.refresh(); +} + +void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) +{ + switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) + { + case LLPathfindingManager::kAgentStateUnknown : + case LLPathfindingManager::kAgentStateNotEnabled : + mEditTab->setEnabled(FALSE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateFrozen : + mEditTab->setEnabled(TRUE); + mUnfreezeLabel->setEnabled(TRUE); + mUnfreezeButton->setEnabled(TRUE); + mLinksetsLabel->setEnabled(FALSE); + mLinksetsButton->setEnabled(FALSE); + mFreezeLabel->setEnabled(FALSE); + mFreezeButton->setEnabled(FALSE); + break; + case LLPathfindingManager::kAgentStateUnfrozen : + mEditTab->setEnabled(TRUE); + mUnfreezeLabel->setEnabled(FALSE); + mUnfreezeButton->setEnabled(FALSE); + mLinksetsLabel->setEnabled(TRUE); + mLinksetsButton->setEnabled(TRUE); + mFreezeLabel->setEnabled(TRUE); + mFreezeButton->setEnabled(TRUE); + break; + default : + llassert(0); + break; + } +} + +void LLFloaterPathfindingConsole::switchIntoTestPathMode() +{ + if (LLPathingLib::getInstance() != NULL) + { + llassert(mPathfindingToolset != NULL); + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() != mPathfindingToolset) + { + mSavedToolset = toolMgrInstance->getCurrentToolset(); + toolMgrInstance->setCurrentToolset(mPathfindingToolset); + } + } +} + +void LLFloaterPathfindingConsole::switchOutOfTestPathMode() +{ + if (LLPathingLib::getInstance() != NULL) + { + llassert(mPathfindingToolset != NULL); + LLToolMgr *toolMgrInstance = LLToolMgr::getInstance(); + if (toolMgrInstance->getCurrentToolset() == mPathfindingToolset) + { + toolMgrInstance->setCurrentToolset(mSavedToolset); + mSavedToolset = NULL; + } + } +} + +void LLFloaterPathfindingConsole::updateCharacterWidth() +{ + LLPathfindingPathTool::getInstance()->setCharacterWidth(mCharacterWidthSlider->getValueF32()); +} + +void LLFloaterPathfindingConsole::updateCharacterType() +{ + LLPathfindingPathTool::ECharacterType characterType; + + switch (mCharacterTypeComboBox->getValue().asInteger()) + { + case XUI_CHARACTER_TYPE_NONE : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + break; + case XUI_CHARACTER_TYPE_A : + characterType = LLPathfindingPathTool::kCharacterTypeA; + break; + case XUI_CHARACTER_TYPE_B : + characterType = LLPathfindingPathTool::kCharacterTypeB; + break; + case XUI_CHARACTER_TYPE_C : + characterType = LLPathfindingPathTool::kCharacterTypeC; + break; + case XUI_CHARACTER_TYPE_D : + characterType = LLPathfindingPathTool::kCharacterTypeD; + break; + default : + characterType = LLPathfindingPathTool::kCharacterTypeNone; + llassert(0); + break; + } + + LLPathfindingPathTool::getInstance()->setCharacterType(characterType); +} + +void LLFloaterPathfindingConsole::clearPath() +{ + LLPathfindingPathTool::getInstance()->clearPath(); +} + +void LLFloaterPathfindingConsole::updatePathTestStatus() +{ + static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); + + std::string statusText(""); + LLStyle::Params styleParams; + + switch (LLPathfindingPathTool::getInstance()->getPathStatus()) + { + case LLPathfindingPathTool::kPathStatusUnknown : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints : + statusText = getString("pathing_choose_start_and_end_points"); + styleParams.color = warningColor; + break; + case LLPathfindingPathTool::kPathStatusChooseStartPoint : + statusText = getString("pathing_choose_start_point"); + styleParams.color = warningColor; + break; + case LLPathfindingPathTool::kPathStatusChooseEndPoint : + statusText = getString("pathing_choose_end_point"); + styleParams.color = warningColor; + break; + case LLPathfindingPathTool::kPathStatusHasValidPath : + statusText = getString("pathing_path_valid"); + break; + case LLPathfindingPathTool::kPathStatusHasInvalidPath : + statusText = getString("pathing_path_invalid"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotEnabled : + statusText = getString("pathing_region_not_enabled"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusNotImplemented : + statusText = getString("pathing_library_not_implemented"); + styleParams.color = errorColor; + break; + case LLPathfindingPathTool::kPathStatusError : + statusText = getString("pathing_error"); + styleParams.color = errorColor; + break; + default : + statusText = getString("pathing_unknown"); + styleParams.color = errorColor; + break; + } + + mPathTestingStatus->setText((LLStringExplicit)statusText, styleParams); +} + + +BOOL LLFloaterPathfindingConsole::isRenderAnyShapes() const +{ + return (isRenderWalkables() || isRenderStaticObstacles() || + isRenderMaterialVolumes() || isRenderExclusionVolumes()); +} + +U32 LLFloaterPathfindingConsole::getRenderShapeFlags() +{ + U32 shapeRenderFlag = 0U; + + if (isRenderWalkables()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_WalkableObjects); + } + if (isRenderStaticObstacles()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ObstacleObjects); + } + if (isRenderMaterialVolumes()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_MaterialPhantoms); + } + if (isRenderExclusionVolumes()) + { + SET_SHAPE_RENDER_FLAG(shapeRenderFlag, LLPathingLib::LLST_ExclusionPhantoms); + } + + return shapeRenderFlag; +} + +void LLFloaterPathfindingConsole::registerNavMeshColorListeners() +{ + if (!mSavedSettingWalkableSlot.connected()) + { + mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingStaticObstacleSlot.connected()) + { + mSavedSettingStaticObstacleSlot = gSavedSettings.getControl(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingMaterialVolumeSlot.connected()) + { + mSavedSettingMaterialVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_MATERIAL_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingExclusionVolumeSlot.connected()) + { + mSavedSettingExclusionVolumeSlot = gSavedSettings.getControl(CONTROL_NAME_EXCLUSION_VOLUMES)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingInteriorEdgeSlot.connected()) + { + mSavedSettingInteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_INTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingExteriorEdgeSlot.connected()) + { + mSavedSettingExteriorEdgeSlot = gSavedSettings.getControl(CONTROL_NAME_EXTERIOR_EDGE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingHeatmapMinSlot.connected()) + { + mSavedSettingHeatmapMinSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MIN)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingHeatmapMaxSlot.connected()) + { + mSavedSettingHeatmapMaxSlot = gSavedSettings.getControl(CONTROL_NAME_HEATMAP_MAX)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingNavMeshFaceSlot.connected()) + { + mSavedSettingNavMeshFaceSlot = gSavedSettings.getControl(CONTROL_NAME_NAVMESH_FACE)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathValidEndSlot.connected()) + { + mSavedSettingTestPathValidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_VALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathInvalidEndSlot.connected()) + { + mSavedSettingTestPathInvalidEndSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH_INVALID_END)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingTestPathSlot.connected()) + { + mSavedSettingTestPathSlot = gSavedSettings.getControl(CONTROL_NAME_TEST_PATH)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } + if (!mSavedSettingWaterSlot.connected()) + { + mSavedSettingWaterSlot = gSavedSettings.getControl(CONTROL_NAME_WATER)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); + } +} + +void LLFloaterPathfindingConsole::deregisterNavMeshColorListeners() +{ + if (mSavedSettingWalkableSlot.connected()) + { + mSavedSettingWalkableSlot.disconnect(); + } + if (mSavedSettingStaticObstacleSlot.connected()) + { + mSavedSettingStaticObstacleSlot.disconnect(); + } + if (mSavedSettingMaterialVolumeSlot.connected()) + { + mSavedSettingMaterialVolumeSlot.disconnect(); + } + if (mSavedSettingExclusionVolumeSlot.connected()) + { + mSavedSettingExclusionVolumeSlot.disconnect(); + } + if (mSavedSettingInteriorEdgeSlot.connected()) + { + mSavedSettingInteriorEdgeSlot.disconnect(); + } + if (mSavedSettingExteriorEdgeSlot.connected()) + { + mSavedSettingExteriorEdgeSlot.disconnect(); + } + if (mSavedSettingHeatmapMinSlot.connected()) + { + mSavedSettingHeatmapMinSlot.disconnect(); + } + if (mSavedSettingHeatmapMaxSlot.connected()) + { + mSavedSettingHeatmapMaxSlot.disconnect(); + } + if (mSavedSettingNavMeshFaceSlot.connected()) + { + mSavedSettingNavMeshFaceSlot.disconnect(); + } + if (mSavedSettingTestPathValidEndSlot.connected()) + { + mSavedSettingTestPathValidEndSlot.disconnect(); + } + if (mSavedSettingTestPathInvalidEndSlot.connected()) + { + mSavedSettingTestPathInvalidEndSlot.disconnect(); + } + if (mSavedSettingTestPathSlot.connected()) + { + mSavedSettingTestPathSlot.disconnect(); + } +} + +void LLFloaterPathfindingConsole::handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue) +{ + fillInColorsForNavMeshVisualization(); +} + +void LLFloaterPathfindingConsole::fillInColorsForNavMeshVisualization() +{ + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::NavMeshColors navMeshColors; + + LLColor4 in = gSavedSettings.getColor4(CONTROL_NAME_WALKABLE_OBJECTS); + navMeshColors.mWalkable= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_STATIC_OBSTACLE_OBJECTS); + navMeshColors.mObstacle= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_MATERIAL_VOLUMES); + navMeshColors.mMaterial= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_EXCLUSION_VOLUMES); + navMeshColors.mExclusion= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_INTERIOR_EDGE); + navMeshColors.mConnectedEdge= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_EXTERIOR_EDGE); + navMeshColors.mBoundaryEdge= LLColor4U(in); + + navMeshColors.mHeatColorBase = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MIN); + + navMeshColors.mHeatColorMax = gSavedSettings.getColor4(CONTROL_NAME_HEATMAP_MAX); + + in = gSavedSettings.getColor4(CONTROL_NAME_NAVMESH_FACE); + navMeshColors.mFaceColor= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_VALID_END); + navMeshColors.mStarValid= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH_INVALID_END); + navMeshColors.mStarInvalid= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_TEST_PATH); + navMeshColors.mTestPath= LLColor4U(in); + + in = gSavedSettings.getColor4(CONTROL_NAME_WATER); + navMeshColors.mWaterColor= LLColor4U(in); + + LLPathingLib::getInstance()->setNavMeshColors(navMeshColors); + } +} -- cgit v1.2.3 From a72034fa42ebaf7e2f56c4a8cb0f445f12d22fe4 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 24 Apr 2012 19:23:20 -0700 Subject: PATH-580: BUGFIX Adding functionality to detect when the region's capabilities have not yet been loading and deferring requests for the navmesh query until the capabilities are fully loaded. --- indra/newview/llfloaterpathfindingconsole.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index e89d0c2cab..ca78042c2b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -605,6 +605,9 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav case LLPathfindingNavMeshZone::kNavMeshZoneRequestUnknown : setConsoleState(kConsoleStateUnknown); break; + case LLPathfindingNavMeshZone::kNavMeshZoneRequestWaiting : + setConsoleState(kConsoleStateRegionLoading); + break; case LLPathfindingNavMeshZone::kNavMeshZoneRequestChecking : setConsoleState(kConsoleStateCheckingVersion); break; @@ -723,6 +726,7 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() { case kConsoleStateUnknown : case kConsoleStateRegionNotEnabled : + case kConsoleStateRegionLoading : mShowLabel->setEnabled(FALSE); mShowWorldCheckBox->setEnabled(FALSE); mShowWorldMovablesOnlyCheckBox->setEnabled(FALSE); @@ -857,6 +861,11 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); viewerStyleParams.color = errorColor; break; + case kConsoleStateRegionLoading : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + viewerStatusText = getString("navmesh_viewer_status_region_loading"); + viewerStyleParams.color = warningColor; + break; case kConsoleStateCheckingVersion : simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_checking_version"); -- cgit v1.2.3 From b8c63d8848dc73d3437a9452a44a04a45fffef7d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 25 Apr 2012 11:17:30 -0700 Subject: Adding ability to change the RetrieveNeighboringRegion debug setting and have it automatically update the navmesh zones. --- indra/newview/llfloaterpathfindingconsole.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index ca78042c2b..2ccba3604b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -68,6 +68,7 @@ #define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) +#define CONTROL_NAME_RETRIEVE_NEIGHBOR "RetrieveNeighboringRegion" #define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable" #define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle" #define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial" @@ -237,7 +238,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mIsNavMeshUpdating = false; initializeNavMeshZoneForCurrentRegion(); - registerNavMeshColorListeners(); + registerSavedSettingsListeners(); fillInColorsForNavMeshVisualization(); } @@ -294,7 +295,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) { mNavMeshZone.disable(); } - deregisterNavMeshColorListeners(); + deregisterSavedSettingsListeners(); setDefaultInputs(); setConsoleState(kConsoleStateUnknown); @@ -512,6 +513,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathEventSlot(), mPathfindingToolset(NULL), mSavedToolset(NULL), + mSavedSettingRetrieveNeighborSlot(), mSavedSettingWalkableSlot(), mSavedSettingStaticObstacleSlot(), mSavedSettingMaterialVolumeSlot(), @@ -1169,8 +1171,12 @@ U32 LLFloaterPathfindingConsole::getRenderShapeFlags() return shapeRenderFlag; } -void LLFloaterPathfindingConsole::registerNavMeshColorListeners() +void LLFloaterPathfindingConsole::registerSavedSettingsListeners() { + if (!mSavedSettingRetrieveNeighborSlot.connected()) + { + mSavedSettingRetrieveNeighborSlot = gSavedSettings.getControl(CONTROL_NAME_RETRIEVE_NEIGHBOR)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleRetrieveNeighborChange, this, _1, _2)); + } if (!mSavedSettingWalkableSlot.connected()) { mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2)); @@ -1225,8 +1231,12 @@ void LLFloaterPathfindingConsole::registerNavMeshColorListeners() } } -void LLFloaterPathfindingConsole::deregisterNavMeshColorListeners() +void LLFloaterPathfindingConsole::deregisterSavedSettingsListeners() { + if (mSavedSettingRetrieveNeighborSlot.connected()) + { + mSavedSettingRetrieveNeighborSlot.disconnect(); + } if (mSavedSettingWalkableSlot.connected()) { mSavedSettingWalkableSlot.disconnect(); @@ -1277,6 +1287,11 @@ void LLFloaterPathfindingConsole::deregisterNavMeshColorListeners() } } +void LLFloaterPathfindingConsole::handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue) +{ + initializeNavMeshZoneForCurrentRegion(); +} + void LLFloaterPathfindingConsole::handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue) { fillInColorsForNavMeshVisualization(); -- cgit v1.2.3 From 87cba5a2b2ff662cb1b4d847b1ca3030ad53c960 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 1 May 2012 10:54:00 -0400 Subject: Path-494: Added support for culling permanent objects from the pathfinding window. --- indra/newview/llfloaterpathfindingconsole.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 2ccba3604b..570a3f45eb 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -48,7 +48,7 @@ #include "llpathfindingpathtool.h" #include "lltoolmgr.h" #include "lltoolfocus.h" - +#include "pipeline.h" #include "llpathinglib.h" #define XUI_RENDER_HEATMAP_NONE 0 @@ -85,6 +85,8 @@ LLHandle LLFloaterPathfindingConsole::sInstanceHandle; +extern LLPipeline gPipeline; + //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- @@ -97,8 +99,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowWorldCheckBox = findChild("show_world"); llassert(mShowWorldCheckBox != NULL); mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this)); - + mShowWorldMovablesOnlyCheckBox = findChild("show_world_movables_only"); + mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRenderWorldMovablesOnly, this)); llassert(mShowWorldMovablesOnlyCheckBox != NULL); mShowNavMeshCheckBox = findChild("show_navmesh"); @@ -600,6 +603,18 @@ void LLFloaterPathfindingConsole::onClearPathClicked() clearPath(); } +void LLFloaterPathfindingConsole::onRenderWorldMovablesOnly() +{ + if ( mShowWorldMovablesOnlyCheckBox->get() ) + { + gPipeline.hidePermanentObjects( mRenderableRestoreList ); + } + else + { + gPipeline.restorePermanentObjects( mRenderableRestoreList ); + mRenderableRestoreList.clear(); + } +} void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) { switch (pNavMeshZoneRequestStatus) -- cgit v1.2.3 From 44387d5ff0ef3453204c137b4c3816a689b9f9ce Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 2 May 2012 11:32:11 -0400 Subject: Fix for Path-494. Teleporting with a list of renderables that needed to be restored caused a crash because the vo's had already been removed prior to the restorePermanentObjects() call. --- indra/newview/llfloaterpathfindingconsole.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 570a3f45eb..9f7e4ab838 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -611,8 +611,7 @@ void LLFloaterPathfindingConsole::onRenderWorldMovablesOnly() } else { - gPipeline.restorePermanentObjects( mRenderableRestoreList ); - mRenderableRestoreList.clear(); + cleanupRenderableRestoreItems(); } } void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) @@ -993,6 +992,13 @@ void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() mNavMeshZone.initialize(); mNavMeshZone.enable(); mNavMeshZone.refresh(); + mRenderableRestoreList.clear(); +} + +void LLFloaterPathfindingConsole::cleanupRenderableRestoreItems() +{ + gPipeline.restorePermanentObjects( mRenderableRestoreList ); + mRenderableRestoreList.clear(); } void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) -- cgit v1.2.3 From 7ae9da8ab57a913c681ded674f48becdeafb7582 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 2 May 2012 13:34:36 -0400 Subject: Handling mRenderableRestoreList data when closing pathfinding window --- indra/newview/llfloaterpathfindingconsole.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 9f7e4ab838..4c55e4debd 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -302,7 +302,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) setDefaultInputs(); setConsoleState(kConsoleStateUnknown); - + cleanupRenderableRestoreItems(); LLFloater::onClose(pIsAppQuitting); } @@ -657,8 +657,8 @@ void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentSta } void LLFloaterPathfindingConsole::onRegionBoundaryCross() -{ - initializeNavMeshZoneForCurrentRegion(); +{ + initializeNavMeshZoneForCurrentRegion(); setRenderWorld(TRUE); setRenderWorldMovablesOnly(FALSE); } @@ -708,6 +708,7 @@ void LLFloaterPathfindingConsole::setDefaultInputs() setRenderExclusionVolumes(FALSE); setRenderWaterPlane(FALSE); setRenderXRay(FALSE); + setRenderWorldMovablesOnly(FALSE); } void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) @@ -992,13 +993,16 @@ void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() mNavMeshZone.initialize(); mNavMeshZone.enable(); mNavMeshZone.refresh(); - mRenderableRestoreList.clear(); + cleanupRenderableRestoreItems(); } void LLFloaterPathfindingConsole::cleanupRenderableRestoreItems() { - gPipeline.restorePermanentObjects( mRenderableRestoreList ); - mRenderableRestoreList.clear(); + if ( !mRenderableRestoreList.empty() ) + { + gPipeline.restorePermanentObjects( mRenderableRestoreList ); + mRenderableRestoreList.clear(); + } } void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) -- cgit v1.2.3 From 92ce47a1b21b3cc06d3d962394f44617a780ffbd Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 9 May 2012 15:56:06 -0400 Subject: Added support to disable a draw pool. When the movable option checkbox is selected we will now also cull the terrain draw pool. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 4c55e4debd..f6eb40abdc 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1003,6 +1003,10 @@ void LLFloaterPathfindingConsole::cleanupRenderableRestoreItems() gPipeline.restorePermanentObjects( mRenderableRestoreList ); mRenderableRestoreList.clear(); } + else + { + gPipeline.skipRenderingOfTerrain( false ); + } } void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) -- cgit v1.2.3 From 8b7b9ce31c7f055708501f788ef4ed2241a2c126 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 22 May 2012 11:20:47 -0700 Subject: PATH-641: BUGFIX Resolving issue with show world movables only not working as expected. --- indra/newview/llfloaterpathfindingconsole.cpp | 31 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index f6eb40abdc..426ea629ee 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -101,8 +101,8 @@ BOOL LLFloaterPathfindingConsole::postBuild() mShowWorldCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldSet, this)); mShowWorldMovablesOnlyCheckBox = findChild("show_world_movables_only"); - mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onRenderWorldMovablesOnly, this)); llassert(mShowWorldMovablesOnlyCheckBox != NULL); + mShowWorldMovablesOnlyCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onShowWorldMovablesOnlySet, this)); mShowNavMeshCheckBox = findChild("show_navmesh"); llassert(mShowNavMeshCheckBox != NULL); @@ -542,6 +542,12 @@ LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() void LLFloaterPathfindingConsole::onShowWorldSet() { setWorldRenderState(); + updateRenderablesObjects(); +} + +void LLFloaterPathfindingConsole::onShowWorldMovablesOnlySet() +{ + updateRenderablesObjects(); } void LLFloaterPathfindingConsole::onShowNavMeshSet() @@ -603,17 +609,6 @@ void LLFloaterPathfindingConsole::onClearPathClicked() clearPath(); } -void LLFloaterPathfindingConsole::onRenderWorldMovablesOnly() -{ - if ( mShowWorldMovablesOnlyCheckBox->get() ) - { - gPipeline.hidePermanentObjects( mRenderableRestoreList ); - } - else - { - cleanupRenderableRestoreItems(); - } -} void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) { switch (pNavMeshZoneRequestStatus) @@ -737,6 +732,18 @@ void LLFloaterPathfindingConsole::setNavMeshRenderState() mShowNavMeshWalkabilityComboBox->setEnabled(renderNavMesh); } +void LLFloaterPathfindingConsole::updateRenderablesObjects() +{ + if ( isRenderWorldMovablesOnly() ) + { + gPipeline.hidePermanentObjects( mRenderableRestoreList ); + } + else + { + cleanupRenderableRestoreItems(); + } +} + void LLFloaterPathfindingConsole::updateControlsOnConsoleState() { switch (mConsoleState) -- cgit v1.2.3 From 4f3a748b5b4dfb3581e3a4ccdc90ad56e2e3ad3d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 22 May 2012 11:50:06 -0700 Subject: PATH-649: BUGFIX Re-initializing the navmesh zone following a teleport failure. --- indra/newview/llfloaterpathfindingconsole.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 426ea629ee..54e60ce0f4 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -50,6 +50,7 @@ #include "lltoolfocus.h" #include "pipeline.h" #include "llpathinglib.h" +#include "llviewerparcelmgr.h" #define XUI_RENDER_HEATMAP_NONE 0 #define XUI_RENDER_HEATMAP_A 1 @@ -255,6 +256,11 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); } + if (!mTeleportFailedSlot.connected()) + { + mTeleportFailedSlot = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); + } + if (!mPathEventSlot.connected()) { mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this)); @@ -279,6 +285,11 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) mPathEventSlot.disconnect(); } + if (mTeleportFailedSlot.connected()) + { + mTeleportFailedSlot.disconnect(); + } + if (mRegionBoundarySlot.connected()) { mRegionBoundarySlot.disconnect(); @@ -513,6 +524,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mIsNavMeshUpdating(false), mAgentStateSlot(), mRegionBoundarySlot(), + mTeleportFailedSlot(), mPathEventSlot(), mPathfindingToolset(NULL), mSavedToolset(NULL), -- cgit v1.2.3 From b912c27bf44a45e607adc3b5c94d3fd8a9bbf53e Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 16:40:53 -0700 Subject: PATH-711: Implementing Leo's changes for the pathfinding console. --- indra/newview/llfloaterpathfindingconsole.cpp | 137 +------------------------- 1 file changed, 1 insertion(+), 136 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 54e60ce0f4..59ce330a10 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -64,9 +64,6 @@ #define XUI_CHARACTER_TYPE_C 3 #define XUI_CHARACTER_TYPE_D 4 -#define XUI_EDIT_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" @@ -138,37 +135,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mViewCharactersButton != NULL); mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this)); - mEditTestTabContainer = findChild("edit_test_tab_container"); - llassert(mEditTestTabContainer != NULL); - mEditTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this)); - - mEditTab = findChild("edit_panel"); - llassert(mEditTab != NULL); - mTestTab = findChild("test_panel"); llassert(mTestTab != 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)); - mPathfindingViewerStatus = findChild("pathfinding_viewer_status"); llassert(mPathfindingViewerStatus != NULL); @@ -205,11 +174,6 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mClearPathButton != NULL); mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); - if (LLPathingLib::getInstance() == NULL) - { - LLPathingLib::initSystem(); - } - if (LLPathingLib::getInstance() != NULL) { mPathfindingToolset = new LLToolset(); @@ -246,11 +210,6 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) fillInColorsForNavMeshVisualization(); } - if (!mAgentStateSlot.connected()) - { - mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1)); - } - if (!mRegionBoundarySlot.connected()) { mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this)); @@ -266,14 +225,10 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this)); } - setAgentState(LLPathfindingManager::getInstance()->getAgentState()); setDefaultInputs(); updatePathTestStatus(); - if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) - { - switchIntoTestPathMode(); - } + switchIntoTestPathMode(); } void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) @@ -295,11 +250,6 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) mRegionBoundarySlot.disconnect(); } - if (mAgentStateSlot.connected()) - { - mAgentStateSlot.disconnect(); - } - if (mNavMeshZoneSlot.connected()) { mNavMeshZoneSlot.disconnect(); @@ -501,15 +451,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mPathfindingViewerStatus(NULL), mPathfindingSimulatorStatus(NULL), mViewCharactersButton(NULL), - mEditTestTabContainer(NULL), - mEditTab(NULL), mTestTab(NULL), - mUnfreezeLabel(NULL), - mUnfreezeButton(NULL), - mLinksetsLabel(NULL), - mLinksetsButton(NULL), - mFreezeLabel(NULL), - mFreezeButton(NULL), mCtrlClickLabel(), mShiftClickLabel(), mCharacterWidthLabel(), @@ -522,7 +464,6 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mNavMeshZoneSlot(), mNavMeshZone(), mIsNavMeshUpdating(false), - mAgentStateSlot(), mRegionBoundarySlot(), mTeleportFailedSlot(), mPathEventSlot(), @@ -577,35 +518,6 @@ void LLFloaterPathfindingConsole::onViewCharactersClicked() LLFloaterPathfindingCharacters::openCharactersViewer(); } -void LLFloaterPathfindingConsole::onTabSwitch() -{ - if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX) - { - switchIntoTestPathMode(); - } - else - { - switchOutOfTestPathMode(); - } -} - -void LLFloaterPathfindingConsole::onUnfreezeClicked() -{ - mUnfreezeButton->setEnabled(FALSE); - LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen); -} - -void LLFloaterPathfindingConsole::onFreezeClicked() -{ - mFreezeButton->setEnabled(FALSE); - LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen); -} - -void LLFloaterPathfindingConsole::onViewEditLinksetClicked() -{ - LLFloaterPathfindingLinksets::openLinksetsEditor(); -} - void LLFloaterPathfindingConsole::onCharacterWidthSet() { updateCharacterWidth(); @@ -658,11 +570,6 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav } } -void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState) -{ - setAgentState(pAgentState); -} - void LLFloaterPathfindingConsole::onRegionBoundaryCross() { initializeNavMeshZoneForCurrentRegion(); @@ -706,7 +613,6 @@ void LLFloaterPathfindingConsole::onPathEvent() void LLFloaterPathfindingConsole::setDefaultInputs() { - mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX); setRenderWorld(TRUE); setRenderNavMesh(FALSE); setRenderWalkables(FALSE); @@ -776,7 +682,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(FALSE); - mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); mCtrlClickLabel->setEnabled(FALSE); mShiftClickLabel->setEnabled(FALSE); @@ -802,7 +707,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(TRUE); - mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); mCtrlClickLabel->setEnabled(FALSE); mShiftClickLabel->setEnabled(FALSE); @@ -830,7 +734,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() mShowRenderWaterPlaneCheckBox->setEnabled(FALSE); mShowXRayCheckBox->setEnabled(FALSE); mViewCharactersButton->setEnabled(TRUE); - mEditTestTabContainer->selectTab(0); mTestTab->setEnabled(FALSE); mCtrlClickLabel->setEnabled(FALSE); mShiftClickLabel->setEnabled(FALSE); @@ -1028,44 +931,6 @@ void LLFloaterPathfindingConsole::cleanupRenderableRestoreItems() } } -void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState) -{ - switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState()) - { - case LLPathfindingManager::kAgentStateUnknown : - case LLPathfindingManager::kAgentStateNotEnabled : - mEditTab->setEnabled(FALSE); - mUnfreezeLabel->setEnabled(FALSE); - mUnfreezeButton->setEnabled(FALSE); - mLinksetsLabel->setEnabled(FALSE); - mLinksetsButton->setEnabled(FALSE); - mFreezeLabel->setEnabled(FALSE); - mFreezeButton->setEnabled(FALSE); - break; - case LLPathfindingManager::kAgentStateFrozen : - mEditTab->setEnabled(TRUE); - mUnfreezeLabel->setEnabled(TRUE); - mUnfreezeButton->setEnabled(TRUE); - mLinksetsLabel->setEnabled(FALSE); - mLinksetsButton->setEnabled(FALSE); - mFreezeLabel->setEnabled(FALSE); - mFreezeButton->setEnabled(FALSE); - break; - case LLPathfindingManager::kAgentStateUnfrozen : - mEditTab->setEnabled(TRUE); - mUnfreezeLabel->setEnabled(FALSE); - mUnfreezeButton->setEnabled(FALSE); - mLinksetsLabel->setEnabled(TRUE); - mLinksetsButton->setEnabled(TRUE); - mFreezeLabel->setEnabled(TRUE); - mFreezeButton->setEnabled(TRUE); - break; - default : - llassert(0); - break; - } -} - void LLFloaterPathfindingConsole::switchIntoTestPathMode() { if (LLPathingLib::getInstance() != NULL) -- cgit v1.2.3 From e738e704b88d64b8a0183f94045d229d9f498bd1 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 11 Jun 2012 17:03:15 -0700 Subject: PATH-714: Removing the DEPRECATED_UNVERSIONED_NAVMESH as the viewer no longer has to support the Premium Wilderness regions on the old server code. --- indra/newview/llfloaterpathfindingconsole.cpp | 34 --------------------------- 1 file changed, 34 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 59ce330a10..eae7aa4bcc 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -847,39 +847,6 @@ std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const { std::string simulatorStatusText(""); -#ifdef DEPRECATED_UNVERSIONED_NAVMESH - if (LLPathfindingManager::getInstance()->isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX()) - { - switch (mNavMeshZone.getNavMeshZoneStatus()) - { - case LLPathfindingNavMeshZone::kNavMeshZonePending : - simulatorStatusText = getString("navmesh_simulator_status_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : - simulatorStatusText = getString("navmesh_simulator_status_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : - simulatorStatusText = getString("navmesh_simulator_status_some_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : - simulatorStatusText = getString("navmesh_simulator_status_some_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : - simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneComplete : - simulatorStatusText = getString("navmesh_simulator_status_complete"); - break; - default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); - break; - } - } - else - { - simulatorStatusText = getString("navmesh_simulator_status_region_not_enabled"); - } -#else // DEPRECATED_UNVERSIONED_NAVMESH switch (mNavMeshZone.getNavMeshZoneStatus()) { case LLPathfindingNavMeshZone::kNavMeshZonePending : @@ -904,7 +871,6 @@ std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const simulatorStatusText = getString("navmesh_simulator_status_unknown"); break; } -#endif // DEPRECATED_UNVERSIONED_NAVMESH return simulatorStatusText; } -- cgit v1.2.3 From 76f7c0e58c75add62c0fb989bf13bfa50952c4bd Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 13 Jun 2012 16:12:11 -0400 Subject: path-722: Make sure to remove the bake navmesh button if the pathingfinding console is closed. --- indra/newview/llfloaterpathfindingconsole.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index eae7aa4bcc..7d3efb5454 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -51,6 +51,7 @@ #include "pipeline.h" #include "llpathinglib.h" #include "llviewerparcelmgr.h" +#include "llpanelnavmeshrebake.h" #define XUI_RENDER_HEATMAP_NONE 0 #define XUI_RENDER_HEATMAP_A 1 @@ -264,6 +265,9 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) setDefaultInputs(); setConsoleState(kConsoleStateUnknown); cleanupRenderableRestoreItems(); + LLPanelNavMeshRebake* pPanelNavMeshRebake = LLPanelNavMeshRebake::getInstance(); + if ( pPanelNavMeshRebake ) { pPanelNavMeshRebake->setVisible( FALSE ); } + LLFloater::onClose(pIsAppQuitting); } -- cgit v1.2.3 From c1c3b856fbc4e911436e93d76a7c7807afca7ca8 Mon Sep 17 00:00:00 2001 From: prep Date: Tue, 19 Jun 2012 15:55:22 -0400 Subject: Path-722: Fixed bug where navmesh rebake panel was being removed after navmesh debug window was closed. Minor code cleanup. --- indra/newview/llfloaterpathfindingconsole.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 7d3efb5454..89aba6654d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -265,8 +265,6 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting) setDefaultInputs(); setConsoleState(kConsoleStateUnknown); cleanupRenderableRestoreItems(); - LLPanelNavMeshRebake* pPanelNavMeshRebake = LLPanelNavMeshRebake::getInstance(); - if ( pPanelNavMeshRebake ) { pPanelNavMeshRebake->setVisible( FALSE ); } LLFloater::onClose(pIsAppQuitting); } -- cgit v1.2.3 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 ++++++++++++++++++--------- 1 file changed, 39 insertions(+), 18 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') 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); -- cgit v1.2.3 From afb42263ab7bd1469708ec534ba43bd45c16f1fc Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 22 Jun 2012 16:47:08 -0700 Subject: PATH-761: Better calling out the various status of the simulator status through the highlight colors. --- indra/newview/llfloaterpathfindingconsole.cpp | 128 +++++++++++++++----------- 1 file changed, 72 insertions(+), 56 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 047559fa5d..810650621d 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -181,6 +181,9 @@ BOOL LLFloaterPathfindingConsole::postBuild() llassert(mClearPathButton != NULL); mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this)); + mErrorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); + mWarningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); + if (LLPathingLib::getInstance() != NULL) { mPathfindingToolset = new LLToolset(); @@ -473,6 +476,8 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mCharacterTypeComboBox(NULL), mPathTestingStatus(NULL), mClearPathButton(NULL), + mErrorColor(), + mWarningColor(), mNavMeshZoneSlot(), mNavMeshZone(), mIsNavMeshUpdating(false), @@ -648,7 +653,8 @@ void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) { mConsoleState = pConsoleState; updateControlsOnConsoleState(); - updateStatusOnConsoleState(); + updateViewerStatusOnConsoleState(); + updateSimulatorStatusOnConsoleState(); } void LLFloaterPathfindingConsole::setWorldRenderState() @@ -797,44 +803,34 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState() } } -void LLFloaterPathfindingConsole::updateStatusOnConsoleState() +void LLFloaterPathfindingConsole::updateViewerStatusOnConsoleState() { - static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); - - std::string simulatorStatusText(""); std::string viewerStatusText(""); LLStyle::Params viewerStyleParams; switch (mConsoleState) { case kConsoleStateUnknown : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_unknown"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; case kConsoleStateLibraryNotImplemented : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_library_not_implemented"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; case kConsoleStateRegionNotEnabled : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_region_not_enabled"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; case kConsoleStateRegionLoading : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_region_loading"); - viewerStyleParams.color = warningColor; + viewerStyleParams.color = mWarningColor; break; case kConsoleStateCheckingVersion : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_checking_version"); - viewerStyleParams.color = warningColor; + viewerStyleParams.color = mWarningColor; break; case kConsoleStateDownloading : - simulatorStatusText = getSimulatorStatusText(); if (mIsNavMeshUpdating) { viewerStatusText = getString("navmesh_viewer_status_updating"); @@ -843,59 +839,82 @@ void LLFloaterPathfindingConsole::updateStatusOnConsoleState() { viewerStatusText = getString("navmesh_viewer_status_downloading"); } - viewerStyleParams.color = warningColor; + viewerStyleParams.color = mWarningColor; break; case kConsoleStateHasNavMesh : - simulatorStatusText = getSimulatorStatusText(); viewerStatusText = getString("navmesh_viewer_status_has_navmesh"); break; case kConsoleStateError : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_error"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; break; default : - simulatorStatusText = getString("navmesh_simulator_status_unknown"); viewerStatusText = getString("navmesh_viewer_status_unknown"); - viewerStyleParams.color = errorColor; + viewerStyleParams.color = mErrorColor; llassert(0); break; } mPathfindingViewerStatus->setText((LLStringExplicit)viewerStatusText, viewerStyleParams); - mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText); } -std::string LLFloaterPathfindingConsole::getSimulatorStatusText() const +void LLFloaterPathfindingConsole::updateSimulatorStatusOnConsoleState() { std::string simulatorStatusText(""); + LLStyle::Params simulatorStyleParams; - switch (mNavMeshZone.getNavMeshZoneStatus()) + switch (mConsoleState) { - case LLPathfindingNavMeshZone::kNavMeshZonePending : - simulatorStatusText = getString("navmesh_simulator_status_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : - simulatorStatusText = getString("navmesh_simulator_status_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : - simulatorStatusText = getString("navmesh_simulator_status_some_pending"); - break; - case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : - simulatorStatusText = getString("navmesh_simulator_status_some_building"); - break; - case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : - simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + case kConsoleStateUnknown : + case kConsoleStateLibraryNotImplemented : + case kConsoleStateRegionNotEnabled : + case kConsoleStateRegionLoading : + case kConsoleStateCheckingVersion : + case kConsoleStateError : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + simulatorStyleParams.color = mErrorColor; break; - case LLPathfindingNavMeshZone::kNavMeshZoneComplete : - simulatorStatusText = getString("navmesh_simulator_status_complete"); + case kConsoleStateDownloading : + case kConsoleStateHasNavMesh : + switch (mNavMeshZone.getNavMeshZoneStatus()) + { + case LLPathfindingNavMeshZone::kNavMeshZonePending : + simulatorStatusText = getString("navmesh_simulator_status_pending"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneBuilding : + simulatorStatusText = getString("navmesh_simulator_status_building"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomePending : + simulatorStatusText = getString("navmesh_simulator_status_some_pending"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneSomeBuilding : + simulatorStatusText = getString("navmesh_simulator_status_some_building"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZonePendingAndBuilding : + simulatorStatusText = getString("navmesh_simulator_status_pending_and_building"); + simulatorStyleParams.color = mWarningColor; + break; + case LLPathfindingNavMeshZone::kNavMeshZoneComplete : + simulatorStatusText = getString("navmesh_simulator_status_complete"); + break; + default : + simulatorStatusText = getString("navmesh_simulator_status_unknown"); + simulatorStyleParams.color = mErrorColor; + break; + } break; - default : + default : simulatorStatusText = getString("navmesh_simulator_status_unknown"); + simulatorStyleParams.color = mErrorColor; + llassert(0); break; } - return simulatorStatusText; + mPathfindingSimulatorStatus->setText((LLStringExplicit)simulatorStatusText, simulatorStyleParams); } void LLFloaterPathfindingConsole::initializeNavMeshZoneForCurrentRegion() @@ -990,9 +1009,6 @@ void LLFloaterPathfindingConsole::clearPath() void LLFloaterPathfindingConsole::updatePathTestStatus() { - static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor"); - static const LLColor4 warningColor = LLUIColorTable::instance().getColor("PathfindingWarningColor"); - std::string statusText(""); LLStyle::Params styleParams; @@ -1000,42 +1016,42 @@ void LLFloaterPathfindingConsole::updatePathTestStatus() { case LLPathfindingPathTool::kPathStatusUnknown : statusText = getString("pathing_unknown"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusChooseStartAndEndPoints : statusText = getString("pathing_choose_start_and_end_points"); - styleParams.color = warningColor; + styleParams.color = mWarningColor; break; case LLPathfindingPathTool::kPathStatusChooseStartPoint : statusText = getString("pathing_choose_start_point"); - styleParams.color = warningColor; + styleParams.color = mWarningColor; break; case LLPathfindingPathTool::kPathStatusChooseEndPoint : statusText = getString("pathing_choose_end_point"); - styleParams.color = warningColor; + styleParams.color = mWarningColor; break; case LLPathfindingPathTool::kPathStatusHasValidPath : statusText = getString("pathing_path_valid"); break; case LLPathfindingPathTool::kPathStatusHasInvalidPath : statusText = getString("pathing_path_invalid"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusNotEnabled : statusText = getString("pathing_region_not_enabled"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusNotImplemented : statusText = getString("pathing_library_not_implemented"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; case LLPathfindingPathTool::kPathStatusError : statusText = getString("pathing_error"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; default : statusText = getString("pathing_unknown"); - styleParams.color = errorColor; + styleParams.color = mErrorColor; break; } -- cgit v1.2.3 From b6d42e0b6223a290f700d9ce9a8aea5f48764610 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 25 Jun 2012 16:41:12 -0700 Subject: PATH-783: Ensuring that the pathfinding console and pathfinding characters floaters cannot be created through getInstanceHandle(). --- indra/newview/llfloaterpathfindingconsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 810650621d..2cf7f3aeb1 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -285,7 +285,7 @@ LLHandle LLFloaterPathfindingConsole::getInstanceHa { if (sInstanceHandle.isDead()) { - LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::getTypedInstance("pathfinding_console"); + LLFloaterPathfindingConsole *floaterInstance = LLFloaterReg::findTypedInstance("pathfinding_console"); if (floaterInstance != NULL) { sInstanceHandle = floaterInstance->mSelfHandle; -- cgit v1.2.3 From 2cd321eaa9b9b9872318ce3977acd9a2f782872f Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 14:09:07 -0700 Subject: Updating the pathfinding-specific settings with appropriate comments and an unified naming scheme. --- indra/newview/llfloaterpathfindingconsole.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 2cf7f3aeb1..c2d19bfb9a 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -70,7 +70,7 @@ #define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type) -#define CONTROL_NAME_RETRIEVE_NEIGHBOR "RetrieveNeighboringRegion" +#define CONTROL_NAME_RETRIEVE_NEIGHBOR "PathfindingRetrieveNeighboringRegion" #define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable" #define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle" #define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial" @@ -80,8 +80,8 @@ #define CONTROL_NAME_HEATMAP_MIN "PathfindingHeatColorBase" #define CONTROL_NAME_HEATMAP_MAX "PathfindingHeatColorMax" #define CONTROL_NAME_NAVMESH_FACE "PathfindingFaceColor" -#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingStarValidColor" -#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingStarInvalidColor" +#define CONTROL_NAME_TEST_PATH_VALID_END "PathfindingTestPathValidEndColor" +#define CONTROL_NAME_TEST_PATH_INVALID_END "PathfindingTestPathInvalidEndColor" #define CONTROL_NAME_TEST_PATH "PathfindingTestPathColor" #define CONTROL_NAME_WATER "PathfindingWaterColor" -- cgit v1.2.3 From 78910cf3016fc55eaf8214640b348df0f8bcdeda Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 18:04:19 -0700 Subject: Updating the header licensing comments. --- indra/newview/llfloaterpathfindingconsole.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index c2d19bfb9a..ab5775de06 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -1,32 +1,35 @@ /** * @file llfloaterpathfindingconsole.cpp -* @author William Todd Stinson -* @brief "Pathfinding console" floater, allowing manipulation of the Havok AI pathfinding settings. +* @brief "Pathfinding console" floater, allowing for viewing and testing of the pathfinding navmesh through Havok AI utilities. +* @author Stinson@lindenlab.com * -* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code -* Copyright (C) 2010, Linden Research, Inc. -* +* Copyright (C) 2012, Linden Research, Inc. +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. -* +* * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* +* * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ + #include "llviewerprecompiledheaders.h" + #include "llfloaterpathfindingconsole.h" + #include "llfloaterpathfindinglinksets.h" #include "llfloaterpathfindingcharacters.h" -- cgit v1.2.3 From a818cd4f7336ed9b33dacd91fcaf5239a8be813d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 26 Jun 2012 18:22:17 -0700 Subject: Renaming the rebake navmesh panel class. --- indra/newview/llfloaterpathfindingconsole.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index ab5775de06..0bd5dc0263 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -54,7 +54,6 @@ #include "pipeline.h" #include "llpathinglib.h" #include "llviewerparcelmgr.h" -#include "llpanelnavmeshrebake.h" #define XUI_RENDER_HEATMAP_NONE 0 #define XUI_RENDER_HEATMAP_A 1 -- cgit v1.2.3 From 685a672b74550ca0dbf8a816257c84c9c44fd34d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 28 Jun 2012 15:37:55 -0700 Subject: Cleaning up new files in preparation for merge into viewer-release. --- indra/newview/llfloaterpathfindingconsole.cpp | 51 +++++++++++++++------------ 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 0bd5dc0263..2fe60a8d8f 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -30,30 +30,31 @@ #include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindinglinksets.h" -#include "llfloaterpathfindingcharacters.h" +#include + +#include -#include "llsd.h" -#include "llhandle.h" -#include "llcontrol.h" -#include "llpanel.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llsliderctrl.h" -#include "lllineeditor.h" -#include "lltextbase.h" -#include "lltabcontainer.h" #include "llcombobox.h" +#include "llcontrol.h" +#include "llenvmanager.h" +#include "llfloaterpathfindingcharacters.h" +#include "llfloaterpathfindinglinksets.h" #include "llfloaterreg.h" +#include "llhandle.h" +#include "llpanel.h" #include "llpathfindingnavmeshzone.h" -#include "llpathfindingmanager.h" -#include "llenvmanager.h" #include "llpathfindingpathtool.h" +#include "llpathinglib.h" +#include "llsliderctrl.h" +#include "llsd.h" +#include "lltabcontainer.h" +#include "lltextbase.h" #include "lltoolmgr.h" #include "lltoolfocus.h" -#include "pipeline.h" -#include "llpathinglib.h" #include "llviewerparcelmgr.h" +#include "pipeline.h" #define XUI_RENDER_HEATMAP_NONE 0 #define XUI_RENDER_HEATMAP_A 1 @@ -89,8 +90,6 @@ LLHandle LLFloaterPathfindingConsole::sInstanceHandle; -extern LLPipeline gPipeline; - //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- @@ -213,7 +212,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) { if (!mNavMeshZoneSlot.connected()) { - mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::onNavMeshZoneCB, this, _1)); + mNavMeshZoneSlot = mNavMeshZone.registerNavMeshZoneListener(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshZoneStatus, this, _1)); } mIsNavMeshUpdating = false; @@ -500,9 +499,10 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mSavedSettingNavMeshFaceSlot(), mSavedSettingTestPathValidEndSlot(), mSavedSettingTestPathInvalidEndSlot(), - mSavedSettingWaterSlot(), mSavedSettingTestPathSlot(), - mConsoleState(kConsoleStateUnknown) + mSavedSettingWaterSlot(), + mConsoleState(kConsoleStateUnknown), + mRenderableRestoreList() { mSelfHandle.bind(this); } @@ -541,7 +541,10 @@ void LLFloaterPathfindingConsole::onShowNavMeshSet() void LLFloaterPathfindingConsole::onShowWalkabilitySet() { - LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); + if (LLPathingLib::getInstance() != NULL) + { + LLPathingLib::getInstance()->setNavMeshMaterialType(getRenderHeatmapType()); + } } void LLFloaterPathfindingConsole::onCharacterWidthSet() @@ -559,7 +562,7 @@ void LLFloaterPathfindingConsole::onClearPathClicked() clearPath(); } -void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) +void LLFloaterPathfindingConsole::handleNavMeshZoneStatus(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus) { switch (pNavMeshZoneRequestStatus) { @@ -641,6 +644,7 @@ void LLFloaterPathfindingConsole::setDefaultInputs() { mViewTestTabContainer->selectTab(XUI_VIEW_TAB_INDEX); setRenderWorld(TRUE); + setRenderWorldMovablesOnly(FALSE); setRenderNavMesh(FALSE); setRenderWalkables(FALSE); setRenderMaterialVolumes(FALSE); @@ -648,7 +652,6 @@ void LLFloaterPathfindingConsole::setDefaultInputs() setRenderExclusionVolumes(FALSE); setRenderWaterPlane(FALSE); setRenderXRay(FALSE); - setRenderWorldMovablesOnly(FALSE); } void LLFloaterPathfindingConsole::setConsoleState(EConsoleState pConsoleState) @@ -1205,6 +1208,10 @@ void LLFloaterPathfindingConsole::deregisterSavedSettingsListeners() { mSavedSettingTestPathSlot.disconnect(); } + if (mSavedSettingWaterSlot.connected()) + { + mSavedSettingWaterSlot.disconnect(); + } } void LLFloaterPathfindingConsole::handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue) -- cgit v1.2.3 From e61785a45f7ad1ace4937423f421ea1f0b956e23 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 12 Jul 2012 14:29:11 -0700 Subject: Removing debug settings that were in place for pathfinding simulator testing. --- indra/newview/llfloaterpathfindingconsole.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloaterpathfindingconsole.cpp') diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 2fe60a8d8f..298454724b 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -53,6 +53,7 @@ #include "lltextbase.h" #include "lltoolmgr.h" #include "lltoolfocus.h" +#include "llviewercontrol.h" #include "llviewerparcelmgr.h" #include "pipeline.h" -- cgit v1.2.3