Added rebake navmesh button. Brought in rest of the underlying navmesh implementation.
This commit is contained in:
@@ -539,8 +539,24 @@
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<!-- UDPDeprecated Messages -->
|
||||
|
||||
<key>NavMeshStatusUpdate</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>AgentStateUpdate</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<!-- UDPDeprecated Messages -->
|
||||
<key>ScriptRunningReply</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
|
||||
@@ -60,6 +60,9 @@ static const char LEGACY_NON_HEADER[] = "<llsd>";
|
||||
const std::string LLSD_BINARY_HEADER("LLSD/Binary");
|
||||
const std::string LLSD_XML_HEADER("LLSD/XML");
|
||||
|
||||
//used to deflate a gzipped asset (currently used for navmeshes)
|
||||
#define windowBits 15
|
||||
#define ENABLE_ZLIB_GZIP 32
|
||||
/**
|
||||
* LLSDSerialize
|
||||
*/
|
||||
@@ -2172,3 +2175,80 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
|
||||
free(result);
|
||||
return true;
|
||||
}
|
||||
//This unzip function will only work with a gzip header and trailer - while the contents
|
||||
//of the actual compressed data is the same for either format (gzip vs zlib ), the headers
|
||||
//and trailers are different for the formats.
|
||||
U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size )
|
||||
{
|
||||
U8* result = NULL;
|
||||
U32 cur_size = 0;
|
||||
z_stream strm;
|
||||
|
||||
const U32 CHUNK = 0x4000;
|
||||
|
||||
U8 *in = new U8[size];
|
||||
is.read((char*) in, size);
|
||||
|
||||
U8 out[CHUNK];
|
||||
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = size;
|
||||
strm.next_in = in;
|
||||
|
||||
|
||||
S32 ret = inflateInit2(&strm, windowBits | ENABLE_ZLIB_GZIP );
|
||||
do
|
||||
{
|
||||
strm.avail_out = CHUNK;
|
||||
strm.next_out = out;
|
||||
ret = inflate(&strm, Z_NO_FLUSH);
|
||||
if (ret == Z_STREAM_ERROR)
|
||||
{
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
delete [] in;
|
||||
valid = false;
|
||||
}
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case Z_NEED_DICT:
|
||||
ret = Z_DATA_ERROR;
|
||||
case Z_DATA_ERROR:
|
||||
case Z_MEM_ERROR:
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
delete [] in;
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
U32 have = CHUNK-strm.avail_out;
|
||||
|
||||
result = (U8*) realloc(result, cur_size + have);
|
||||
memcpy(result+cur_size, out, have);
|
||||
cur_size += have;
|
||||
|
||||
} while (ret == Z_OK);
|
||||
|
||||
inflateEnd(&strm);
|
||||
delete [] in;
|
||||
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
free(result);
|
||||
valid = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//result now points to the decompressed LLSD block
|
||||
{
|
||||
outsize= cur_size;
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -755,6 +755,9 @@ public:
|
||||
LLPointer<LLSDXMLParser> p = new LLSDXMLParser;
|
||||
return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED);
|
||||
}
|
||||
// Line oriented parser, 30% faster than fromXML(), but can
|
||||
// only be used when you know you have the complete XML
|
||||
// document available in the stream.
|
||||
static S32 fromXMLDocument(LLSD& sd, std::istream& str)
|
||||
{
|
||||
LLPointer<LLSDXMLParser> p = new LLSDXMLParser();
|
||||
@@ -791,4 +794,5 @@ public:
|
||||
//dirty little zip functions -- yell at davep
|
||||
LL_COMMON_API std::string zip_llsd(LLSD& data);
|
||||
LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size);
|
||||
LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size);
|
||||
#endif // LL_LLSDSERIALIZE_H
|
||||
|
||||
@@ -474,6 +474,10 @@ public:
|
||||
/*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
|
||||
/*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
|
||||
|
||||
template <class T> T* findChild(const std::string& name)
|
||||
{
|
||||
return getChild<T>(name,true,false);
|
||||
}
|
||||
template <class T> T* getChild(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const
|
||||
{
|
||||
LLView* child = getChildView(name, recurse, FALSE);
|
||||
|
||||
@@ -380,6 +380,7 @@ set(viewer_SOURCE_FILES
|
||||
llpanelmsgs.cpp
|
||||
llpanelnetwork.cpp
|
||||
llpanelobject.cpp
|
||||
llpanelpathfindingrebakenavmesh.cpp
|
||||
llpanelpermissions.cpp
|
||||
llpanelpick.cpp
|
||||
llpanelplace.cpp
|
||||
@@ -388,6 +389,15 @@ set(viewer_SOURCE_FILES
|
||||
llpanelweb.cpp
|
||||
llparcelselection.cpp
|
||||
llpatchvertexarray.cpp
|
||||
llpathfindingcharacter.cpp
|
||||
llpathfindingcharacterlist.cpp
|
||||
llpathfindinglinkset.cpp
|
||||
llpathfindinglinksetlist.cpp
|
||||
llpathfindingmanager.cpp
|
||||
llpathfindingnavmesh.cpp
|
||||
llpathfindingnavmeshstatus.cpp
|
||||
llpathfindingobject.cpp
|
||||
llpathfindingobjectlist.cpp
|
||||
llphysicsmotion.cpp
|
||||
llphysicsshapebuilderutil.cpp
|
||||
llpolymesh.cpp
|
||||
@@ -879,6 +889,7 @@ set(viewer_HEADER_FILES
|
||||
llpanelmsgs.h
|
||||
llpanelnetwork.h
|
||||
llpanelobject.h
|
||||
llpanelpathfindingrebakenavmesh.h
|
||||
llpanelpermissions.h
|
||||
llpanelpick.h
|
||||
llpanelplace.h
|
||||
@@ -887,6 +898,15 @@ set(viewer_HEADER_FILES
|
||||
llpanelweb.h
|
||||
llparcelselection.h
|
||||
llpatchvertexarray.h
|
||||
llpathfindingcharacter.h
|
||||
llpathfindingcharacterlist.h
|
||||
llpathfindinglinkset.h
|
||||
llpathfindinglinksetlist.h
|
||||
llpathfindingmanager.h
|
||||
llpathfindingnavmesh.h
|
||||
llpathfindingnavmeshstatus.h
|
||||
llpathfindingobject.h
|
||||
llpathfindingobjectlist.h
|
||||
llphysicsmotion.h
|
||||
llphysicsshapebuilderutil.h
|
||||
llpolymesh.h
|
||||
|
||||
@@ -13234,7 +13234,7 @@
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<integer>10</integer>
|
||||
<integer>5</integer>
|
||||
</map>
|
||||
<key>SystemLanguage</key>
|
||||
<map>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "llmoveview.h"
|
||||
#include "llchatbar.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llpanelpathfindingrebakenavmesh.h"
|
||||
#include "llparcel.h"
|
||||
#include "llrendersphere.h"
|
||||
#include "llsdmessage.h"
|
||||
@@ -1871,6 +1872,8 @@ void LLAgent::endAnimationUpdateUI()
|
||||
gMenuBarView->setVisible(TRUE);
|
||||
gStatusBar->setVisibleForMouselook(true);
|
||||
|
||||
LLPanelPathfindingRebakeNavmesh::getInstance()->setVisible(TRUE);
|
||||
|
||||
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
|
||||
|
||||
|
||||
@@ -1959,6 +1962,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
// hide menus
|
||||
gMenuBarView->setVisible(FALSE);
|
||||
gStatusBar->setVisibleForMouselook(false);
|
||||
LLPanelPathfindingRebakeNavmesh::getInstance()->setVisible(FALSE);
|
||||
|
||||
// clear out camera lag effect
|
||||
gAgentCamera.clearCameraLag();
|
||||
|
||||
@@ -79,6 +79,8 @@
|
||||
#include "rlvhandler.h"
|
||||
// [/RLVa:KB]
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
@@ -224,53 +226,61 @@ void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
|
||||
void LLOverlayBar::layoutButtons()
|
||||
{
|
||||
LLView* state_buttons_panel = getChildView("state_buttons");
|
||||
LLView* state_buttons_panel = getChildView("state_management_buttons_container");
|
||||
|
||||
if (state_buttons_panel->getVisible())
|
||||
{
|
||||
LLViewQuery query;
|
||||
LLWidgetTypeFilter<LLButton> widget_filter;
|
||||
query.addPreFilter(LLEnabledFilter::getInstance());
|
||||
query.addPreFilter(&widget_filter);
|
||||
U32 required_width=0;
|
||||
const child_list_t& view_list = *(state_buttons_panel->getChildList());
|
||||
BOOST_FOREACH(LLView* viewp, view_list)
|
||||
{
|
||||
required_width+=viewp->getRect().getWidth();
|
||||
}
|
||||
|
||||
child_list_t button_list = query(state_buttons_panel);
|
||||
const S32 MAX_BAR_WIDTH = 800;
|
||||
//const S32 MAX_BUTTON_WIDTH = 150;
|
||||
|
||||
const S32 MAX_BAR_WIDTH = 600;
|
||||
S32 bar_width = llclamp(state_buttons_panel->getRect().getWidth(), 0, MAX_BAR_WIDTH);
|
||||
|
||||
// calculate button widths
|
||||
const S32 MAX_BUTTON_WIDTH = 150;
|
||||
S32 segment_width = llclamp(lltrunc((F32)(bar_width) / (F32)button_list.size()), 0, MAX_BUTTON_WIDTH);
|
||||
S32 btn_width = segment_width - gSavedSettings.getS32("StatusBarPad");
|
||||
static LLCachedControl<S32> status_bar_pad("StatusBarPad",10);
|
||||
S32 usable_bar_width = llclamp(state_buttons_panel->getRect().getWidth(), 0, MAX_BAR_WIDTH) - (view_list.size()-1) * status_bar_pad;
|
||||
F32 element_scale = (F32)usable_bar_width / (F32)required_width;
|
||||
|
||||
// Evenly space all buttons, starting from left
|
||||
S32 left = 0;
|
||||
S32 bottom = 1;
|
||||
|
||||
for (child_list_reverse_iter_t child_iter = button_list.rbegin();
|
||||
child_iter != button_list.rend(); ++child_iter)
|
||||
BOOST_REVERSE_FOREACH(LLView* viewp, view_list)
|
||||
{
|
||||
LLView *view = *child_iter;
|
||||
LLRect r = view->getRect();
|
||||
r.setOriginAndSize(left, bottom, btn_width, r.getHeight());
|
||||
view->setRect(r);
|
||||
left += segment_width;
|
||||
LLRect r = viewp->getRect();
|
||||
S32 new_width = r.getWidth() * element_scale;
|
||||
//if(dynamic_cast<LLButton*>(viewp))
|
||||
// new_width = llclamp(new_width,0,MAX_BUTTON_WIDTH);
|
||||
r.setOriginAndSize(left, bottom, new_width, r.getHeight());
|
||||
viewp->setShape(r,false);
|
||||
left += viewp->getRect().getWidth() + status_bar_pad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLButton* LLOverlayBar::updateButtonVisiblity(const std::string& button_name, bool visible)
|
||||
{
|
||||
LLButton* button = findChild<LLButton>(button_name);
|
||||
if (button && (bool)button->getVisible() != visible)
|
||||
{
|
||||
button->setVisible(visible);
|
||||
sendChildToFront(button);
|
||||
moveChildToBackOfTabGroup(button);
|
||||
}
|
||||
return button;
|
||||
}
|
||||
|
||||
// Per-frame updates of visibility
|
||||
void LLOverlayBar::refresh()
|
||||
{
|
||||
BOOL buttons_changed = FALSE;
|
||||
bool buttons_changed = FALSE;
|
||||
|
||||
BOOL im_received = gIMMgr->getIMReceived();
|
||||
int unread_count = gIMMgr->getIMUnreadCount();
|
||||
LLButton* button = getChild<LLButton>("New IM");
|
||||
|
||||
if ((button && button->getVisible() != im_received) ||
|
||||
(button && button->getVisible()))
|
||||
if(LLButton* button = updateButtonVisiblity("New IM",gIMMgr->getIMReceived()))
|
||||
{
|
||||
int unread_count = gIMMgr->getIMUnreadCount();
|
||||
if (unread_count > 0)
|
||||
{
|
||||
if (unread_count > 1)
|
||||
@@ -284,86 +294,16 @@ void LLOverlayBar::refresh()
|
||||
button->setLabel("1 " + mOriginalIMLabel);
|
||||
}
|
||||
}
|
||||
button->setVisible(im_received);
|
||||
sendChildToFront(button);
|
||||
moveChildToBackOfTabGroup(button);
|
||||
buttons_changed = TRUE;
|
||||
buttons_changed = true;
|
||||
}
|
||||
|
||||
BOOL busy = gAgent.getBusy();
|
||||
button = getChild<LLButton>("Set Not Busy");
|
||||
if (button && button->getVisible() != busy)
|
||||
{
|
||||
button->setVisible(busy);
|
||||
sendChildToFront(button);
|
||||
moveChildToBackOfTabGroup(button);
|
||||
buttons_changed = TRUE;
|
||||
}
|
||||
|
||||
BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera();
|
||||
button = getChild<LLButton>("Flycam");
|
||||
if (button && button->getVisible() != flycam)
|
||||
{
|
||||
button->setVisible(flycam);
|
||||
sendChildToFront(button);
|
||||
moveChildToBackOfTabGroup(button);
|
||||
buttons_changed = TRUE;
|
||||
}
|
||||
|
||||
BOOL mouselook_grabbed;
|
||||
mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX)
|
||||
|| gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX);
|
||||
button = getChild<LLButton>("Mouselook");
|
||||
|
||||
if (button && button->getVisible() != mouselook_grabbed)
|
||||
{
|
||||
button->setVisible(mouselook_grabbed);
|
||||
sendChildToFront(button);
|
||||
moveChildToBackOfTabGroup(button);
|
||||
buttons_changed = TRUE;
|
||||
}
|
||||
|
||||
BOOL sitting = FALSE;
|
||||
if (gAgentAvatarp)
|
||||
{
|
||||
// sitting = gAgentAvatarp->isSitting();
|
||||
buttons_changed |= updateButtonVisiblity("Set Not Busy",gAgent.getBusy()) != NULL;
|
||||
buttons_changed |= updateButtonVisiblity("Flycam",LLViewerJoystick::getInstance()->getOverrideCamera()) != NULL;
|
||||
buttons_changed |= updateButtonVisiblity("Mouselook",gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX)||gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX)) != NULL;
|
||||
// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
|
||||
sitting = gAgentAvatarp->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT);
|
||||
// buttons_changed |= updateButtonVisiblity("Stand Up", isAgentAvatarValid() && gAgentAvatarp->isSitting()) != NULL;
|
||||
buttons_changed |= updateButtonVisiblity("Stand Up",isAgentAvatarValid() && gAgentAvatarp->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) != NULL;
|
||||
// [/RLVa:KB]
|
||||
}
|
||||
button = getChild<LLButton>("Stand Up");
|
||||
|
||||
if (button && button->getVisible() != sitting)
|
||||
{
|
||||
button->setVisible(sitting);
|
||||
sendChildToFront(button);
|
||||
moveChildToBackOfTabGroup(button);
|
||||
buttons_changed = TRUE;
|
||||
}
|
||||
|
||||
BOOL teleporting = FALSE;
|
||||
if ((gAgent.getTeleportState() == LLAgent::TELEPORT_START) ||
|
||||
(gAgent.getTeleportState() == LLAgent::TELEPORT_REQUESTED) ||
|
||||
(gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING) ||
|
||||
(gAgent.getTeleportState() == LLAgent::TELEPORT_START))
|
||||
{
|
||||
teleporting = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
teleporting = FALSE;
|
||||
}
|
||||
|
||||
|
||||
button = getChild<LLButton>("Cancel TP");
|
||||
|
||||
if (button && button->getVisible() != teleporting)
|
||||
{
|
||||
button->setVisible(teleporting);
|
||||
sendChildToFront(button);
|
||||
moveChildToBackOfTabGroup(button);
|
||||
buttons_changed = TRUE;
|
||||
}
|
||||
buttons_changed |= updateButtonVisiblity("Cancel TP",(gAgent.getTeleportState() >= LLAgent::TELEPORT_START) && (gAgent.getTeleportState() <= LLAgent::TELEPORT_MOVING)) != NULL;
|
||||
|
||||
moveChildToBackOfTabGroup(mAORemote);
|
||||
moveChildToBackOfTabGroup(mMediaRemote);
|
||||
@@ -384,7 +324,7 @@ void LLOverlayBar::refresh()
|
||||
childSetVisible("AdvSettings_container", FALSE);
|
||||
childSetVisible("AdvSettings_container_exp", FALSE);
|
||||
childSetVisible("ao_remote_container", FALSE);
|
||||
childSetVisible("state_buttons", FALSE);
|
||||
childSetVisible("state_management_buttons_container", FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -394,7 +334,7 @@ void LLOverlayBar::refresh()
|
||||
childSetVisible("AdvSettings_container", !sAdvSettingsPopup);//!gSavedSettings.getBOOL("wlfAdvSettingsPopup"));
|
||||
childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup);//gSavedSettings.getBOOL("wlfAdvSettingsPopup"));
|
||||
childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote"));
|
||||
childSetVisible("state_buttons", TRUE);
|
||||
childSetVisible("state_management_buttons_container", TRUE);
|
||||
}
|
||||
}
|
||||
if(!in_mouselook)
|
||||
|
||||
@@ -64,6 +64,8 @@ public:
|
||||
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
|
||||
/*virtual*/ BOOL postBuild();
|
||||
|
||||
LLButton* updateButtonVisiblity(const std::string& button_name, bool visible);
|
||||
|
||||
void layoutButtons();
|
||||
|
||||
// helpers for returning desired state
|
||||
|
||||
279
indra/newview/llpanelpathfindingrebakenavmesh.cpp
Normal file
279
indra/newview/llpanelpathfindingrebakenavmesh.cpp
Normal file
@@ -0,0 +1,279 @@
|
||||
/**
|
||||
* @file llpanelpathfindingrebakenavmesh.cpp
|
||||
* @brief Implementation of llpanelpathfindingrebakenavmesh
|
||||
* @author Prep@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpanelpathfindingrebakenavmesh.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llbutton.h"
|
||||
#include "llenvmanager.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llpanel.h"
|
||||
#include "llpathfindingmanager.h"
|
||||
#include "llpathfindingnavmesh.h"
|
||||
#include "llpathfindingnavmeshstatus.h"
|
||||
#include "lltoolbar.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "lluictrlfactory.h"
|
||||
|
||||
|
||||
LLPanelPathfindingRebakeNavmesh* LLPanelPathfindingRebakeNavmesh::getInstance()
|
||||
{
|
||||
static LLPanelPathfindingRebakeNavmesh* panel = getPanel();
|
||||
return panel;
|
||||
}
|
||||
|
||||
BOOL LLPanelPathfindingRebakeNavmesh::postBuild()
|
||||
{
|
||||
//Rebake button
|
||||
mNavMeshRebakeButton = getChild<LLButton>("navmesh_btn");
|
||||
llassert(mNavMeshRebakeButton != NULL);
|
||||
mNavMeshRebakeButton->setCommitCallback(boost::bind(&LLPanelPathfindingRebakeNavmesh::onNavMeshRebakeClick, this));
|
||||
//LLHints::registerHintTarget("navmesh_btn", mNavMeshRebakeButton->getHandle());
|
||||
|
||||
//Sending rebake request
|
||||
mNavMeshSendingButton = findChild<LLButton>("navmesh_btn_sending");
|
||||
llassert(mNavMeshSendingButton != NULL);
|
||||
//LLHints::registerHintTarget("navmesh_btn_sending", mNavMeshSendingButton->getHandle());
|
||||
|
||||
//rebaking...
|
||||
mNavMeshBakingButton = findChild<LLButton>("navmesh_btn_baking");
|
||||
llassert(mNavMeshBakingButton != NULL);
|
||||
//LLHints::registerHintTarget("navmesh_btn_baking", mNavMeshBakingButton->getHandle());
|
||||
|
||||
setMode(kRebakeNavMesh_Default);
|
||||
|
||||
createNavMeshStatusListenerForCurrentRegion();
|
||||
|
||||
if ( !mRegionCrossingSlot.connected() )
|
||||
{
|
||||
mRegionCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLPanelPathfindingRebakeNavmesh::handleRegionBoundaryCrossed, this));
|
||||
}
|
||||
|
||||
if (!mAgentStateSlot.connected())
|
||||
{
|
||||
mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLPanelPathfindingRebakeNavmesh::handleAgentState, this, _1));
|
||||
}
|
||||
LLPathfindingManager::getInstance()->requestGetAgentState();
|
||||
|
||||
return LLPanel::postBuild();
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::draw()
|
||||
{
|
||||
if (doDraw())
|
||||
{
|
||||
updatePosition();
|
||||
LLPanel::draw();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLPanelPathfindingRebakeNavmesh::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen)
|
||||
{
|
||||
gViewerWindow->unblockToolTips();
|
||||
|
||||
if (mNavMeshRebakeButton->getVisible())
|
||||
{
|
||||
msg=mNavMeshRebakeButton->getToolTip();
|
||||
//LLToolTipMgr::instance().show(mNavMeshRebakeButton->getToolTip());
|
||||
}
|
||||
else if (mNavMeshSendingButton->getVisible())
|
||||
{
|
||||
msg=mNavMeshSendingButton->getToolTip();
|
||||
//LLToolTipMgr::instance().show(mNavMeshSendingButton->getToolTip());
|
||||
}
|
||||
else if (mNavMeshBakingButton->getVisible())
|
||||
{
|
||||
msg=mNavMeshBakingButton->getToolTip();
|
||||
//LLToolTipMgr::instance().show(mNavMeshBakingButton->getToolTip());
|
||||
}
|
||||
|
||||
// Convert rect local to screen coordinates
|
||||
localPointToScreen(
|
||||
0, 0,
|
||||
&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
|
||||
localPointToScreen(
|
||||
getRect().getWidth(), getRect().getHeight(),
|
||||
&(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) );
|
||||
return true;//LLPanel::handleToolTip(x, y, mask);
|
||||
}
|
||||
|
||||
LLPanelPathfindingRebakeNavmesh::LLPanelPathfindingRebakeNavmesh()
|
||||
: LLPanel(),
|
||||
mCanRebakeRegion(FALSE),
|
||||
mRebakeNavMeshMode(kRebakeNavMesh_Default),
|
||||
mNavMeshRebakeButton(NULL),
|
||||
mNavMeshSendingButton(NULL),
|
||||
mNavMeshBakingButton(NULL),
|
||||
mNavMeshSlot(),
|
||||
mRegionCrossingSlot(),
|
||||
mAgentStateSlot()
|
||||
{
|
||||
// make sure we have the only instance of this class
|
||||
static bool b = true;
|
||||
llassert_always(b);
|
||||
b=false;
|
||||
}
|
||||
|
||||
LLPanelPathfindingRebakeNavmesh::~LLPanelPathfindingRebakeNavmesh()
|
||||
{
|
||||
}
|
||||
|
||||
LLPanelPathfindingRebakeNavmesh* LLPanelPathfindingRebakeNavmesh::getPanel()
|
||||
{
|
||||
LLPanelPathfindingRebakeNavmesh* panel = new LLPanelPathfindingRebakeNavmesh();
|
||||
LLUICtrlFactory::getInstance()->buildPanel(panel,"panel_navmesh_rebake.xml");
|
||||
return panel;
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::setMode(ERebakeNavMeshMode pRebakeNavMeshMode)
|
||||
{
|
||||
if (pRebakeNavMeshMode == kRebakeNavMesh_Available)
|
||||
{
|
||||
LLNotificationsUtil::add("PathfindingRebakeNavmesh");
|
||||
}
|
||||
mNavMeshRebakeButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_Available);
|
||||
mNavMeshSendingButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_RequestSent);
|
||||
mNavMeshBakingButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_InProgress);
|
||||
mRebakeNavMeshMode = pRebakeNavMeshMode;
|
||||
}
|
||||
|
||||
LLPanelPathfindingRebakeNavmesh::ERebakeNavMeshMode LLPanelPathfindingRebakeNavmesh::getMode() const
|
||||
{
|
||||
return mRebakeNavMeshMode;
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::onNavMeshRebakeClick()
|
||||
{
|
||||
setMode(kRebakeNavMesh_RequestSent);
|
||||
LLPathfindingManager::getInstance()->requestRebakeNavMesh(boost::bind(&LLPanelPathfindingRebakeNavmesh::handleRebakeNavMeshResponse, this, _1));
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::handleAgentState(BOOL pCanRebakeRegion)
|
||||
{
|
||||
mCanRebakeRegion = pCanRebakeRegion;
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::handleRebakeNavMeshResponse(bool pResponseStatus)
|
||||
{
|
||||
if (getMode() == kRebakeNavMesh_RequestSent)
|
||||
{
|
||||
setMode(pResponseStatus ? kRebakeNavMesh_InProgress : kRebakeNavMesh_Default);
|
||||
}
|
||||
|
||||
if (!pResponseStatus)
|
||||
{
|
||||
LLNotificationsUtil::add("PathfindingCannotRebakeNavmesh");
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus)
|
||||
{
|
||||
ERebakeNavMeshMode rebakeNavMeshMode = kRebakeNavMesh_Default;
|
||||
if (pNavMeshStatus.isValid())
|
||||
{
|
||||
switch (pNavMeshStatus.getStatus())
|
||||
{
|
||||
case LLPathfindingNavMeshStatus::kPending :
|
||||
case LLPathfindingNavMeshStatus::kRepending :
|
||||
rebakeNavMeshMode = kRebakeNavMesh_Available;
|
||||
break;
|
||||
case LLPathfindingNavMeshStatus::kBuilding :
|
||||
rebakeNavMeshMode = kRebakeNavMesh_InProgress;
|
||||
break;
|
||||
case LLPathfindingNavMeshStatus::kComplete :
|
||||
rebakeNavMeshMode = kRebakeNavMesh_NotAvailable;
|
||||
break;
|
||||
default :
|
||||
rebakeNavMeshMode = kRebakeNavMesh_Default;
|
||||
llassert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setMode(rebakeNavMeshMode);
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::handleRegionBoundaryCrossed()
|
||||
{
|
||||
createNavMeshStatusListenerForCurrentRegion();
|
||||
mCanRebakeRegion = FALSE;
|
||||
LLPathfindingManager::getInstance()->requestGetAgentState();
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::createNavMeshStatusListenerForCurrentRegion()
|
||||
{
|
||||
if (mNavMeshSlot.connected())
|
||||
{
|
||||
mNavMeshSlot.disconnect();
|
||||
}
|
||||
|
||||
LLViewerRegion *currentRegion = gAgent.getRegion();
|
||||
if (currentRegion != NULL)
|
||||
{
|
||||
mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLPanelPathfindingRebakeNavmesh::handleNavMeshStatus, this, _2));
|
||||
LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true);
|
||||
}
|
||||
}
|
||||
|
||||
bool LLPanelPathfindingRebakeNavmesh::doDraw() const
|
||||
{
|
||||
return (mCanRebakeRegion && (mRebakeNavMeshMode != kRebakeNavMesh_NotAvailable));
|
||||
}
|
||||
|
||||
void LLPanelPathfindingRebakeNavmesh::updatePosition()
|
||||
{
|
||||
/*S32 y_pos = 0;
|
||||
S32 bottom_tb_center = 0;
|
||||
|
||||
if (LLToolBar* toolbar_bottom = gToolBarView->getChild<LLToolBar>("toolbar_bottom"))
|
||||
{
|
||||
y_pos = toolbar_bottom->getRect().getHeight();
|
||||
bottom_tb_center = toolbar_bottom->getRect().getCenterX();
|
||||
}
|
||||
|
||||
S32 left_tb_width = 0;
|
||||
if (LLToolBar* toolbar_left = gToolBarView->getChild<LLToolBar>("toolbar_left"))
|
||||
{
|
||||
left_tb_width = toolbar_left->getRect().getWidth();
|
||||
}
|
||||
|
||||
if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container"))
|
||||
{
|
||||
panel_ssf_container->setOrigin(0, y_pos);
|
||||
}
|
||||
|
||||
S32 x_pos = bottom_tb_center-getRect().getWidth()/2 - left_tb_width + 113 /* width of stand/fly button *//* + 10 *//* margin */;
|
||||
|
||||
/*setOrigin( x_pos, 0);*/
|
||||
}
|
||||
96
indra/newview/llpanelpathfindingrebakenavmesh.h
Normal file
96
indra/newview/llpanelpathfindingrebakenavmesh.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* @file llpanelpathfindingrebakenavmesh.h
|
||||
* @brief Header file for llpanelpathfindingrebakenavmesh
|
||||
* @author Prep@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPANELPATHFINDINGREBAKENAVMESH_H
|
||||
#define LL_LLPANELPATHFINDINGREBAKENAVMESH_H
|
||||
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
#include "llpanel.h"
|
||||
#include "llpathfindingmanager.h"
|
||||
#include "llpathfindingnavmesh.h"
|
||||
|
||||
class LLButton;
|
||||
class LLPathfindingNavMeshStatus;
|
||||
|
||||
class LLPanelPathfindingRebakeNavmesh : public LLPanel
|
||||
{
|
||||
|
||||
LOG_CLASS(LLPanelPathfindingRebakeNavmesh);
|
||||
|
||||
public:
|
||||
static LLPanelPathfindingRebakeNavmesh* getInstance();
|
||||
|
||||
virtual BOOL postBuild();
|
||||
|
||||
virtual void draw();
|
||||
virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
typedef enum
|
||||
{
|
||||
kRebakeNavMesh_Available,
|
||||
kRebakeNavMesh_RequestSent,
|
||||
kRebakeNavMesh_InProgress,
|
||||
kRebakeNavMesh_NotAvailable,
|
||||
kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable
|
||||
} ERebakeNavMeshMode;
|
||||
|
||||
LLPanelPathfindingRebakeNavmesh();
|
||||
virtual ~LLPanelPathfindingRebakeNavmesh();
|
||||
|
||||
static LLPanelPathfindingRebakeNavmesh* getPanel();
|
||||
|
||||
void setMode(ERebakeNavMeshMode pRebakeNavMeshMode);
|
||||
ERebakeNavMeshMode getMode() const;
|
||||
|
||||
void onNavMeshRebakeClick();
|
||||
|
||||
void handleAgentState(BOOL pCanRebakeRegion);
|
||||
void handleRebakeNavMeshResponse(bool pResponseStatus);
|
||||
void handleNavMeshStatus(const LLPathfindingNavMeshStatus &pNavMeshStatus);
|
||||
void handleRegionBoundaryCrossed();
|
||||
|
||||
void createNavMeshStatusListenerForCurrentRegion();
|
||||
|
||||
bool doDraw() const;
|
||||
void updatePosition();
|
||||
|
||||
BOOL mCanRebakeRegion;
|
||||
ERebakeNavMeshMode mRebakeNavMeshMode;
|
||||
|
||||
LLButton* mNavMeshRebakeButton;
|
||||
LLButton* mNavMeshSendingButton;
|
||||
LLButton* mNavMeshBakingButton;
|
||||
|
||||
LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
|
||||
boost::signals2::connection mRegionCrossingSlot;
|
||||
LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
|
||||
};
|
||||
|
||||
#endif // LL_LLPANELPATHFINDINGREBAKENAVMESH_H
|
||||
99
indra/newview/llpathfindingcharacter.cpp
Normal file
99
indra/newview/llpathfindingcharacter.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* @file llpathfindingcharacter.cpp
|
||||
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindingcharacter.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "llpathfindingobject.h"
|
||||
#include "llsd.h"
|
||||
|
||||
#define CHARACTER_CPU_TIME_FIELD "cpu_time"
|
||||
#define CHARACTER_HORIZONTAL_FIELD "horizontal"
|
||||
#define CHARACTER_LENGTH_FIELD "length"
|
||||
#define CHARACTER_RADIUS_FIELD "radius"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingCharacter
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const LLSD& pCharacterData)
|
||||
: LLPathfindingObject(pUUID, pCharacterData),
|
||||
mCPUTime(0U),
|
||||
mIsHorizontal(FALSE),
|
||||
mLength(0.0f),
|
||||
mRadius(0.0f)
|
||||
{
|
||||
parseCharacterData(pCharacterData);
|
||||
}
|
||||
|
||||
LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOther)
|
||||
: LLPathfindingObject(pOther),
|
||||
mCPUTime(pOther.mCPUTime),
|
||||
mIsHorizontal(pOther.mIsHorizontal),
|
||||
mLength(pOther.mLength),
|
||||
mRadius(pOther.mRadius)
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingCharacter::~LLPathfindingCharacter()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCharacter& pOther)
|
||||
{
|
||||
dynamic_cast<LLPathfindingObject &>(*this) = pOther;
|
||||
|
||||
mCPUTime = pOther.mCPUTime;
|
||||
mIsHorizontal = pOther.mIsHorizontal;
|
||||
mLength = pOther.mLength;
|
||||
mRadius = pOther.mRadius;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void LLPathfindingCharacter::parseCharacterData(const LLSD &pCharacterData)
|
||||
{
|
||||
llassert(pCharacterData.has(CHARACTER_CPU_TIME_FIELD));
|
||||
llassert(pCharacterData.get(CHARACTER_CPU_TIME_FIELD).isReal());
|
||||
mCPUTime = pCharacterData.get(CHARACTER_CPU_TIME_FIELD).asReal();
|
||||
|
||||
llassert(pCharacterData.has(CHARACTER_HORIZONTAL_FIELD));
|
||||
llassert(pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).isBoolean());
|
||||
mIsHorizontal = pCharacterData.get(CHARACTER_HORIZONTAL_FIELD).asBoolean();
|
||||
|
||||
llassert(pCharacterData.has(CHARACTER_LENGTH_FIELD));
|
||||
llassert(pCharacterData.get(CHARACTER_LENGTH_FIELD).isReal());
|
||||
mLength = pCharacterData.get(CHARACTER_LENGTH_FIELD).asReal();
|
||||
|
||||
llassert(pCharacterData.has(CHARACTER_RADIUS_FIELD));
|
||||
llassert(pCharacterData.get(CHARACTER_RADIUS_FIELD).isReal());
|
||||
mRadius = pCharacterData.get(CHARACTER_RADIUS_FIELD).asReal();
|
||||
}
|
||||
63
indra/newview/llpathfindingcharacter.h
Normal file
63
indra/newview/llpathfindingcharacter.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @file llpathfindingcharacter.h
|
||||
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGCHARACTER_H
|
||||
#define LL_LLPATHFINDINGCHARACTER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "llpathfindingobject.h"
|
||||
|
||||
class LLSD;
|
||||
|
||||
class LLPathfindingCharacter : public LLPathfindingObject
|
||||
{
|
||||
public:
|
||||
LLPathfindingCharacter(const std::string &pUUID, const LLSD &pCharacterData);
|
||||
LLPathfindingCharacter(const LLPathfindingCharacter& pOther);
|
||||
virtual ~LLPathfindingCharacter();
|
||||
|
||||
LLPathfindingCharacter& operator =(const LLPathfindingCharacter& pOther);
|
||||
|
||||
inline F32 getCPUTime() const {return mCPUTime;};
|
||||
|
||||
inline BOOL isHorizontal() const {return mIsHorizontal;};
|
||||
inline F32 getLength() const {return mLength;};
|
||||
inline F32 getRadius() const {return mRadius;};
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
void parseCharacterData(const LLSD &pCharacterData);
|
||||
|
||||
F32 mCPUTime;
|
||||
|
||||
BOOL mIsHorizontal;
|
||||
F32 mLength;
|
||||
F32 mRadius;
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGCHARACTER_H
|
||||
69
indra/newview/llpathfindingcharacterlist.cpp
Normal file
69
indra/newview/llpathfindingcharacterlist.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @file llpathfindingcharacterlist.cpp
|
||||
* @brief Implementation of llpathfindingcharacterlist
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindingcharacterlist.h"
|
||||
|
||||
#include "llpathfindingcharacter.h"
|
||||
#include "llpathfindingobject.h"
|
||||
#include "llpathfindingobjectlist.h"
|
||||
#include "llsd.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingCharacterList
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
LLPathfindingCharacterList::LLPathfindingCharacterList()
|
||||
: LLPathfindingObjectList()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterListData)
|
||||
: LLPathfindingObjectList()
|
||||
{
|
||||
parseCharacterListData(pCharacterListData);
|
||||
}
|
||||
|
||||
LLPathfindingCharacterList::~LLPathfindingCharacterList()
|
||||
{
|
||||
}
|
||||
|
||||
void LLPathfindingCharacterList::parseCharacterListData(const LLSD& pCharacterListData)
|
||||
{
|
||||
LLPathfindingObjectMap &objectMap = getObjectMap();
|
||||
|
||||
for (LLSD::map_const_iterator characterDataIter = pCharacterListData.beginMap();
|
||||
characterDataIter != pCharacterListData.endMap(); ++characterDataIter)
|
||||
{
|
||||
const std::string& uuid(characterDataIter->first);
|
||||
const LLSD& characterData = characterDataIter->second;
|
||||
LLPathfindingObjectPtr character(new LLPathfindingCharacter(uuid, characterData));
|
||||
objectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(uuid, character));
|
||||
}
|
||||
}
|
||||
47
indra/newview/llpathfindingcharacterlist.h
Normal file
47
indra/newview/llpathfindingcharacterlist.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @file llpathfindingcharacterlist.h
|
||||
* @brief Header file for llpathfindingcharacterlist
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGCHARACTERLIST_H
|
||||
#define LL_LLPATHFINDINGCHARACTERLIST_H
|
||||
|
||||
#include "llpathfindingobjectlist.h"
|
||||
|
||||
class LLSD;
|
||||
|
||||
class LLPathfindingCharacterList : public LLPathfindingObjectList
|
||||
{
|
||||
public:
|
||||
LLPathfindingCharacterList();
|
||||
LLPathfindingCharacterList(const LLSD& pCharacterListData);
|
||||
virtual ~LLPathfindingCharacterList();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
void parseCharacterListData(const LLSD& pCharacterListData);
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGCHARACTERLIST_H
|
||||
387
indra/newview/llpathfindinglinkset.cpp
Normal file
387
indra/newview/llpathfindinglinkset.cpp
Normal file
@@ -0,0 +1,387 @@
|
||||
/**
|
||||
* @file llpathfindinglinkset.cpp
|
||||
* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindinglinkset.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "llpathfindingobject.h"
|
||||
#include "llsd.h"
|
||||
|
||||
#define LINKSET_LAND_IMPACT_FIELD "landimpact"
|
||||
#define LINKSET_MODIFIABLE_FIELD "modifiable"
|
||||
#define LINKSET_CATEGORY_FIELD "navmesh_category"
|
||||
#define LINKSET_CAN_BE_VOLUME "can_be_volume"
|
||||
#define LINKSET_PHANTOM_FIELD "phantom"
|
||||
#define LINKSET_WALKABILITY_A_FIELD "A"
|
||||
#define LINKSET_WALKABILITY_B_FIELD "B"
|
||||
#define LINKSET_WALKABILITY_C_FIELD "C"
|
||||
#define LINKSET_WALKABILITY_D_FIELD "D"
|
||||
|
||||
#define LINKSET_CATEGORY_VALUE_INCLUDE 0
|
||||
#define LINKSET_CATEGORY_VALUE_EXCLUDE 1
|
||||
#define LINKSET_CATEGORY_VALUE_IGNORE 2
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingLinkset
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
const S32 LLPathfindingLinkset::MIN_WALKABILITY_VALUE(0);
|
||||
const S32 LLPathfindingLinkset::MAX_WALKABILITY_VALUE(100);
|
||||
|
||||
LLPathfindingLinkset::LLPathfindingLinkset(const LLSD& pTerrainData)
|
||||
: LLPathfindingObject(),
|
||||
mIsTerrain(true),
|
||||
mLandImpact(0U),
|
||||
mIsModifiable(FALSE),
|
||||
mCanBeVolume(FALSE),
|
||||
mLinksetUse(kUnknown),
|
||||
mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE),
|
||||
mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE),
|
||||
mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE),
|
||||
mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE)
|
||||
{
|
||||
parsePathfindingData(pTerrainData);
|
||||
}
|
||||
|
||||
LLPathfindingLinkset::LLPathfindingLinkset(const std::string &pUUID, const LLSD& pLinksetData)
|
||||
: LLPathfindingObject(pUUID, pLinksetData),
|
||||
mIsTerrain(false),
|
||||
mLandImpact(0U),
|
||||
mIsModifiable(TRUE),
|
||||
mCanBeVolume(TRUE),
|
||||
mLinksetUse(kUnknown),
|
||||
mWalkabilityCoefficientA(MIN_WALKABILITY_VALUE),
|
||||
mWalkabilityCoefficientB(MIN_WALKABILITY_VALUE),
|
||||
mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE),
|
||||
mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE)
|
||||
{
|
||||
parseLinksetData(pLinksetData);
|
||||
parsePathfindingData(pLinksetData);
|
||||
}
|
||||
|
||||
LLPathfindingLinkset::LLPathfindingLinkset(const LLPathfindingLinkset& pOther)
|
||||
: LLPathfindingObject(pOther),
|
||||
mIsTerrain(pOther.mIsTerrain),
|
||||
mLandImpact(pOther.mLandImpact),
|
||||
mIsModifiable(pOther.mIsModifiable),
|
||||
mCanBeVolume(pOther.mCanBeVolume),
|
||||
mLinksetUse(pOther.mLinksetUse),
|
||||
mWalkabilityCoefficientA(pOther.mWalkabilityCoefficientA),
|
||||
mWalkabilityCoefficientB(pOther.mWalkabilityCoefficientB),
|
||||
mWalkabilityCoefficientC(pOther.mWalkabilityCoefficientC),
|
||||
mWalkabilityCoefficientD(pOther.mWalkabilityCoefficientD)
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingLinkset::~LLPathfindingLinkset()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingLinkset& LLPathfindingLinkset::operator =(const LLPathfindingLinkset& pOther)
|
||||
{
|
||||
dynamic_cast<LLPathfindingObject &>(*this) = pOther;
|
||||
|
||||
mIsTerrain = pOther.mIsTerrain;
|
||||
mLandImpact = pOther.mLandImpact;
|
||||
mIsModifiable = pOther.mIsModifiable;
|
||||
mCanBeVolume = pOther.mCanBeVolume;
|
||||
mLinksetUse = pOther.mLinksetUse;
|
||||
mWalkabilityCoefficientA = pOther.mWalkabilityCoefficientA;
|
||||
mWalkabilityCoefficientB = pOther.mWalkabilityCoefficientB;
|
||||
mWalkabilityCoefficientC = pOther.mWalkabilityCoefficientC;
|
||||
mWalkabilityCoefficientD = pOther.mWalkabilityCoefficientD;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOL LLPathfindingLinkset::isPhantom() const
|
||||
{
|
||||
return isPhantom(getLinksetUse());
|
||||
}
|
||||
|
||||
LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse)
|
||||
{
|
||||
BOOL isPhantom = LLPathfindingLinkset::isPhantom(pLinksetUse);
|
||||
ENavMeshGenerationCategory navMeshGenerationCategory = getNavMeshGenerationCategory(pLinksetUse);
|
||||
|
||||
return getLinksetUse(!isPhantom, navMeshGenerationCategory);
|
||||
}
|
||||
|
||||
bool LLPathfindingLinkset::isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const
|
||||
{
|
||||
return (!isModifiable() && (isPhantom() != isPhantom(pLinksetUse)));
|
||||
}
|
||||
|
||||
bool LLPathfindingLinkset::isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const
|
||||
{
|
||||
return (!canBeVolume() && ((pLinksetUse == kMaterialVolume) || (pLinksetUse == kExclusionVolume)));
|
||||
}
|
||||
|
||||
LLSD LLPathfindingLinkset::encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
|
||||
{
|
||||
LLSD itemData;
|
||||
|
||||
if (!isTerrain() && (pLinksetUse != kUnknown) && (getLinksetUse() != pLinksetUse) &&
|
||||
(canBeVolume() || ((pLinksetUse != kMaterialVolume) && (pLinksetUse != kExclusionVolume))))
|
||||
{
|
||||
if (isModifiable())
|
||||
{
|
||||
itemData[LINKSET_PHANTOM_FIELD] = static_cast<bool>(isPhantom(pLinksetUse));
|
||||
}
|
||||
|
||||
itemData[LINKSET_CATEGORY_FIELD] = convertCategoryToLLSD(getNavMeshGenerationCategory(pLinksetUse));
|
||||
}
|
||||
|
||||
if (mWalkabilityCoefficientA != pA)
|
||||
{
|
||||
itemData[LINKSET_WALKABILITY_A_FIELD] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
|
||||
}
|
||||
|
||||
if (mWalkabilityCoefficientB != pB)
|
||||
{
|
||||
itemData[LINKSET_WALKABILITY_B_FIELD] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
|
||||
}
|
||||
|
||||
if (mWalkabilityCoefficientC != pC)
|
||||
{
|
||||
itemData[LINKSET_WALKABILITY_C_FIELD] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
|
||||
}
|
||||
|
||||
if (mWalkabilityCoefficientD != pD)
|
||||
{
|
||||
itemData[LINKSET_WALKABILITY_D_FIELD] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE);
|
||||
}
|
||||
|
||||
return itemData;
|
||||
}
|
||||
|
||||
void LLPathfindingLinkset::parseLinksetData(const LLSD &pLinksetData)
|
||||
{
|
||||
llassert(pLinksetData.has(LINKSET_LAND_IMPACT_FIELD));
|
||||
llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).isInteger());
|
||||
llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger() >= 0);
|
||||
mLandImpact = pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger();
|
||||
|
||||
llassert(pLinksetData.has(LINKSET_MODIFIABLE_FIELD));
|
||||
llassert(pLinksetData.get(LINKSET_MODIFIABLE_FIELD).isBoolean());
|
||||
mIsModifiable = pLinksetData.get(LINKSET_MODIFIABLE_FIELD).asBoolean();
|
||||
}
|
||||
|
||||
void LLPathfindingLinkset::parsePathfindingData(const LLSD &pLinksetData)
|
||||
{
|
||||
bool isPhantom = false;
|
||||
if (pLinksetData.has(LINKSET_PHANTOM_FIELD))
|
||||
{
|
||||
llassert(pLinksetData.get(LINKSET_PHANTOM_FIELD).isBoolean());
|
||||
isPhantom = pLinksetData.get(LINKSET_PHANTOM_FIELD).asBoolean();
|
||||
}
|
||||
|
||||
llassert(pLinksetData.has(LINKSET_CATEGORY_FIELD));
|
||||
mLinksetUse = getLinksetUse(isPhantom, convertCategoryFromLLSD(pLinksetData.get(LINKSET_CATEGORY_FIELD)));
|
||||
|
||||
if (pLinksetData.has(LINKSET_CAN_BE_VOLUME))
|
||||
{
|
||||
llassert(pLinksetData.get(LINKSET_CAN_BE_VOLUME).isBoolean());
|
||||
mCanBeVolume = pLinksetData.get(LINKSET_CAN_BE_VOLUME).asBoolean();
|
||||
}
|
||||
|
||||
llassert(pLinksetData.has(LINKSET_WALKABILITY_A_FIELD));
|
||||
llassert(pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).isInteger());
|
||||
mWalkabilityCoefficientA = pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).asInteger();
|
||||
llassert(mWalkabilityCoefficientA >= MIN_WALKABILITY_VALUE);
|
||||
llassert(mWalkabilityCoefficientA <= MAX_WALKABILITY_VALUE);
|
||||
|
||||
llassert(pLinksetData.has(LINKSET_WALKABILITY_B_FIELD));
|
||||
llassert(pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).isInteger());
|
||||
mWalkabilityCoefficientB = pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).asInteger();
|
||||
llassert(mWalkabilityCoefficientB >= MIN_WALKABILITY_VALUE);
|
||||
llassert(mWalkabilityCoefficientB <= MAX_WALKABILITY_VALUE);
|
||||
|
||||
llassert(pLinksetData.has(LINKSET_WALKABILITY_C_FIELD));
|
||||
llassert(pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).isInteger());
|
||||
mWalkabilityCoefficientC = pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).asInteger();
|
||||
llassert(mWalkabilityCoefficientC >= MIN_WALKABILITY_VALUE);
|
||||
llassert(mWalkabilityCoefficientC <= MAX_WALKABILITY_VALUE);
|
||||
|
||||
llassert(pLinksetData.has(LINKSET_WALKABILITY_D_FIELD));
|
||||
llassert(pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).isInteger());
|
||||
mWalkabilityCoefficientD = pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).asInteger();
|
||||
llassert(mWalkabilityCoefficientD >= MIN_WALKABILITY_VALUE);
|
||||
llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE);
|
||||
}
|
||||
|
||||
BOOL LLPathfindingLinkset::isPhantom(ELinksetUse pLinksetUse)
|
||||
{
|
||||
BOOL retVal;
|
||||
|
||||
switch (pLinksetUse)
|
||||
{
|
||||
case kWalkable :
|
||||
case kStaticObstacle :
|
||||
case kDynamicObstacle :
|
||||
retVal = false;
|
||||
break;
|
||||
case kMaterialVolume :
|
||||
case kExclusionVolume :
|
||||
case kDynamicPhantom :
|
||||
retVal = true;
|
||||
break;
|
||||
case kUnknown :
|
||||
default :
|
||||
retVal = false;
|
||||
llassert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
LLPathfindingLinkset::ELinksetUse LLPathfindingLinkset::getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory)
|
||||
{
|
||||
ELinksetUse linksetUse = kUnknown;
|
||||
|
||||
if (pIsPhantom)
|
||||
{
|
||||
switch (pNavMeshGenerationCategory)
|
||||
{
|
||||
case kNavMeshGenerationIgnore :
|
||||
linksetUse = kDynamicPhantom;
|
||||
break;
|
||||
case kNavMeshGenerationInclude :
|
||||
linksetUse = kMaterialVolume;
|
||||
break;
|
||||
case kNavMeshGenerationExclude :
|
||||
linksetUse = kExclusionVolume;
|
||||
break;
|
||||
default :
|
||||
linksetUse = kUnknown;
|
||||
llassert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (pNavMeshGenerationCategory)
|
||||
{
|
||||
case kNavMeshGenerationIgnore :
|
||||
linksetUse = kDynamicObstacle;
|
||||
break;
|
||||
case kNavMeshGenerationInclude :
|
||||
linksetUse = kWalkable;
|
||||
break;
|
||||
case kNavMeshGenerationExclude :
|
||||
linksetUse = kStaticObstacle;
|
||||
break;
|
||||
default :
|
||||
linksetUse = kUnknown;
|
||||
llassert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return linksetUse;
|
||||
}
|
||||
|
||||
LLPathfindingLinkset::ENavMeshGenerationCategory LLPathfindingLinkset::getNavMeshGenerationCategory(ELinksetUse pLinksetUse)
|
||||
{
|
||||
ENavMeshGenerationCategory navMeshGenerationCategory;
|
||||
switch (pLinksetUse)
|
||||
{
|
||||
case kWalkable :
|
||||
case kMaterialVolume :
|
||||
navMeshGenerationCategory = kNavMeshGenerationInclude;
|
||||
break;
|
||||
case kStaticObstacle :
|
||||
case kExclusionVolume :
|
||||
navMeshGenerationCategory = kNavMeshGenerationExclude;
|
||||
break;
|
||||
case kDynamicObstacle :
|
||||
case kDynamicPhantom :
|
||||
navMeshGenerationCategory = kNavMeshGenerationIgnore;
|
||||
break;
|
||||
case kUnknown :
|
||||
default :
|
||||
navMeshGenerationCategory = kNavMeshGenerationIgnore;
|
||||
llassert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return navMeshGenerationCategory;
|
||||
}
|
||||
|
||||
LLSD LLPathfindingLinkset::convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory)
|
||||
{
|
||||
LLSD llsd;
|
||||
|
||||
switch (pNavMeshGenerationCategory)
|
||||
{
|
||||
case kNavMeshGenerationIgnore :
|
||||
llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE);
|
||||
break;
|
||||
case kNavMeshGenerationInclude :
|
||||
llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_INCLUDE);
|
||||
break;
|
||||
case kNavMeshGenerationExclude :
|
||||
llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_EXCLUDE);
|
||||
break;
|
||||
default :
|
||||
llsd = static_cast<S32>(LINKSET_CATEGORY_VALUE_IGNORE);
|
||||
llassert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return llsd;
|
||||
}
|
||||
|
||||
LLPathfindingLinkset::ENavMeshGenerationCategory LLPathfindingLinkset::convertCategoryFromLLSD(const LLSD &llsd)
|
||||
{
|
||||
ENavMeshGenerationCategory navMeshGenerationCategory;
|
||||
|
||||
llassert(llsd.isInteger());
|
||||
switch (llsd.asInteger())
|
||||
{
|
||||
case LINKSET_CATEGORY_VALUE_IGNORE :
|
||||
navMeshGenerationCategory = kNavMeshGenerationIgnore;
|
||||
break;
|
||||
case LINKSET_CATEGORY_VALUE_INCLUDE :
|
||||
navMeshGenerationCategory = kNavMeshGenerationInclude;
|
||||
break;
|
||||
case LINKSET_CATEGORY_VALUE_EXCLUDE :
|
||||
navMeshGenerationCategory = kNavMeshGenerationExclude;
|
||||
break;
|
||||
default :
|
||||
navMeshGenerationCategory = kNavMeshGenerationIgnore;
|
||||
llassert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return navMeshGenerationCategory;
|
||||
}
|
||||
108
indra/newview/llpathfindinglinkset.h
Normal file
108
indra/newview/llpathfindinglinkset.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* @file llpathfindinglinkset.h
|
||||
* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGLINKSET_H
|
||||
#define LL_LLPATHFINDINGLINKSET_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "llpathfindingobject.h"
|
||||
|
||||
class LLSD;
|
||||
|
||||
class LLPathfindingLinkset : public LLPathfindingObject
|
||||
{
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
kUnknown,
|
||||
kWalkable,
|
||||
kStaticObstacle,
|
||||
kDynamicObstacle,
|
||||
kMaterialVolume,
|
||||
kExclusionVolume,
|
||||
kDynamicPhantom
|
||||
} ELinksetUse;
|
||||
|
||||
LLPathfindingLinkset(const LLSD &pTerrainData);
|
||||
LLPathfindingLinkset(const std::string &pUUID, const LLSD &pLinksetData);
|
||||
LLPathfindingLinkset(const LLPathfindingLinkset& pOther);
|
||||
virtual ~LLPathfindingLinkset();
|
||||
|
||||
LLPathfindingLinkset& operator = (const LLPathfindingLinkset& pOther);
|
||||
|
||||
inline bool isTerrain() const {return mIsTerrain;};
|
||||
inline U32 getLandImpact() const {return mLandImpact;};
|
||||
BOOL isModifiable() const {return mIsModifiable;};
|
||||
BOOL isPhantom() const;
|
||||
BOOL canBeVolume() const {return mCanBeVolume;};
|
||||
static ELinksetUse getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse);
|
||||
|
||||
inline ELinksetUse getLinksetUse() const {return mLinksetUse;};
|
||||
|
||||
inline S32 getWalkabilityCoefficientA() const {return mWalkabilityCoefficientA;};
|
||||
inline S32 getWalkabilityCoefficientB() const {return mWalkabilityCoefficientB;};
|
||||
inline S32 getWalkabilityCoefficientC() const {return mWalkabilityCoefficientC;};
|
||||
inline S32 getWalkabilityCoefficientD() const {return mWalkabilityCoefficientD;};
|
||||
|
||||
bool isShowUnmodifiablePhantomWarning(ELinksetUse pLinksetUse) const;
|
||||
bool isShowCannotBeVolumeWarning(ELinksetUse pLinksetUse) const;
|
||||
LLSD encodeAlteredFields(ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
|
||||
|
||||
static const S32 MIN_WALKABILITY_VALUE;
|
||||
static const S32 MAX_WALKABILITY_VALUE;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
typedef enum
|
||||
{
|
||||
kNavMeshGenerationIgnore,
|
||||
kNavMeshGenerationInclude,
|
||||
kNavMeshGenerationExclude
|
||||
} ENavMeshGenerationCategory;
|
||||
|
||||
void parseLinksetData(const LLSD &pLinksetData);
|
||||
void parsePathfindingData(const LLSD &pLinksetData);
|
||||
|
||||
static BOOL isPhantom(ELinksetUse pLinksetUse);
|
||||
static ELinksetUse getLinksetUse(bool pIsPhantom, ENavMeshGenerationCategory pNavMeshGenerationCategory);
|
||||
static ENavMeshGenerationCategory getNavMeshGenerationCategory(ELinksetUse pLinksetUse);
|
||||
static LLSD convertCategoryToLLSD(ENavMeshGenerationCategory pNavMeshGenerationCategory);
|
||||
static ENavMeshGenerationCategory convertCategoryFromLLSD(const LLSD &llsd);
|
||||
|
||||
bool mIsTerrain;
|
||||
U32 mLandImpact;
|
||||
BOOL mIsModifiable;
|
||||
BOOL mCanBeVolume;
|
||||
ELinksetUse mLinksetUse;
|
||||
S32 mWalkabilityCoefficientA;
|
||||
S32 mWalkabilityCoefficientB;
|
||||
S32 mWalkabilityCoefficientC;
|
||||
S32 mWalkabilityCoefficientD;
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGLINKSET_H
|
||||
196
indra/newview/llpathfindinglinksetlist.cpp
Normal file
196
indra/newview/llpathfindinglinksetlist.cpp
Normal file
@@ -0,0 +1,196 @@
|
||||
/**
|
||||
* @file llpathfindinglinksetlist.cpp
|
||||
* @brief Implementation of llpathfindinglinksetlist
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindinglinksetlist.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "llpathfindinglinkset.h"
|
||||
#include "llpathfindingobject.h"
|
||||
#include "llpathfindingobjectlist.h"
|
||||
#include "llsd.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingLinksetList
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
LLPathfindingLinksetList::LLPathfindingLinksetList()
|
||||
: LLPathfindingObjectList()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetListData)
|
||||
: LLPathfindingObjectList()
|
||||
{
|
||||
parseLinksetListData(pLinksetListData);
|
||||
}
|
||||
|
||||
LLPathfindingLinksetList::~LLPathfindingLinksetList()
|
||||
{
|
||||
}
|
||||
|
||||
LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
|
||||
{
|
||||
LLSD listData;
|
||||
|
||||
for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
|
||||
{
|
||||
const LLPathfindingObjectPtr objectPtr = linksetIter->second;
|
||||
const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
|
||||
|
||||
if (!linkset->isTerrain())
|
||||
{
|
||||
LLSD linksetData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
|
||||
if (!linksetData.isUndefined())
|
||||
{
|
||||
const std::string& uuid(linksetIter->first);
|
||||
listData[uuid] = linksetData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return listData;
|
||||
}
|
||||
|
||||
LLSD LLPathfindingLinksetList::encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
|
||||
{
|
||||
LLSD terrainData;
|
||||
|
||||
for (const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
|
||||
{
|
||||
const LLPathfindingObjectPtr objectPtr = linksetIter->second;
|
||||
const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
|
||||
|
||||
if (linkset->isTerrain())
|
||||
{
|
||||
terrainData = linkset->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return terrainData;
|
||||
}
|
||||
|
||||
bool LLPathfindingLinksetList::isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
|
||||
{
|
||||
bool isShowWarning = false;
|
||||
|
||||
for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
|
||||
{
|
||||
const LLPathfindingObjectPtr objectPtr = objectIter->second;
|
||||
const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
|
||||
isShowWarning = linkset->isShowUnmodifiablePhantomWarning(pLinksetUse);
|
||||
}
|
||||
|
||||
return isShowWarning;
|
||||
}
|
||||
|
||||
bool LLPathfindingLinksetList::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const
|
||||
{
|
||||
bool isShowWarning = false;
|
||||
|
||||
for (const_iterator objectIter = begin(); !isShowWarning && (objectIter != end()); ++objectIter)
|
||||
{
|
||||
const LLPathfindingObjectPtr objectPtr = objectIter->second;
|
||||
const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
|
||||
isShowWarning = linkset->isShowCannotBeVolumeWarning(pLinksetUse);
|
||||
}
|
||||
|
||||
return isShowWarning;
|
||||
}
|
||||
|
||||
void LLPathfindingLinksetList::determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle,
|
||||
BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const
|
||||
{
|
||||
pCanBeWalkable = FALSE;
|
||||
pCanBeStaticObstacle = FALSE;
|
||||
pCanBeDynamicObstacle = FALSE;
|
||||
pCanBeMaterialVolume = FALSE;
|
||||
pCanBeExclusionVolume = FALSE;
|
||||
pCanBeDynamicPhantom = FALSE;
|
||||
|
||||
for (const_iterator objectIter = begin();
|
||||
!(pCanBeWalkable && pCanBeStaticObstacle && pCanBeDynamicObstacle && pCanBeMaterialVolume && pCanBeExclusionVolume && pCanBeDynamicPhantom) && (objectIter != end());
|
||||
++objectIter)
|
||||
{
|
||||
const LLPathfindingObjectPtr objectPtr = objectIter->second;
|
||||
const LLPathfindingLinkset *linkset = dynamic_cast<const LLPathfindingLinkset *>(objectPtr.get());
|
||||
|
||||
if (linkset->isTerrain())
|
||||
{
|
||||
pCanBeWalkable = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (linkset->isModifiable())
|
||||
{
|
||||
pCanBeWalkable = TRUE;
|
||||
pCanBeStaticObstacle = TRUE;
|
||||
pCanBeDynamicObstacle = TRUE;
|
||||
pCanBeDynamicPhantom = TRUE;
|
||||
if (linkset->canBeVolume())
|
||||
{
|
||||
pCanBeMaterialVolume = TRUE;
|
||||
pCanBeExclusionVolume = TRUE;
|
||||
}
|
||||
}
|
||||
else if (linkset->isPhantom())
|
||||
{
|
||||
pCanBeDynamicPhantom = TRUE;
|
||||
if (linkset->canBeVolume())
|
||||
{
|
||||
pCanBeMaterialVolume = TRUE;
|
||||
pCanBeExclusionVolume = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pCanBeWalkable = TRUE;
|
||||
pCanBeStaticObstacle = TRUE;
|
||||
pCanBeDynamicObstacle = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingLinksetList::parseLinksetListData(const LLSD& pLinksetListData)
|
||||
{
|
||||
LLPathfindingObjectMap &objectMap = getObjectMap();
|
||||
|
||||
for (LLSD::map_const_iterator linksetDataIter = pLinksetListData.beginMap();
|
||||
linksetDataIter != pLinksetListData.endMap(); ++linksetDataIter)
|
||||
{
|
||||
const std::string& uuid(linksetDataIter->first);
|
||||
const LLSD& linksetData = linksetDataIter->second;
|
||||
LLPathfindingObjectPtr linksetPtr(new LLPathfindingLinkset(uuid, linksetData));
|
||||
objectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(uuid, linksetPtr));
|
||||
}
|
||||
}
|
||||
57
indra/newview/llpathfindinglinksetlist.h
Normal file
57
indra/newview/llpathfindinglinksetlist.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @file llpathfindinglinksetlist.h
|
||||
* @brief Header file for llpathfindinglinksetlist
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGLINKSETLIST_H
|
||||
#define LL_LLPATHFINDINGLINKSETLIST_H
|
||||
|
||||
#include "llpathfindinglinkset.h"
|
||||
#include "llpathfindingobjectlist.h"
|
||||
|
||||
class LLSD;
|
||||
|
||||
class LLPathfindingLinksetList : public LLPathfindingObjectList
|
||||
{
|
||||
public:
|
||||
LLPathfindingLinksetList();
|
||||
LLPathfindingLinksetList(const LLSD& pLinksetListData);
|
||||
virtual ~LLPathfindingLinksetList();
|
||||
|
||||
LLSD encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
|
||||
LLSD encodeTerrainFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const;
|
||||
|
||||
bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
|
||||
bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
|
||||
|
||||
void determinePossibleStates(BOOL &pCanBeWalkable, BOOL &pCanBeStaticObstacle, BOOL &pCanBeDynamicObstacle,
|
||||
BOOL &pCanBeMaterialVolume, BOOL &pCanBeExclusionVolume, BOOL &pCanBeDynamicPhantom) const;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
void parseLinksetListData(const LLSD& pLinksetListData);
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGLINKSETLIST_H
|
||||
1050
indra/newview/llpathfindingmanager.cpp
Normal file
1050
indra/newview/llpathfindingmanager.cpp
Normal file
File diff suppressed because it is too large
Load Diff
127
indra/newview/llpathfindingmanager.h
Normal file
127
indra/newview/llpathfindingmanager.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* @file llpathfindingmanager.h
|
||||
* @brief Header file for llpathfindingmanager
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGMANAGER_H
|
||||
#define LL_LLPATHFINDINGMANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
#include "llpathfindinglinkset.h"
|
||||
#include "llpathfindingobjectlist.h"
|
||||
#include "llpathfindingnavmesh.h"
|
||||
#include "llsingleton.h"
|
||||
|
||||
class LLPathfindingNavMeshStatus;
|
||||
class LLUUID;
|
||||
class LLViewerRegion;
|
||||
|
||||
class LLPathfindingManager : public LLSingleton<LLPathfindingManager>
|
||||
{
|
||||
friend class LLNavMeshSimStateChangeNode;
|
||||
friend class NavMeshStatusResponder;
|
||||
friend class LLAgentStateChangeNode;
|
||||
friend class AgentStateResponder;
|
||||
public:
|
||||
typedef enum {
|
||||
kRequestStarted,
|
||||
kRequestCompleted,
|
||||
kRequestNotEnabled,
|
||||
kRequestError
|
||||
} ERequestStatus;
|
||||
|
||||
LLPathfindingManager();
|
||||
virtual ~LLPathfindingManager();
|
||||
|
||||
void initSystem();
|
||||
void quitSystem();
|
||||
|
||||
bool isPathfindingViewEnabled() const;
|
||||
bool isPathfindingEnabledForCurrentRegion() const;
|
||||
bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const;
|
||||
|
||||
bool isAllowViewTerrainProperties() const;
|
||||
|
||||
LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback);
|
||||
void requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly);
|
||||
|
||||
typedef U32 request_id_t;
|
||||
typedef boost::function<void (request_id_t, ERequestStatus, LLPathfindingObjectListPtr)> object_request_callback_t;
|
||||
|
||||
void requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const;
|
||||
void requestSetLinksets(request_id_t pRequestId, const LLPathfindingObjectListPtr &pLinksetListPtr, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, object_request_callback_t pLinksetsCallback) const;
|
||||
|
||||
void requestGetCharacters(request_id_t pRequestId, object_request_callback_t pCharactersCallback) const;
|
||||
|
||||
typedef boost::function<void (BOOL)> agent_state_callback_t;
|
||||
typedef boost::signals2::signal<void (BOOL)> agent_state_signal_t;
|
||||
typedef boost::signals2::connection agent_state_slot_t;
|
||||
|
||||
agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback);
|
||||
void requestGetAgentState();
|
||||
|
||||
typedef boost::function<void (bool)> rebake_navmesh_callback_t;
|
||||
void requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
typedef std::map<LLUUID, LLPathfindingNavMeshPtr> NavMeshMap;
|
||||
|
||||
void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus);
|
||||
|
||||
void handleDeferredGetAgentStateForRegion(const LLUUID &pRegionUUID);
|
||||
void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly);
|
||||
void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const;
|
||||
void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const;
|
||||
|
||||
void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly);
|
||||
void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus);
|
||||
|
||||
void handleAgentState(BOOL pCanRebakeRegion);
|
||||
|
||||
LLPathfindingNavMeshPtr getNavMeshForRegion(const LLUUID &pRegionUUID);
|
||||
LLPathfindingNavMeshPtr getNavMeshForRegion(LLViewerRegion *pRegion);
|
||||
|
||||
std::string getNavMeshStatusURLForCurrentRegion() const;
|
||||
std::string getNavMeshStatusURLForRegion(LLViewerRegion *pRegion) const;
|
||||
std::string getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const;
|
||||
std::string getObjectLinksetsURLForCurrentRegion() const;
|
||||
std::string getTerrainLinksetsURLForCurrentRegion() const;
|
||||
std::string getCharactersURLForCurrentRegion() const;
|
||||
std::string getAgentStateURLForRegion(LLViewerRegion *pRegion) const;
|
||||
std::string getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const;
|
||||
std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const;
|
||||
LLViewerRegion *getCurrentRegion() const;
|
||||
|
||||
NavMeshMap mNavMeshMap;
|
||||
agent_state_signal_t mAgentStateSignal;
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGMANAGER_H
|
||||
205
indra/newview/llpathfindingnavmesh.cpp
Normal file
205
indra/newview/llpathfindingnavmesh.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
/**
|
||||
* @file llpathfindingnavmesh.cpp
|
||||
* @brief Implementation of llpathfindingnavmesh
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindingnavmesh.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "llpathfindingnavmeshstatus.h"
|
||||
#include "llsd.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "lluuid.h"
|
||||
|
||||
#define NAVMESH_VERSION_FIELD "navmesh_version"
|
||||
#define NAVMESH_DATA_FIELD "navmesh_data"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingNavMesh
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
LLPathfindingNavMesh::LLPathfindingNavMesh(const LLUUID &pRegionUUID)
|
||||
: mNavMeshStatus(pRegionUUID),
|
||||
mNavMeshRequestStatus(kNavMeshRequestUnknown),
|
||||
mNavMeshSignal(),
|
||||
mNavMeshData()
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingNavMesh::~LLPathfindingNavMesh()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingNavMesh::navmesh_slot_t LLPathfindingNavMesh::registerNavMeshListener(navmesh_callback_t pNavMeshCallback)
|
||||
{
|
||||
return mNavMeshSignal.connect(pNavMeshCallback);
|
||||
}
|
||||
|
||||
bool LLPathfindingNavMesh::hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const
|
||||
{
|
||||
return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) &&
|
||||
((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) ||
|
||||
((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty())));
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshWaitForRegionLoad()
|
||||
{
|
||||
setRequestStatus(kNavMeshRequestWaiting);
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshCheckVersion()
|
||||
{
|
||||
setRequestStatus(kNavMeshRequestChecking);
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus)
|
||||
{
|
||||
llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
|
||||
llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion());
|
||||
mNavMeshStatus = pNavMeshStatus;
|
||||
if (mNavMeshRequestStatus == kNavMeshRequestChecking)
|
||||
{
|
||||
llassert(!mNavMeshData.empty());
|
||||
setRequestStatus(kNavMeshRequestCompleted);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendStatus();
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus)
|
||||
{
|
||||
llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
|
||||
if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion())
|
||||
{
|
||||
mNavMeshStatus = pNavMeshStatus;
|
||||
sendStatus();
|
||||
}
|
||||
else
|
||||
{
|
||||
mNavMeshData.clear();
|
||||
mNavMeshStatus = pNavMeshStatus;
|
||||
setRequestStatus(kNavMeshRequestNeedsUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus)
|
||||
{
|
||||
llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
|
||||
mNavMeshStatus = pNavMeshStatus;
|
||||
setRequestStatus(kNavMeshRequestStarted);
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion)
|
||||
{
|
||||
llassert(pContent.has(NAVMESH_VERSION_FIELD));
|
||||
if (pContent.has(NAVMESH_VERSION_FIELD))
|
||||
{
|
||||
llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger());
|
||||
llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0);
|
||||
U32 embeddedNavMeshVersion = static_cast<U32>(pContent.get(NAVMESH_VERSION_FIELD).asInteger());
|
||||
llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur?
|
||||
if (embeddedNavMeshVersion != pNavMeshVersion)
|
||||
{
|
||||
llwarns << "Mismatch between expected and embedded navmesh versions occurred" << llendl;
|
||||
pNavMeshVersion = embeddedNavMeshVersion;
|
||||
}
|
||||
}
|
||||
|
||||
if (mNavMeshStatus.getVersion() == pNavMeshVersion)
|
||||
{
|
||||
ENavMeshRequestStatus status;
|
||||
if ( pContent.has(NAVMESH_DATA_FIELD) )
|
||||
{
|
||||
const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
|
||||
unsigned int binSize = value.size();
|
||||
std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
|
||||
std::istringstream streamdecomp( newStr );
|
||||
unsigned int decompBinSize = 0;
|
||||
bool valid = false;
|
||||
U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
|
||||
if ( !valid )
|
||||
{
|
||||
llwarns << "Unable to decompress the navmesh llsd." << llendl;
|
||||
status = kNavMeshRequestError;
|
||||
}
|
||||
else
|
||||
{
|
||||
llassert(pUncompressedNavMeshContainer);
|
||||
mNavMeshData.resize( decompBinSize );
|
||||
memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize );
|
||||
status = kNavMeshRequestCompleted;
|
||||
}
|
||||
if ( pUncompressedNavMeshContainer )
|
||||
{
|
||||
free( pUncompressedNavMeshContainer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "No mesh data received" << llendl;
|
||||
status = kNavMeshRequestError;
|
||||
}
|
||||
setRequestStatus(status);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshNotEnabled()
|
||||
{
|
||||
mNavMeshData.clear();
|
||||
setRequestStatus(kNavMeshRequestNotEnabled);
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshError()
|
||||
{
|
||||
mNavMeshData.clear();
|
||||
setRequestStatus(kNavMeshRequestError);
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion)
|
||||
{
|
||||
llwarns << "error with request to URL '" << pURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl;
|
||||
if (mNavMeshStatus.getVersion() == pNavMeshVersion)
|
||||
{
|
||||
handleNavMeshError();
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus)
|
||||
{
|
||||
mNavMeshRequestStatus = pNavMeshRequestStatus;
|
||||
sendStatus();
|
||||
}
|
||||
|
||||
void LLPathfindingNavMesh::sendStatus()
|
||||
{
|
||||
mNavMeshSignal(mNavMeshRequestStatus, mNavMeshStatus, mNavMeshData);
|
||||
}
|
||||
91
indra/newview/llpathfindingnavmesh.h
Normal file
91
indra/newview/llpathfindingnavmesh.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @file llpathfindingnavmesh.h
|
||||
* @brief Header file for llpathfindingnavmesh
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGNAVMESH_H
|
||||
#define LL_LLPATHFINDINGNAVMESH_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
#include "llpathfindingnavmeshstatus.h"
|
||||
#include "llsd.h"
|
||||
|
||||
class LLPathfindingNavMesh;
|
||||
class LLUUID;
|
||||
|
||||
typedef boost::shared_ptr<LLPathfindingNavMesh> LLPathfindingNavMeshPtr;
|
||||
|
||||
class LLPathfindingNavMesh
|
||||
{
|
||||
public:
|
||||
typedef enum {
|
||||
kNavMeshRequestUnknown,
|
||||
kNavMeshRequestWaiting,
|
||||
kNavMeshRequestChecking,
|
||||
kNavMeshRequestNeedsUpdate,
|
||||
kNavMeshRequestStarted,
|
||||
kNavMeshRequestCompleted,
|
||||
kNavMeshRequestNotEnabled,
|
||||
kNavMeshRequestError
|
||||
} ENavMeshRequestStatus;
|
||||
|
||||
typedef boost::function<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_callback_t;
|
||||
typedef boost::signals2::signal<void (ENavMeshRequestStatus, const LLPathfindingNavMeshStatus &, const LLSD::Binary &)> navmesh_signal_t;
|
||||
typedef boost::signals2::connection navmesh_slot_t;
|
||||
|
||||
LLPathfindingNavMesh(const LLUUID &pRegionUUID);
|
||||
virtual ~LLPathfindingNavMesh();
|
||||
|
||||
navmesh_slot_t registerNavMeshListener(navmesh_callback_t pNavMeshCallback);
|
||||
|
||||
bool hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const;
|
||||
|
||||
void handleNavMeshWaitForRegionLoad();
|
||||
void handleNavMeshCheckVersion();
|
||||
void handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus);
|
||||
void handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus);
|
||||
void handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus);
|
||||
void handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion);
|
||||
void handleNavMeshNotEnabled();
|
||||
void handleNavMeshError();
|
||||
void handleNavMeshError(U32 pStatus, const std::string &pReason, const std::string &pURL, U32 pNavMeshVersion);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
void setRequestStatus(ENavMeshRequestStatus pNavMeshRequestStatus);
|
||||
void sendStatus();
|
||||
|
||||
LLPathfindingNavMeshStatus mNavMeshStatus;
|
||||
ENavMeshRequestStatus mNavMeshRequestStatus;
|
||||
navmesh_signal_t mNavMeshSignal;
|
||||
LLSD::Binary mNavMeshData;
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGNAVMESH_H
|
||||
145
indra/newview/llpathfindingnavmeshstatus.cpp
Normal file
145
indra/newview/llpathfindingnavmeshstatus.cpp
Normal file
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
* @file llpathfindingnavmeshstatus.cpp
|
||||
* @brief Implementation of llpathfindingnavmeshstatus
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindingnavmeshstatus.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "llsd.h"
|
||||
#include "llstring.h"
|
||||
#include "lluuid.h"
|
||||
|
||||
#define REGION_FIELD "region_id"
|
||||
#define STATUS_FIELD "status"
|
||||
#define VERSION_FIELD "version"
|
||||
|
||||
const std::string LLPathfindingNavMeshStatus::sStatusPending("pending");
|
||||
const std::string LLPathfindingNavMeshStatus::sStatusBuilding("building");
|
||||
const std::string LLPathfindingNavMeshStatus::sStatusComplete("complete");
|
||||
const std::string LLPathfindingNavMeshStatus::sStatusRepending("repending");
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingNavMeshStatus
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus()
|
||||
: mIsValid(false),
|
||||
mRegionUUID(),
|
||||
mVersion(0U),
|
||||
mStatus(kComplete)
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID)
|
||||
: mIsValid(false),
|
||||
mRegionUUID(pRegionUUID),
|
||||
mVersion(0U),
|
||||
mStatus(kComplete)
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent)
|
||||
: mIsValid(true),
|
||||
mRegionUUID(pRegionUUID),
|
||||
mVersion(0U),
|
||||
mStatus(kComplete)
|
||||
{
|
||||
parseStatus(pContent);
|
||||
}
|
||||
|
||||
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLSD &pContent)
|
||||
: mIsValid(true),
|
||||
mRegionUUID(),
|
||||
mVersion(0U),
|
||||
mStatus(kComplete)
|
||||
{
|
||||
llassert(pContent.has(REGION_FIELD));
|
||||
llassert(pContent.get(REGION_FIELD).isUUID());
|
||||
mRegionUUID = pContent.get(REGION_FIELD).asUUID();
|
||||
|
||||
parseStatus(pContent);
|
||||
}
|
||||
|
||||
LLPathfindingNavMeshStatus::LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther)
|
||||
: mIsValid(pOther.mIsValid),
|
||||
mRegionUUID(pOther.mRegionUUID),
|
||||
mVersion(pOther.mVersion),
|
||||
mStatus(pOther.mStatus)
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingNavMeshStatus::~LLPathfindingNavMeshStatus()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingNavMeshStatus &LLPathfindingNavMeshStatus::operator =(const LLPathfindingNavMeshStatus &pOther)
|
||||
{
|
||||
mIsValid = pOther.mIsValid;
|
||||
mRegionUUID = pOther.mRegionUUID;
|
||||
mVersion = pOther.mVersion;
|
||||
mStatus = pOther.mStatus;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void LLPathfindingNavMeshStatus::parseStatus(const LLSD &pContent)
|
||||
{
|
||||
llassert(pContent.has(VERSION_FIELD));
|
||||
llassert(pContent.get(VERSION_FIELD).isInteger());
|
||||
llassert(pContent.get(VERSION_FIELD).asInteger() >= 0);
|
||||
mVersion = static_cast<U32>(pContent.get(VERSION_FIELD).asInteger());
|
||||
|
||||
llassert(pContent.has(STATUS_FIELD));
|
||||
llassert(pContent.get(STATUS_FIELD).isString());
|
||||
std::string status = pContent.get(STATUS_FIELD).asString();
|
||||
|
||||
if (LLStringUtil::compareStrings(status, sStatusPending) == 0)
|
||||
{
|
||||
mStatus = kPending;
|
||||
}
|
||||
else if (LLStringUtil::compareStrings(status, sStatusBuilding) == 0)
|
||||
{
|
||||
mStatus = kBuilding;
|
||||
}
|
||||
else if (LLStringUtil::compareStrings(status, sStatusComplete) == 0)
|
||||
{
|
||||
mStatus = kComplete;
|
||||
}
|
||||
else if (LLStringUtil::compareStrings(status, sStatusRepending) == 0)
|
||||
{
|
||||
mStatus = kRepending;
|
||||
}
|
||||
else
|
||||
{
|
||||
mStatus = kComplete;
|
||||
llassert(0);
|
||||
}
|
||||
}
|
||||
77
indra/newview/llpathfindingnavmeshstatus.h
Normal file
77
indra/newview/llpathfindingnavmeshstatus.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @file llpathfindingnavmeshstatus.h
|
||||
* @brief Header file for llpathfindingnavmeshstatus
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H
|
||||
#define LL_LLPATHFINDINGNAVMESHSTATUS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "lluuid.h"
|
||||
|
||||
class LLSD;
|
||||
|
||||
class LLPathfindingNavMeshStatus
|
||||
{
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
kPending,
|
||||
kBuilding,
|
||||
kComplete,
|
||||
kRepending
|
||||
} ENavMeshStatus;
|
||||
|
||||
LLPathfindingNavMeshStatus();
|
||||
LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID);
|
||||
LLPathfindingNavMeshStatus(const LLUUID &pRegionUUID, const LLSD &pContent);
|
||||
LLPathfindingNavMeshStatus(const LLSD &pContent);
|
||||
LLPathfindingNavMeshStatus(const LLPathfindingNavMeshStatus &pOther);
|
||||
virtual ~LLPathfindingNavMeshStatus();
|
||||
|
||||
LLPathfindingNavMeshStatus &operator =(const LLPathfindingNavMeshStatus &pOther);
|
||||
|
||||
bool isValid() const {return mIsValid;};
|
||||
const LLUUID &getRegionUUID() const {return mRegionUUID;};
|
||||
U32 getVersion() const {return mVersion;};
|
||||
ENavMeshStatus getStatus() const {return mStatus;};
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
void parseStatus(const LLSD &pContent);
|
||||
|
||||
bool mIsValid;
|
||||
LLUUID mRegionUUID;
|
||||
U32 mVersion;
|
||||
ENavMeshStatus mStatus;
|
||||
|
||||
static const std::string sStatusPending;
|
||||
static const std::string sStatusBuilding;
|
||||
static const std::string sStatusComplete;
|
||||
static const std::string sStatusRepending;
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGNAVMESHSTATUS_H
|
||||
162
indra/newview/llpathfindingobject.cpp
Normal file
162
indra/newview/llpathfindingobject.cpp
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* @file llpathfindingobject.cpp
|
||||
* @brief Implementation of llpathfindingobject
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindingobject.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "llavatarname.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llsd.h"
|
||||
#include "lluuid.h"
|
||||
#include "v3math.h"
|
||||
|
||||
#define PATHFINDING_OBJECT_NAME_FIELD "name"
|
||||
#define PATHFINDING_OBJECT_DESCRIPTION_FIELD "description"
|
||||
#define PATHFINDING_OBJECT_OWNER_FIELD "owner"
|
||||
#define PATHFINDING_OBJECT_POSITION_FIELD "position"
|
||||
#define PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD "owner_is_group"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingObject
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
LLPathfindingObject::LLPathfindingObject()
|
||||
: mUUID(),
|
||||
mName(),
|
||||
mDescription(),
|
||||
mOwnerUUID(),
|
||||
mHasOwnerName(false),
|
||||
mOwnerName(),
|
||||
mIsGroupOwned(false),
|
||||
mLocation()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData)
|
||||
: mUUID(pUUID),
|
||||
mName(),
|
||||
mDescription(),
|
||||
mOwnerUUID(),
|
||||
mHasOwnerName(false),
|
||||
mOwnerName(),
|
||||
mIsGroupOwned(false),
|
||||
mLocation()
|
||||
{
|
||||
parseObjectData(pObjectData);
|
||||
}
|
||||
|
||||
LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther)
|
||||
: mUUID(pOther.mUUID),
|
||||
mName(pOther.mName),
|
||||
mDescription(pOther.mDescription),
|
||||
mOwnerUUID(pOther.mOwnerUUID),
|
||||
mHasOwnerName(false),
|
||||
mOwnerName(),
|
||||
mIsGroupOwned(pOther.mIsGroupOwned),
|
||||
mLocation(pOther.mLocation)
|
||||
{
|
||||
fetchOwnerName();
|
||||
}
|
||||
|
||||
LLPathfindingObject::~LLPathfindingObject()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingObject &LLPathfindingObject::operator =(const LLPathfindingObject& pOther)
|
||||
{
|
||||
mUUID = pOther.mUUID;
|
||||
mName = pOther.mName;
|
||||
mDescription = pOther.mDescription;
|
||||
mOwnerUUID = pOther.mOwnerUUID;
|
||||
fetchOwnerName();
|
||||
mIsGroupOwned = pOther.mIsGroupOwned;
|
||||
mLocation = pOther.mLocation;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string LLPathfindingObject::getOwnerName() const
|
||||
{
|
||||
std::string ownerName;
|
||||
|
||||
if (hasOwner())
|
||||
{
|
||||
ownerName = mOwnerName.getCompleteName();
|
||||
}
|
||||
|
||||
return ownerName;
|
||||
}
|
||||
|
||||
void LLPathfindingObject::parseObjectData(const LLSD &pObjectData)
|
||||
{
|
||||
llassert(pObjectData.has(PATHFINDING_OBJECT_NAME_FIELD));
|
||||
llassert(pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).isString());
|
||||
mName = pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).asString();
|
||||
|
||||
llassert(pObjectData.has(PATHFINDING_OBJECT_DESCRIPTION_FIELD));
|
||||
llassert(pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).isString());
|
||||
mDescription = pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).asString();
|
||||
|
||||
llassert(pObjectData.has(PATHFINDING_OBJECT_OWNER_FIELD));
|
||||
llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID());
|
||||
mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID();
|
||||
fetchOwnerName();
|
||||
|
||||
if (pObjectData.has(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD))
|
||||
{
|
||||
llassert(pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).isBoolean());
|
||||
mIsGroupOwned = pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).asBoolean();
|
||||
}
|
||||
|
||||
llassert(pObjectData.has(PATHFINDING_OBJECT_POSITION_FIELD));
|
||||
llassert(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD).isArray());
|
||||
mLocation.setValue(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD));
|
||||
}
|
||||
|
||||
void LLPathfindingObject::fetchOwnerName()
|
||||
{
|
||||
mHasOwnerName = false;
|
||||
if (hasOwner())
|
||||
{
|
||||
mHasOwnerName = LLAvatarNameCache::get(mOwnerUUID, &mOwnerName);
|
||||
if (!mHasOwnerName)
|
||||
{
|
||||
LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName)
|
||||
{
|
||||
llassert(mOwnerUUID == pOwnerUUID);
|
||||
mOwnerName = pAvatarName;
|
||||
mHasOwnerName = true;
|
||||
}
|
||||
80
indra/newview/llpathfindingobject.h
Normal file
80
indra/newview/llpathfindingobject.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @file llpathfindingobject.h
|
||||
* @brief Header file for llpathfindingobject
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGOBJECT_H
|
||||
#define LL_LLPATHFINDINGOBJECT_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "llavatarname.h"
|
||||
#include "lluuid.h"
|
||||
#include "v3math.h"
|
||||
|
||||
class LLPathfindingObject;
|
||||
class LLSD;
|
||||
|
||||
typedef boost::shared_ptr<LLPathfindingObject> LLPathfindingObjectPtr;
|
||||
|
||||
class LLPathfindingObject
|
||||
{
|
||||
public:
|
||||
LLPathfindingObject();
|
||||
LLPathfindingObject(const std::string &pUUID, const LLSD &pObjectData);
|
||||
LLPathfindingObject(const LLPathfindingObject& pOther);
|
||||
virtual ~LLPathfindingObject();
|
||||
|
||||
LLPathfindingObject& operator =(const LLPathfindingObject& 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 BOOL hasOwner() const {return mOwnerUUID.notNull();};
|
||||
inline bool hasOwnerName() const {return mHasOwnerName;};
|
||||
std::string getOwnerName() const;
|
||||
inline BOOL isGroupOwned() const {return mIsGroupOwned;};
|
||||
inline const LLVector3& getLocation() const {return mLocation;};
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
void parseObjectData(const LLSD &pObjectData);
|
||||
|
||||
void fetchOwnerName();
|
||||
void handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName);
|
||||
|
||||
LLUUID mUUID;
|
||||
std::string mName;
|
||||
std::string mDescription;
|
||||
LLUUID mOwnerUUID;
|
||||
bool mHasOwnerName;
|
||||
LLAvatarName mOwnerName;
|
||||
BOOL mIsGroupOwned;
|
||||
LLVector3 mLocation;
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGOBJECT_H
|
||||
112
indra/newview/llpathfindingobjectlist.cpp
Normal file
112
indra/newview/llpathfindingobjectlist.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* @file llpathfindingobjectlist.cpp
|
||||
* @brief Implementation of llpathfindingobjectlist
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llpathfindingobjectlist.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "llpathfindingobject.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLPathfindingObjectList
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
LLPathfindingObjectList::LLPathfindingObjectList()
|
||||
: mObjectMap()
|
||||
{
|
||||
}
|
||||
|
||||
LLPathfindingObjectList::~LLPathfindingObjectList()
|
||||
{
|
||||
}
|
||||
|
||||
bool LLPathfindingObjectList::isEmpty() const
|
||||
{
|
||||
return mObjectMap.empty();
|
||||
}
|
||||
|
||||
void LLPathfindingObjectList::update(LLPathfindingObjectPtr pUpdateObjectPtr)
|
||||
{
|
||||
if (pUpdateObjectPtr != NULL)
|
||||
{
|
||||
std::string updateObjectId = pUpdateObjectPtr->getUUID().asString();
|
||||
|
||||
LLPathfindingObjectMap::iterator foundObjectIter = mObjectMap.find(updateObjectId);
|
||||
if (foundObjectIter == mObjectMap.end())
|
||||
{
|
||||
mObjectMap.insert(std::pair<std::string, LLPathfindingObjectPtr>(updateObjectId, pUpdateObjectPtr));
|
||||
}
|
||||
else
|
||||
{
|
||||
foundObjectIter->second = pUpdateObjectPtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPathfindingObjectList::update(LLPathfindingObjectListPtr pUpdateObjectListPtr)
|
||||
{
|
||||
if ((pUpdateObjectListPtr != NULL) && !pUpdateObjectListPtr->isEmpty())
|
||||
{
|
||||
for (LLPathfindingObjectMap::const_iterator updateObjectIter = pUpdateObjectListPtr->begin();
|
||||
updateObjectIter != pUpdateObjectListPtr->end(); ++updateObjectIter)
|
||||
{
|
||||
const LLPathfindingObjectPtr updateObjectPtr = updateObjectIter->second;
|
||||
update(updateObjectPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLPathfindingObjectPtr LLPathfindingObjectList::find(const std::string &pObjectId) const
|
||||
{
|
||||
LLPathfindingObjectPtr objectPtr;
|
||||
|
||||
LLPathfindingObjectMap::const_iterator objectIter = mObjectMap.find(pObjectId);
|
||||
if (objectIter != mObjectMap.end())
|
||||
{
|
||||
objectPtr = objectIter->second;
|
||||
}
|
||||
|
||||
return objectPtr;
|
||||
}
|
||||
|
||||
LLPathfindingObjectList::const_iterator LLPathfindingObjectList::begin() const
|
||||
{
|
||||
return mObjectMap.begin();
|
||||
}
|
||||
|
||||
LLPathfindingObjectList::const_iterator LLPathfindingObjectList::end() const
|
||||
{
|
||||
return mObjectMap.end();
|
||||
}
|
||||
|
||||
LLPathfindingObjectMap &LLPathfindingObjectList::getObjectMap()
|
||||
{
|
||||
return mObjectMap;
|
||||
}
|
||||
67
indra/newview/llpathfindingobjectlist.h
Normal file
67
indra/newview/llpathfindingobjectlist.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @file llpathfindingobjectlist.h
|
||||
* @brief Header file for llpathfindingobjectlist
|
||||
* @author Stinson@lindenlab.com
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2012, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LL_LLPATHFINDINGOBJECTLIST_H
|
||||
#define LL_LLPATHFINDINGOBJECTLIST_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "llpathfindingobject.h"
|
||||
|
||||
class LLPathfindingObjectList;
|
||||
|
||||
typedef boost::shared_ptr<LLPathfindingObjectList> LLPathfindingObjectListPtr;
|
||||
typedef std::map<std::string, LLPathfindingObjectPtr> LLPathfindingObjectMap;
|
||||
|
||||
class LLPathfindingObjectList
|
||||
{
|
||||
public:
|
||||
LLPathfindingObjectList();
|
||||
virtual ~LLPathfindingObjectList();
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
void update(LLPathfindingObjectPtr pUpdateObjectPtr);
|
||||
void update(LLPathfindingObjectListPtr pUpdateObjectListPtr);
|
||||
|
||||
LLPathfindingObjectPtr find(const std::string &pObjectId) const;
|
||||
|
||||
typedef LLPathfindingObjectMap::const_iterator const_iterator;
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
|
||||
protected:
|
||||
LLPathfindingObjectMap &getObjectMap();
|
||||
|
||||
private:
|
||||
LLPathfindingObjectMap mObjectMap;
|
||||
};
|
||||
|
||||
#endif // LL_LLPATHFINDINGOBJECTLIST_H
|
||||
@@ -221,6 +221,8 @@
|
||||
#include "shfloatermediaticker.h"
|
||||
// </edit>
|
||||
|
||||
#include "llpathfindingmanager.h"
|
||||
|
||||
#include "llavatarnamecache.h"
|
||||
#include "lgghunspell_wrapper.h"
|
||||
|
||||
@@ -2729,6 +2731,10 @@ bool idle_startup()
|
||||
// reset timers now that we are running "logged in" logic
|
||||
LLFastTimer::reset();
|
||||
display_startup();
|
||||
|
||||
llassert(LLPathfindingManager::getInstance() != NULL);
|
||||
LLPathfindingManager::getInstance()->initSystem();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -260,6 +260,7 @@
|
||||
#include "slfloatermediafilter.h"
|
||||
#include "llviewerobjectbackup.h"
|
||||
#include "llagentui.h"
|
||||
#include "llpathfindingmanager.h"
|
||||
|
||||
#include "hippogridmanager.h"
|
||||
|
||||
@@ -2742,6 +2743,16 @@ class LLObjectMeasure : public view_listener_t
|
||||
}
|
||||
};
|
||||
|
||||
bool enable_object_select_in_pathfinding_linksets()
|
||||
{
|
||||
return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetEditableLinksets();
|
||||
}
|
||||
|
||||
bool enable_object_select_in_pathfinding_characters()
|
||||
{
|
||||
return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetViewableCharacters();
|
||||
}
|
||||
|
||||
class LLAvatarAnims : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
@@ -5192,6 +5203,7 @@ class LLToolsSaveToInventory : public view_listener_t
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLToolsSaveToObjectInventory : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
@@ -5206,6 +5218,22 @@ class LLToolsSaveToObjectInventory : public view_listener_t
|
||||
}
|
||||
};
|
||||
|
||||
class LLToolsEnablePathfinding : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion();
|
||||
}
|
||||
};
|
||||
|
||||
class LLToolsEnablePathfindingView : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isPathfindingViewEnabled();
|
||||
}
|
||||
};
|
||||
|
||||
// Round the position of all root objects to the grid
|
||||
class LLToolsSnapObjectXY : public view_listener_t
|
||||
{
|
||||
@@ -9380,6 +9408,9 @@ void initialize_menus()
|
||||
addMenu(new LLToolsEnableTakeCopy(), "Tools.EnableTakeCopy");
|
||||
addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.SaveToObjectInventory");
|
||||
|
||||
addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding");
|
||||
addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView");
|
||||
|
||||
/*addMenu(new LLToolsVisibleBuyObject(), "Tools.VisibleBuyObject");
|
||||
addMenu(new LLToolsVisibleTakeObject(), "Tools.VisibleTakeObject");*/
|
||||
|
||||
|
||||
@@ -1562,8 +1562,10 @@ void LLViewerRegion::unpackRegionHandshake()
|
||||
|
||||
void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
|
||||
{
|
||||
capabilityNames.append("AgentState");
|
||||
//capabilityNames.append("AttachmentResources"); //Script limits (llfloaterscriptlimits.cpp)
|
||||
//capabilityNames.append("AvatarPickerSearch"); //Display name/SLID lookup (llfloateravatarpicker.cpp)
|
||||
capabilityNames.append("CharacterProperties");
|
||||
capabilityNames.append("ChatSessionRequest");
|
||||
capabilityNames.append("CopyInventoryFromNotecard");
|
||||
capabilityNames.append("CreateInventoryCategory");
|
||||
@@ -1596,7 +1598,9 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
|
||||
#if MESH_IMPORT
|
||||
capabilityNames.append("MeshUploadFlag");
|
||||
#endif //MESH_IMPORT
|
||||
capabilityNames.append("NavMeshGenerationStatus");
|
||||
capabilityNames.append("NewFileAgentInventory");
|
||||
capabilityNames.append("ObjectNavMeshProperties");
|
||||
capabilityNames.append("ParcelPropertiesUpdate");
|
||||
capabilityNames.append("ParcelNavigateMedia");
|
||||
capabilityNames.append("ParcelVoiceInfoRequest");
|
||||
@@ -1605,6 +1609,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
|
||||
capabilityNames.append("RemoteParcelRequest");
|
||||
capabilityNames.append("RequestTextureDownload");
|
||||
capabilityNames.append("ResourceCostSelected"); //Unreferenced?
|
||||
capabilityNames.append("RetrieveNavMeshSrc");
|
||||
capabilityNames.append("SearchStatRequest");
|
||||
capabilityNames.append("SearchStatTracking");
|
||||
capabilityNames.append("SendPostcard");
|
||||
@@ -1616,6 +1621,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
|
||||
capabilityNames.append("SetDisplayName");
|
||||
capabilityNames.append("SimConsoleAsync");
|
||||
capabilityNames.append("StartGroupProposal");
|
||||
capabilityNames.append("TerrainNavMeshProperties");
|
||||
capabilityNames.append("TextureStats");
|
||||
capabilityNames.append("UntrustedSimulatorMessage");
|
||||
capabilityNames.append("UpdateAgentInformation");
|
||||
|
||||
@@ -128,6 +128,7 @@
|
||||
#include "llmodaldialog.h"
|
||||
#include "llmorphview.h"
|
||||
#include "llmoveview.h"
|
||||
#include "llpanelpathfindingrebakenavmesh.h"
|
||||
#include "llnotify.h"
|
||||
#include "lloverlaybar.h"
|
||||
#include "llpreviewtexture.h"
|
||||
@@ -1955,6 +1956,10 @@ void LLViewerWindow::initWorldUI()
|
||||
// put behind everything else in the UI
|
||||
mRootView->addChildInBack(gHUDView);
|
||||
}
|
||||
|
||||
LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container");
|
||||
LLPanelPathfindingRebakeNavmesh *panel_rebake_navmesh = LLPanelPathfindingRebakeNavmesh::getInstance();
|
||||
panel_ssf_container->addChild(panel_rebake_navmesh);
|
||||
}
|
||||
|
||||
// initWorldUI that wasn't before logging in. Some of this may require the access the 'LindenUserDir'.
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<panel
|
||||
height="25"
|
||||
layout="topleft"
|
||||
name="panel_navmesh_rebake"
|
||||
mouse_opaque="false"
|
||||
visible="true"
|
||||
follows="none"
|
||||
width="133">
|
||||
<button
|
||||
follows="none"
|
||||
height="20"
|
||||
label="Rebake region"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="navmesh_btn"
|
||||
tool_tip="Click to rebake the region's navmesh."
|
||||
bottom="-25"
|
||||
visible="false"
|
||||
enabled="true"
|
||||
width="120" />
|
||||
<button
|
||||
follows="none"
|
||||
height="20"
|
||||
label="Requesting rebake"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="navmesh_btn_sending"
|
||||
tool_tip="Sending rebake request to the server."
|
||||
bottom="-25"
|
||||
visible="false"
|
||||
enabled="false"
|
||||
width="120" />
|
||||
<button
|
||||
follows="left|bottom"
|
||||
height="20"
|
||||
label="Region is rebaking"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="navmesh_btn_baking"
|
||||
tool_tip="Region is being rebaked. When completed, this button will disappear."
|
||||
bottom="-25"
|
||||
visible="false"
|
||||
enabled="false"
|
||||
width="120" />
|
||||
</panel>
|
||||
@@ -14,8 +14,8 @@
|
||||
name="padding" use_bounding_rect="true" user_resize="false" width="420" />
|
||||
<layout_panel auto_resize="false" bottom="0" follows="left|bottom|right|top" height="20"
|
||||
left="0" min_height="20" min_width="100" mouse_opaque="false"
|
||||
name="state_buttons" use_bounding_rect="true" user_resize="false"
|
||||
width="420">
|
||||
name="state_management_buttons_container" use_bounding_rect="true" user_resize="false"
|
||||
width="799">
|
||||
<button bottom="1" follows="left|bottom" font="SansSerif" halign="center" height="20"
|
||||
label="New IM" label_selected="New IM" left="0"
|
||||
name="New IM" scale_image="true"
|
||||
@@ -25,7 +25,7 @@
|
||||
label="Set Not Busy" label_selected="Set Not Busy" left="114"
|
||||
name="Set Not Busy" scale_image="true"
|
||||
tool_tip="Chat and IM is hidden for you. Click here to set yourself not busy."
|
||||
width="102" />
|
||||
width="112" />
|
||||
<button bottom="1" follows="left|bottom" font="SansSerif" halign="center" height="20"
|
||||
label="Flycam" label_selected="Flycam" left="229" name="Flycam" scale_image="true"
|
||||
tool_tip="Your camera is under joystick control, click here to release it."
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<layout_panel min_width="410" name="main_panel" width="410">
|
||||
<layout_stack name="chatbar_and_buttons" right="410">
|
||||
<layout_panel name="padding" width="410"/>
|
||||
<layout_panel name="state_buttons" width="410">
|
||||
<layout_panel name="state_management_buttons_container" width="410">
|
||||
|
||||
<button label="Disponible" label_selected="Disponible" name="Set Not Busy" tool_tip="Le chat et les IM ne s'affichent pas. Cliquez ici pour ne plus être en mode occupé(e)."/>
|
||||
<button label="Flycam" label_selected="Flycam" name="Flycam" tool_tip="Votre caméra est contrôlée par le joystick, cliquez ici pour la libérer."/>
|
||||
|
||||
Reference in New Issue
Block a user