From 3c2be426e5e905076d00b9492c0e66c8b31caf19 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 30 May 2012 18:47:12 -0700 Subject: First pass at refactoring the pathfinding linksets and pathfinding characters classes to reduce code duplication, as both functionalities were heavily duplicated. --- indra/newview/llfloaterpathfindingobjects.h | 152 ++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 indra/newview/llfloaterpathfindingobjects.h (limited to 'indra/newview/llfloaterpathfindingobjects.h') diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h new file mode 100644 index 0000000000..7fa7f89f51 --- /dev/null +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -0,0 +1,152 @@ +/** +* @file llfloaterpathfindingobjects.h +* @brief Header file for llfloaterpathfindingobjects +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, 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_LLFLOATERPATHFINDINGOBJECTS_H +#define LL_LLFLOATERPATHFINDINGOBJECTS_H + +#include + +#include "llfloater.h" +#include "llpathfindingmanager.h" +#include "llpathfindingobject.h" +#include "llpathfindingobjectlist.h" +#include "llselectmgr.h" +#include "v4color.h" + +class LLButton; +class LLCheckBoxCtrl; +class LLScrollListCtrl; +class LLSD; +class LLTextBase; + +class LLFloaterPathfindingObjects : public LLFloater +{ +public: + virtual void onOpen(const LLSD &pKey); + virtual void onClose(bool pIsAppQuitting); + virtual void draw(); + +protected: + friend class LLFloaterReg; + + typedef enum + { + kMessagingUnknown, + kMessagingGetRequestSent, + kMessagingGetError, + kMessagingSetRequestSent, + kMessagingSetError, + kMessagingComplete, + kMessagingNotEnabled + } EMessagingState; + + LLFloaterPathfindingObjects(const LLSD &pSeed); + virtual ~LLFloaterPathfindingObjects(); + + virtual BOOL postBuild(); + + virtual void requestGetObjects(); + LLPathfindingManager::request_id_t getNewRequestId(); + void handleNewObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList); + void handleUpdateObjectList(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pRequestStatus, LLPathfindingObjectListPtr pObjectList); + + void rebuildObjectsScrollList(); + virtual LLSD convertObjectsIntoScrollListData(const LLPathfindingObjectListPtr pObjectListPtr) const; + + virtual void updateControls(); + virtual void updateSelection(); + + virtual S32 getNameColumnIndex() const; + virtual const LLColor4 &getBeaconColor() const; + virtual const LLColor4 &getBeaconTextColor() const; + virtual S32 getBeaconWidth() const; + + BOOL isShowBeacons() const; + void clearAllObjects(); + void selectAllObjects(); + void selectNoneObjects(); + void teleportToSelectedObject(); + + virtual LLPathfindingObjectListPtr getEmptyObjectList() const; + int getNumSelectedObjects() const; + LLPathfindingObjectListPtr getSelectedObjects() const; + LLPathfindingObjectPtr getFirstSelectedObject() const; + + EMessagingState getMessagingState() const; + +private: + LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther); + + void setMessagingState(EMessagingState pMessagingState); + + void onRefreshObjectsClicked(); + void onSelectAllObjectsClicked(); + void onSelectNoneObjectsClicked(); + void onTakeClicked(); + void onTakeCopyClicked(); + void onReturnClicked(); + void onDeleteClicked(); + void onTeleportClicked(); + + void onScrollListSelectionChanged(); + void onSelectionListChanged(); + void onRegionBoundaryCrossed(); + + void updateMessagingStatus(); + void updateStateOnListActionControls(); + void updateStateOnEditFields(); + + LLPathfindingObjectPtr findObject(const LLScrollListItem *pListItem) const; + + LLScrollListCtrl *mObjectsScrollList; + LLTextBase *mMessagingStatus; + LLButton *mRefreshListButton; + LLButton *mSelectAllButton; + LLButton *mSelectNoneButton; + LLCheckBoxCtrl *mShowBeaconCheckBox; + LLButton *mTakeButton; + LLButton *mTakeCopyButton; + LLButton *mReturnButton; + LLButton *mDeleteButton; + LLButton *mTeleportButton; + + LLColor4 mDefaultBeaconColor; + LLColor4 mDefaultBeaconTextColor; + LLColor4 mErrorTextColor; + LLColor4 mWarningTextColor; + + EMessagingState mMessagingState; + LLPathfindingManager::request_id_t mMessagingRequestId; + + LLPathfindingObjectListPtr mObjectList; + + LLObjectSelectionHandle mObjectsSelection; + + boost::signals2::connection mSelectionUpdateSlot; + boost::signals2::connection mRegionBoundaryCrossingSlot; +}; + +#endif // LL_LLFLOATERPATHFINDINGOBJECTS_H -- cgit v1.3 From 3352a1eac15f752535b636866eeb966ec3900c62 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Wed, 30 May 2012 19:39:08 -0700 Subject: Cleaning up some unreferenced headers and classes definitions from previous refactoring. --- indra/newview/llfloaterpathfindingcharacters.cpp | 5 ++-- indra/newview/llfloaterpathfindingcharacters.h | 8 +------ indra/newview/llfloaterpathfindinglinksets.cpp | 11 ++------- indra/newview/llfloaterpathfindinglinksets.h | 1 + indra/newview/llfloaterpathfindingobjects.cpp | 5 +--- indra/newview/llfloaterpathfindingobjects.h | 1 + indra/newview/llpathfindingcharacterlist.cpp | 2 +- indra/newview/llpathfindingcharacterlist.h | 1 - indra/newview/llpathfindinglinkset.cpp | 2 ++ indra/newview/llpathfindinglinkset.h | 30 +++++++++++++----------- indra/newview/llpathfindinglinksetlist.cpp | 5 +++- indra/newview/llpathfindinglinksetlist.h | 1 - indra/newview/llpathfindingmanager.cpp | 4 +--- indra/newview/llpathfindingmanager.h | 2 -- indra/newview/llpathfindingobject.h | 4 ++-- indra/newview/llpathfindingobjectlist.cpp | 2 ++ 16 files changed, 37 insertions(+), 47 deletions(-) (limited to 'indra/newview/llfloaterpathfindingobjects.h') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index 6599bac6a6..59f54c12bf 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -33,9 +33,10 @@ #include "llfloaterpathfindingobjects.h" #include "llpathfindingcharacter.h" #include "llpathfindingcharacterlist.h" +#include "llpathfindingmanager.h" +#include "llpathfindingobjectlist.h" #include "llsd.h" -#include "lluuid.h" -#include "llviewerregion.h" +#include "lluicolortable.h" //--------------------------------------------------------------------------- // LLFloaterPathfindingCharacters diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index c4277b9d25..38fb4d48d7 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -29,17 +29,11 @@ #define LL_LLFLOATERPATHFINDINGCHARACTERS_H #include "llfloaterpathfindingobjects.h" -#include "llpathfindingcharacter.h" -#include "llpathfindingmanager.h" #include "llpathfindingobjectlist.h" #include "v4color.h" -class LLButton; -class LLCheckBoxCtrl; -class LLRadioGroup; -class LLScrollListCtrl; +class LLPathfindingCharacter; class LLSD; -class LLTextBase; class LLFloaterPathfindingCharacters : public LLFloaterPathfindingObjects { diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 7fe22f65cf..36f54ffae1 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -33,27 +33,20 @@ #include "llagent.h" #include "llbutton.h" -#include "llcheckboxctrl.h" #include "llcombobox.h" -#include "llfloater.h" #include "llfloaterreg.h" #include "lllineeditor.h" #include "llnotificationsutil.h" #include "llpathfindinglinkset.h" #include "llpathfindinglinksetlist.h" #include "llpathfindingmanager.h" -#include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsd.h" -#include "llselectmgr.h" #include "lltextbase.h" #include "lltextvalidate.h" -#include "lluuid.h" -#include "llviewermenu.h" -#include "llviewerobject.h" -#include "llviewerobjectlist.h" -#include "llviewerregion.h" +#include "lluicolortable.h" #include "v3math.h" +#include "v4color.h" #define XUI_LINKSET_USE_NONE 0 #define XUI_LINKSET_USE_WALKABLE 1 diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index bad803f420..d989e0ea4d 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -41,6 +41,7 @@ class LLScrollListItem; class LLSD; class LLTextBase; class LLUICtrl; +class LLVector3; class LLFloaterPathfindingLinksets : public LLFloaterPathfindingObjects { diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index 3b3de3f417..e8d80c09d8 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -34,14 +34,10 @@ #include #include -#include "v4color.h" - #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llcombobox.h" #include "llenvmanager.h" -#include "lllineeditor.h" #include "llfloater.h" #include "llpathfindingmanager.h" #include "llresmgr.h" @@ -57,6 +53,7 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" +#include "v4color.h" #define DEFAULT_BEACON_WIDTH 6 diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index 7fa7f89f51..34eb129864 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -39,6 +39,7 @@ class LLButton; class LLCheckBoxCtrl; class LLScrollListCtrl; +class LLScrollListItem; class LLSD; class LLTextBase; diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp index 53b21f436d..9b0ed14e35 100644 --- a/indra/newview/llpathfindingcharacterlist.cpp +++ b/indra/newview/llpathfindingcharacterlist.cpp @@ -29,10 +29,10 @@ #include "llpathfindingcharacterlist.h" -#include "llsd.h" #include "llpathfindingcharacter.h" #include "llpathfindingobject.h" #include "llpathfindingobjectlist.h" +#include "llsd.h" //--------------------------------------------------------------------------- // LLPathfindingCharacterList diff --git a/indra/newview/llpathfindingcharacterlist.h b/indra/newview/llpathfindingcharacterlist.h index a80db08c87..734cfcafa1 100644 --- a/indra/newview/llpathfindingcharacterlist.h +++ b/indra/newview/llpathfindingcharacterlist.h @@ -28,7 +28,6 @@ #ifndef LL_LLPATHFINDINGCHARACTERLIST_H #define LL_LLPATHFINDINGCHARACTERLIST_H -#include "llpathfindingcharacter.h" #include "llpathfindingobjectlist.h" class LLSD; diff --git a/indra/newview/llpathfindinglinkset.cpp b/indra/newview/llpathfindinglinkset.cpp index dca5b6c93d..5b321b4408 100644 --- a/indra/newview/llpathfindinglinkset.cpp +++ b/indra/newview/llpathfindinglinkset.cpp @@ -29,6 +29,8 @@ #include "llpathfindinglinkset.h" +#include + #include "llpathfindingobject.h" #include "llsd.h" diff --git a/indra/newview/llpathfindinglinkset.h b/indra/newview/llpathfindinglinkset.h index cda71dffb3..a598452ea5 100644 --- a/indra/newview/llpathfindinglinkset.h +++ b/indra/newview/llpathfindinglinkset.h @@ -28,6 +28,8 @@ #ifndef LL_LLPATHFINDINGLINKSET_H #define LL_LLPATHFINDINGLINKSET_H +#include + #include "llpathfindingobject.h" #define DEPRECATED_NAVMESH_PERMANENT_WALKABLE_FLAGS @@ -56,23 +58,23 @@ public: LLPathfindingLinkset& operator = (const LLPathfindingLinkset& pOther); - inline bool isTerrain() const {return mIsTerrain;}; - inline U32 getLandImpact() const {return mLandImpact;}; - BOOL isModifiable() const {return mIsModifiable;}; - BOOL isPhantom() const; - BOOL canBeVolume() const {return mCanBeVolume;}; - static ELinksetUse getLinksetUseWithToggledPhantom(ELinksetUse pLinksetUse); + inline bool isTerrain() const {return mIsTerrain;}; + inline U32 getLandImpact() const {return mLandImpact;}; + 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 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;}; + 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; + 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; diff --git a/indra/newview/llpathfindinglinksetlist.cpp b/indra/newview/llpathfindinglinksetlist.cpp index 0ba6ef07f3..5323635438 100644 --- a/indra/newview/llpathfindinglinksetlist.cpp +++ b/indra/newview/llpathfindinglinksetlist.cpp @@ -29,10 +29,13 @@ #include "llpathfindinglinksetlist.h" -#include "llsd.h" +#include +#include + #include "llpathfindinglinkset.h" #include "llpathfindingobject.h" #include "llpathfindingobjectlist.h" +#include "llsd.h" //--------------------------------------------------------------------------- // LLPathfindingLinksetList diff --git a/indra/newview/llpathfindinglinksetlist.h b/indra/newview/llpathfindinglinksetlist.h index 7bd6986094..50a8e069d0 100644 --- a/indra/newview/llpathfindinglinksetlist.h +++ b/indra/newview/llpathfindinglinksetlist.h @@ -32,7 +32,6 @@ #include "llpathfindingobjectlist.h" class LLSD; -class LLVector3; class LLPathfindingLinksetList : public LLPathfindingObjectList { diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index b8b9dff51c..e282a3e2f4 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -30,7 +30,7 @@ #include "llpathfindingmanager.h" #include -#include +#include #include #include @@ -39,14 +39,12 @@ #include "llhttpclient.h" #include "llhttpnode.h" #include "llnotificationsutil.h" -#include "llpathfindingcharacter.h" #include "llpathfindingcharacterlist.h" #include "llpathfindinglinkset.h" #include "llpathfindinglinksetlist.h" #include "llpathfindingnavmesh.h" #include "llpathfindingnavmeshstatus.h" #include "llpathfindingobject.h" -#include "llpathfindinglinksetlist.h" #include "llsingleton.h" #include "llsd.h" #include "lltrans.h" diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 172670cdf8..3c9af91e7b 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -40,7 +40,6 @@ #include "llsingleton.h" #include "lluuid.h" -class LLFloater; class LLViewerRegion; class LLPathfindingNavMeshStatus; @@ -143,4 +142,3 @@ private: }; #endif // LL_LLPATHFINDINGMANAGER_H - diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index 9dc114b40f..880a3a6864 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -27,9 +27,9 @@ #ifndef LL_LLPATHFINDINGOBJECT_H #define LL_LLPATHFINDINGOBJECT_H -#include "v3math.h" #include "llavatarname.h" #include "lluuid.h" +#include "v3math.h" #include @@ -60,7 +60,7 @@ public: protected: private: - void parseObjectData(const LLSD &pObjectData); + void parseObjectData(const LLSD &pObjectData); LLUUID mUUID; std::string mName; diff --git a/indra/newview/llpathfindingobjectlist.cpp b/indra/newview/llpathfindingobjectlist.cpp index cad3a0a00f..68a7e736e6 100644 --- a/indra/newview/llpathfindingobjectlist.cpp +++ b/indra/newview/llpathfindingobjectlist.cpp @@ -32,6 +32,8 @@ #include #include +#include "llpathfindingobject.h" + //--------------------------------------------------------------------------- // LLPathfindingObjectList //--------------------------------------------------------------------------- -- cgit v1.3 From 938f42ded789dd70b31820d29694256cec3a1572 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 31 May 2012 12:22:47 -0700 Subject: Reloading the the pathfinding object floaters when the god level is changed. --- indra/newview/llagent.cpp | 7 +++++++ indra/newview/llagent.h | 10 ++++++++++ indra/newview/llfloaterpathfindingobjects.cpp | 15 +++++++++++++++ indra/newview/llfloaterpathfindingobjects.h | 3 +++ 4 files changed, 35 insertions(+) (limited to 'indra/newview/llfloaterpathfindingobjects.h') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3870a3be2e..d94e01ee47 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -243,6 +243,7 @@ LLAgent::LLAgent() : mbTeleportKeepsLookAt(false), mAgentAccess(new LLAgentAccess(gSavedSettings)), + mGodLevelChangeSignal(), mCanEditParcel(false), mTeleportSourceSLURL(new LLSLURL), mTeleportState( TELEPORT_NONE ), @@ -2434,6 +2435,12 @@ void LLAgent::setAdminOverride(BOOL b) void LLAgent::setGodLevel(U8 god_level) { mAgentAccess->setGodLevel(god_level); + mGodLevelChangeSignal(god_level); +} + +LLAgent::god_level_change_slot_t LLAgent::registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback) +{ + return mGodLevelChangeSignal.connect(pGodLevelChangeCallback); } void LLAgent::setAOTransition() diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 740770bbdf..72f695d917 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -631,6 +631,16 @@ public: void requestEnterGodMode(); void requestLeaveGodMode(); + typedef boost::function god_level_change_callback_t; + typedef boost::signals2::signal god_level_change_signal_t; + typedef boost::signals2::connection god_level_change_slot_t; + + god_level_change_slot_t registerGodLevelChanageListener(god_level_change_callback_t pGodLevelChangeCallback); + +private: + god_level_change_signal_t mGodLevelChangeSignal; + + //-------------------------------------------------------------------- // Maturity //-------------------------------------------------------------------- diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index e8d80c09d8..3f6c4983d5 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -78,11 +78,21 @@ void LLFloaterPathfindingObjects::onOpen(const LLSD &pKey) mRegionBoundaryCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLFloaterPathfindingObjects::onRegionBoundaryCrossed, this)); } + if (!mGodLevelChangeSlot.connected()) + { + mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterPathfindingObjects::onGodLevelChange, this, _1)); + } + requestGetObjects(); } void LLFloaterPathfindingObjects::onClose(bool pIsAppQuitting) { + if (mGodLevelChangeSlot.connected()) + { + mGodLevelChangeSlot.disconnect(); + } + if (mRegionBoundaryCrossingSlot.connected()) { mRegionBoundaryCrossingSlot.disconnect(); @@ -554,6 +564,11 @@ void LLFloaterPathfindingObjects::onRegionBoundaryCrossed() requestGetObjects(); } +void LLFloaterPathfindingObjects::onGodLevelChange(U8 pGodLevel) +{ + requestGetObjects(); +} + void LLFloaterPathfindingObjects::updateMessagingStatus() { std::string statusText(""); diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index 34eb129864..79d241757c 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -29,6 +29,7 @@ #include +#include "llagent.h" #include "llfloater.h" #include "llpathfindingmanager.h" #include "llpathfindingobject.h" @@ -115,6 +116,7 @@ private: void onScrollListSelectionChanged(); void onSelectionListChanged(); void onRegionBoundaryCrossed(); + void onGodLevelChange(U8 pGodLevel); void updateMessagingStatus(); void updateStateOnListActionControls(); @@ -148,6 +150,7 @@ private: boost::signals2::connection mSelectionUpdateSlot; boost::signals2::connection mRegionBoundaryCrossingSlot; + LLAgent::god_level_change_slot_t mGodLevelChangeSlot; }; #endif // LL_LLFLOATERPATHFINDINGOBJECTS_H -- cgit v1.3 From ef75a2e07ec4f26c9126c04af1adfbd28d7eaa9b Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 31 May 2012 16:38:19 -0400 Subject: WIP:Displaying physics capsule for a character - it is currently disabled. --- indra/llcommon/lluuid.cpp | 171 ++++++++++++++++++++ indra/llcommon/lluuid.h | 173 +-------------------- indra/newview/llfloaterpathfindingobjects.cpp | 91 ++++++++++- indra/newview/llfloaterpathfindingobjects.h | 11 ++ indra/newview/llpathfindingcharacter.cpp | 8 + indra/newview/llpathfindingcharacterlist.cpp | 8 + indra/newview/pipeline.cpp | 144 +++++++++++++---- indra/newview/pipeline.h | 5 +- .../xui/en/floater_pathfinding_characters.xml | 9 ++ .../xui/en/floater_pathfinding_linksets.xml | 9 ++ 10 files changed, 427 insertions(+), 202 deletions(-) (limited to 'indra/newview/llfloaterpathfindingobjects.h') diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 5d452ac4e4..db8c9c85ab 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -922,3 +922,174 @@ LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const } return result; } + +// Construct +LLUUID::LLUUID() +{ + setNull(); +} + + +// Faster than copying from memory + void LLUUID::setNull() +{ + U32 *word = (U32 *)mData; + word[0] = 0; + word[1] = 0; + word[2] = 0; + word[3] = 0; +} + + +// Compare + bool LLUUID::operator==(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary & to avoid branching + return + (tmp[0] == rhstmp[0]) & + (tmp[1] == rhstmp[1]) & + (tmp[2] == rhstmp[2]) & + (tmp[3] == rhstmp[3]); +} + + + bool LLUUID::operator!=(const LLUUID& rhs) const +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + // Note: binary | to avoid branching + return + (tmp[0] != rhstmp[0]) | + (tmp[1] != rhstmp[1]) | + (tmp[2] != rhstmp[2]) | + (tmp[3] != rhstmp[3]); +} + +/* +// JC: This is dangerous. It allows UUIDs to be cast automatically +// to integers, among other things. Use isNull() or notNull(). + LLUUID::operator bool() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} +*/ + + BOOL LLUUID::notNull() const +{ + U32 *word = (U32 *)mData; + return (word[0] | word[1] | word[2] | word[3]) > 0; +} + +// Faster than == LLUUID::null because doesn't require +// as much memory access. + BOOL LLUUID::isNull() const +{ + U32 *word = (U32 *)mData; + // If all bits are zero, return !0 == TRUE + return !(word[0] | word[1] | word[2] | word[3]); +} + +// Copy constructor + LLUUID::LLUUID(const LLUUID& rhs) +{ + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; +} + + LLUUID::~LLUUID() +{ +} + +// Assignment + LLUUID& LLUUID::operator=(const LLUUID& rhs) +{ + // No need to check the case where this==&rhs. The branch is slower than the write. + U32 *tmp = (U32 *)mData; + U32 *rhstmp = (U32 *)rhs.mData; + tmp[0] = rhstmp[0]; + tmp[1] = rhstmp[1]; + tmp[2] = rhstmp[2]; + tmp[3] = rhstmp[3]; + + return *this; +} + + + LLUUID::LLUUID(const char *in_string) +{ + if (!in_string || in_string[0] == 0) + { + setNull(); + return; + } + + set(in_string); +} + + LLUUID::LLUUID(const std::string& in_string) +{ + if (in_string.empty()) + { + setNull(); + return; + } + + set(in_string); +} + +// IW: DON'T "optimize" these w/ U32s or you'll scoogie the sort order +// IW: this will make me very sad + bool LLUUID::operator<(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] < rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] < rhs.mData[UUID_BYTES - 1]); +} + + bool LLUUID::operator>(const LLUUID &rhs) const +{ + U32 i; + for( i = 0; i < (UUID_BYTES - 1); i++ ) + { + if( mData[i] != rhs.mData[i] ) + { + return (mData[i] > rhs.mData[i]); + } + } + return (mData[UUID_BYTES - 1] > rhs.mData[UUID_BYTES - 1]); +} + + U16 LLUUID::getCRC16() const +{ + // A UUID is 16 bytes, or 8 shorts. + U16 *short_data = (U16*)mData; + U16 out = 0; + out += short_data[0]; + out += short_data[1]; + out += short_data[2]; + out += short_data[3]; + out += short_data[4]; + out += short_data[5]; + out += short_data[6]; + out += short_data[7]; + return out; +} + + U32 LLUUID::getCRC32() const +{ + U32 *tmp = (U32*)mData; + return tmp[0] + tmp[1] + tmp[2] + tmp[3]; +} diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 726be4a82d..0b9e7d0cd0 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -129,177 +129,6 @@ public: typedef std::vector uuid_vec_t; -// Construct -inline LLUUID::LLUUID() -{ - setNull(); -} - - -// Faster than copying from memory -inline void LLUUID::setNull() -{ - U32 *word = (U32 *)mData; - word[0] = 0; - word[1] = 0; - word[2] = 0; - word[3] = 0; -} - - -// Compare -inline bool LLUUID::operator==(const LLUUID& rhs) const -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary & to avoid branching - return - (tmp[0] == rhstmp[0]) & - (tmp[1] == rhstmp[1]) & - (tmp[2] == rhstmp[2]) & - (tmp[3] == rhstmp[3]); -} - - -inline bool LLUUID::operator!=(const LLUUID& rhs) const -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary | to avoid branching - return - (tmp[0] != rhstmp[0]) | - (tmp[1] != rhstmp[1]) | - (tmp[2] != rhstmp[2]) | - (tmp[3] != rhstmp[3]); -} - -/* -// JC: This is dangerous. It allows UUIDs to be cast automatically -// to integers, among other things. Use isNull() or notNull(). -inline LLUUID::operator bool() const -{ - U32 *word = (U32 *)mData; - return (word[0] | word[1] | word[2] | word[3]) > 0; -} -*/ - -inline BOOL LLUUID::notNull() const -{ - U32 *word = (U32 *)mData; - return (word[0] | word[1] | word[2] | word[3]) > 0; -} - -// Faster than == LLUUID::null because doesn't require -// as much memory access. -inline BOOL LLUUID::isNull() const -{ - U32 *word = (U32 *)mData; - // If all bits are zero, return !0 == TRUE - return !(word[0] | word[1] | word[2] | word[3]); -} - -// Copy constructor -inline LLUUID::LLUUID(const LLUUID& rhs) -{ - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; -} - -inline LLUUID::~LLUUID() -{ -} - -// Assignment -inline LLUUID& LLUUID::operator=(const LLUUID& rhs) -{ - // No need to check the case where this==&rhs. The branch is slower than the write. - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; - - return *this; -} - - -inline LLUUID::LLUUID(const char *in_string) -{ - if (!in_string || in_string[0] == 0) - { - setNull(); - return; - } - - set(in_string); -} - -inline LLUUID::LLUUID(const std::string& in_string) -{ - if (in_string.empty()) - { - setNull(); - return; - } - - set(in_string); -} - -// IW: DON'T "optimize" these w/ U32s or you'll scoogie the sort order -// IW: this will make me very sad -inline bool LLUUID::operator<(const LLUUID &rhs) const -{ - U32 i; - for( i = 0; i < (UUID_BYTES - 1); i++ ) - { - if( mData[i] != rhs.mData[i] ) - { - return (mData[i] < rhs.mData[i]); - } - } - return (mData[UUID_BYTES - 1] < rhs.mData[UUID_BYTES - 1]); -} - -inline bool LLUUID::operator>(const LLUUID &rhs) const -{ - U32 i; - for( i = 0; i < (UUID_BYTES - 1); i++ ) - { - if( mData[i] != rhs.mData[i] ) - { - return (mData[i] > rhs.mData[i]); - } - } - return (mData[UUID_BYTES - 1] > rhs.mData[UUID_BYTES - 1]); -} - -inline U16 LLUUID::getCRC16() const -{ - // A UUID is 16 bytes, or 8 shorts. - U16 *short_data = (U16*)mData; - U16 out = 0; - out += short_data[0]; - out += short_data[1]; - out += short_data[2]; - out += short_data[3]; - out += short_data[4]; - out += short_data[5]; - out += short_data[6]; - out += short_data[7]; - return out; -} - -inline U32 LLUUID::getCRC32() const -{ - U32 *tmp = (U32*)mData; - return tmp[0] + tmp[1] + tmp[2] + tmp[3]; -} - // Helper structure for ordering lluuids in stl containers. // eg: std::map widget_map; @@ -329,3 +158,5 @@ public: }; #endif + + diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index e8d80c09d8..572f2f707e 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -54,9 +54,13 @@ #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "v4color.h" +#include "pipeline.h" +#include "llfloaterreg.h" #define DEFAULT_BEACON_WIDTH 6 +LLHandle LLFloaterPathfindingObjects::sInstanceHandle; + //--------------------------------------------------------------------------- // LLFloaterPathfindingObjects //--------------------------------------------------------------------------- @@ -144,6 +148,7 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) mSelectAllButton(NULL), mSelectNoneButton(NULL), mShowBeaconCheckBox(NULL), + mShowPhysicsCapsuleCheckBox(NULL), mTakeButton(NULL), mTakeCopyButton(NULL), mReturnButton(NULL), @@ -158,8 +163,10 @@ LLFloaterPathfindingObjects::LLFloaterPathfindingObjects(const LLSD &pSeed) mObjectList(), mObjectsSelection(), mSelectionUpdateSlot(), - mRegionBoundaryCrossingSlot() + mRegionBoundaryCrossingSlot(), + mSelfHandle() { + mSelfHandle.bind(this); } LLFloaterPathfindingObjects::~LLFloaterPathfindingObjects() @@ -196,6 +203,10 @@ BOOL LLFloaterPathfindingObjects::postBuild() mShowBeaconCheckBox = findChild("show_beacon"); llassert(mShowBeaconCheckBox != NULL); + mShowPhysicsCapsuleCheckBox = findChild("show_physics_capsule"); + llassert(mShowPhysicsCapsuleCheckBox != NULL); + mShowPhysicsCapsuleCheckBox->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onShowPhysicsCapsuleClicked, this)); + mTakeButton = findChild("take_objects"); llassert(mTakeButton != NULL); mTakeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingObjects::onTakeClicked, this)); @@ -657,6 +668,7 @@ 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()); @@ -675,3 +687,80 @@ 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 selectedItems = mObjectsScrollList->getAllSelected(); + if ( selectedItems.size() > 1 ) + { + return LLUUID::null; + } + if (selectedItems.size() == 1) + { + std::vector::const_reference selectedItemRef = selectedItems.front(); + const LLScrollListItem *selectedItem = selectedItemRef; + llassert(mObjectList != NULL); + LLViewerObject *viewerObject = gObjectList.findObject( selectedItem->getUUID() ); + if ( viewerObject != NULL ) + { + pos = viewerObject->getRenderPosition(); + } + //prep#llinfos<<"id : "<getUUID()<getUUID(); + } + + return LLUUID::null; +} + +LLHandle LLFloaterPathfindingObjects::getInstanceHandle() +{ + if ( sInstanceHandle.isDead() ) + { + LLFloaterPathfindingObjects *floaterInstance = LLFloaterReg::getTypedInstance("pathfinding_characters"); + if (floaterInstance != NULL) + { + sInstanceHandle = floaterInstance->mSelfHandle; + } + } + + return sInstanceHandle; +} diff --git a/indra/newview/llfloaterpathfindingobjects.h b/indra/newview/llfloaterpathfindingobjects.h index 34eb129864..f9c099e1a2 100644 --- a/indra/newview/llfloaterpathfindingobjects.h +++ b/indra/newview/llfloaterpathfindingobjects.h @@ -98,6 +98,11 @@ protected: EMessagingState getMessagingState() const; +public: + LLUUID getUUIDFromSelection( LLVector3& pos ); + BOOL isPhysicsCapsuleEnabled( LLUUID& id, LLVector3& pos ); + void onShowPhysicsCapsuleClicked(); + private: LLFloaterPathfindingObjects(const LLFloaterPathfindingObjects &pOther); @@ -128,6 +133,7 @@ private: LLButton *mSelectAllButton; LLButton *mSelectNoneButton; LLCheckBoxCtrl *mShowBeaconCheckBox; + LLCheckBoxCtrl *mShowPhysicsCapsuleCheckBox; LLButton *mTakeButton; LLButton *mTakeCopyButton; LLButton *mReturnButton; @@ -148,6 +154,11 @@ private: boost::signals2::connection mSelectionUpdateSlot; boost::signals2::connection mRegionBoundaryCrossingSlot; +public: + + LLRootHandle mSelfHandle; + static LLHandle sInstanceHandle; + static LLHandle getInstanceHandle(); }; #endif // LL_LLFLOATERPATHFINDINGOBJECTS_H diff --git a/indra/newview/llpathfindingcharacter.cpp b/indra/newview/llpathfindingcharacter.cpp index 0696783bf7..011a736568 100644 --- a/indra/newview/llpathfindingcharacter.cpp +++ b/indra/newview/llpathfindingcharacter.cpp @@ -31,12 +31,16 @@ #include "llpathfindingobject.h" #include "llsd.h" +#include "llpathinglib.h" #define CHARACTER_CPU_TIME_FIELD "cpu_time" #define CHARACTER_HORIZONTAL_FIELD "horizontal" #define CHARACTER_LENGTH_FIELD "length" #define CHARACTER_RADIUS_FIELD "radius" +//prep# +#define SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE + //--------------------------------------------------------------------------- // LLPathfindingCharacter //--------------------------------------------------------------------------- @@ -119,5 +123,9 @@ 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 + LLPathingLib::getInstance()->createPhysicsCapsuleRep( mLength, mRadius, mIsHorizontal, LLVector3(0,0,0), getUUID() ); + #endif // SERVER_SIDE_CHARACTER_SHAPE_ROLLOUT_COMPLETE } diff --git a/indra/newview/llpathfindingcharacterlist.cpp b/indra/newview/llpathfindingcharacterlist.cpp index 9b0ed14e35..15eaac771f 100644 --- a/indra/newview/llpathfindingcharacterlist.cpp +++ b/indra/newview/llpathfindingcharacterlist.cpp @@ -33,6 +33,7 @@ #include "llpathfindingobject.h" #include "llpathfindingobjectlist.h" #include "llsd.h" +#include "llpathinglib.h" //--------------------------------------------------------------------------- // LLPathfindingCharacterList @@ -46,6 +47,13 @@ LLPathfindingCharacterList::LLPathfindingCharacterList() LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterListData) : LLPathfindingObjectList() { + if ( LLPathingLib::getInstance() == NULL ) + { + LLPathingLib::initSystem(); + } + + LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals( ); + parseCharacterListData(pCharacterListData); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index cdcf468a4d..46d257bd87 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -106,6 +106,7 @@ #include "llnotifications.h" #include "llpathinglib.h" #include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindingobjects.h" #include "llpathfindingpathtool.h" #ifdef _DEBUG @@ -4359,6 +4360,49 @@ void LLPipeline::renderDebug() LLPathingLib *llPathingLibInstance = LLPathingLib::getInstance(); if ( llPathingLibInstance != NULL ) { + //character floater renderables + + LLHandle pathfindingCharacterHandle = LLFloaterPathfindingObjects::getInstanceHandle(); + if ( !pathfindingCharacterHandle.isDead() ) + { + LLFloaterPathfindingObjects *pathfindingCharacter = pathfindingCharacterHandle.get(); + + if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() ) + { + if (LLGLSLShader::sNoFixedFunction) + { + gPathfindingProgram.bind(); + gPathfindingProgram.uniform1f("tint", 1.f); + gPathfindingProgram.uniform1f("ambiance", 1.f); + gPathfindingProgram.uniform1f("alpha_scale", 1.f); + } + + LLUUID id; + LLVector3 pos; + if ( pathfindingCharacter->isPhysicsCapsuleEnabled( id, pos ) ) + { + if (LLGLSLShader::sNoFixedFunction) + { + //remove blending artifacts + gGL.setColorMask(false, false); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START ); + llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END ); + gGL.setColorMask(true, false); + LLGLEnable blend(GL_BLEND); + gPathfindingProgram.uniform1f("alpha_scale", 0.90f); + llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos ); + gPathfindingProgram.bind(); + } + else + { + llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos ); + } + } + } + } + + + //pathing console renderables LLHandle pathfindingConsoleHandle = LLFloaterPathfindingConsole::getInstanceHandle(); if (!pathfindingConsoleHandle.isDead()) { @@ -10145,21 +10189,7 @@ void LLPipeline::hidePermanentObjects( std::vector& restoreList ) if ( pDrawable ) { restoreList.push_back( i ); - pDrawable->setState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); - //hide children - LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); - for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); iter++ ) - { - LLViewerObject* child = *iter; - LLDrawable* drawable = child->mDrawable; - if (drawable) - { - drawable->setState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); - } - } + hideDrawable( pDrawable ); } } } @@ -10191,20 +10221,7 @@ void LLPipeline::restorePermanentObjects( const std::vector& restoreList ) if ( pDrawable ) { pDrawable->clearState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); - //restore children - LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); - for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); iter++) - { - LLViewerObject* child = *iter; - LLDrawable* drawable = child->mDrawable; - if (drawable) - { - drawable->clearState( LLDrawable::FORCE_INVISIBLE ); - markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); - } - } + unhideDrawable( pDrawable ); } } ++itCurrent; @@ -10227,3 +10244,72 @@ void LLPipeline::skipRenderingOfTerrain( BOOL flag ) ++iter; } } + +void LLPipeline::hideObject( const LLUUID& id ) +{ + LLViewerObject *pVO = gObjectList.findObject( id ); + + if ( pVO ) + { + LLDrawable *pDrawable = pVO->mDrawable; + + if ( pDrawable ) + { + hideDrawable( pDrawable ); + } + } +} + +void LLPipeline::hideDrawable( LLDrawable *pDrawable ) +{ + pDrawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //hide the children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++ ) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if ( drawable ) + { + drawable->setState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } +} +void LLPipeline::unhideDrawable( LLDrawable *pDrawable ) +{ + pDrawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( pDrawable, LLDrawable::REBUILD_ALL, TRUE ); + //restore children + LLViewerObject::const_child_list_t& child_list = pDrawable->getVObj()->getChildren(); + for ( LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++) + { + LLViewerObject* child = *iter; + LLDrawable* drawable = child->mDrawable; + if ( drawable ) + { + drawable->clearState( LLDrawable::FORCE_INVISIBLE ); + markRebuild( drawable, LLDrawable::REBUILD_ALL, TRUE ); + } + } +} +void LLPipeline::restoreHiddenObject( const LLUUID& id ) +{ + LLViewerObject *pVO = gObjectList.findObject( id ); + + if ( pVO ) + { + LLDrawable *pDrawable = pVO->mDrawable; + if ( pDrawable ) + { + unhideDrawable( pDrawable ); + } + } +} + + + + diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index f431576702..117b18be80 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -371,6 +371,8 @@ public: void hidePermanentObjects( std::vector& restoreList ); void restorePermanentObjects( const std::vector& restoreList ); void skipRenderingOfTerrain( BOOL flag ); + void hideObject( const LLUUID& id ); + void restoreHiddenObject( const LLUUID& id ); private: void unloadShaders(); @@ -379,7 +381,8 @@ private: BOOL updateDrawableGeom(LLDrawable* drawable, BOOL priority); void assertInitializedDoError(); bool assertInitialized() { const bool is_init = isInit(); if (!is_init) assertInitializedDoError(); return is_init; }; - + void hideDrawable( LLDrawable *pDrawable ); + void unhideDrawable( LLDrawable *pDrawable ); public: enum {GPU_CLASS_MAX = 3 }; diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml index a81c4cb891..fac6ee05bb 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_characters.xml @@ -147,6 +147,15 @@ top_pad="-16" left_pad="0" width="90" /> +