summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpathfindingcharacters.cpp
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-06-25 18:02:41 -0700
committerTodd Stinson <stinson@lindenlab.com>2012-06-25 18:02:41 -0700
commitce101172954c9cbc9a089d8796643d545bdee9d5 (patch)
tree590ee7fb969c5b29034b3e30879406c12c2b6fae /indra/newview/llfloaterpathfindingcharacters.cpp
parentb6d42e0b6223a290f700d9ce9a8aea5f48764610 (diff)
PATH-718: Ensuring that the characters panel will work correctly with a stubbed physicsextension library.
Diffstat (limited to 'indra/newview/llfloaterpathfindingcharacters.cpp')
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.cpp40
1 files changed, 35 insertions, 5 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