Removing windows line endings from .h and .cpp files.

master
Todd Stinson 2012-04-25 13:04:13 -07:00
parent b8c63d8848
commit cbebd682f7
21 changed files with 7804 additions and 7804 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +1,75 @@
/**
* @file object_flags.h
* @brief Flags for object creation and transmission
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_OBJECT_FLAGS_H
#define LL_OBJECT_FLAGS_H
// downstream flags from sim->viewer
const U32 FLAGS_USE_PHYSICS = (1U << 0);
const U32 FLAGS_CREATE_SELECTED = (1U << 1);
const U32 FLAGS_OBJECT_MODIFY = (1U << 2);
const U32 FLAGS_OBJECT_COPY = (1U << 3);
const U32 FLAGS_OBJECT_ANY_OWNER = (1U << 4);
const U32 FLAGS_OBJECT_YOU_OWNER = (1U << 5);
const U32 FLAGS_SCRIPTED = (1U << 6);
const U32 FLAGS_HANDLE_TOUCH = (1U << 7);
const U32 FLAGS_OBJECT_MOVE = (1U << 8);
const U32 FLAGS_TAKES_MONEY = (1U << 9);
const U32 FLAGS_PHANTOM = (1U << 10);
const U32 FLAGS_INVENTORY_EMPTY = (1U << 11);
const U32 FLAGS_OBJECT_PERMANENT = (1U << 12);
const U32 FLAGS_CHARACTER = (1U << 13);
//const U32 FLAGS_UNUSED_000 = (1U << 14); // was FLAGS_JOINT_LP2P
const U32 FLAGS_INCLUDE_IN_SEARCH = (1U << 15);
const U32 FLAGS_ALLOW_INVENTORY_DROP = (1U << 16);
const U32 FLAGS_OBJECT_TRANSFER = (1U << 17);
const U32 FLAGS_OBJECT_GROUP_OWNED = (1U << 18);
//const U32 FLAGS_UNUSED_001 = (1U << 19); // was FLAGS_OBJECT_YOU_OFFICER
const U32 FLAGS_CAMERA_DECOUPLED = (1U << 20);
const U32 FLAGS_ANIM_SOURCE = (1U << 21);
const U32 FLAGS_CAMERA_SOURCE = (1U << 22);
//const U32 FLAGS_UNUSED_002 = (1U << 23); // was FLAGS_CAST_SHADOWS
//const U32 FLAGS_UNUSED_003 = (1U << 24);
//const U32 FLAGS_UNUSED_004 = (1U << 25);
//const U32 FLAGS_UNUSED_005 = (1U << 26);
//const U32 FLAGS_UNUSED_006 = (1U << 27);
const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28);
const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29);
//const U32 FLAGS_UNUSED_007 = (1U << 30); // was FLAGS_TEMPORARY
//const U32 FLAGS_UNUSED_008 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED
const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE;
typedef enum e_havok_joint_type
{
HJT_INVALID = 0,
HJT_HINGE = 1,
HJT_POINT = 2,
// HJT_LPOINT = 3,
// HJT_WHEEL = 4,
HJT_EOF = 3
} EHavokJointType;
#endif
/**
* @file object_flags.h
* @brief Flags for object creation and transmission
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_OBJECT_FLAGS_H
#define LL_OBJECT_FLAGS_H
// downstream flags from sim->viewer
const U32 FLAGS_USE_PHYSICS = (1U << 0);
const U32 FLAGS_CREATE_SELECTED = (1U << 1);
const U32 FLAGS_OBJECT_MODIFY = (1U << 2);
const U32 FLAGS_OBJECT_COPY = (1U << 3);
const U32 FLAGS_OBJECT_ANY_OWNER = (1U << 4);
const U32 FLAGS_OBJECT_YOU_OWNER = (1U << 5);
const U32 FLAGS_SCRIPTED = (1U << 6);
const U32 FLAGS_HANDLE_TOUCH = (1U << 7);
const U32 FLAGS_OBJECT_MOVE = (1U << 8);
const U32 FLAGS_TAKES_MONEY = (1U << 9);
const U32 FLAGS_PHANTOM = (1U << 10);
const U32 FLAGS_INVENTORY_EMPTY = (1U << 11);
const U32 FLAGS_OBJECT_PERMANENT = (1U << 12);
const U32 FLAGS_CHARACTER = (1U << 13);
//const U32 FLAGS_UNUSED_000 = (1U << 14); // was FLAGS_JOINT_LP2P
const U32 FLAGS_INCLUDE_IN_SEARCH = (1U << 15);
const U32 FLAGS_ALLOW_INVENTORY_DROP = (1U << 16);
const U32 FLAGS_OBJECT_TRANSFER = (1U << 17);
const U32 FLAGS_OBJECT_GROUP_OWNED = (1U << 18);
//const U32 FLAGS_UNUSED_001 = (1U << 19); // was FLAGS_OBJECT_YOU_OFFICER
const U32 FLAGS_CAMERA_DECOUPLED = (1U << 20);
const U32 FLAGS_ANIM_SOURCE = (1U << 21);
const U32 FLAGS_CAMERA_SOURCE = (1U << 22);
//const U32 FLAGS_UNUSED_002 = (1U << 23); // was FLAGS_CAST_SHADOWS
//const U32 FLAGS_UNUSED_003 = (1U << 24);
//const U32 FLAGS_UNUSED_004 = (1U << 25);
//const U32 FLAGS_UNUSED_005 = (1U << 26);
//const U32 FLAGS_UNUSED_006 = (1U << 27);
const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28);
const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29);
//const U32 FLAGS_UNUSED_007 = (1U << 30); // was FLAGS_TEMPORARY
//const U32 FLAGS_UNUSED_008 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED
const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE;
typedef enum e_havok_joint_type
{
HJT_INVALID = 0,
HJT_HINGE = 1,
HJT_POINT = 2,
// HJT_LPOINT = 3,
// HJT_WHEEL = 4,
HJT_EOF = 3
} EHavokJointType;
#endif

View File

@ -1,167 +1,167 @@
/**
* @file llfloaterpathfindingbasic.cpp
* @author William Todd Stinson
* @brief "Pathfinding basic" floater, allowing for basic freezing and unfreezing of the pathfinding avatar mode.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaterpathfindingbasic.h"
#include "llsd.h"
#include "lltextbase.h"
#include "llbutton.h"
#include "llpathfindingmanager.h"
#include <boost/bind.hpp>
//---------------------------------------------------------------------------
// LLFloaterPathfindingBasic
//---------------------------------------------------------------------------
BOOL LLFloaterPathfindingBasic::postBuild()
{
mStatusText = findChild<LLTextBase>("status_label");
llassert(mStatusText != NULL);
mUnfreezeLabel = findChild<LLTextBase>("unfreeze_label");
llassert(mUnfreezeLabel != NULL);
mUnfreezeButton = findChild<LLButton>("enter_unfrozen_mode");
llassert(mUnfreezeButton != NULL);
mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onUnfreezeClicked, this));
mFreezeLabel = findChild<LLTextBase>("freeze_label");
llassert(mFreezeLabel != NULL);
mFreezeButton = findChild<LLButton>("enter_frozen_mode");
llassert(mFreezeButton != NULL);
mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onFreezeClicked, this));
return LLFloater::postBuild();
}
void LLFloaterPathfindingBasic::onOpen(const LLSD& pKey)
{
LLFloater::onOpen(pKey);
if (!mAgentStateSlot.connected())
{
mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingBasic::onAgentStateCB, this, _1));
}
setAgentState(LLPathfindingManager::getInstance()->getAgentState());
}
void LLFloaterPathfindingBasic::onClose(bool pIsAppQuitting)
{
if (mAgentStateSlot.connected())
{
mAgentStateSlot.disconnect();
}
LLFloater::onClose(pIsAppQuitting);
}
LLFloaterPathfindingBasic::LLFloaterPathfindingBasic(const LLSD& pSeed)
: LLFloater(pSeed),
mStatusText(NULL),
mUnfreezeLabel(NULL),
mUnfreezeButton(NULL),
mFreezeLabel(NULL),
mFreezeButton(NULL),
mAgentStateSlot()
{
}
LLFloaterPathfindingBasic::~LLFloaterPathfindingBasic()
{
}
void LLFloaterPathfindingBasic::onUnfreezeClicked()
{
mUnfreezeButton->setEnabled(FALSE);
LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen);
}
void LLFloaterPathfindingBasic::onFreezeClicked()
{
mUnfreezeButton->setEnabled(FALSE);
LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen);
}
void LLFloaterPathfindingBasic::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState)
{
setAgentState(pAgentState);
}
void LLFloaterPathfindingBasic::setAgentState(LLPathfindingManager::EAgentState pAgentState)
{
static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor");
LLStyle::Params styleParams;
switch (pAgentState)
{
case LLPathfindingManager::kAgentStateUnknown :
mStatusText->setVisible(TRUE);
mStatusText->setText((LLStringExplicit)getString("status_querying_state"), styleParams);
break;
case LLPathfindingManager::kAgentStateNotEnabled :
mStatusText->setVisible(TRUE);
styleParams.color = errorColor;
mStatusText->setText((LLStringExplicit)getString("status_pathfinding_not_enabled"), styleParams);
break;
case LLPathfindingManager::kAgentStateError :
mStatusText->setVisible(TRUE);
styleParams.color = errorColor;
mStatusText->setText((LLStringExplicit)getString("status_unable_to_change_state"), styleParams);
break;
default :
mStatusText->setVisible(FALSE);
break;
}
switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState())
{
case LLPathfindingManager::kAgentStateUnknown :
case LLPathfindingManager::kAgentStateNotEnabled :
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mFreezeLabel->setEnabled(FALSE);
mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateFrozen :
mUnfreezeLabel->setEnabled(TRUE);
mUnfreezeButton->setEnabled(TRUE);
mFreezeLabel->setEnabled(FALSE);
mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateUnfrozen :
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mFreezeLabel->setEnabled(TRUE);
mFreezeButton->setEnabled(TRUE);
break;
default :
llassert(0);
break;
}
}
/**
* @file llfloaterpathfindingbasic.cpp
* @author William Todd Stinson
* @brief "Pathfinding basic" floater, allowing for basic freezing and unfreezing of the pathfinding avatar mode.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaterpathfindingbasic.h"
#include "llsd.h"
#include "lltextbase.h"
#include "llbutton.h"
#include "llpathfindingmanager.h"
#include <boost/bind.hpp>
//---------------------------------------------------------------------------
// LLFloaterPathfindingBasic
//---------------------------------------------------------------------------
BOOL LLFloaterPathfindingBasic::postBuild()
{
mStatusText = findChild<LLTextBase>("status_label");
llassert(mStatusText != NULL);
mUnfreezeLabel = findChild<LLTextBase>("unfreeze_label");
llassert(mUnfreezeLabel != NULL);
mUnfreezeButton = findChild<LLButton>("enter_unfrozen_mode");
llassert(mUnfreezeButton != NULL);
mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onUnfreezeClicked, this));
mFreezeLabel = findChild<LLTextBase>("freeze_label");
llassert(mFreezeLabel != NULL);
mFreezeButton = findChild<LLButton>("enter_frozen_mode");
llassert(mFreezeButton != NULL);
mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onFreezeClicked, this));
return LLFloater::postBuild();
}
void LLFloaterPathfindingBasic::onOpen(const LLSD& pKey)
{
LLFloater::onOpen(pKey);
if (!mAgentStateSlot.connected())
{
mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingBasic::onAgentStateCB, this, _1));
}
setAgentState(LLPathfindingManager::getInstance()->getAgentState());
}
void LLFloaterPathfindingBasic::onClose(bool pIsAppQuitting)
{
if (mAgentStateSlot.connected())
{
mAgentStateSlot.disconnect();
}
LLFloater::onClose(pIsAppQuitting);
}
LLFloaterPathfindingBasic::LLFloaterPathfindingBasic(const LLSD& pSeed)
: LLFloater(pSeed),
mStatusText(NULL),
mUnfreezeLabel(NULL),
mUnfreezeButton(NULL),
mFreezeLabel(NULL),
mFreezeButton(NULL),
mAgentStateSlot()
{
}
LLFloaterPathfindingBasic::~LLFloaterPathfindingBasic()
{
}
void LLFloaterPathfindingBasic::onUnfreezeClicked()
{
mUnfreezeButton->setEnabled(FALSE);
LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen);
}
void LLFloaterPathfindingBasic::onFreezeClicked()
{
mUnfreezeButton->setEnabled(FALSE);
LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen);
}
void LLFloaterPathfindingBasic::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState)
{
setAgentState(pAgentState);
}
void LLFloaterPathfindingBasic::setAgentState(LLPathfindingManager::EAgentState pAgentState)
{
static const LLColor4 errorColor = LLUIColorTable::instance().getColor("PathfindingErrorColor");
LLStyle::Params styleParams;
switch (pAgentState)
{
case LLPathfindingManager::kAgentStateUnknown :
mStatusText->setVisible(TRUE);
mStatusText->setText((LLStringExplicit)getString("status_querying_state"), styleParams);
break;
case LLPathfindingManager::kAgentStateNotEnabled :
mStatusText->setVisible(TRUE);
styleParams.color = errorColor;
mStatusText->setText((LLStringExplicit)getString("status_pathfinding_not_enabled"), styleParams);
break;
case LLPathfindingManager::kAgentStateError :
mStatusText->setVisible(TRUE);
styleParams.color = errorColor;
mStatusText->setText((LLStringExplicit)getString("status_unable_to_change_state"), styleParams);
break;
default :
mStatusText->setVisible(FALSE);
break;
}
switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState())
{
case LLPathfindingManager::kAgentStateUnknown :
case LLPathfindingManager::kAgentStateNotEnabled :
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mFreezeLabel->setEnabled(FALSE);
mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateFrozen :
mUnfreezeLabel->setEnabled(TRUE);
mUnfreezeButton->setEnabled(TRUE);
mFreezeLabel->setEnabled(FALSE);
mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateUnfrozen :
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mFreezeLabel->setEnabled(TRUE);
mFreezeButton->setEnabled(TRUE);
break;
default :
llassert(0);
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,128 +1,128 @@
/**
* @file llfloaterpathfindingcharacters.h
* @author William Todd Stinson
* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERPATHFINDINGCHARACTERS_H
#define LL_LLFLOATERPATHFINDINGCHARACTERS_H
#include <string>
#include <map>
#include "llfloater.h"
#include "llpathfindingcharacter.h"
#include "llpathfindingcharacterlist.h"
#include "llpathfindingmanager.h"
#include "llselectmgr.h"
#include <boost/signals2.hpp>
class LLSD;
class LLTextBase;
class LLScrollListCtrl;
class LLCheckBoxCtrl;
class LLRadioGroup;
class LLButton;
class LLFloaterPathfindingCharacters
: public LLFloater
{
friend class LLFloaterReg;
public:
typedef enum
{
kMessagingUnknown,
kMessagingGetRequestSent,
kMessagingGetError,
kMessagingComplete,
kMessagingNotEnabled
} EMessagingState;
virtual BOOL postBuild();
virtual void onOpen(const LLSD& pKey);
virtual void onClose(bool pAppQuitting);
virtual void draw();
static void openCharactersViewer();
protected:
private:
LLScrollListCtrl *mCharactersScrollList;
LLTextBase *mCharactersStatus;
LLButton *mRefreshListButton;
LLButton *mSelectAllButton;
LLButton *mSelectNoneButton;
LLCheckBoxCtrl *mShowBeaconCheckBox;
LLButton *mTakeButton;
LLButton *mTakeCopyButton;
LLButton *mReturnButton;
LLButton *mDeleteButton;
LLButton *mTeleportButton;
EMessagingState mMessagingState;
LLPathfindingManager::request_id_t mMessagingRequestId;
LLPathfindingCharacterListPtr mCharacterListPtr;
LLObjectSelectionHandle mCharacterSelection;
boost::signals2::connection mSelectionUpdateSlot;
boost::signals2::connection mRegionBoundarySlot;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
LLFloaterPathfindingCharacters(const LLSD& pSeed);
virtual ~LLFloaterPathfindingCharacters();
EMessagingState getMessagingState() const;
void setMessagingState(EMessagingState pMessagingState);
void requestGetCharacters();
void handleNewCharacters(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pCharacterRequestStatus, LLPathfindingCharacterListPtr pCharacterListPtr);
void onCharactersSelectionChange();
void onRefreshCharactersClicked();
void onSelectAllCharactersClicked();
void onSelectNoneCharactersClicked();
void onTakeCharactersClicked();
void onTakeCopyCharactersClicked();
void onReturnCharactersClicked();
void onDeleteCharactersClicked();
void onTeleportCharacterToMeClicked();
void onRegionBoundaryCross();
void selectAllCharacters();
void selectNoneCharacters();
void clearCharacters();
void updateControls();
void updateScrollList();
LLSD buildCharacterScrollListElement(const LLPathfindingCharacterPtr pCharacterPtr) const;
void updateStatusMessage();
void updateEnableStateOnListActions();
void updateEnableStateOnEditFields();
};
#endif // LL_LLFLOATERPATHFINDINGCHARACTERS_H
/**
* @file llfloaterpathfindingcharacters.h
* @author William Todd Stinson
* @brief "Pathfinding characters" floater, allowing for identification of pathfinding characters and their cpu usage.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERPATHFINDINGCHARACTERS_H
#define LL_LLFLOATERPATHFINDINGCHARACTERS_H
#include <string>
#include <map>
#include "llfloater.h"
#include "llpathfindingcharacter.h"
#include "llpathfindingcharacterlist.h"
#include "llpathfindingmanager.h"
#include "llselectmgr.h"
#include <boost/signals2.hpp>
class LLSD;
class LLTextBase;
class LLScrollListCtrl;
class LLCheckBoxCtrl;
class LLRadioGroup;
class LLButton;
class LLFloaterPathfindingCharacters
: public LLFloater
{
friend class LLFloaterReg;
public:
typedef enum
{
kMessagingUnknown,
kMessagingGetRequestSent,
kMessagingGetError,
kMessagingComplete,
kMessagingNotEnabled
} EMessagingState;
virtual BOOL postBuild();
virtual void onOpen(const LLSD& pKey);
virtual void onClose(bool pAppQuitting);
virtual void draw();
static void openCharactersViewer();
protected:
private:
LLScrollListCtrl *mCharactersScrollList;
LLTextBase *mCharactersStatus;
LLButton *mRefreshListButton;
LLButton *mSelectAllButton;
LLButton *mSelectNoneButton;
LLCheckBoxCtrl *mShowBeaconCheckBox;
LLButton *mTakeButton;
LLButton *mTakeCopyButton;
LLButton *mReturnButton;
LLButton *mDeleteButton;
LLButton *mTeleportButton;
EMessagingState mMessagingState;
LLPathfindingManager::request_id_t mMessagingRequestId;
LLPathfindingCharacterListPtr mCharacterListPtr;
LLObjectSelectionHandle mCharacterSelection;
boost::signals2::connection mSelectionUpdateSlot;
boost::signals2::connection mRegionBoundarySlot;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
LLFloaterPathfindingCharacters(const LLSD& pSeed);
virtual ~LLFloaterPathfindingCharacters();
EMessagingState getMessagingState() const;
void setMessagingState(EMessagingState pMessagingState);
void requestGetCharacters();
void handleNewCharacters(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pCharacterRequestStatus, LLPathfindingCharacterListPtr pCharacterListPtr);
void onCharactersSelectionChange();
void onRefreshCharactersClicked();
void onSelectAllCharactersClicked();
void onSelectNoneCharactersClicked();
void onTakeCharactersClicked();
void onTakeCopyCharactersClicked();
void onReturnCharactersClicked();
void onDeleteCharactersClicked();
void onTeleportCharacterToMeClicked();
void onRegionBoundaryCross();
void selectAllCharacters();
void selectNoneCharacters();
void clearCharacters();
void updateControls();
void updateScrollList();
LLSD buildCharacterScrollListElement(const LLPathfindingCharacterPtr pCharacterPtr) const;
void updateStatusMessage();
void updateEnableStateOnListActions();
void updateEnableStateOnEditFields();
};
#endif // LL_LLFLOATERPATHFINDINGCHARACTERS_H

File diff suppressed because it is too large Load Diff

View File

@ -1,184 +1,184 @@
/**
* @file llfloaterpathfindinglinksets.h
* @author William Todd Stinson
* @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERPATHFINDINGLINKSETS_H
#define LL_LLFLOATERPATHFINDINGLINKSETS_H
#include "llfloater.h"
#include "lluuid.h"
#include "llselectmgr.h"
#include "llpathfindinglinkset.h"
#include "llpathfindinglinksetlist.h"
#include "llpathfindingmanager.h"
#include <boost/signals2.hpp>
class LLSD;
class LLUICtrl;
class LLTextBase;
class LLScrollListCtrl;
class LLScrollListItem;
class LLLineEditor;
class LLComboBox;
class LLCheckBoxCtrl;
class LLButton;
class LLFloaterPathfindingLinksets
: public LLFloater
{
friend class LLFloaterReg;
public:
typedef enum
{
kMessagingUnknown,
kMessagingGetRequestSent,
kMessagingGetError,
kMessagingSetRequestSent,
kMessagingSetError,
kMessagingComplete,
kMessagingNotEnabled
} EMessagingState;
virtual BOOL postBuild();
virtual void onOpen(const LLSD& pKey);
virtual void onClose(bool pAppQuitting);
virtual void draw();
static void openLinksetsEditor();
protected:
private:
LLLineEditor *mFilterByName;
LLLineEditor *mFilterByDescription;
LLComboBox *mFilterByLinksetUse;
LLScrollListCtrl *mLinksetsScrollList;
LLTextBase *mLinksetsStatus;
LLButton *mRefreshListButton;
LLButton *mSelectAllButton;
LLButton *mSelectNoneButton;
LLCheckBoxCtrl *mShowBeaconCheckBox;
LLButton *mTakeButton;
LLButton *mTakeCopyButton;
LLButton *mReturnButton;
LLButton *mDeleteButton;
LLButton *mTeleportButton;
LLComboBox *mEditLinksetUse;
LLScrollListItem *mEditLinksetUseUnset;
LLScrollListItem *mEditLinksetUseWalkable;
LLScrollListItem *mEditLinksetUseStaticObstacle;
LLScrollListItem *mEditLinksetUseDynamicObstacle;
LLScrollListItem *mEditLinksetUseMaterialVolume;
LLScrollListItem *mEditLinksetUseExclusionVolume;
LLScrollListItem *mEditLinksetUseDynamicPhantom;
LLTextBase *mLabelWalkabilityCoefficients;
LLTextBase *mLabelEditA;
LLLineEditor *mEditA;
LLTextBase *mLabelEditB;
LLLineEditor *mEditB;
LLTextBase *mLabelEditC;
LLLineEditor *mEditC;
LLTextBase *mLabelEditD;
LLLineEditor *mEditD;
LLButton *mApplyEditsButton;
EMessagingState mMessagingState;
LLPathfindingManager::request_id_t mMessagingRequestId;
LLPathfindingLinksetListPtr mLinksetsListPtr;
LLObjectSelectionHandle mLinksetsSelection;
LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
boost::signals2::connection mSelectionUpdateSlot;
boost::signals2::connection mRegionBoundarySlot;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
LLFloaterPathfindingLinksets(const LLSD& pSeed);
virtual ~LLFloaterPathfindingLinksets();
EMessagingState getMessagingState() const;
void setMessagingState(EMessagingState pMessagingState);
void requestGetLinksets();
void requestSetLinksets(LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD);
void handleNewLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr);
void handleUpdateLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr);
void onApplyAllFilters();
void onClearFiltersClicked();
void onLinksetsSelectionChange();
void onRefreshLinksetsClicked();
void onSelectAllLinksetsClicked();
void onSelectNoneLinksetsClicked();
void onTakeClicked();
void onTakeCopyClicked();
void onReturnClicked();
void onDeleteClicked();
void onTeleportClicked();
void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl);
void onApplyChangesClicked();
void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState);
void onRegionBoundaryCross();
void applyFilters();
void clearFilters();
void selectAllLinksets();
void selectNoneLinksets();
void clearLinksets();
void updateControls();
void updateEditFieldValues();
void updateScrollList();
LLSD buildLinksetScrollListElement(const LLPathfindingLinksetPtr pLinksetPtr, const LLVector3 &pAvatarPosition) const;
LLSD buildLinksetUseScrollListElement(const std::string &label, S32 value) const;
bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse linksetUse) const;
bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse linksetUse) const;
void updateStatusMessage();
void updateEnableStateOnListActions();
void updateEnableStateOnEditFields();
void updateEnableStateOnEditLinksetUse();
void applyEdit();
void handleApplyEdit(const LLSD &pNotification, const LLSD &pResponse);
void doApplyEdit();
std::string getLinksetUseString(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
LLPathfindingLinkset::ELinksetUse getFilterLinksetUse() const;
void setFilterLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
LLPathfindingLinkset::ELinksetUse getEditLinksetUse() const;
void setEditLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const;
LLSD convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
};
#endif // LL_LLFLOATERPATHFINDINGLINKSETS_H
/**
* @file llfloaterpathfindinglinksets.h
* @author William Todd Stinson
* @brief "Pathfinding linksets" floater, allowing manipulation of the Havok AI pathfinding settings.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATERPATHFINDINGLINKSETS_H
#define LL_LLFLOATERPATHFINDINGLINKSETS_H
#include "llfloater.h"
#include "lluuid.h"
#include "llselectmgr.h"
#include "llpathfindinglinkset.h"
#include "llpathfindinglinksetlist.h"
#include "llpathfindingmanager.h"
#include <boost/signals2.hpp>
class LLSD;
class LLUICtrl;
class LLTextBase;
class LLScrollListCtrl;
class LLScrollListItem;
class LLLineEditor;
class LLComboBox;
class LLCheckBoxCtrl;
class LLButton;
class LLFloaterPathfindingLinksets
: public LLFloater
{
friend class LLFloaterReg;
public:
typedef enum
{
kMessagingUnknown,
kMessagingGetRequestSent,
kMessagingGetError,
kMessagingSetRequestSent,
kMessagingSetError,
kMessagingComplete,
kMessagingNotEnabled
} EMessagingState;
virtual BOOL postBuild();
virtual void onOpen(const LLSD& pKey);
virtual void onClose(bool pAppQuitting);
virtual void draw();
static void openLinksetsEditor();
protected:
private:
LLLineEditor *mFilterByName;
LLLineEditor *mFilterByDescription;
LLComboBox *mFilterByLinksetUse;
LLScrollListCtrl *mLinksetsScrollList;
LLTextBase *mLinksetsStatus;
LLButton *mRefreshListButton;
LLButton *mSelectAllButton;
LLButton *mSelectNoneButton;
LLCheckBoxCtrl *mShowBeaconCheckBox;
LLButton *mTakeButton;
LLButton *mTakeCopyButton;
LLButton *mReturnButton;
LLButton *mDeleteButton;
LLButton *mTeleportButton;
LLComboBox *mEditLinksetUse;
LLScrollListItem *mEditLinksetUseUnset;
LLScrollListItem *mEditLinksetUseWalkable;
LLScrollListItem *mEditLinksetUseStaticObstacle;
LLScrollListItem *mEditLinksetUseDynamicObstacle;
LLScrollListItem *mEditLinksetUseMaterialVolume;
LLScrollListItem *mEditLinksetUseExclusionVolume;
LLScrollListItem *mEditLinksetUseDynamicPhantom;
LLTextBase *mLabelWalkabilityCoefficients;
LLTextBase *mLabelEditA;
LLLineEditor *mEditA;
LLTextBase *mLabelEditB;
LLLineEditor *mEditB;
LLTextBase *mLabelEditC;
LLLineEditor *mEditC;
LLTextBase *mLabelEditD;
LLLineEditor *mEditD;
LLButton *mApplyEditsButton;
EMessagingState mMessagingState;
LLPathfindingManager::request_id_t mMessagingRequestId;
LLPathfindingLinksetListPtr mLinksetsListPtr;
LLObjectSelectionHandle mLinksetsSelection;
LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
boost::signals2::connection mSelectionUpdateSlot;
boost::signals2::connection mRegionBoundarySlot;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
LLFloaterPathfindingLinksets(const LLSD& pSeed);
virtual ~LLFloaterPathfindingLinksets();
EMessagingState getMessagingState() const;
void setMessagingState(EMessagingState pMessagingState);
void requestGetLinksets();
void requestSetLinksets(LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD);
void handleNewLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr);
void handleUpdateLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr);
void onApplyAllFilters();
void onClearFiltersClicked();
void onLinksetsSelectionChange();
void onRefreshLinksetsClicked();
void onSelectAllLinksetsClicked();
void onSelectNoneLinksetsClicked();
void onTakeClicked();
void onTakeCopyClicked();
void onReturnClicked();
void onDeleteClicked();
void onTeleportClicked();
void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl);
void onApplyChangesClicked();
void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState);
void onRegionBoundaryCross();
void applyFilters();
void clearFilters();
void selectAllLinksets();
void selectNoneLinksets();
void clearLinksets();
void updateControls();
void updateEditFieldValues();
void updateScrollList();
LLSD buildLinksetScrollListElement(const LLPathfindingLinksetPtr pLinksetPtr, const LLVector3 &pAvatarPosition) const;
LLSD buildLinksetUseScrollListElement(const std::string &label, S32 value) const;
bool isShowUnmodifiablePhantomWarning(LLPathfindingLinkset::ELinksetUse linksetUse) const;
bool isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse linksetUse) const;
void updateStatusMessage();
void updateEnableStateOnListActions();
void updateEnableStateOnEditFields();
void updateEnableStateOnEditLinksetUse();
void applyEdit();
void handleApplyEdit(const LLSD &pNotification, const LLSD &pResponse);
void doApplyEdit();
std::string getLinksetUseString(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
LLPathfindingLinkset::ELinksetUse getFilterLinksetUse() const;
void setFilterLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
LLPathfindingLinkset::ELinksetUse getEditLinksetUse() const;
void setEditLinksetUse(LLPathfindingLinkset::ELinksetUse pLinksetUse);
LLPathfindingLinkset::ELinksetUse convertToLinksetUse(LLSD pXuiValue) const;
LLSD convertToXuiValue(LLPathfindingLinkset::ELinksetUse pLinksetUse) const;
};
#endif // LL_LLFLOATERPATHFINDINGLINKSETS_H

View File

@ -890,12 +890,12 @@ void LLPanelVolume::onCommitIsFlexible(LLUICtrl *, void*)
void LLPanelVolume::handleResponseChangeToFlexible(const LLSD &pNotification, const LLSD &pResponse)
{
if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
{
sendIsFlexible();
}
else
{
getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(FALSE);
}
if (LLNotificationsUtil::getSelectedOption(pNotification, pResponse) == 0)
{
sendIsFlexible();
}
else
{
getChild<LLUICtrl>("Flexible1D Checkbox Ctrl")->setValue(FALSE);
}
}

View File

@ -1,103 +1,103 @@
/**
* @file llpathfindingcharacter.cpp
* @author William Todd Stinson
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llpathfindingcharacter.h"
#include "llsd.h"
#include "v3math.h"
#include "lluuid.h"
#include "llavatarname.h"
#include "llavatarnamecache.h"
#define CHARACTER_NAME_FIELD "name"
#define CHARACTER_DESCRIPTION_FIELD "description"
#define CHARACTER_OWNER_FIELD "owner"
#define CHARACTER_CPU_TIME_FIELD "cpu_time"
#define CHARACTER_POSITION_FIELD "position"
//---------------------------------------------------------------------------
// LLPathfindingCharacter
//---------------------------------------------------------------------------
LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const LLSD& pCharacterItem)
: mUUID(pUUID),
mName(),
mDescription(),
mOwnerUUID(),
mOwnerName(),
mCPUTime(0U),
mLocation(LLVector3::zero)
{
llassert(pCharacterItem.has(CHARACTER_NAME_FIELD));
llassert(pCharacterItem.get(CHARACTER_NAME_FIELD).isString());
mName = pCharacterItem.get(CHARACTER_NAME_FIELD).asString();
llassert(pCharacterItem.has(CHARACTER_DESCRIPTION_FIELD));
llassert(pCharacterItem.get(CHARACTER_DESCRIPTION_FIELD).isString());
mDescription = pCharacterItem.get(CHARACTER_DESCRIPTION_FIELD).asString();
llassert(pCharacterItem.has(CHARACTER_OWNER_FIELD));
llassert(pCharacterItem.get(CHARACTER_OWNER_FIELD).isUUID());
mOwnerUUID = pCharacterItem.get(CHARACTER_OWNER_FIELD).asUUID();
LLAvatarNameCache::get(mOwnerUUID, &mOwnerName);
llassert(pCharacterItem.has(CHARACTER_CPU_TIME_FIELD));
llassert(pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).isReal());
mCPUTime = pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).asReal();
llassert(pCharacterItem.has(CHARACTER_POSITION_FIELD));
llassert(pCharacterItem.get(CHARACTER_POSITION_FIELD).isArray());
mLocation.setValue(pCharacterItem.get(CHARACTER_POSITION_FIELD));
}
LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOther)
: mUUID(pOther.mUUID),
mName(pOther.mName),
mDescription(pOther.mDescription),
mOwnerUUID(pOther.mOwnerUUID),
mOwnerName(pOther.mOwnerName),
mCPUTime(pOther.mCPUTime),
mLocation(pOther.mLocation)
{
}
LLPathfindingCharacter::~LLPathfindingCharacter()
{
}
LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCharacter& pOther)
{
mUUID = pOther.mUUID;
mName = pOther.mName;
mDescription = pOther.mDescription;
mOwnerUUID = pOther.mOwnerUUID;
mOwnerName = pOther.mOwnerName;
mCPUTime = pOther.mCPUTime;
mLocation = pOther.mLocation;
return *this;
}
/**
* @file llpathfindingcharacter.cpp
* @author William Todd Stinson
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llpathfindingcharacter.h"
#include "llsd.h"
#include "v3math.h"
#include "lluuid.h"
#include "llavatarname.h"
#include "llavatarnamecache.h"
#define CHARACTER_NAME_FIELD "name"
#define CHARACTER_DESCRIPTION_FIELD "description"
#define CHARACTER_OWNER_FIELD "owner"
#define CHARACTER_CPU_TIME_FIELD "cpu_time"
#define CHARACTER_POSITION_FIELD "position"
//---------------------------------------------------------------------------
// LLPathfindingCharacter
//---------------------------------------------------------------------------
LLPathfindingCharacter::LLPathfindingCharacter(const std::string &pUUID, const LLSD& pCharacterItem)
: mUUID(pUUID),
mName(),
mDescription(),
mOwnerUUID(),
mOwnerName(),
mCPUTime(0U),
mLocation(LLVector3::zero)
{
llassert(pCharacterItem.has(CHARACTER_NAME_FIELD));
llassert(pCharacterItem.get(CHARACTER_NAME_FIELD).isString());
mName = pCharacterItem.get(CHARACTER_NAME_FIELD).asString();
llassert(pCharacterItem.has(CHARACTER_DESCRIPTION_FIELD));
llassert(pCharacterItem.get(CHARACTER_DESCRIPTION_FIELD).isString());
mDescription = pCharacterItem.get(CHARACTER_DESCRIPTION_FIELD).asString();
llassert(pCharacterItem.has(CHARACTER_OWNER_FIELD));
llassert(pCharacterItem.get(CHARACTER_OWNER_FIELD).isUUID());
mOwnerUUID = pCharacterItem.get(CHARACTER_OWNER_FIELD).asUUID();
LLAvatarNameCache::get(mOwnerUUID, &mOwnerName);
llassert(pCharacterItem.has(CHARACTER_CPU_TIME_FIELD));
llassert(pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).isReal());
mCPUTime = pCharacterItem.get(CHARACTER_CPU_TIME_FIELD).asReal();
llassert(pCharacterItem.has(CHARACTER_POSITION_FIELD));
llassert(pCharacterItem.get(CHARACTER_POSITION_FIELD).isArray());
mLocation.setValue(pCharacterItem.get(CHARACTER_POSITION_FIELD));
}
LLPathfindingCharacter::LLPathfindingCharacter(const LLPathfindingCharacter& pOther)
: mUUID(pOther.mUUID),
mName(pOther.mName),
mDescription(pOther.mDescription),
mOwnerUUID(pOther.mOwnerUUID),
mOwnerName(pOther.mOwnerName),
mCPUTime(pOther.mCPUTime),
mLocation(pOther.mLocation)
{
}
LLPathfindingCharacter::~LLPathfindingCharacter()
{
}
LLPathfindingCharacter& LLPathfindingCharacter::operator =(const LLPathfindingCharacter& pOther)
{
mUUID = pOther.mUUID;
mName = pOther.mName;
mDescription = pOther.mDescription;
mOwnerUUID = pOther.mOwnerUUID;
mOwnerName = pOther.mOwnerName;
mCPUTime = pOther.mCPUTime;
mLocation = pOther.mLocation;
return *this;
}

View File

@ -1,70 +1,70 @@
/**
* @file llpathfindingcharacter.h
* @author William Todd Stinson
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGCHARACTER_H
#define LL_LLPATHFINDINGCHARACTER_H
#include "v3math.h"
#include "lluuid.h"
#include "llavatarname.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingCharacter;
typedef boost::shared_ptr<LLPathfindingCharacter> LLPathfindingCharacterPtr;
class LLPathfindingCharacter
{
public:
LLPathfindingCharacter(const std::string &pUUID, const LLSD &pCharacterItem);
LLPathfindingCharacter(const LLPathfindingCharacter& pOther);
virtual ~LLPathfindingCharacter();
LLPathfindingCharacter& operator = (const LLPathfindingCharacter& pOther);
inline const LLUUID& getUUID() const {return mUUID;};
inline const std::string& getName() const {return mName;};
inline const std::string& getDescription() const {return mDescription;};
inline const std::string getOwnerName() const {return mOwnerName.getCompleteName();};
inline F32 getCPUTime() const {return mCPUTime;};
inline const LLVector3& getLocation() const {return mLocation;};
protected:
private:
LLUUID mUUID;
std::string mName;
std::string mDescription;
LLUUID mOwnerUUID;
LLAvatarName mOwnerName;
F32 mCPUTime;
LLVector3 mLocation;
};
#endif // LL_LLPATHFINDINGCHARACTER_H
/**
* @file llpathfindingcharacter.h
* @author William Todd Stinson
* @brief Definition of a pathfinding character that contains various properties required for havok pathfinding.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGCHARACTER_H
#define LL_LLPATHFINDINGCHARACTER_H
#include "v3math.h"
#include "lluuid.h"
#include "llavatarname.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingCharacter;
typedef boost::shared_ptr<LLPathfindingCharacter> LLPathfindingCharacterPtr;
class LLPathfindingCharacter
{
public:
LLPathfindingCharacter(const std::string &pUUID, const LLSD &pCharacterItem);
LLPathfindingCharacter(const LLPathfindingCharacter& pOther);
virtual ~LLPathfindingCharacter();
LLPathfindingCharacter& operator = (const LLPathfindingCharacter& pOther);
inline const LLUUID& getUUID() const {return mUUID;};
inline const std::string& getName() const {return mName;};
inline const std::string& getDescription() const {return mDescription;};
inline const std::string getOwnerName() const {return mOwnerName.getCompleteName();};
inline F32 getCPUTime() const {return mCPUTime;};
inline const LLVector3& getLocation() const {return mLocation;};
protected:
private:
LLUUID mUUID;
std::string mName;
std::string mDescription;
LLUUID mOwnerUUID;
LLAvatarName mOwnerName;
F32 mCPUTime;
LLVector3 mLocation;
};
#endif // LL_LLPATHFINDINGCHARACTER_H

View File

@ -1,63 +1,63 @@
/**
* @file llpathfindingcharacterlist.cpp
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding characters
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include <string>
#include <map>
#include "llsd.h"
#include "lluuid.h"
#include "llpathfindingcharacter.h"
#include "llpathfindingcharacterlist.h"
//---------------------------------------------------------------------------
// LLPathfindingCharacterList
//---------------------------------------------------------------------------
LLPathfindingCharacterList::LLPathfindingCharacterList()
: LLPathfindingCharacterMap()
{
}
LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterItems)
: LLPathfindingCharacterMap()
{
for (LLSD::map_const_iterator characterItemIter = pCharacterItems.beginMap();
characterItemIter != pCharacterItems.endMap(); ++characterItemIter)
{
const std::string& uuid(characterItemIter->first);
const LLSD& characterData = characterItemIter->second;
LLPathfindingCharacterPtr character(new LLPathfindingCharacter(uuid, characterData));
insert(std::pair<std::string, LLPathfindingCharacterPtr>(uuid, character));
}
}
LLPathfindingCharacterList::~LLPathfindingCharacterList()
{
clear();
}
/**
* @file llpathfindingcharacterlist.cpp
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding characters
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include <string>
#include <map>
#include "llsd.h"
#include "lluuid.h"
#include "llpathfindingcharacter.h"
#include "llpathfindingcharacterlist.h"
//---------------------------------------------------------------------------
// LLPathfindingCharacterList
//---------------------------------------------------------------------------
LLPathfindingCharacterList::LLPathfindingCharacterList()
: LLPathfindingCharacterMap()
{
}
LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterItems)
: LLPathfindingCharacterMap()
{
for (LLSD::map_const_iterator characterItemIter = pCharacterItems.beginMap();
characterItemIter != pCharacterItems.endMap(); ++characterItemIter)
{
const std::string& uuid(characterItemIter->first);
const LLSD& characterData = characterItemIter->second;
LLPathfindingCharacterPtr character(new LLPathfindingCharacter(uuid, characterData));
insert(std::pair<std::string, LLPathfindingCharacterPtr>(uuid, character));
}
}
LLPathfindingCharacterList::~LLPathfindingCharacterList()
{
clear();
}

View File

@ -1,56 +1,56 @@
/**
* @file llpathfindingcharacterlist.h
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding characters
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGCHARACTERLIST_H
#define LL_LLPATHFINDINGCHARACTERLIST_H
#include <string>
#include <map>
#include "llpathfindingcharacter.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingCharacterList;
typedef boost::shared_ptr<LLPathfindingCharacterList> LLPathfindingCharacterListPtr;
typedef std::map<std::string, LLPathfindingCharacterPtr> LLPathfindingCharacterMap;
class LLPathfindingCharacterList : public LLPathfindingCharacterMap
{
public:
LLPathfindingCharacterList();
LLPathfindingCharacterList(const LLSD& pCharacterItems);
virtual ~LLPathfindingCharacterList();
protected:
private:
};
#endif // LL_LLPATHFINDINGCHARACTERLIST_H
/**
* @file llpathfindingcharacterlist.h
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding characters
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGCHARACTERLIST_H
#define LL_LLPATHFINDINGCHARACTERLIST_H
#include <string>
#include <map>
#include "llpathfindingcharacter.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingCharacterList;
typedef boost::shared_ptr<LLPathfindingCharacterList> LLPathfindingCharacterListPtr;
typedef std::map<std::string, LLPathfindingCharacterPtr> LLPathfindingCharacterMap;
class LLPathfindingCharacterList : public LLPathfindingCharacterMap
{
public:
LLPathfindingCharacterList();
LLPathfindingCharacterList(const LLSD& pCharacterItems);
virtual ~LLPathfindingCharacterList();
protected:
private:
};
#endif // LL_LLPATHFINDINGCHARACTERLIST_H

File diff suppressed because it is too large Load Diff

View File

@ -1,132 +1,132 @@
/**
* @file llpathfindinglinkset.h
* @author William Todd Stinson
* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGLINKSET_H
#define LL_LLPATHFINDINGLINKSET_H
#include "v3math.h"
#include "lluuid.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingLinkset;
typedef boost::shared_ptr<LLPathfindingLinkset> LLPathfindingLinksetPtr;
#define DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS
#define MISSING_MODIFIABLE_FIELD_WAR
class LLPathfindingLinkset
{
public:
typedef enum
{
kUnknown,
kWalkable,
kStaticObstacle,
kDynamicObstacle,
kMaterialVolume,
kExclusionVolume,
kDynamicPhantom
} ELinksetUse;
LLPathfindingLinkset(const LLSD &pTerrainLinksetItem);
LLPathfindingLinkset(const std::string &pUUID, const LLSD &pLinksetItem);
LLPathfindingLinkset(const LLPathfindingLinkset& pOther);
virtual ~LLPathfindingLinkset();
LLPathfindingLinkset& operator = (const LLPathfindingLinkset& pOther);
inline bool isTerrain() const {return mIsTerrain;};
inline const LLUUID& getUUID() const {return mUUID;};
inline const std::string& getName() const {return mName;};
inline const std::string& getDescription() const {return mDescription;};
inline U32 getLandImpact() const {return mLandImpact;};
inline const LLVector3& getLocation() const {return mLocation;};
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 parseObjectData(const LLSD &pLinksetItem);
void parsePathfindingData(const LLSD &pLinksetItem);
#ifdef DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS
static ELinksetUse getLinksetUse(bool pIsPhantom, bool pIsPermanent, bool pIsWalkable);
static BOOL isPermanent(ELinksetUse pLinksetUse);
static BOOL isWalkable(ELinksetUse pLinksetUse);
#endif // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS
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);
LLUUID mUUID;
bool mIsTerrain;
std::string mName;
std::string mDescription;
U32 mLandImpact;
LLVector3 mLocation;
#ifdef MISSING_MODIFIABLE_FIELD_WAR
bool mHasModifiable;
#endif // MISSING_MODIFIABLE_FIELD_WAR
BOOL mIsModifiable;
BOOL mCanBeVolume;
ELinksetUse mLinksetUse;
S32 mWalkabilityCoefficientA;
S32 mWalkabilityCoefficientB;
S32 mWalkabilityCoefficientC;
S32 mWalkabilityCoefficientD;
};
#endif // LL_LLPATHFINDINGLINKSET_H
/**
* @file llpathfindinglinkset.h
* @author William Todd Stinson
* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGLINKSET_H
#define LL_LLPATHFINDINGLINKSET_H
#include "v3math.h"
#include "lluuid.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingLinkset;
typedef boost::shared_ptr<LLPathfindingLinkset> LLPathfindingLinksetPtr;
#define DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS
#define MISSING_MODIFIABLE_FIELD_WAR
class LLPathfindingLinkset
{
public:
typedef enum
{
kUnknown,
kWalkable,
kStaticObstacle,
kDynamicObstacle,
kMaterialVolume,
kExclusionVolume,
kDynamicPhantom
} ELinksetUse;
LLPathfindingLinkset(const LLSD &pTerrainLinksetItem);
LLPathfindingLinkset(const std::string &pUUID, const LLSD &pLinksetItem);
LLPathfindingLinkset(const LLPathfindingLinkset& pOther);
virtual ~LLPathfindingLinkset();
LLPathfindingLinkset& operator = (const LLPathfindingLinkset& pOther);
inline bool isTerrain() const {return mIsTerrain;};
inline const LLUUID& getUUID() const {return mUUID;};
inline const std::string& getName() const {return mName;};
inline const std::string& getDescription() const {return mDescription;};
inline U32 getLandImpact() const {return mLandImpact;};
inline const LLVector3& getLocation() const {return mLocation;};
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 parseObjectData(const LLSD &pLinksetItem);
void parsePathfindingData(const LLSD &pLinksetItem);
#ifdef DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS
static ELinksetUse getLinksetUse(bool pIsPhantom, bool pIsPermanent, bool pIsWalkable);
static BOOL isPermanent(ELinksetUse pLinksetUse);
static BOOL isWalkable(ELinksetUse pLinksetUse);
#endif // DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS
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);
LLUUID mUUID;
bool mIsTerrain;
std::string mName;
std::string mDescription;
U32 mLandImpact;
LLVector3 mLocation;
#ifdef MISSING_MODIFIABLE_FIELD_WAR
bool mHasModifiable;
#endif // MISSING_MODIFIABLE_FIELD_WAR
BOOL mIsModifiable;
BOOL mCanBeVolume;
ELinksetUse mLinksetUse;
S32 mWalkabilityCoefficientA;
S32 mWalkabilityCoefficientB;
S32 mWalkabilityCoefficientC;
S32 mWalkabilityCoefficientD;
};
#endif // LL_LLPATHFINDINGLINKSET_H

View File

@ -1,122 +1,122 @@
/**
* @file llpathfindinglinksetlist.cpp
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding linksets
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include <string>
#include <map>
#include "llsd.h"
#include "lluuid.h"
#include "llpathfindinglinkset.h"
#include "llpathfindinglinksetlist.h"
//---------------------------------------------------------------------------
// LLPathfindingLinksetList
//---------------------------------------------------------------------------
LLPathfindingLinksetList::LLPathfindingLinksetList()
: LLPathfindingLinksetMap()
{
}
LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetItems)
: LLPathfindingLinksetMap()
{
for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap();
linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter)
{
const std::string& uuid(linksetItemIter->first);
const LLSD& linksetData = linksetItemIter->second;
LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData));
insert(std::pair<std::string, LLPathfindingLinksetPtr>(uuid, linkset));
}
}
LLPathfindingLinksetList::~LLPathfindingLinksetList()
{
clear();
}
void LLPathfindingLinksetList::update(const LLPathfindingLinksetList &pUpdateLinksetList)
{
for (LLPathfindingLinksetList::const_iterator updateLinksetIter = pUpdateLinksetList.begin();
updateLinksetIter != pUpdateLinksetList.end(); ++updateLinksetIter)
{
const std::string &uuid = updateLinksetIter->first;
const LLPathfindingLinksetPtr updateLinksetPtr = updateLinksetIter->second;
LLPathfindingLinksetList::iterator linksetIter = find(uuid);
if (linksetIter == end())
{
insert(std::pair<std::string, LLPathfindingLinksetPtr>(uuid, updateLinksetPtr));
}
else
{
LLPathfindingLinksetPtr linksetPtr = linksetIter->second;
*linksetPtr = *updateLinksetPtr;
}
}
}
LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
{
LLSD listData;
for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
{
const LLPathfindingLinksetPtr linksetPtr = linksetIter->second;
if (!linksetPtr->isTerrain())
{
LLSD linksetData = linksetPtr->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 (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
{
const LLPathfindingLinksetPtr linksetPtr = linksetIter->second;
if (linksetPtr->isTerrain())
{
terrainData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
break;
}
}
return terrainData;
}
/**
* @file llpathfindinglinksetlist.cpp
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding linksets
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include <string>
#include <map>
#include "llsd.h"
#include "lluuid.h"
#include "llpathfindinglinkset.h"
#include "llpathfindinglinksetlist.h"
//---------------------------------------------------------------------------
// LLPathfindingLinksetList
//---------------------------------------------------------------------------
LLPathfindingLinksetList::LLPathfindingLinksetList()
: LLPathfindingLinksetMap()
{
}
LLPathfindingLinksetList::LLPathfindingLinksetList(const LLSD& pLinksetItems)
: LLPathfindingLinksetMap()
{
for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap();
linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter)
{
const std::string& uuid(linksetItemIter->first);
const LLSD& linksetData = linksetItemIter->second;
LLPathfindingLinksetPtr linkset(new LLPathfindingLinkset(uuid, linksetData));
insert(std::pair<std::string, LLPathfindingLinksetPtr>(uuid, linkset));
}
}
LLPathfindingLinksetList::~LLPathfindingLinksetList()
{
clear();
}
void LLPathfindingLinksetList::update(const LLPathfindingLinksetList &pUpdateLinksetList)
{
for (LLPathfindingLinksetList::const_iterator updateLinksetIter = pUpdateLinksetList.begin();
updateLinksetIter != pUpdateLinksetList.end(); ++updateLinksetIter)
{
const std::string &uuid = updateLinksetIter->first;
const LLPathfindingLinksetPtr updateLinksetPtr = updateLinksetIter->second;
LLPathfindingLinksetList::iterator linksetIter = find(uuid);
if (linksetIter == end())
{
insert(std::pair<std::string, LLPathfindingLinksetPtr>(uuid, updateLinksetPtr));
}
else
{
LLPathfindingLinksetPtr linksetPtr = linksetIter->second;
*linksetPtr = *updateLinksetPtr;
}
}
}
LLSD LLPathfindingLinksetList::encodeObjectFields(LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) const
{
LLSD listData;
for (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
{
const LLPathfindingLinksetPtr linksetPtr = linksetIter->second;
if (!linksetPtr->isTerrain())
{
LLSD linksetData = linksetPtr->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 (LLPathfindingLinksetMap::const_iterator linksetIter = begin(); linksetIter != end(); ++linksetIter)
{
const LLPathfindingLinksetPtr linksetPtr = linksetIter->second;
if (linksetPtr->isTerrain())
{
terrainData = linksetPtr->encodeAlteredFields(pLinksetUse, pA, pB, pC, pD);
break;
}
}
return terrainData;
}

View File

@ -1,61 +1,61 @@
/**
* @file llpathfindinglinksetlist.h
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding linksets
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGLINKSETLIST_H
#define LL_LLPATHFINDINGLINKSETLIST_H
#include <string>
#include <map>
#include "llpathfindinglinkset.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingLinksetList;
typedef boost::shared_ptr<LLPathfindingLinksetList> LLPathfindingLinksetListPtr;
typedef std::map<std::string, LLPathfindingLinksetPtr> LLPathfindingLinksetMap;
class LLPathfindingLinksetList : public LLPathfindingLinksetMap
{
public:
LLPathfindingLinksetList();
LLPathfindingLinksetList(const LLSD& pLinksetItems);
virtual ~LLPathfindingLinksetList();
void update(const LLPathfindingLinksetList &pUpdateLinksetList);
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;
protected:
private:
};
#endif // LL_LLPATHFINDINGLINKSETLIST_H
/**
* @file llpathfindinglinksetlist.h
* @author William Todd Stinson
* @brief Class to implement the list of a set of pathfinding linksets
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGLINKSETLIST_H
#define LL_LLPATHFINDINGLINKSETLIST_H
#include <string>
#include <map>
#include "llpathfindinglinkset.h"
#include <boost/shared_ptr.hpp>
class LLSD;
class LLPathfindingLinksetList;
typedef boost::shared_ptr<LLPathfindingLinksetList> LLPathfindingLinksetListPtr;
typedef std::map<std::string, LLPathfindingLinksetPtr> LLPathfindingLinksetMap;
class LLPathfindingLinksetList : public LLPathfindingLinksetMap
{
public:
LLPathfindingLinksetList();
LLPathfindingLinksetList(const LLSD& pLinksetItems);
virtual ~LLPathfindingLinksetList();
void update(const LLPathfindingLinksetList &pUpdateLinksetList);
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;
protected:
private:
};
#endif // LL_LLPATHFINDINGLINKSETLIST_H

View File

@ -1,159 +1,159 @@
/**
* @file llpathfindingnavmeshstatus.cpp
* @author William Todd Stinson
* @brief A class for representing the navmesh status of a pathfinding region.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llsd.h"
#include "lluuid.h"
#include "llstring.h"
#include "llpathfindingnavmeshstatus.h"
#include <string>
#define REGION_FIELD "region_id"
#define DEPRECATED_STATE_FIELD "state"
#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());
#ifdef DEPRECATED_STATE_FIELD
std::string status;
if (pContent.has(DEPRECATED_STATE_FIELD))
{
llassert(pContent.has(DEPRECATED_STATE_FIELD));
llassert(pContent.get(DEPRECATED_STATE_FIELD).isString());
status = pContent.get(DEPRECATED_STATE_FIELD).asString();
}
else
{
llassert(pContent.has(STATUS_FIELD));
llassert(pContent.get(STATUS_FIELD).isString());
status = pContent.get(STATUS_FIELD).asString();
}
#else // DEPRECATED_STATE_FIELD
llassert(pContent.has(STATUS_FIELD));
llassert(pContent.get(STATUS_FIELD).isString());
std::string status = pContent.get(STATUS_FIELD).asString();
#endif // DEPRECATED_STATE_FIELD
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);
}
}
/**
* @file llpathfindingnavmeshstatus.cpp
* @author William Todd Stinson
* @brief A class for representing the navmesh status of a pathfinding region.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llsd.h"
#include "lluuid.h"
#include "llstring.h"
#include "llpathfindingnavmeshstatus.h"
#include <string>
#define REGION_FIELD "region_id"
#define DEPRECATED_STATE_FIELD "state"
#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());
#ifdef DEPRECATED_STATE_FIELD
std::string status;
if (pContent.has(DEPRECATED_STATE_FIELD))
{
llassert(pContent.has(DEPRECATED_STATE_FIELD));
llassert(pContent.get(DEPRECATED_STATE_FIELD).isString());
status = pContent.get(DEPRECATED_STATE_FIELD).asString();
}
else
{
llassert(pContent.has(STATUS_FIELD));
llassert(pContent.get(STATUS_FIELD).isString());
status = pContent.get(STATUS_FIELD).asString();
}
#else // DEPRECATED_STATE_FIELD
llassert(pContent.has(STATUS_FIELD));
llassert(pContent.get(STATUS_FIELD).isString());
std::string status = pContent.get(STATUS_FIELD).asString();
#endif // DEPRECATED_STATE_FIELD
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);
}
}

View File

@ -1,85 +1,85 @@
/**
* @file llpathfindingnavmeshstatus.h
* @author William Todd Stinson
* @brief A class for representing the navmesh status of a pathfinding region.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H
#define LL_LLPATHFINDINGNAVMESHSTATUS_H
#include "lluuid.h"
#include <string>
// XXX stinson 03/12/2012 : This definition is in place to support an older version of the pathfinding simulator that does not have versioned information
#define DEPRECATED_UNVERSIONED_NAVMESH
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);
#ifdef DEPRECATED_UNVERSIONED_NAVMESH
void incrementNavMeshVersionXXX() {++mVersion;};
#endif // DEPRECATED_UNVERSIONED_NAVMESH
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
/**
* @file llpathfindingnavmeshstatus.h
* @author William Todd Stinson
* @brief A class for representing the navmesh status of a pathfinding region.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGNAVMESHSTATUS_H
#define LL_LLPATHFINDINGNAVMESHSTATUS_H
#include "lluuid.h"
#include <string>
// XXX stinson 03/12/2012 : This definition is in place to support an older version of the pathfinding simulator that does not have versioned information
#define DEPRECATED_UNVERSIONED_NAVMESH
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);
#ifdef DEPRECATED_UNVERSIONED_NAVMESH
void incrementNavMeshVersionXXX() {++mVersion;};
#endif // DEPRECATED_UNVERSIONED_NAVMESH
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

View File

@ -1,429 +1,429 @@
/**
* @file llpathfindingpathtool.cpp
* @author William Todd Stinson
* @brief XXX
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llpathfindingpathtool.h"
#include "llsingleton.h"
#include "lltool.h"
#include "llviewerwindow.h"
#include "llviewercamera.h"
#include "llpathfindingmanager.h"
#include "llpathinglib.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#define PATH_TOOL_NAME "PathfindingPathTool"
LLPathfindingPathTool::LLPathfindingPathTool()
: LLTool(PATH_TOOL_NAME),
LLSingleton<LLPathfindingPathTool>(),
mFinalPathData(),
mTempPathData(),
mPathResult(LLPathingLib::LLPL_NO_PATH),
mCharacterType(kCharacterTypeNone),
mPathEventSignal(),
mIsLeftMouseButtonHeld(false),
mIsMiddleMouseButtonHeld(false),
mIsRightMouseButtonHeld(false)
{
if (!LLPathingLib::getInstance())
{
LLPathingLib::initSystem();
}
setCharacterWidth(1.0f);
setCharacterType(mCharacterType);
}
LLPathfindingPathTool::~LLPathfindingPathTool()
{
}
BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask)
{
BOOL returnVal = FALSE;
if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
{
computeFinalPoints(pX, pY, pMask);
mIsLeftMouseButtonHeld = true;
setMouseCapture(TRUE);
returnVal = TRUE;
}
mIsLeftMouseButtonHeld = true;
return returnVal;
}
BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask)
{
BOOL returnVal = FALSE;
if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
{
computeFinalPoints(pX, pY, pMask);
setMouseCapture(FALSE);
returnVal = TRUE;
}
mIsLeftMouseButtonHeld = false;
return returnVal;
}
BOOL LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask)
{
setMouseCapture(TRUE);
mIsMiddleMouseButtonHeld = true;
gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
return TRUE;
}
BOOL LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask)
{
if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
{
setMouseCapture(FALSE);
}
mIsMiddleMouseButtonHeld = false;
return TRUE;
}
BOOL LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask)
{
setMouseCapture(TRUE);
mIsRightMouseButtonHeld = true;
gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
return TRUE;
}
BOOL LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask)
{
if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld)
{
setMouseCapture(FALSE);
}
mIsRightMouseButtonHeld = false;
return TRUE;
}
BOOL LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask)
{
return TRUE;
}
BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask)
{
BOOL returnVal = FALSE;
if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
{
gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING);
computeTempPoints(pX, pY, pMask);
returnVal = TRUE;
}
else
{
clearTemp();
computeFinalPath();
}
return returnVal;
}
LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const
{
EPathStatus status = kPathStatusUnknown;
if (LLPathingLib::getInstance() == NULL)
{
status = kPathStatusNotImplemented;
}
else if (!LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion())
{
status = kPathStatusNotEnabled;
}
else if (!hasFinalA() && !hasFinalB())
{
status = kPathStatusChooseStartAndEndPoints;
}
else if (!hasFinalA())
{
status = kPathStatusChooseStartPoint;
}
else if (!hasFinalB())
{
status = kPathStatusChooseEndPoint;
}
else if (mPathResult == LLPathingLib::LLPL_PATH_GENERATED_OK)
{
status = kPathStatusHasValidPath;
}
else if (mPathResult == LLPathingLib::LLPL_NO_PATH)
{
status = kPathStatusHasInvalidPath;
}
else
{
status = kPathStatusError;
}
return status;
}
F32 LLPathfindingPathTool::getCharacterWidth() const
{
return mFinalPathData.mCharacterWidth;
}
void LLPathfindingPathTool::setCharacterWidth(F32 pCharacterWidth)
{
mFinalPathData.mCharacterWidth = pCharacterWidth;
mTempPathData.mCharacterWidth = pCharacterWidth;
computeFinalPath();
}
LLPathfindingPathTool::ECharacterType LLPathfindingPathTool::getCharacterType() const
{
return mCharacterType;
}
void LLPathfindingPathTool::setCharacterType(ECharacterType pCharacterType)
{
mCharacterType = pCharacterType;
LLPathingLib::LLPLCharacterType characterType;
switch (pCharacterType)
{
case kCharacterTypeNone :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
break;
case kCharacterTypeA :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_A;
break;
case kCharacterTypeB :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_B;
break;
case kCharacterTypeC :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_C;
break;
case kCharacterTypeD :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_D;
break;
default :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
llassert(0);
break;
}
mFinalPathData.mCharacterType = characterType;
mTempPathData.mCharacterType = characterType;
computeFinalPath();
}
bool LLPathfindingPathTool::isRenderPath() const
{
return (hasFinalA() || hasFinalB() || hasTempA() || hasTempB());
}
void LLPathfindingPathTool::clearPath()
{
clearFinal();
clearTemp();
computeFinalPath();
}
LLPathfindingPathTool::path_event_slot_t LLPathfindingPathTool::registerPathEventListener(path_event_callback_t pPathEventCallback)
{
return mPathEventSignal.connect(pPathEventCallback);
}
bool LLPathfindingPathTool::isAnyPathToolModKeys(MASK pMask) const
{
return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0);
}
bool LLPathfindingPathTool::isPointAModKeys(MASK pMask) const
{
return ((pMask & MASK_CONTROL) != 0);
}
bool LLPathfindingPathTool::isPointBModKeys(MASK pMask) const
{
return ((pMask & MASK_SHIFT) != 0);
}
void LLPathfindingPathTool::getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const
{
LLVector3 dv = gViewerWindow->mouseDirectionGlobal(pX, pY);
LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin();
pRayStart = mousePos;
pRayEnd = mousePos + dv * 150;
}
void LLPathfindingPathTool::computeFinalPoints(S32 pX, S32 pY, MASK pMask)
{
LLVector3 rayStart, rayEnd;
getRayPoints(pX, pY, rayStart, rayEnd);
if (isPointAModKeys(pMask))
{
setFinalA(rayStart, rayEnd);
}
else if (isPointBModKeys(pMask))
{
setFinalB(rayStart, rayEnd);
}
computeFinalPath();
}
void LLPathfindingPathTool::computeTempPoints(S32 pX, S32 pY, MASK pMask)
{
LLVector3 rayStart, rayEnd;
getRayPoints(pX, pY, rayStart, rayEnd);
if (isPointAModKeys(pMask))
{
setTempA(rayStart, rayEnd);
if (hasFinalB())
{
setTempB(getFinalBStart(), getFinalBEnd());
}
}
else if (isPointBModKeys(pMask))
{
if (hasFinalA())
{
setTempA(getFinalAStart(), getFinalAEnd());
}
setTempB(rayStart, rayEnd);
}
computeTempPath();
}
void LLPathfindingPathTool::setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mFinalPathData.mStartPointA = pStartPoint;
mFinalPathData.mEndPointA = pEndPoint;
mFinalPathData.mHasPointA = true;
}
bool LLPathfindingPathTool::hasFinalA() const
{
return mFinalPathData.mHasPointA;
}
const LLVector3 &LLPathfindingPathTool::getFinalAStart() const
{
return mFinalPathData.mStartPointA;
}
const LLVector3 &LLPathfindingPathTool::getFinalAEnd() const
{
return mFinalPathData.mEndPointA;
}
void LLPathfindingPathTool::setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mTempPathData.mStartPointA = pStartPoint;
mTempPathData.mEndPointA = pEndPoint;
mTempPathData.mHasPointA = true;
}
bool LLPathfindingPathTool::hasTempA() const
{
return mTempPathData.mHasPointA;
}
void LLPathfindingPathTool::setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mFinalPathData.mStartPointB = pStartPoint;
mFinalPathData.mEndPointB = pEndPoint;
mFinalPathData.mHasPointB = true;
}
bool LLPathfindingPathTool::hasFinalB() const
{
return mFinalPathData.mHasPointB;
}
const LLVector3 &LLPathfindingPathTool::getFinalBStart() const
{
return mFinalPathData.mStartPointB;
}
const LLVector3 &LLPathfindingPathTool::getFinalBEnd() const
{
return mFinalPathData.mEndPointB;
}
void LLPathfindingPathTool::setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mTempPathData.mStartPointB = pStartPoint;
mTempPathData.mEndPointB = pEndPoint;
mTempPathData.mHasPointB = true;
}
bool LLPathfindingPathTool::hasTempB() const
{
return mTempPathData.mHasPointB;
}
void LLPathfindingPathTool::clearFinal()
{
mFinalPathData.mHasPointA = false;
mFinalPathData.mHasPointB = false;
}
void LLPathfindingPathTool::clearTemp()
{
mTempPathData.mHasPointA = false;
mTempPathData.mHasPointB = false;
}
void LLPathfindingPathTool::computeFinalPath()
{
mPathResult = LLPathingLib::LLPL_NO_PATH;
if (LLPathingLib::getInstance() != NULL)
{
mPathResult = LLPathingLib::getInstance()->generatePath(mFinalPathData);
}
mPathEventSignal();
}
void LLPathfindingPathTool::computeTempPath()
{
mPathResult = LLPathingLib::LLPL_NO_PATH;
if (LLPathingLib::getInstance() != NULL)
{
mPathResult = LLPathingLib::getInstance()->generatePath(mTempPathData);
}
mPathEventSignal();
}
/**
* @file llpathfindingpathtool.cpp
* @author William Todd Stinson
* @brief XXX
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llpathfindingpathtool.h"
#include "llsingleton.h"
#include "lltool.h"
#include "llviewerwindow.h"
#include "llviewercamera.h"
#include "llpathfindingmanager.h"
#include "llpathinglib.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#define PATH_TOOL_NAME "PathfindingPathTool"
LLPathfindingPathTool::LLPathfindingPathTool()
: LLTool(PATH_TOOL_NAME),
LLSingleton<LLPathfindingPathTool>(),
mFinalPathData(),
mTempPathData(),
mPathResult(LLPathingLib::LLPL_NO_PATH),
mCharacterType(kCharacterTypeNone),
mPathEventSignal(),
mIsLeftMouseButtonHeld(false),
mIsMiddleMouseButtonHeld(false),
mIsRightMouseButtonHeld(false)
{
if (!LLPathingLib::getInstance())
{
LLPathingLib::initSystem();
}
setCharacterWidth(1.0f);
setCharacterType(mCharacterType);
}
LLPathfindingPathTool::~LLPathfindingPathTool()
{
}
BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask)
{
BOOL returnVal = FALSE;
if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
{
computeFinalPoints(pX, pY, pMask);
mIsLeftMouseButtonHeld = true;
setMouseCapture(TRUE);
returnVal = TRUE;
}
mIsLeftMouseButtonHeld = true;
return returnVal;
}
BOOL LLPathfindingPathTool::handleMouseUp(S32 pX, S32 pY, MASK pMask)
{
BOOL returnVal = FALSE;
if (mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
{
computeFinalPoints(pX, pY, pMask);
setMouseCapture(FALSE);
returnVal = TRUE;
}
mIsLeftMouseButtonHeld = false;
return returnVal;
}
BOOL LLPathfindingPathTool::handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask)
{
setMouseCapture(TRUE);
mIsMiddleMouseButtonHeld = true;
gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
return TRUE;
}
BOOL LLPathfindingPathTool::handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask)
{
if (!mIsLeftMouseButtonHeld && mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld)
{
setMouseCapture(FALSE);
}
mIsMiddleMouseButtonHeld = false;
return TRUE;
}
BOOL LLPathfindingPathTool::handleRightMouseDown(S32 pX, S32 pY, MASK pMask)
{
setMouseCapture(TRUE);
mIsRightMouseButtonHeld = true;
gViewerWindow->setCursor(UI_CURSOR_TOOLNO);
return TRUE;
}
BOOL LLPathfindingPathTool::handleRightMouseUp(S32 pX, S32 pY, MASK pMask)
{
if (!mIsLeftMouseButtonHeld && !mIsMiddleMouseButtonHeld && mIsRightMouseButtonHeld)
{
setMouseCapture(FALSE);
}
mIsRightMouseButtonHeld = false;
return TRUE;
}
BOOL LLPathfindingPathTool::handleDoubleClick(S32 pX, S32 pY, MASK pMask)
{
return TRUE;
}
BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask)
{
BOOL returnVal = FALSE;
if (!mIsMiddleMouseButtonHeld && !mIsRightMouseButtonHeld && isAnyPathToolModKeys(pMask))
{
gViewerWindow->setCursor(UI_CURSOR_TOOLPATHFINDING);
computeTempPoints(pX, pY, pMask);
returnVal = TRUE;
}
else
{
clearTemp();
computeFinalPath();
}
return returnVal;
}
LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const
{
EPathStatus status = kPathStatusUnknown;
if (LLPathingLib::getInstance() == NULL)
{
status = kPathStatusNotImplemented;
}
else if (!LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion())
{
status = kPathStatusNotEnabled;
}
else if (!hasFinalA() && !hasFinalB())
{
status = kPathStatusChooseStartAndEndPoints;
}
else if (!hasFinalA())
{
status = kPathStatusChooseStartPoint;
}
else if (!hasFinalB())
{
status = kPathStatusChooseEndPoint;
}
else if (mPathResult == LLPathingLib::LLPL_PATH_GENERATED_OK)
{
status = kPathStatusHasValidPath;
}
else if (mPathResult == LLPathingLib::LLPL_NO_PATH)
{
status = kPathStatusHasInvalidPath;
}
else
{
status = kPathStatusError;
}
return status;
}
F32 LLPathfindingPathTool::getCharacterWidth() const
{
return mFinalPathData.mCharacterWidth;
}
void LLPathfindingPathTool::setCharacterWidth(F32 pCharacterWidth)
{
mFinalPathData.mCharacterWidth = pCharacterWidth;
mTempPathData.mCharacterWidth = pCharacterWidth;
computeFinalPath();
}
LLPathfindingPathTool::ECharacterType LLPathfindingPathTool::getCharacterType() const
{
return mCharacterType;
}
void LLPathfindingPathTool::setCharacterType(ECharacterType pCharacterType)
{
mCharacterType = pCharacterType;
LLPathingLib::LLPLCharacterType characterType;
switch (pCharacterType)
{
case kCharacterTypeNone :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
break;
case kCharacterTypeA :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_A;
break;
case kCharacterTypeB :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_B;
break;
case kCharacterTypeC :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_C;
break;
case kCharacterTypeD :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_D;
break;
default :
characterType = LLPathingLib::LLPL_CHARACTER_TYPE_NONE;
llassert(0);
break;
}
mFinalPathData.mCharacterType = characterType;
mTempPathData.mCharacterType = characterType;
computeFinalPath();
}
bool LLPathfindingPathTool::isRenderPath() const
{
return (hasFinalA() || hasFinalB() || hasTempA() || hasTempB());
}
void LLPathfindingPathTool::clearPath()
{
clearFinal();
clearTemp();
computeFinalPath();
}
LLPathfindingPathTool::path_event_slot_t LLPathfindingPathTool::registerPathEventListener(path_event_callback_t pPathEventCallback)
{
return mPathEventSignal.connect(pPathEventCallback);
}
bool LLPathfindingPathTool::isAnyPathToolModKeys(MASK pMask) const
{
return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0);
}
bool LLPathfindingPathTool::isPointAModKeys(MASK pMask) const
{
return ((pMask & MASK_CONTROL) != 0);
}
bool LLPathfindingPathTool::isPointBModKeys(MASK pMask) const
{
return ((pMask & MASK_SHIFT) != 0);
}
void LLPathfindingPathTool::getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const
{
LLVector3 dv = gViewerWindow->mouseDirectionGlobal(pX, pY);
LLVector3 mousePos = LLViewerCamera::getInstance()->getOrigin();
pRayStart = mousePos;
pRayEnd = mousePos + dv * 150;
}
void LLPathfindingPathTool::computeFinalPoints(S32 pX, S32 pY, MASK pMask)
{
LLVector3 rayStart, rayEnd;
getRayPoints(pX, pY, rayStart, rayEnd);
if (isPointAModKeys(pMask))
{
setFinalA(rayStart, rayEnd);
}
else if (isPointBModKeys(pMask))
{
setFinalB(rayStart, rayEnd);
}
computeFinalPath();
}
void LLPathfindingPathTool::computeTempPoints(S32 pX, S32 pY, MASK pMask)
{
LLVector3 rayStart, rayEnd;
getRayPoints(pX, pY, rayStart, rayEnd);
if (isPointAModKeys(pMask))
{
setTempA(rayStart, rayEnd);
if (hasFinalB())
{
setTempB(getFinalBStart(), getFinalBEnd());
}
}
else if (isPointBModKeys(pMask))
{
if (hasFinalA())
{
setTempA(getFinalAStart(), getFinalAEnd());
}
setTempB(rayStart, rayEnd);
}
computeTempPath();
}
void LLPathfindingPathTool::setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mFinalPathData.mStartPointA = pStartPoint;
mFinalPathData.mEndPointA = pEndPoint;
mFinalPathData.mHasPointA = true;
}
bool LLPathfindingPathTool::hasFinalA() const
{
return mFinalPathData.mHasPointA;
}
const LLVector3 &LLPathfindingPathTool::getFinalAStart() const
{
return mFinalPathData.mStartPointA;
}
const LLVector3 &LLPathfindingPathTool::getFinalAEnd() const
{
return mFinalPathData.mEndPointA;
}
void LLPathfindingPathTool::setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mTempPathData.mStartPointA = pStartPoint;
mTempPathData.mEndPointA = pEndPoint;
mTempPathData.mHasPointA = true;
}
bool LLPathfindingPathTool::hasTempA() const
{
return mTempPathData.mHasPointA;
}
void LLPathfindingPathTool::setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mFinalPathData.mStartPointB = pStartPoint;
mFinalPathData.mEndPointB = pEndPoint;
mFinalPathData.mHasPointB = true;
}
bool LLPathfindingPathTool::hasFinalB() const
{
return mFinalPathData.mHasPointB;
}
const LLVector3 &LLPathfindingPathTool::getFinalBStart() const
{
return mFinalPathData.mStartPointB;
}
const LLVector3 &LLPathfindingPathTool::getFinalBEnd() const
{
return mFinalPathData.mEndPointB;
}
void LLPathfindingPathTool::setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint)
{
mTempPathData.mStartPointB = pStartPoint;
mTempPathData.mEndPointB = pEndPoint;
mTempPathData.mHasPointB = true;
}
bool LLPathfindingPathTool::hasTempB() const
{
return mTempPathData.mHasPointB;
}
void LLPathfindingPathTool::clearFinal()
{
mFinalPathData.mHasPointA = false;
mFinalPathData.mHasPointB = false;
}
void LLPathfindingPathTool::clearTemp()
{
mTempPathData.mHasPointA = false;
mTempPathData.mHasPointB = false;
}
void LLPathfindingPathTool::computeFinalPath()
{
mPathResult = LLPathingLib::LLPL_NO_PATH;
if (LLPathingLib::getInstance() != NULL)
{
mPathResult = LLPathingLib::getInstance()->generatePath(mFinalPathData);
}
mPathEventSignal();
}
void LLPathfindingPathTool::computeTempPath()
{
mPathResult = LLPathingLib::LLPL_NO_PATH;
if (LLPathingLib::getInstance() != NULL)
{
mPathResult = LLPathingLib::getInstance()->generatePath(mTempPathData);
}
mPathEventSignal();
}

View File

@ -1,136 +1,136 @@
/**
* @file llpathfindingpathtool.h
* @author William Todd Stinson
* @brief XXX
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGPATHTOOL_H
#define LL_LLPATHFINDINGPATHTOOL_H
#include "llsingleton.h"
#include "lltool.h"
#include "llpathinglib.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
class LLPathfindingPathTool : public LLTool, public LLSingleton<LLPathfindingPathTool>
{
public:
typedef enum
{
kPathStatusUnknown,
kPathStatusChooseStartAndEndPoints,
kPathStatusChooseStartPoint,
kPathStatusChooseEndPoint,
kPathStatusHasValidPath,
kPathStatusHasInvalidPath,
kPathStatusNotEnabled,
kPathStatusNotImplemented,
kPathStatusError
} EPathStatus;
typedef enum
{
kCharacterTypeNone,
kCharacterTypeA,
kCharacterTypeB,
kCharacterTypeC,
kCharacterTypeD
} ECharacterType;
LLPathfindingPathTool();
virtual ~LLPathfindingPathTool();
typedef boost::function<void (void)> path_event_callback_t;
typedef boost::signals2::signal<void (void)> path_event_signal_t;
typedef boost::signals2::connection path_event_slot_t;
virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask);
EPathStatus getPathStatus() const;
F32 getCharacterWidth() const;
void setCharacterWidth(F32 pCharacterWidth);
ECharacterType getCharacterType() const;
void setCharacterType(ECharacterType pCharacterType);
bool isRenderPath() const;
void clearPath();
path_event_slot_t registerPathEventListener(path_event_callback_t pPathEventCallback);
protected:
private:
bool isAnyPathToolModKeys(MASK pMask) const;
bool isPointAModKeys(MASK pMask) const;
bool isPointBModKeys(MASK pMask) const;
void getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const;
void computeFinalPoints(S32 pX, S32 pY, MASK pMask);
void computeTempPoints(S32 pX, S32 pY, MASK pMask);
void setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasFinalA() const;
const LLVector3 &getFinalAStart() const;
const LLVector3 &getFinalAEnd() const;
void setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasTempA() const;
void setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasFinalB() const;
const LLVector3 &getFinalBStart() const;
const LLVector3 &getFinalBEnd() const;
void setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasTempB() const;
void clearFinal();
void clearTemp();
void computeFinalPath();
void computeTempPath();
LLPathingLib::PathingPacket mFinalPathData;
LLPathingLib::PathingPacket mTempPathData;
LLPathingLib::LLPLResult mPathResult;
ECharacterType mCharacterType;
path_event_signal_t mPathEventSignal;
bool mIsLeftMouseButtonHeld;
bool mIsMiddleMouseButtonHeld;
bool mIsRightMouseButtonHeld;
};
#endif // LL_LLPATHFINDINGPATHTOOL_H
/**
* @file llpathfindingpathtool.h
* @author William Todd Stinson
* @brief XXX
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLPATHFINDINGPATHTOOL_H
#define LL_LLPATHFINDINGPATHTOOL_H
#include "llsingleton.h"
#include "lltool.h"
#include "llpathinglib.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
class LLPathfindingPathTool : public LLTool, public LLSingleton<LLPathfindingPathTool>
{
public:
typedef enum
{
kPathStatusUnknown,
kPathStatusChooseStartAndEndPoints,
kPathStatusChooseStartPoint,
kPathStatusChooseEndPoint,
kPathStatusHasValidPath,
kPathStatusHasInvalidPath,
kPathStatusNotEnabled,
kPathStatusNotImplemented,
kPathStatusError
} EPathStatus;
typedef enum
{
kCharacterTypeNone,
kCharacterTypeA,
kCharacterTypeB,
kCharacterTypeC,
kCharacterTypeD
} ECharacterType;
LLPathfindingPathTool();
virtual ~LLPathfindingPathTool();
typedef boost::function<void (void)> path_event_callback_t;
typedef boost::signals2::signal<void (void)> path_event_signal_t;
typedef boost::signals2::connection path_event_slot_t;
virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask);
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask);
EPathStatus getPathStatus() const;
F32 getCharacterWidth() const;
void setCharacterWidth(F32 pCharacterWidth);
ECharacterType getCharacterType() const;
void setCharacterType(ECharacterType pCharacterType);
bool isRenderPath() const;
void clearPath();
path_event_slot_t registerPathEventListener(path_event_callback_t pPathEventCallback);
protected:
private:
bool isAnyPathToolModKeys(MASK pMask) const;
bool isPointAModKeys(MASK pMask) const;
bool isPointBModKeys(MASK pMask) const;
void getRayPoints(S32 pX, S32 pY, LLVector3 &pRayStart, LLVector3 &pRayEnd) const;
void computeFinalPoints(S32 pX, S32 pY, MASK pMask);
void computeTempPoints(S32 pX, S32 pY, MASK pMask);
void setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasFinalA() const;
const LLVector3 &getFinalAStart() const;
const LLVector3 &getFinalAEnd() const;
void setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasTempA() const;
void setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasFinalB() const;
const LLVector3 &getFinalBStart() const;
const LLVector3 &getFinalBEnd() const;
void setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint);
bool hasTempB() const;
void clearFinal();
void clearTemp();
void computeFinalPath();
void computeTempPath();
LLPathingLib::PathingPacket mFinalPathData;
LLPathingLib::PathingPacket mTempPathData;
LLPathingLib::LLPLResult mPathResult;
ECharacterType mCharacterType;
path_event_signal_t mPathEventSignal;
bool mIsLeftMouseButtonHeld;
bool mIsMiddleMouseButtonHeld;
bool mIsRightMouseButtonHeld;
};
#endif // LL_LLPATHFINDINGPATHTOOL_H

File diff suppressed because it is too large Load Diff