summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.cpp40
-rw-r--r--indra/newview/llpathfindingcharacter.cpp5
-rw-r--r--indra/newview/llpathfindingcharacterlist.cpp6
3 files changed, 35 insertions, 16 deletions
diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index 7a4c5c81cb..5245b78871 100644
--- a/indra/newview/llfloaterpathfindingcharacters.cpp
+++ b/indra/newview/llfloaterpathfindingcharacters.cpp
@@ -36,7 +36,9 @@
#include "llpathfindingcharacter.h"
#include "llpathfindingcharacterlist.h"
#include "llpathfindingmanager.h"
+#include "llpathfindingobject.h"
#include "llpathfindingobjectlist.h"
+#include "llpathinglib.h"
#include "llsd.h"
#include "lluicolortable.h"
#include "llviewerobject.h"
@@ -63,7 +65,7 @@ BOOL LLFloaterPathfindingCharacters::isShowPhysicsCapsule() const
void LLFloaterPathfindingCharacters::setShowPhysicsCapsule(BOOL pIsShowPhysicsCapsule)
{
- mShowPhysicsCapsuleCheckBox->set(pIsShowPhysicsCapsule);
+ mShowPhysicsCapsuleCheckBox->set(pIsShowPhysicsCapsule && (LLPathingLib::getInstance() != NULL));
}
BOOL LLFloaterPathfindingCharacters::isPhysicsCapsuleEnabled(LLUUID& id, LLVector3& pos, LLQuaternion& rot) const
@@ -115,6 +117,7 @@ BOOL LLFloaterPathfindingCharacters::postBuild()
mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule");
llassert(mShowPhysicsCapsuleCheckBox != NULL);
mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked, this));
+ mShowPhysicsCapsuleCheckBox->setEnabled(LLPathingLib::getInstance() != NULL);
return LLFloaterPathfindingObjects::postBuild();
}
@@ -171,13 +174,23 @@ LLPathfindingObjectListPtr LLFloaterPathfindingCharacters::getEmptyObjectList()
void LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked()
{
- if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule())
+ if (LLPathingLib::getInstance() == NULL)
{
- showCapsule();
+ if (isShowPhysicsCapsule())
+ {
+ setShowPhysicsCapsule(FALSE);
+ }
}
else
{
- hideCapsule();
+ if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule())
+ {
+ showCapsule();
+ }
+ else
+ {
+ hideCapsule();
+ }
}
}
@@ -222,7 +235,7 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListData(const LLPathfi
void LLFloaterPathfindingCharacters::updateStateOnDisplayControls()
{
int numSelectedItems = getNumSelectedObjects();;
- bool isEditEnabled = (numSelectedItems == 1);
+ bool isEditEnabled = ((numSelectedItems == 1) && (LLPathingLib::getInstance() != NULL));
mShowPhysicsCapsuleCheckBox->setEnabled(isEditEnabled);
if (!isEditEnabled)
@@ -256,6 +269,19 @@ void LLFloaterPathfindingCharacters::showCapsule() const
{
if (mSelectedCharacterId.notNull() && isShowPhysicsCapsule())
{
+ LLPathfindingObjectPtr objectPtr = getFirstSelectedObject();
+ llassert(objectPtr != NULL);
+ if (objectPtr != NULL)
+ {
+ const LLPathfindingCharacter *character = dynamic_cast<const LLPathfindingCharacter *>(objectPtr.get());
+ llassert(mSelectedCharacterId == character->getUUID());
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(),
+ character->isHorizontal(), character->getUUID());
+ }
+ }
+
gPipeline.hideObject(mSelectedCharacterId);
}
}
@@ -266,6 +292,10 @@ void LLFloaterPathfindingCharacters::hideCapsule() const
{
gPipeline.restoreHiddenObject(mSelectedCharacterId);
}
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals();
+ }
}
bool LLFloaterPathfindingCharacters::getCapsuleRenderData(LLVector3& pPosition, LLQuaternion& rot) const
diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp
index 98e9141043..c9f3555e9c 100644
--- a/indra/newview/llpathfindingcharacter.cpp
+++ b/indra/newview/llpathfindingcharacter.cpp
@@ -31,7 +31,6 @@
#include "llpathfindingobject.h"
#include "llsd.h"
-#include "llpathinglib.h"
#define CHARACTER_CPU_TIME_FIELD "cpu_time"
#define CHARACTER_HORIZONTAL_FIELD "horizontal"
@@ -94,8 +93,4 @@ void LLPathfindingCharacter::parseCharacterData(const LLSD &pCharacterData)
llassert(pCharacterData.has(CHARACTER_RADIUS_FIELD));
llassert(pCharacterData.get(CHARACTER_RADIUS_FIELD).isReal());
mRadius = pCharacterData.get(CHARACTER_RADIUS_FIELD).asReal();
-
- //Create the rep inside the pathing library
- LLVector3 empty(0,0,0);
- LLPathingLib::getInstance()->createPhysicsCapsuleRep( mLength, mRadius, mIsHorizontal, empty, getUUID() );
}
diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp
index ac1fb15be9..9b0ed14e35 100644
--- a/indra/newview/llpathfindingcharacterlist.cpp
+++ b/indra/newview/llpathfindingcharacterlist.cpp
@@ -33,7 +33,6 @@
#include "llpathfindingobject.h"
#include "llpathfindingobjectlist.h"
#include "llsd.h"
-#include "llpathinglib.h"
//---------------------------------------------------------------------------
// LLPathfindingCharacterList
@@ -47,11 +46,6 @@ LLPathfindingCharacterList::LLPathfindingCharacterList()
LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterListData)
: LLPathfindingObjectList()
{
- if (LLPathingLib::getInstance() != NULL)
- {
- LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals( );
- }
-
parseCharacterListData(pCharacterListData);
}