diff options
author | prep <none@none> | 2012-06-01 15:48:19 -0400 |
---|---|---|
committer | prep <none@none> | 2012-06-01 15:48:19 -0400 |
commit | a8ff37b95609148c60ddda9acfca65b2b89d6b9d (patch) | |
tree | 391f3c53eebb67a5efedfbfb46b9714a374baffe /indra/newview/llfloaterpathfindingobjects.cpp | |
parent | ed486b3ca00c12aee5b1f594f9f8e507e784996a (diff) |
Migrated physics capsule logic into pathing character object
Diffstat (limited to 'indra/newview/llfloaterpathfindingobjects.cpp')
-rw-r--r-- | indra/newview/llfloaterpathfindingobjects.cpp | 92 |
1 files changed, 12 insertions, 80 deletions
diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index 8d5674054b..da7c51599f 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -59,8 +59,6 @@ #define DEFAULT_BEACON_WIDTH 6 -LLHandle<LLFloaterPathfindingObjects> LLFloaterPathfindingObjects::sInstanceHandle; - //--------------------------------------------------------------------------- // LLFloaterPathfindingObjects //--------------------------------------------------------------------------- @@ -92,6 +90,8 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey) void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting) { + unhideAnyCharacters(); + if (mGodLevelChangeSlot.connected()) { mGodLevelChangeSlot.disconnect(); @@ -158,7 +158,6 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) mSelectAllButton(NULL), mSelectNoneButton(NULL), mShowBeaconCheckBox(NULL), - mShowPhysicsCapsuleCheckBox(NULL), mTakeButton(NULL), mTakeCopyButton(NULL), mReturnButton(NULL), @@ -173,10 +172,8 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) mObjectList(), mObjectsSelection(), mSelectionUpdateSlot(), - mRegionBoundaryCrossingSlot(), - mSelfHandle() + mRegionBoundaryCrossingSlot() { - mSelfHandle.bind(this); } LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects() @@ -213,10 +210,6 @@ BOOL LLFloaterPathfindingObjects::postBuild() mShowBeaconCheckBox = findChild<LLCheckBoxCtrl>("show_beacon"); llassert(mShowBeaconCheckBox != NULL); - mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule"); - llassert(mShowPhysicsCapsuleCheckBox != NULL); - mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onShowPhysicsCapsuleClicked, this)); - mTakeButton = findChild<LLButton>("take_objects"); llassert(mTakeButton != NULL); mTakeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeClicked, this)); @@ -649,7 +642,6 @@ void LLFloaterPathfindingObjects::updateStateOnEditFields() bool isEditEnabled = (numSelectedItems > 0); mShowBeaconCheckBox->setEnabled(isEditEnabled); - //prep#mShowPhysicsCapsuleCheckBox->setEnabled( false ); mTakeButton->setEnabled(isEditEnabled && visible_take_object()); mTakeCopyButton->setEnabled(isEditEnabled && enable_object_take_copy()); mReturnButton->setEnabled(isEditEnabled && enable_object_return()); @@ -701,79 +693,19 @@ LLPathfindingObjectPtr LLFloaterPathfindingObjects::findObject(const LLScrollLis return objectPtr; } -void LLFloaterPathfindingObjects::onShowPhysicsCapsuleClicked() -{ - if ( mShowPhysicsCapsuleCheckBox->get() ) - { - //We want to hide the VO and display the the objects physics capsule - LLVector3 pos; - LLUUID id = getUUIDFromSelection( pos ); - if ( id.notNull() ) - { - gPipeline.hideObject( id ); - } - } - else - { - //We want to restore the selected objects vo and disable the physics capsule rendering - LLVector3 pos; - LLUUID id = getUUIDFromSelection( pos ); - if ( id.notNull() ) - { - gPipeline.restoreHiddenObject( id ); - } - } -} - -BOOL LLFloaterPathfindingObjects::isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos ) -{ - BOOL result = false; - if ( mShowPhysicsCapsuleCheckBox->get() ) - { - id = getUUIDFromSelection( pos ); - result = true; - } - else - { - id.setNull(); - } - return result; -} -LLUUID LLFloaterPathfindingObjects::getUUIDFromSelection( LLVector3& pos ) -{ - std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); - if ( selectedItems.size() > 1 ) - { - return LLUUID::null; - } - if (selectedItems.size() == 1) - { - std::vector<LLScrollListItem*>::const_reference selectedItemRef = selectedItems.front(); - const LLScrollListItem *selectedItem = selectedItemRef; - llassert(mObjectList != NULL); - LLViewerObject *viewerObject = gObjectList.findObject( selectedItem->getUUID() ); - if ( viewerObject != NULL ) - { - pos = viewerObject->getRenderPosition(); - } - //llinfos<<"id : "<<selectedItem->getUUID()<<llendl; - return selectedItem->getUUID(); - } - - return LLUUID::null; -} - -LLHandle<LLFloaterPathfindingObjects> LLFloaterPathfindingObjects::getInstanceHandle() +void LLFloaterPathfindingObjects::unhideAnyCharacters( ) { - if ( sInstanceHandle.isDead() ) + std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); + int numSelectedItems = selectedItems.size(); + uuid_vec_t selectedUUIDs; + if (numSelectedItems > 0) { - LLFloaterPathfindingObjects *floaterInstance = LLFloaterReg::getTypedInstance<LLFloaterPathfindingObjects>("pathfinding_characters"); - if (floaterInstance != NULL) + for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin(); + itemIter != selectedItems.end(); ++itemIter) { - sInstanceHandle = floaterInstance->mSelfHandle; + const LLScrollListItem *listItem = *itemIter; + gPipeline.restoreHiddenObject( listItem->getUUID() ); } } - - return sInstanceHandle; } |