diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-02-02 18:30:35 -0800 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-02-02 18:30:35 -0800 |
commit | 525343b9e5f39dafafe2a16e8173ad7f69acb0d6 (patch) | |
tree | 3d19fb2fcdb6763d558f72a75c4daed69f584193 /indra | |
parent | 9c8d5a14bd5e45a6b2c1ecbdc1e44e6c2705babb (diff) |
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.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/commands.xml | 10 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingcharacters.cpp | 491 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingcharacters.h | 124 | ||||
-rw-r--r-- | indra/newview/llpathfindingcharacter.cpp | 98 | ||||
-rw-r--r-- | indra/newview/llpathfindingcharacter.h | 63 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/textures.xml | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml | 173 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 2 |
11 files changed, 970 insertions, 3 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 1015aae055..76aa982f1d 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -218,6 +218,7 @@ set(viewer_SOURCE_FILES llfloaterobjectweights.cpp llfloateropenobject.cpp llfloateroutbox.cpp + llfloaterpathfindingcharacters.cpp llfloaterpathfindinglinksets.cpp llfloaterpathfindingsetup.cpp llfloaterpay.cpp @@ -416,6 +417,7 @@ set(viewer_SOURCE_FILES llparcelselection.cpp llparticipantlist.cpp llpatchvertexarray.cpp + llpathfindingcharacter.cpp llpathfindinglinkset.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp @@ -779,6 +781,7 @@ set(viewer_HEADER_FILES llfloaterobjectweights.h llfloateropenobject.h llfloateroutbox.h + llfloaterpathfindingcharacters.h llfloaterpathfindinglinksets.h llfloaterpathfindingsetup.h llfloaterpay.h @@ -966,6 +969,7 @@ set(viewer_HEADER_FILES llparcelselection.h llparticipantlist.h llpatchvertexarray.h + llpathfindingcharacter.h llpathfindinglinkset.h llphysicsmotion.h llphysicsshapebuilderutil.h diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 7d42f237b1..4ff6b6f37d 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -165,6 +165,16 @@ is_running_function="Floater.IsOpen" is_running_parameters="pathfinding_setup" /> + <command name="pathfinding_characters" + available_in_toybox="false" + icon="Command_PF_Characters_Icon" + label_ref="Command_PF_Characters_Label" + tooltip_ref="Command_PF_Characters_Tooltip" + execute_function="Floater.ToggleOrBringToFront" + execute_parameters="pathfinding_characters" + is_running_function="Floater.IsOpen" + is_running_parameters="pathfinding_characters" + /> <command name="pathfinding_linksets" available_in_toybox="false" icon="Command_PF_Linksets_Icon" diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp new file mode 100644 index 0000000000..021b48f0a0 --- /dev/null +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -0,0 +1,491 @@ +/**
+ * @file llfloaterpathfindingcharacters.cpp
+ * @author William Todd Stinson
+ * @brief "Pathfinding linksets" 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 "llfloater.h"
+#include "llfloaterpathfindingcharacters.h"
+#include "llpathfindingcharacter.h"
+#include "llsd.h"
+#include "llagent.h"
+#include "llhandle.h"
+#include "llfloaterreg.h"
+#include "lltextbase.h"
+#include "llscrolllistitem.h"
+#include "llscrolllistctrl.h"
+#include "llcheckboxctrl.h"
+#include "llradiogroup.h"
+#include "llbutton.h"
+#include "llresmgr.h"
+#include "llviewerregion.h"
+#include "llhttpclient.h"
+#include "lluuid.h"
+
+//---------------------------------------------------------------------------
+// CharactersGetResponder
+//---------------------------------------------------------------------------
+
+class CharactersGetResponder : public LLHTTPClient::Responder
+{
+public:
+ CharactersGetResponder(const std::string& pCharactersDataGetURL,
+ const LLHandle<LLFloaterPathfindingCharacters> &pCharactersFloaterHandle);
+ virtual ~CharactersGetResponder();
+
+ virtual void result(const LLSD& pContent);
+ virtual void error(U32 pStatus, const std::string& pReason);
+
+private:
+ CharactersGetResponder(const CharactersGetResponder& pOther);
+
+ std::string mCharactersDataGetURL;
+ LLHandle<LLFloaterPathfindingCharacters> mCharactersFloaterHandle;
+};
+
+//---------------------------------------------------------------------------
+// LLFloaterPathfindingCharacters
+//---------------------------------------------------------------------------
+
+BOOL LLFloaterPathfindingCharacters::postBuild()
+{
+ childSetAction("refresh_characters_list", boost::bind(&LLFloaterPathfindingCharacters::onRefreshCharactersClicked, this));
+ childSetAction("select_all_characters", boost::bind(&LLFloaterPathfindingCharacters::onSelectAllCharactersClicked, this));
+ childSetAction("select_none_characters", boost::bind(&LLFloaterPathfindingCharacters::onSelectNoneCharactersClicked, this));
+
+ mCharactersScrollList = findChild<LLScrollListCtrl>("pathfinding_characters");
+ llassert(mCharactersScrollList != NULL);
+ mCharactersScrollList->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onCharactersSelectionChange, this));
+ mCharactersScrollList->setCommitOnSelectionChange(true);
+ mCharactersScrollList->sortByColumnIndex(0, true);
+
+ mCharactersStatus = findChild<LLTextBase>("characters_status");
+ llassert(mCharactersStatus != NULL);
+
+ mLabelActions = findChild<LLTextBase>("actions_label");
+ llassert(mLabelActions != NULL);
+
+ mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon");
+ llassert(mShowBeaconCheckBox != NULL);
+ mShowBeaconCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onShowBeaconToggled, this));
+
+ mTakeBtn = findChild<LLButton>("take_characters");
+ llassert(mTakeBtn != NULL)
+ mTakeBtn->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onTakeCharactersClicked, this));
+
+ mTakeCopyBtn = findChild<LLButton>("take_copy_characters");
+ llassert(mTakeCopyBtn != NULL)
+ mTakeCopyBtn->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onTakeCopyCharactersClicked, this));
+
+ mReturnBtn = findChild<LLButton>("return_characters");
+ llassert(mReturnBtn != NULL)
+ mReturnBtn->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onReturnCharactersClicked, this));
+
+ mDeleteBtn = findChild<LLButton>("delete_characters");
+ llassert(mDeleteBtn != NULL)
+ mDeleteBtn->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onDeleteCharactersClicked, this));
+
+ mTeleportBtn = findChild<LLButton>("teleport_to_character");
+ llassert(mTeleportBtn != NULL)
+ mTeleportBtn->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onTeleportCharacterToMeClicked, this));
+
+ setEnableActionFields(false);
+ setMessagingState(kMessagingInitial);
+
+ return LLFloater::postBuild();
+}
+
+void LLFloaterPathfindingCharacters::onOpen(const LLSD& pKey)
+{
+ sendCharactersDataGetRequest();
+}
+
+LLFloaterPathfindingCharacters::EMessagingState LLFloaterPathfindingCharacters::getMessagingState() const
+{
+ return mMessagingState;
+}
+
+BOOL LLFloaterPathfindingCharacters::isMessagingInProgress() const
+{
+ BOOL retVal;
+ switch (getMessagingState())
+ {
+ case kMessagingFetchStarting :
+ case kMessagingFetchRequestSent :
+ case kMessagingFetchRequestSent_MultiRequested :
+ case kMessagingFetchReceived :
+ retVal = true;
+ break;
+ default :
+ retVal = false;
+ break;
+ }
+
+ return retVal;
+}
+
+LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed)
+ : LLFloater(pSeed),
+ mSelfHandle(),
+ mPathfindingCharacters(),
+ mMessagingState(kMessagingInitial),
+ mCharactersScrollList(NULL),
+ mCharactersStatus(NULL),
+ mLabelActions(NULL),
+ mShowBeaconCheckBox(NULL),
+ mTakeBtn(NULL),
+ mTakeCopyBtn(NULL),
+ mReturnBtn(NULL),
+ mDeleteBtn(NULL),
+ mTeleportBtn(NULL)
+{
+ mSelfHandle.bind(this);
+}
+
+LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters()
+{
+ mPathfindingCharacters.clear();
+}
+
+void LLFloaterPathfindingCharacters::sendCharactersDataGetRequest()
+{
+ if (isMessagingInProgress())
+ {
+ if (getMessagingState() == kMessagingFetchRequestSent)
+ {
+ setMessagingState(kMessagingFetchRequestSent_MultiRequested);
+ }
+ }
+ else
+ {
+ setMessagingState(kMessagingFetchStarting);
+ mPathfindingCharacters.clear();
+ updateCharactersList();
+
+ std::string charactersDataURL = getCapabilityURL();
+ if (charactersDataURL.empty())
+ {
+ setMessagingState(kMessagingComplete);
+ llwarns << "cannot query pathfinding characters from current region '" << getRegionName() << "'" << llendl;
+ }
+ else
+ {
+ setMessagingState(kMessagingFetchRequestSent);
+ LLHTTPClient::get(charactersDataURL, new CharactersGetResponder(charactersDataURL, mSelfHandle));
+ }
+ }
+}
+
+void LLFloaterPathfindingCharacters::handleCharactersDataGetReply(const LLSD& pCharactersData)
+{
+ setMessagingState(kMessagingFetchReceived);
+ mPathfindingCharacters.clear();
+ parseCharactersData(pCharactersData);
+ updateCharactersList();
+ setMessagingState(kMessagingComplete);
+}
+
+void LLFloaterPathfindingCharacters::handleCharactersDataGetError(const std::string& pURL, const std::string& pErrorReason)
+{
+ setMessagingState(kMessagingFetchError);
+ mPathfindingCharacters.clear();
+ updateCharactersList();
+ llwarns << "Error fetching pathfinding characters from URL '" << pURL << "' because " << pErrorReason << llendl;
+}
+
+std::string LLFloaterPathfindingCharacters::getRegionName() const
+{
+ std::string regionName("");
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region != NULL)
+ {
+ regionName = region->getName();
+ }
+
+ return regionName;
+}
+
+std::string LLFloaterPathfindingCharacters::getCapabilityURL() const
+{
+ std::string charactersDataURL("");
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region != NULL)
+ {
+ charactersDataURL = region->getCapability("ObjectNavMeshProperties");
+ }
+
+ return charactersDataURL;
+}
+
+void LLFloaterPathfindingCharacters::parseCharactersData(const LLSD &pCharactersData)
+{
+ for (LLSD::map_const_iterator characterItemIter = pCharactersData.beginMap();
+ characterItemIter != pCharactersData.endMap(); ++characterItemIter)
+ {
+ const std::string &uuid(characterItemIter->first);
+ const LLSD &characterData(characterItemIter->second);
+ LLPathfindingCharacter character(uuid, characterData);
+
+ mPathfindingCharacters.insert(std::pair<std::string, LLPathfindingCharacter>(uuid, character));
+ }
+}
+
+void LLFloaterPathfindingCharacters::setMessagingState(EMessagingState pMessagingState)
+{
+ mMessagingState = pMessagingState;
+ updateCharactersList();
+ updateActionFields();
+}
+
+void LLFloaterPathfindingCharacters::onCharactersSelectionChange()
+{
+ updateCharactersStatusMessage();
+ updateActionFields();
+}
+
+void LLFloaterPathfindingCharacters::onRefreshCharactersClicked()
+{
+ sendCharactersDataGetRequest();
+}
+
+void LLFloaterPathfindingCharacters::onSelectAllCharactersClicked()
+{
+ selectAllCharacters();
+}
+
+void LLFloaterPathfindingCharacters::onSelectNoneCharactersClicked()
+{
+ selectNoneCharacters();
+}
+
+void LLFloaterPathfindingCharacters::onShowBeaconToggled()
+{
+ llwarns << "functionality has not yet been implemented to toggle show beacon" << llendl;
+}
+
+void LLFloaterPathfindingCharacters::onTakeCharactersClicked()
+{
+ llwarns << "functionality has not yet been implemented to take characters" << llendl;
+}
+
+void LLFloaterPathfindingCharacters::onTakeCopyCharactersClicked()
+{
+ llwarns << "functionality has not yet been implemented to take a copy of characters" << llendl;
+}
+
+void LLFloaterPathfindingCharacters::onReturnCharactersClicked()
+{
+ llwarns << "functionality has not yet been implemented to return characters" << llendl;
+}
+
+void LLFloaterPathfindingCharacters::onDeleteCharactersClicked()
+{
+ llwarns << "functionality has not yet been implemented to delete characters" << llendl;
+}
+
+void LLFloaterPathfindingCharacters::onTeleportCharacterToMeClicked()
+{
+ llwarns << "functionality has not yet been implemented to teleport me tothe character" << llendl;
+}
+
+void LLFloaterPathfindingCharacters::updateCharactersList()
+{
+ std::vector<LLScrollListItem*> selectedItems = mCharactersScrollList->getAllSelected();
+ int numSelectedItems = selectedItems.size();
+ uuid_vec_t selectedUUIDs;
+ if (numSelectedItems > 0)
+ {
+ selectedUUIDs.reserve(selectedItems.size());
+ for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
+ itemIter != selectedItems.end(); ++itemIter)
+ {
+ const LLScrollListItem *listItem = *itemIter;
+ selectedUUIDs.push_back(listItem->getUUID());
+ }
+ }
+
+ mCharactersScrollList->deleteAllItems();
+ updateCharactersStatusMessage();
+
+ for (PathfindingCharacterMap::const_iterator characterIter = mPathfindingCharacters.begin();
+ characterIter != mPathfindingCharacters.end(); ++characterIter)
+ {
+ const LLPathfindingCharacter& character(characterIter->second);
+
+ LLSD columns;
+
+ columns[0]["column"] = "name";
+ columns[0]["value"] = character.getName();
+ columns[0]["font"] = "SANSSERIF";
+
+ columns[1]["column"] = "description";
+ columns[1]["value"] = character.getDescription();
+ columns[1]["font"] = "SANSSERIF";
+
+ columns[2]["column"] = "owner";
+ columns[2]["value"] = character.getOwner();
+ columns[2]["font"] = "SANSSERIF";
+
+ columns[3]["column"] = "cpu_time";
+ columns[3]["value"] = llformat("%3d ms", character.getCPUTime());
+ columns[3]["font"] = "SANSSERIF";
+
+ columns[4]["column"] = "altitude";
+ columns[4]["value"] = llformat("%1.0f m", character.getLocation()[2]);
+ columns[4]["font"] = "SANSSERIF";
+
+ LLSD element;
+ element["id"] = character.getUUID().asString();
+ element["column"] = columns;
+
+ mCharactersScrollList->addElement(element);
+ }
+
+ mCharactersScrollList->selectMultiple(selectedUUIDs);
+ updateCharactersStatusMessage();
+ updateActionFields();
+}
+
+void LLFloaterPathfindingCharacters::selectAllCharacters()
+{
+ mCharactersScrollList->selectAll();
+}
+
+void LLFloaterPathfindingCharacters::selectNoneCharacters()
+{
+ mCharactersScrollList->deselectAllItems();
+}
+
+void LLFloaterPathfindingCharacters::updateCharactersStatusMessage()
+{
+ static const LLColor4 warningColor = LLUIColorTable::instance().getColor("DrYellow");
+
+ std::string statusText("");
+ LLStyle::Params styleParams;
+
+ switch (getMessagingState())
+ {
+ case kMessagingInitial:
+ statusText = getString("characters_messaging_initial");
+ break;
+ case kMessagingFetchStarting :
+ statusText = getString("characters_messaging_fetch_starting");
+ break;
+ case kMessagingFetchRequestSent :
+ statusText = getString("characters_messaging_fetch_inprogress");
+ break;
+ case kMessagingFetchRequestSent_MultiRequested :
+ statusText = getString("characters_messaging_fetch_inprogress_multi_request");
+ break;
+ case kMessagingFetchReceived :
+ statusText = getString("characters_messaging_fetch_received");
+ break;
+ case kMessagingFetchError :
+ statusText = getString("characters_messaging_fetch_error");
+ styleParams.color = warningColor;
+ break;
+ case kMessagingComplete :
+ if (mCharactersScrollList->isEmpty())
+ {
+ statusText = getString("characters_messaging_complete_none_found");
+ }
+ else
+ {
+ S32 numItems = mCharactersScrollList->getItemCount();
+ S32 numSelectedItems = mCharactersScrollList->getNumSelected();
+
+ LLLocale locale(LLStringUtil::getLocale());
+ std::string numItemsString;
+ LLResMgr::getInstance()->getIntegerString(numItemsString, numItems);
+
+ std::string numSelectedItemsString;
+ LLResMgr::getInstance()->getIntegerString(numSelectedItemsString, numSelectedItems);
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[NUM_SELECTED]"] = numSelectedItemsString;
+ string_args["[NUM_TOTAL]"] = numItemsString;
+ statusText = getString("characters_messaging_complete_available", string_args);
+ }
+ break;
+ default:
+ statusText = getString("characters_messaging_initial");
+ llassert(0);
+ break;
+ }
+
+ mCharactersStatus->setText((LLStringExplicit)statusText, styleParams);
+}
+
+void LLFloaterPathfindingCharacters::updateActionFields()
+{
+ std::vector<LLScrollListItem*> selectedItems = mCharactersScrollList->getAllSelected();
+ setEnableActionFields(!selectedItems.empty());
+}
+
+void LLFloaterPathfindingCharacters::setEnableActionFields(BOOL pEnabled)
+{
+ mLabelActions->setEnabled(pEnabled);
+ mShowBeaconCheckBox->setEnabled(pEnabled);
+ mTakeBtn->setEnabled(pEnabled);
+ mTakeCopyBtn->setEnabled(pEnabled);
+ mReturnBtn->setEnabled(pEnabled);
+ mDeleteBtn->setEnabled(pEnabled);
+ mTeleportBtn->setEnabled(pEnabled && (mCharactersScrollList->getNumSelected() == 1));
+}
+
+//---------------------------------------------------------------------------
+// CharactersGetResponder
+//---------------------------------------------------------------------------
+
+CharactersGetResponder::CharactersGetResponder(const std::string& pCharactersDataGetURL,
+ const LLHandle<LLFloaterPathfindingCharacters> &pCharactersFloaterHandle)
+ : mCharactersDataGetURL(pCharactersDataGetURL),
+ mCharactersFloaterHandle(pCharactersFloaterHandle)
+{
+}
+
+CharactersGetResponder::~CharactersGetResponder()
+{
+}
+
+void CharactersGetResponder::result(const LLSD& pContent)
+{
+ LLFloaterPathfindingCharacters *charactersFloater = mCharactersFloaterHandle.get();
+ if (charactersFloater != NULL)
+ {
+ charactersFloater->handleCharactersDataGetReply(pContent);
+ }
+}
+
+void CharactersGetResponder::error(U32 status, const std::string& reason)
+{
+ LLFloaterPathfindingCharacters *charactersFloater = mCharactersFloaterHandle.get();
+ if (charactersFloater != NULL)
+ {
+ charactersFloater->handleCharactersDataGetError(mCharactersDataGetURL, reason);
+ }
+}
diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h new file mode 100644 index 0000000000..6264c5d27a --- /dev/null +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -0,0 +1,124 @@ +/**
+ * @file llfloaterpathfindingcharacters.h
+ * @author William Todd Stinson
+ * @brief "Pathfinding linksets" 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_LLFLOATERPATHFINDINGCHARACTERS_H
+#define LL_LLFLOATERPATHFINDINGCHARACTERS_H
+
+#include <string>
+#include <map>
+
+#include "llhandle.h"
+#include "llfloater.h"
+#include "llpathfindingcharacter.h"
+
+class LLSD;
+class LLTextBase;
+class LLScrollListCtrl;
+class LLCheckBoxCtrl;
+class LLRadioGroup;
+class LLButton;
+
+class LLFloaterPathfindingCharacters
+: public LLFloater
+{
+ friend class LLFloaterReg;
+ friend class CharactersGetResponder;
+
+public:
+ typedef enum
+ {
+ kMessagingInitial,
+ kMessagingFetchStarting,
+ kMessagingFetchRequestSent,
+ kMessagingFetchRequestSent_MultiRequested,
+ kMessagingFetchReceived,
+ kMessagingFetchError,
+ kMessagingComplete
+ } EMessagingState;
+
+ virtual BOOL postBuild();
+ virtual void onOpen(const LLSD& pKey);
+
+ EMessagingState getMessagingState() const;
+ BOOL isMessagingInProgress() const;
+
+protected:
+
+private:
+ typedef std::map<std::string, LLPathfindingCharacter> PathfindingCharacterMap;
+
+ LLRootHandle<LLFloaterPathfindingCharacters> mSelfHandle;
+ PathfindingCharacterMap mPathfindingCharacters;
+ EMessagingState mMessagingState;
+ LLScrollListCtrl *mCharactersScrollList;
+ LLTextBase *mCharactersStatus;
+ LLTextBase *mLabelActions;
+ LLCheckBoxCtrl *mShowBeaconCheckBox;
+ LLButton *mTakeBtn;
+ LLButton *mTakeCopyBtn;
+ LLButton *mReturnBtn;
+ LLButton *mDeleteBtn;
+ LLButton *mTeleportBtn;
+
+ // Does its own instance management, so clients not allowed
+ // to allocate or destroy.
+ LLFloaterPathfindingCharacters(const LLSD& pSeed);
+ virtual ~LLFloaterPathfindingCharacters();
+
+ void sendCharactersDataGetRequest();
+ void handleCharactersDataGetReply(const LLSD& pCharactersData);
+ void handleCharactersDataGetError(const std::string& pURL, const std::string& pErrorReason);
+
+ std::string getRegionName() const;
+ std::string getCapabilityURL() const;
+
+ void parseCharactersData(const LLSD &pCharactersData);
+
+ void setMessagingState(EMessagingState pMessagingState);
+
+ void onCharactersSelectionChange();
+ void onRefreshCharactersClicked();
+ void onSelectAllCharactersClicked();
+ void onSelectNoneCharactersClicked();
+ void onShowBeaconToggled();
+ void onTakeCharactersClicked();
+ void onTakeCopyCharactersClicked();
+ void onReturnCharactersClicked();
+ void onDeleteCharactersClicked();
+ void onTeleportCharacterToMeClicked();
+
+ void updateCharactersList();
+ void selectAllCharacters();
+ void selectNoneCharacters();
+
+ void updateCharactersStatusMessage();
+
+ void updateActionFields();
+ void setEnableActionFields(BOOL pEnabled);
+};
+
+#endif // LL_LLFLOATERPATHFINDINGCHARACTERS_H
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;
+}
diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h new file mode 100644 index 0000000000..c64d88892a --- /dev/null +++ b/indra/newview/llpathfindingcharacter.h @@ -0,0 +1,63 @@ +/**
+ * @file llpathfindingcharacter.h
+ * @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$
+ */
+
+#ifndef LL_LLPATHFINDINGCHARACTER_H
+#define LL_LLPATHFINDINGCHARACTER_H
+
+#include "v3math.h"
+#include "lluuid.h"
+
+class LLSD;
+
+class LLPathfindingCharacter
+{
+public:
+ LLPathfindingCharacter(const std::string &pUUID, const LLSD &pCharacterItem);
+ LLPathfindingCharacter(const LLPathfindingCharacter& pOther);
+ virtual ~LLPathfindingCharacter();
+
+ LLPathfindingCharacter& operator = (const LLPathfindingCharacter& pOther);
+
+ inline const LLUUID& getUUID() const {return mUUID;};
+ inline const std::string& getName() const {return mName;};
+ inline const std::string& getDescription() const {return mDescription;};
+ inline const std::string& getOwner() const {return mOwner;};
+ inline U32 getCPUTime() const {return mCPUTime;};
+ inline const LLVector3& getLocation() const {return mLocation;};
+
+protected:
+
+private:
+ LLUUID mUUID;
+ std::string mName;
+ std::string mDescription;
+ std::string mOwner;
+ U32 mCPUTime;
+ LLVector3 mLocation;
+};
+
+#endif // LL_LLPATHFINDINGCHARACTER_H
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 837db1550b..84a0a8c6c4 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -84,8 +84,9 @@ #include "llfloaterobjectweights.h" #include "llfloateropenobject.h" #include "llfloateroutbox.h" -#include "llfloaterpathfindingsetup.h" +#include "llfloaterpathfindingcharacters.h" #include "llfloaterpathfindinglinksets.h" +#include "llfloaterpathfindingsetup.h" #include "llfloaterpay.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" @@ -245,6 +246,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>); LLFloaterPayUtil::registerFloater(); + LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingCharacters>); LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingLinksets>); LLFloaterReg::add("pathfinding_setup", "floater_pathfinding_setup.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPathfindingSetup>); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 9f14caa142..5eea581987 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -140,6 +140,7 @@ with the same filename but different name <texture name="Command_Outbox_Icon" file_name="toolbar_icons/outbox.png" preload="true" /> <texture name="Command_Pathfinding_Icon" file_name="toolbar_icons/land.png" preload="true" /> <texture name="Command_People_Icon" file_name="toolbar_icons/people.png" preload="true" /> + <texture name="Command_PF_Characters_Icon" file_name="toolbar_icons/land.png" preload="true" /> <texture name="Command_PF_Linksets_Icon" file_name="toolbar_icons/land.png" preload="true" /> <texture name="Command_Picks_Icon" file_name="toolbar_icons/picks.png" preload="true" /> <texture name="Command_Places_Icon" file_name="toolbar_icons/places.png" preload="true" /> diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml new file mode 100644 index 0000000000..9ae28d6a15 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + open_positioning="cascading" + can_tear_off="false" + height="273" + layout="topleft" + name="floater_pathfinding_characters" + help_topic="floater_pathfinding_characters" + reuse_instance="true" + save_rect="true" + single_instance="true" + title="Pathfinding characters" + width="635"> + <floater.string name="characters_messaging_initial"></floater.string> + <floater.string name="characters_messaging_fetch_starting">Building query for pathfinding characters ...</floater.string> + <floater.string name="characters_messaging_fetch_inprogress">Querying for pathfinding characters ...</floater.string> + <floater.string name="characters_messaging_fetch_inprogress_multi_request">Querying for pathfinding characters (already in progress) ...</floater.string> + <floater.string name="characters_messaging_fetch_received">Loading pathfinding characters data from response ...</floater.string> + <floater.string name="characters_messaging_fetch_error">Error detected while querying for pathfinding characters</floater.string> + <floater.string name="characters_messaging_complete_none_found">No pathfinding characters</floater.string> + <floater.string name="characters_messaging_complete_available">[NUM_SELECTED] characters selected out of [NUM_TOTAL]</floater.string> + <scroll_list + column_padding="0" + draw_heading="true" + follows="all" + height="135" + layout="topleft" + left="18" + top="10" + multi_select="true" + name="pathfinding_characters" + width="600"> + <scroll_list.columns + label="Name" + name="name" + width="137" /> + <scroll_list.columns + label="Description" + name="description" + width="172" /> + <scroll_list.columns + label="Owner" + name="owner" + width="141" /> + <scroll_list.columns + label="CPU" + name="cpu_time" + width="60" /> + <scroll_list.columns + label="Altitude" + name="altitude" + width="64" /> + </scroll_list> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + length="1" + follows="left|top" + layout="topleft" + name="characters_status" + top="161" + width="500"> + Characters: + </text> + <button + follows="right|top" + height="21" + label="Refresh list" + layout="topleft" + name="refresh_characters_list" + top="161" + left="257" + width="115"/> + <button + follows="right|top" + height="21" + label="Select all" + layout="topleft" + name="select_all_characters" + top="161" + left="378" + width="115"/> + <button + follows="right|top" + height="21" + label="Select none" + layout="topleft" + name="select_none_characters" + top="161" + left="502" + width="115"/> + <view_border + bevel_style="none" + follows="top|left" + height="0" + layout="topleft" + name="horiz_separator" + top="196" + left="20" + width="600"/> + <text + height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + length="1" + follows="left|top" + layout="topleft" + name="actions_label" + top_pad="12" + width="910"> + Actions on selected characters: + </text> + <check_box + height="19" + label="Show beacon" + layout="topleft" + name="show_beacon" + top="208" + left="259" + width="90" /> + <button + follows="right|top" + height="22" + label="Take" + layout="topleft" + name="take_characters" + top="232" + left="17" + width="94"/> + <button + follows="right|top" + height="22" + label="Take copy" + layout="topleft" + name="take_copy_characters" + top="232" + left="119" + width="94"/> + <button + follows="right|top" + height="22" + label="Return" + layout="topleft" + name="return_characters" + top="233" + left="220" + width="94"/> + <button + follows="right|top" + height="22" + label="Delete" + layout="topleft" + name="delete_characters" + top="233" + left="322" + width="94"/> + <button + follows="right|top" + height="22" + label="Teleport me to it" + layout="topleft" + name="teleport_to_character" + tool_tip="Enabled only when one character is selected." + top="233" + left="420" + width="159"/> +</floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index f952fc3266..33a756fdd5 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -959,11 +959,10 @@ </menu_item_call> <menu_item_call label="Characters..." - enabled="false" name="pathfinding_characters_menu_item"> <menu_item_call.on_click function="Floater.ToggleOrBringToFront" - parameter="pathfinding_linksets" /> + parameter="pathfinding_characters" /> </menu_item_call> </menu> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index d2ccf7a396..793893f540 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3696,6 +3696,7 @@ Try enclosing path to the editor with double quotes. <string name="Command_Outbox_Label">Merchant outbox</string> <string name="Command_Pathfinding_Label">Pathfinding</string> <string name="Command_People_Label">People</string> + <string name="Command_PF_Characters_Label">Pathfinding Characters</string> <string name="Command_PF_Linksets_Label">Pathfinding Linksets</string> <string name="Command_Picks_Label">Picks</string> <string name="Command_Places_Label">Places</string> @@ -3724,6 +3725,7 @@ Try enclosing path to the editor with double quotes. <string name="Command_Outbox_Tooltip">Transfer items to your marketplace for sale</string> <string name="Command_Pathfinding_Tooltip">Information about pathfinding</string> <string name="Command_People_Tooltip">Friends, groups, and nearby people</string> + <string name="Command_PF_Characters_Tooltip">Manipulation of pathfinding characters</string> <string name="Command_PF_Linksets_Tooltip">Manipulation of pathfinding linksets</string> <string name="Command_Picks_Tooltip">Places to show as favorites in your profile</string> <string name="Command_Places_Tooltip">Places you've saved</string> |