From 525343b9e5f39dafafe2a16e8173ad7f69acb0d6 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 2 Feb 2012 18:30:35 -0800 Subject: PATH-245: First pass at laying out the characters floater. Functionality is mostly stubbed in. The data is currently tied to the same cap service as the linkset data, so that will need to change as soon as the new service is available. --- indra/newview/llpathfindingcharacter.cpp | 98 ++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 indra/newview/llpathfindingcharacter.cpp (limited to 'indra/newview/llpathfindingcharacter.cpp') diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp new file mode 100644 index 0000000000..efbb3606e1 --- /dev/null +++ b/indra/newview/llpathfindingcharacter.cpp @@ -0,0 +1,98 @@ +/** + * @file llpathfindinglinksets.cpp + * @author William Todd Stinson + * @brief Definition of a pathfinding character that contains various properties required for havok pathfinding. + * + * $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 "llpathfindingcharacter.h" +#include "llsd.h" +#include "v3math.h" +#include "lluuid.h" + +#define CHARACTER_NAME_FIELD "name" +#define CHARACTER_DESCRIPTION_FIELD "description" +#define CHARACTER_OWNER_FIELD "description" +#define CHARACTER_CPU_TIME_FIELD "landimpact" +#define CHARACTER_POSITION_FIELD "position" + +//--------------------------------------------------------------------------- +// LLPathfindingCharacter +//--------------------------------------------------------------------------- + +LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const LLSD& pCharacterItem) + : mUUID(pUUID), + mName(), + mDescription(), + mOwner(), + mCPUTime(0U), + mLocation() +{ + llassert(pCharacterItem.has(CHARACTER_NAME_FIELD)); + llassert(pCharacterItem.get(CHARACTER_NAME_FIELD).isString()); + mName = pCharacterItem.get(CHARACTER_NAME_FIELD).asString(); + + llassert(pCharacterItem.has(CHARACTER_DESCRIPTION_FIELD)); + llassert(pCharacterItem.get(CHARACTER_DESCRIPTION_FIELD).isString()); + mDescription = pCharacterItem.get(CHARACTER_DESCRIPTION_FIELD).asString(); + + llassert(pCharacterItem.has(CHARACTER_OWNER_FIELD)); + llassert(pCharacterItem.get(CHARACTER_OWNER_FIELD).isString()); + mOwner = pCharacterItem.get(CHARACTER_OWNER_FIELD).asString(); + + llassert(pCharacterItem.has(CHARACTER_CPU_TIME_FIELD)); + llassert(pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).isInteger()); + llassert(pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).asInteger() >= 0); + mCPUTime = pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).asInteger(); + + llassert(pCharacterItem.has(CHARACTER_POSITION_FIELD)); + llassert(pCharacterItem.get(CHARACTER_POSITION_FIELD).isArray()); + mLocation.setValue(pCharacterItem.get(CHARACTER_POSITION_FIELD)); +} + +LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOther) + : mUUID(pOther.mUUID), + mName(pOther.mName), + mDescription(pOther.mDescription), + mOwner(pOther.mOwner), + mCPUTime(pOther.mCPUTime), + mLocation(pOther.mLocation) +{ +} + +LLPathfindingCharacter::~LLPathfindingCharacter() +{ +} + +LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCharacter& pOther) +{ + mUUID = pOther.mUUID; + mName = pOther.mName; + mDescription = pOther.mDescription; + mOwner = pOther.mOwner; + mCPUTime = pOther.mCPUTime; + mLocation = pOther.mLocation; + + return *this; +} -- cgit v1.3 From fa46459cdb6d63fea6a76d8c11eee5503edf5bb1 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 7 Feb 2012 14:13:57 -0800 Subject: PATH-245: Hooking the characters floater up to the character service. Also, adding in an additional state to handle the floater when the service does not exist. --- indra/newview/llfloaterpathfindingcharacters.cpp | 8 ++++++-- indra/newview/llfloaterpathfindingcharacters.h | 3 ++- indra/newview/llpathfindingcharacter.cpp | 4 ++-- indra/newview/llviewerregion.cpp | 1 + .../skins/default/xui/en/floater_pathfinding_characters.xml | 9 +++++---- 5 files changed, 16 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpathfindingcharacter.cpp') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 021b48f0a0..86b7e86f9e 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -187,7 +187,7 @@ void LLFloaterPathfindingCharacters::sendCharactersDataGetRequest() std::string charactersDataURL = getCapabilityURL(); if (charactersDataURL.empty()) { - setMessagingState(kMessagingComplete); + setMessagingState(kMessagingServiceNotAvailable); llwarns << "cannot query pathfinding characters from current region '" << getRegionName() << "'" << llendl; } else @@ -235,7 +235,7 @@ std::string LLFloaterPathfindingCharacters::getCapabilityURL() const LLViewerRegion* region = gAgent.getRegion(); if (region != NULL) { - charactersDataURL = region->getCapability("ObjectNavMeshProperties"); + charactersDataURL = region->getCapability("CharacterProperties"); } return charactersDataURL; @@ -431,6 +431,10 @@ void LLFloaterPathfindingCharacters::updateCharactersStatusMessage() statusText = getString("characters_messaging_complete_available", string_args); } break; + case kMessagingServiceNotAvailable: + statusText = getString("characters_messaging_service_not_available"); + styleParams.color = warningColor; + break; default: statusText = getString("characters_messaging_initial"); llassert(0); diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index 6264c5d27a..ae3a34f459 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -57,7 +57,8 @@ public: kMessagingFetchRequestSent_MultiRequested, kMessagingFetchReceived, kMessagingFetchError, - kMessagingComplete + kMessagingComplete, + kMessagingServiceNotAvailable } EMessagingState; virtual BOOL postBuild(); diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp index efbb3606e1..99e23c546f 100644 --- a/indra/newview/llpathfindingcharacter.cpp +++ b/indra/newview/llpathfindingcharacter.cpp @@ -33,8 +33,8 @@ #define CHARACTER_NAME_FIELD "name" #define CHARACTER_DESCRIPTION_FIELD "description" -#define CHARACTER_OWNER_FIELD "description" -#define CHARACTER_CPU_TIME_FIELD "landimpact" +#define CHARACTER_OWNER_FIELD "owner" +#define CHARACTER_CPU_TIME_FIELD "cpu_time" #define CHARACTER_POSITION_FIELD "position" //--------------------------------------------------------------------------- diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cc4cac4202..ffad4d89ba 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1491,6 +1491,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) { capabilityNames.append("AttachmentResources"); capabilityNames.append("AvatarPickerSearch"); + capabilityNames.append("CharacterProperties"); capabilityNames.append("ChatSessionRequest"); capabilityNames.append("CopyInventoryFromNotecard"); capabilityNames.append("CreateInventoryCategory"); diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml index 9ae28d6a15..5938342556 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml @@ -19,6 +19,7 @@ Error detected while querying for pathfinding characters No pathfinding characters [NUM_SELECTED] characters selected out of [NUM_TOTAL] + Required capability is not available in current region + width="240"> Characters: