diff options
-rw-r--r-- | indra/newview/llfloaterpathfindingcharacters.cpp | 111 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingcharacters.h | 18 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingobjects.cpp | 92 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingobjects.h | 18 | ||||
-rw-r--r-- | indra/newview/llpathfindingcharacter.h | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml | 9 |
7 files changed, 150 insertions, 106 deletions
diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 59f54c12bf..8915683b6d 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -38,6 +38,17 @@ #include "llsd.h" #include "lluicolortable.h" +#include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llfloater.h" +#include "llscrolllistctrl.h" +#include "llscrolllistitem.h" +#include "llselectmgr.h" +#include "pipeline.h" +#include "llviewerobjectlist.h" + +LLHandle<LLFloaterPathfindingCharacters> LLFloaterPathfindingCharacters::sInstanceHandle; + //--------------------------------------------------------------------------- // LLFloaterPathfindingCharacters //--------------------------------------------------------------------------- @@ -46,11 +57,17 @@ void LLFloaterPathfindingCharacters::openCharactersViewer() { LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_characters"); } +void LLFloaterPathfindingCharacters::onClose(bool pIsAppQuitting) +{ +} LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed) : LLFloaterPathfindingObjects(pSeed), - mBeaconColor() + mBeaconColor(), + mSelfHandle(), + mShowPhysicsCapsuleCheckBox(NULL) { + mSelfHandle.bind(this); } LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters() @@ -61,6 +78,10 @@ BOOL LLFloaterPathfindingCharacters::postBuild() { mBeaconColor = LLUIColorTable::getInstance()->getColor("PathfindingCharacterBeaconColor"); + mShowPhysicsCapsuleCheckBox = findChild<LLCheckBoxCtrl>("show_physics_capsule"); + llassert(mShowPhysicsCapsuleCheckBox != NULL); + mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingCharacters::onShowPhysicsCapsuleClicked, this)); + return LLFloaterPathfindingObjects::postBuild(); } @@ -137,3 +158,91 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListData(const LLPathfi return element; } + + +void LLFloaterPathfindingCharacters::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 LLFloaterPathfindingCharacters::isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos ) +{ + BOOL result = false; + if ( mShowPhysicsCapsuleCheckBox->get() ) + { + id = getUUIDFromSelection( pos ); + result = true; + } + else + { + id.setNull(); + } + return result; +} + +LLUUID LLFloaterPathfindingCharacters::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<LLFloaterPathfindingCharacters> LLFloaterPathfindingCharacters::getInstanceHandle() +{ + if ( sInstanceHandle.isDead() ) + { + LLFloaterPathfindingCharacters *floaterInstance = LLFloaterReg::getTypedInstance<LLFloaterPathfindingCharacters>("pathfinding_characters"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} + +void LLFloaterPathfindingCharacters::updateStateOnEditFields() +{ + int numSelectedItems = mObjectsScrollList->getNumSelected(); + bool isEditEnabled = (numSelectedItems > 0); + + mShowPhysicsCapsuleCheckBox->setEnabled(isEditEnabled); + + LLFloaterPathfindingObjects::updateStateOnEditFields(); +} diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index 38fb4d48d7..3c1aee2b80 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -39,7 +39,8 @@ class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects { public: static void openCharactersViewer(); - + /*virtual*/ void onClose(bool pIsAppQuitting); + void updateStateOnEditFields(); protected: friend class LLFloaterReg; @@ -57,10 +58,25 @@ protected: virtual LLPathfindingObjectListPtr getEmptyObjectList() const; + + private: LLSD buildCharacterScrollListData(const LLPathfindingCharacter *pCharacterPtr) const; LLColor4 mBeaconColor; + + LLUUID getUUIDFromSelection( LLVector3& pos ); + +public: + BOOL isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos ); + void onShowPhysicsCapsuleClicked(); + LLRootHandle<LLFloaterPathfindingCharacters> mSelfHandle; + static LLHandle<LLFloaterPathfindingCharacters> sInstanceHandle; + static LLHandle<LLFloaterPathfindingCharacters> getInstanceHandle(); + +public: + LLCheckBoxCtrl *mShowPhysicsCapsuleCheckBox; + }; #endif // LL_LLFLOATERPATHFINDINGCHARACTERS_H 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; } diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index fc096a7c31..e0f3c12419 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -50,6 +50,7 @@ public: virtual void onOpen(const LLSD &pKey); virtual void onClose(bool pIsAppQuitting); virtual void draw(); + virtual void updateStateOnEditFields(); protected: friend class LLFloaterReg; @@ -98,11 +99,6 @@ protected: EMessagingState getMessagingState() const; -public: - LLUUID getUUIDFromSelection( LLVector3& pos ); - BOOL isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos ); - void onShowPhysicsCapsuleClicked(); - private: LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther); @@ -124,18 +120,20 @@ private: void updateMessagingStatus(); void updateStateOnListActionControls(); - void updateStateOnEditFields(); void updateOnScrollListChange(); LLPathfindingObjectPtr findObject(const LLScrollListItem *pListItem) const; + void unhideAnyCharacters( ); + +protected: LLScrollListCtrl *mObjectsScrollList; LLTextBase *mMessagingStatus; LLButton *mRefreshListButton; LLButton *mSelectAllButton; LLButton *mSelectNoneButton; LLCheckBoxCtrl *mShowBeaconCheckBox; - LLCheckBoxCtrl *mShowPhysicsCapsuleCheckBox; + LLButton *mTakeButton; LLButton *mTakeCopyButton; LLButton *mReturnButton; @@ -157,11 +155,7 @@ private: boost::signals2::connection mSelectionUpdateSlot; boost::signals2::connection mRegionBoundaryCrossingSlot; LLAgent::god_level_change_slot_t mGodLevelChangeSlot; -public: - - LLRootHandle<LLFloaterPathfindingObjects> mSelfHandle; - static LLHandle<LLFloaterPathfindingObjects> sInstanceHandle; - static LLHandle<LLFloaterPathfindingObjects> getInstanceHandle(); + }; #endif // LL_LLFLOATERPATHFINDINGOBJECTS_H diff --git a/indra/newview/llpathfindingcharacter.h b/indra/newview/llpathfindingcharacter.h index 6887a99886..772b68c533 100644 --- a/indra/newview/llpathfindingcharacter.h +++ b/indra/newview/llpathfindingcharacter.h @@ -52,6 +52,8 @@ public: protected: +public: + private: void parseCharacterData(const LLSD &pCharacterData); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 46d257bd87..d54accfea5 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -106,7 +106,7 @@ #include "llnotifications.h" #include "llpathinglib.h" #include "llfloaterpathfindingconsole.h" -#include "llfloaterpathfindingobjects.h" +#include "llfloaterpathfindingcharacters.h" #include "llpathfindingpathtool.h" #ifdef _DEBUG @@ -4362,10 +4362,10 @@ void LLPipeline::renderDebug() { //character floater renderables - LLHandle<LLFloaterPathfindingObjects> pathfindingCharacterHandle = LLFloaterPathfindingObjects::getInstanceHandle(); + LLHandle<LLFloaterPathfindingCharacters> pathfindingCharacterHandle = LLFloaterPathfindingCharacters::getInstanceHandle(); if ( !pathfindingCharacterHandle.isDead() ) { - LLFloaterPathfindingObjects *pathfindingCharacter = pathfindingCharacterHandle.get(); + LLFloaterPathfindingCharacters *pathfindingCharacter = pathfindingCharacterHandle.get(); if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() ) { diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml index 063aa7bef0..3ae5301cc2 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -300,15 +300,6 @@ left_pad="0" top_pad="-16" width="90" /> - <check_box - height="19" - follows="left|bottom" - label="Show physics capsule" - layout="topleft" - name="show_physics_capsule" - top_pad="-19" - left_pad="10" - width="90" /> <button follows="left|bottom" height="21" |