From e88ed1164adf3797f97ede40def40e0d85fc24f6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 10 Feb 2012 13:37:37 -0800 Subject: PATH-245: Adding functionality for returning objects to owner from the characters floater. --- indra/newview/llfloaterpathfindingcharacters.cpp | 6 +-- indra/newview/llviewermenu.cpp | 49 ++++++++++++++++++++++++ indra/newview/llviewermenu.h | 2 + 3 files changed, 54 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 561ad9535b..25642f0226 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -356,12 +356,12 @@ void LLFloaterPathfindingCharacters::onTakeCopyCharactersClicked() void LLFloaterPathfindingCharacters::onReturnCharactersClicked() { - llwarns << "functionality has not yet been implemented to return characters" << llendl; + handle_object_return(); } void LLFloaterPathfindingCharacters::onDeleteCharactersClicked() { - handle_object_delete(); + handle_object_delete(); } void LLFloaterPathfindingCharacters::onTeleportCharacterToMeClicked() @@ -528,7 +528,7 @@ void LLFloaterPathfindingCharacters::setEnableActionFields(BOOL pEnabled) mShowBeaconCheckBox->setEnabled(pEnabled); mTakeBtn->setEnabled(pEnabled && tools_visible_take_object()); mTakeCopyBtn->setEnabled(pEnabled && enable_object_take_copy()); - mReturnBtn->setEnabled(false && pEnabled); + mReturnBtn->setEnabled(pEnabled && enable_object_return()); mDeleteBtn->setEnabled(pEnabled && enable_object_delete()); mTeleportBtn->setEnabled(pEnabled && (mCharactersScrollList->getNumSelected() == 1)); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d2c441ce73..92a01c22b3 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5010,6 +5010,12 @@ class LLEditDelete : public view_listener_t } }; +bool enable_object_return() +{ + return (!LLSelectMgr::getInstance()->getSelection()->isEmpty() && + (gAgent.isGodlike() || can_derez(DRD_RETURN_TO_OWNER))); +} + bool enable_object_delete() { bool new_value = @@ -5025,6 +5031,49 @@ bool enable_object_delete() return new_value; } +class LLObjectsReturnPackage +{ +public: + LLObjectsReturnPackage() : mObjectSelection(), mReturnableObjects(), mError(), mFirstRegion(NULL) {}; + ~LLObjectsReturnPackage() + { + mObjectSelection.clear(); + mReturnableObjects.clear(); + mError.clear(); + mFirstRegion = NULL; + }; + + LLObjectSelectionHandle mObjectSelection; + LLDynamicArray mReturnableObjects; + std::string mError; + LLViewerRegion *mFirstRegion; +}; + +static void return_objects(LLObjectsReturnPackage *objectsReturnPackage, const LLSD& notification, const LLSD& response) +{ + if (LLNotificationsUtil::getSelectedOption(notification, response) == 0) + { + // Ignore category ID for this derez destination. + derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, objectsReturnPackage->mFirstRegion, objectsReturnPackage->mError, &objectsReturnPackage->mReturnableObjects); + } + + delete objectsReturnPackage; +} + +void handle_object_return() +{ + if (!LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + LLObjectsReturnPackage *objectsReturnPackage = new LLObjectsReturnPackage(); + objectsReturnPackage->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); + + // Save selected objects, so that we still know what to return after the confirmation dialog resets selection. + get_derezzable_objects(DRD_RETURN_TO_OWNER, objectsReturnPackage->mError, objectsReturnPackage->mFirstRegion, &objectsReturnPackage->mReturnableObjects); + + LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&return_objects, objectsReturnPackage, _1, _2)); + } +} + void handle_object_delete() { diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 6316141e75..f10891737f 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -96,6 +96,7 @@ void handle_object_open(); bool visible_take_object(); bool tools_visible_take_object(); bool enable_object_take_copy(); +bool enable_object_return(); bool enable_object_delete(); // Buy either contents or object itself @@ -104,6 +105,7 @@ void handle_take(); void handle_take_copy(); void handle_look_at_selection(const LLSD& param); void handle_zoom_to_object(LLUUID object_id); +void handle_object_return(); void handle_object_delete(); void handle_buy_land(); -- 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/CMakeLists.txt | 4 +- indra/newview/llfloaterpathfindingconsole.cpp | 653 +++++++++++++++++++++ indra/newview/llfloaterpathfindingconsole.h | 151 +++++ indra/newview/llfloaterpathfindingsetup.cpp | 653 --------------------- indra/newview/llfloaterpathfindingsetup.h | 151 ----- indra/newview/llnavmeshstation.cpp | 2 +- indra/newview/llviewerdisplay.cpp | 2 +- indra/newview/llviewerfloaterreg.cpp | 4 +- indra/newview/llviewerwindow.cpp | 2 +- .../default/xui/en/floater_pathfinding_console.xml | 466 +++++++++++++++ .../default/xui/en/floater_pathfinding_setup.xml | 466 --------------- 11 files changed, 1277 insertions(+), 1277 deletions(-) create mode 100644 indra/newview/llfloaterpathfindingconsole.cpp create mode 100644 indra/newview/llfloaterpathfindingconsole.h delete mode 100644 indra/newview/llfloaterpathfindingsetup.cpp delete mode 100644 indra/newview/llfloaterpathfindingsetup.h create mode 100644 indra/newview/skins/default/xui/en/floater_pathfinding_console.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_pathfinding_setup.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 76aa982f1d..45688a1724 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -219,8 +219,8 @@ set(viewer_SOURCE_FILES llfloateropenobject.cpp llfloateroutbox.cpp llfloaterpathfindingcharacters.cpp + llfloaterpathfindingconsole.cpp llfloaterpathfindinglinksets.cpp - llfloaterpathfindingsetup.cpp llfloaterpay.cpp llfloaterperms.cpp llfloaterpostprocess.cpp @@ -782,8 +782,8 @@ set(viewer_HEADER_FILES llfloateropenobject.h llfloateroutbox.h llfloaterpathfindingcharacters.h + llfloaterpathfindingconsole.h llfloaterpathfindinglinksets.h - llfloaterpathfindingsetup.h llfloaterpay.h llfloaterperms.h llfloaterpostprocess.h 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); + } +} diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h new file mode 100644 index 0000000000..edb7072b28 --- /dev/null +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -0,0 +1,151 @@ +/** + * @file llfloaterpathfindingsetup.h + * @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$ + */ + +#ifndef LL_LLFLOATERPATHFINDINGSETUP_H +#define LL_LLFLOATERPATHFINDINGSETUP_H + +#include "llfloater.h" +#include "llnavmeshstation.h" +#include "LLPathingLib.h" + +class LLSD; +class LLRadioGroup; +class LLSliderCtrl; +class LLLineEditor; +class LLTextBase; +class LLCheckBoxCtrl; + +class LLFloaterPathfindingSetup +: public LLFloater +{ + friend class LLFloaterReg; + +public: + typedef enum + { + kRenderOverlayOnFixedPhysicsGeometry = 0, + kRenderOverlayOnAllRenderableGeometry = 1 + } ERegionOverlayDisplay; + + typedef enum + { + kPathSelectNone = 0, + kPathSelectStartPoint = 1, + kPathSelectEndPoint = 2 + } EPathSelectionState; + + typedef enum + { + kCharacterTypeA = 0, + kCharacterTypeB = 1, + kCharacterTypeC = 2, + kCharacterTypeD = 3 + } ECharacterType; + + virtual BOOL postBuild(); + //Populates a data packet that is forwarded onto the LLPathingSystem + void providePathingData( const LLVector3& point1, const LLVector3& point2 ); + + ERegionOverlayDisplay getRegionOverlayDisplay() const; + void setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay); + + EPathSelectionState getPathSelectionState() const; + void setPathSelectionState(EPathSelectionState pPathSelectionState); + + F32 getCharacterWidth() const; + void setCharacterWidth(F32 pCharacterWidth); + + ECharacterType getCharacterType() const; + void setCharacterType(ECharacterType pCharacterType); + + F32 getTerrainMaterialA() const; + void setTerrainMaterialA(F32 pTerrainMaterial); + + F32 getTerrainMaterialB() const; + void setTerrainMaterialB(F32 pTerrainMaterial); + + F32 getTerrainMaterialC() const; + void setTerrainMaterialC(F32 pTerrainMaterial); + + F32 getTerrainMaterialD() const; + void setTerrainMaterialD(F32 pTerrainMaterial); + + void setHasNavMeshReceived(); + void setHasNoNavMesh(); + +protected: + +private: + // Does its own instance management, so clients not allowed + // to allocate or destroy. + LLFloaterPathfindingSetup(const LLSD& pSeed); + virtual ~LLFloaterPathfindingSetup(); + + virtual void onOpen(const LLSD& pKey); + + void onShowNavMeshToggle(); + void onShowExcludeVolumesToggle(); + void onShowPathToggle(); + void onShowWaterPlaneToggle(); + void onRegionOverlayDisplaySwitch(); + void onPathSelectionSwitch(); + void onCharacterWidthSet(); + void onCharacterTypeSwitch(); + void onViewEditLinksetClicked(); + void onRebuildNavMeshClicked(); + void onRefreshNavMeshClicked(); + void onTerrainMaterialASet(); + void onTerrainMaterialBSet(); + void onTerrainMaterialCSet(); + void onTerrainMaterialDSet(); + void generatePath(); + + LLCheckBoxCtrl *mShowNavMeshCheckBox; + LLCheckBoxCtrl *mShowExcludeVolumesCheckBox; + LLCheckBoxCtrl *mShowPathCheckBox; + LLCheckBoxCtrl *mShowWaterPlaneCheckBox; + LLRadioGroup *mRegionOverlayDisplayRadioGroup; + LLRadioGroup *mPathSelectionRadioGroup; + LLSliderCtrl *mCharacterWidthSlider; + LLRadioGroup *mCharacterTypeRadioGroup; + LLTextBase *mPathfindingStatus; + LLLineEditor *mTerrainMaterialA; + LLLineEditor *mTerrainMaterialB; + LLLineEditor *mTerrainMaterialC; + LLLineEditor *mTerrainMaterialD; + + LLNavMeshDownloadObserver mNavMeshDownloadObserver[10]; + int mCurrentMDO; + int mNavMeshCnt; + + //Container that is populated and subsequently submitted to the LLPathingSystem for processing + LLPathingLib::PathingPacket mPathData; + bool mHasStartPoint; + bool mHasEndPoint; +}; + +#endif // LL_LLFLOATERPATHFINDINGSETUP_H diff --git a/indra/newview/llfloaterpathfindingsetup.cpp b/indra/newview/llfloaterpathfindingsetup.cpp deleted file mode 100644 index dc8e96eb53..0000000000 --- a/indra/newview/llfloaterpathfindingsetup.cpp +++ /dev/null @@ -1,653 +0,0 @@ -/** -* @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 "llfloaterpathfindingsetup.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); - } -} diff --git a/indra/newview/llfloaterpathfindingsetup.h b/indra/newview/llfloaterpathfindingsetup.h deleted file mode 100644 index edb7072b28..0000000000 --- a/indra/newview/llfloaterpathfindingsetup.h +++ /dev/null @@ -1,151 +0,0 @@ -/** - * @file llfloaterpathfindingsetup.h - * @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$ - */ - -#ifndef LL_LLFLOATERPATHFINDINGSETUP_H -#define LL_LLFLOATERPATHFINDINGSETUP_H - -#include "llfloater.h" -#include "llnavmeshstation.h" -#include "LLPathingLib.h" - -class LLSD; -class LLRadioGroup; -class LLSliderCtrl; -class LLLineEditor; -class LLTextBase; -class LLCheckBoxCtrl; - -class LLFloaterPathfindingSetup -: public LLFloater -{ - friend class LLFloaterReg; - -public: - typedef enum - { - kRenderOverlayOnFixedPhysicsGeometry = 0, - kRenderOverlayOnAllRenderableGeometry = 1 - } ERegionOverlayDisplay; - - typedef enum - { - kPathSelectNone = 0, - kPathSelectStartPoint = 1, - kPathSelectEndPoint = 2 - } EPathSelectionState; - - typedef enum - { - kCharacterTypeA = 0, - kCharacterTypeB = 1, - kCharacterTypeC = 2, - kCharacterTypeD = 3 - } ECharacterType; - - virtual BOOL postBuild(); - //Populates a data packet that is forwarded onto the LLPathingSystem - void providePathingData( const LLVector3& point1, const LLVector3& point2 ); - - ERegionOverlayDisplay getRegionOverlayDisplay() const; - void setRegionOverlayDisplay(ERegionOverlayDisplay pRegionOverlayDisplay); - - EPathSelectionState getPathSelectionState() const; - void setPathSelectionState(EPathSelectionState pPathSelectionState); - - F32 getCharacterWidth() const; - void setCharacterWidth(F32 pCharacterWidth); - - ECharacterType getCharacterType() const; - void setCharacterType(ECharacterType pCharacterType); - - F32 getTerrainMaterialA() const; - void setTerrainMaterialA(F32 pTerrainMaterial); - - F32 getTerrainMaterialB() const; - void setTerrainMaterialB(F32 pTerrainMaterial); - - F32 getTerrainMaterialC() const; - void setTerrainMaterialC(F32 pTerrainMaterial); - - F32 getTerrainMaterialD() const; - void setTerrainMaterialD(F32 pTerrainMaterial); - - void setHasNavMeshReceived(); - void setHasNoNavMesh(); - -protected: - -private: - // Does its own instance management, so clients not allowed - // to allocate or destroy. - LLFloaterPathfindingSetup(const LLSD& pSeed); - virtual ~LLFloaterPathfindingSetup(); - - virtual void onOpen(const LLSD& pKey); - - void onShowNavMeshToggle(); - void onShowExcludeVolumesToggle(); - void onShowPathToggle(); - void onShowWaterPlaneToggle(); - void onRegionOverlayDisplaySwitch(); - void onPathSelectionSwitch(); - void onCharacterWidthSet(); - void onCharacterTypeSwitch(); - void onViewEditLinksetClicked(); - void onRebuildNavMeshClicked(); - void onRefreshNavMeshClicked(); - void onTerrainMaterialASet(); - void onTerrainMaterialBSet(); - void onTerrainMaterialCSet(); - void onTerrainMaterialDSet(); - void generatePath(); - - LLCheckBoxCtrl *mShowNavMeshCheckBox; - LLCheckBoxCtrl *mShowExcludeVolumesCheckBox; - LLCheckBoxCtrl *mShowPathCheckBox; - LLCheckBoxCtrl *mShowWaterPlaneCheckBox; - LLRadioGroup *mRegionOverlayDisplayRadioGroup; - LLRadioGroup *mPathSelectionRadioGroup; - LLSliderCtrl *mCharacterWidthSlider; - LLRadioGroup *mCharacterTypeRadioGroup; - LLTextBase *mPathfindingStatus; - LLLineEditor *mTerrainMaterialA; - LLLineEditor *mTerrainMaterialB; - LLLineEditor *mTerrainMaterialC; - LLLineEditor *mTerrainMaterialD; - - LLNavMeshDownloadObserver mNavMeshDownloadObserver[10]; - int mCurrentMDO; - int mNavMeshCnt; - - //Container that is populated and subsequently submitted to the LLPathingSystem for processing - LLPathingLib::PathingPacket mPathData; - bool mHasStartPoint; - bool mHasEndPoint; -}; - -#endif // LL_LLFLOATERPATHFINDINGSETUP_H diff --git a/indra/newview/llnavmeshstation.cpp b/indra/newview/llnavmeshstation.cpp index 16f459ff84..87f7e92ddd 100644 --- a/indra/newview/llnavmeshstation.cpp +++ b/indra/newview/llnavmeshstation.cpp @@ -31,7 +31,7 @@ #include "llagent.h" #include "llviewerregion.h" #include "llsdutil.h" -#include "llfloaterpathfindingsetup.h" +#include "llfloaterpathfindingconsole.h" //=============================================================================== LLNavMeshStation::LLNavMeshStation() diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 719f560101..3e21334cd4 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -78,7 +78,7 @@ #include "llwaterparammanager.h" #include "llpostprocess.h" #include "LLPathingLib.h" -#include "llfloaterpathfindingsetup.h" +#include "llfloaterpathfindingconsole.h" #include "llfloaterreg.h" extern LLPointer gStartTexture; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 84a0a8c6c4..e4d17e9d25 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -86,7 +86,7 @@ #include "llfloateroutbox.h" #include "llfloaterpathfindingcharacters.h" #include "llfloaterpathfindinglinksets.h" -#include "llfloaterpathfindingsetup.h" +#include "llfloaterpathfindingconsole.h" #include "llfloaterpay.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" @@ -248,7 +248,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("pathfinding_setup", "floater_pathfinding_setup.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("pathfinding_setup", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 04b687b42f..9109b5379b 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -204,7 +204,7 @@ #include "llviewerwindowlistener.h" #include "llpaneltopinfobar.h" #include "LLPathingLib.h" -#include "llfloaterpathfindingsetup.h" +#include "llfloaterpathfindingconsole.h" #if LL_WINDOWS #include // For Unicode conversion methods diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml new file mode 100644 index 0000000000..37555eea3a --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_console.xml @@ -0,0 +1,466 @@ + + + + Downloading the navmesh ... + Navmesh received. + No navmesh for region. + Pathfinding is not enabled for this region. + Cannot find pathing library implementation. + + Show overlays: + + + + + + + Overlay on: + + + + + + + +Click on two points +to see the path between them. + + + + + + + Character width + + + + m + + + Character type + + + + + + + + + + + + View / edit linkset attributes: + +