From 6bd777214c535b91048533c792cb2dd499ec6ebf Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 18 Nov 2013 19:05:34 -0500 Subject: add callbacks to LLAgent for Region and Parcel changes --- indra/newview/llagent.h | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'indra/newview/llagent.h') diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 7fac17d098..fafa166efd 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -231,15 +231,36 @@ private: LLVector3 mHomePosRegion; //-------------------------------------------------------------------- - // Region + // Parcel //-------------------------------------------------------------------- public: + void changeParcels(); // called by LLViewerParcelMgr when we cross a parcel boundary + + // Register a boost callback to be called when the agent changes parcels + typedef boost::function parcel_changed_callback_t; + boost::signals2::connection addParcelChangedCallback(parcel_changed_callback_t); + +private: + typedef boost::signals2::signal parcel_changed_signal_t; + parcel_changed_signal_t mParcelChangedSignal; + + //-------------------------------------------------------------------- + // Region + //-------------------------------------------------------------------- + public: void setRegion(LLViewerRegion *regionp); LLViewerRegion *getRegion() const; LLHost getRegionHost() const; BOOL inPrelude(); -private: + + // Register a boost callback to be called when the agent changes regions + typedef boost::function region_changed_callback_t; + boost::signals2::connection addRegionChangedCallback(region_changed_callback_t); + + private: LLViewerRegion *mRegionp; + typedef boost::signals2::signal region_changed_signal_t; + region_changed_signal_t mRegionChangedSignal; //-------------------------------------------------------------------- // History @@ -640,9 +661,10 @@ private: public: bool canEditParcel() const { return mCanEditParcel; } private: + static void setCanEditParcel(); bool mCanEditParcel; - static void parcelChangedCallback(); + /******************************************************************************** ** ** -- cgit v1.2.3 From a5db4f6c3d1f6804c20b3095b39203887728d3a6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 19 Nov 2013 09:28:58 -0500 Subject: add documentation to LLAgent::addRegionChangedCallback and improve logging --- indra/newview/llagent.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/newview/llagent.h') diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index fafa166efd..0662be897a 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -253,7 +253,24 @@ private: LLHost getRegionHost() const; BOOL inPrelude(); - // Register a boost callback to be called when the agent changes regions + /** + * Register a boost callback to be called when the agent changes regions + * Note that if you need to access a capability for the region, you may need to wait + * for the capabilities to be received, since in some cases your region changed + * callback will be called before the capabilities have been received. Your callback + * may need to look something like: + * + * LLViewerRegion* region = gAgent.getRegion(); + * if (region->capabilitiesReceived()) + * { + * useCapability(region); + * } + * else // Need to handle via callback after caps arrive. + * { + * region->setCapabilitiesReceivedCallback(boost::bind(&useCapability,region,_1)); + * // you may or may not want to remove that callback + * } + */ typedef boost::function region_changed_callback_t; boost::signals2::connection addRegionChangedCallback(region_changed_callback_t); -- cgit v1.2.3 From 0e346960bb45900cf1d9472834687c9b7b928e1f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 17 Dec 2013 13:05:12 -0500 Subject: add LLAgent::removeRegionChangedCallback --- indra/newview/llagent.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llagent.h') diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 0662be897a..bc003387de 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -273,6 +273,7 @@ private: */ typedef boost::function region_changed_callback_t; boost::signals2::connection addRegionChangedCallback(region_changed_callback_t); + void removeRegionChangedCallback(boost::signals2::connection callback); private: LLViewerRegion *mRegionp; -- cgit v1.2.3 From 1886428638c2cb1e82db9f97ad311c2a506677a6 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Wed, 18 Dec 2013 06:26:22 +0000 Subject: STORM-1831 Changing addRegionChangedCallback to more closely resemble the feature it replaces. This fixes the crashes reported by Whirly ;-) --- indra/newview/llagent.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llagent.h') diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index bc003387de..0766407494 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -271,13 +271,13 @@ private: * // you may or may not want to remove that callback * } */ - typedef boost::function region_changed_callback_t; - boost::signals2::connection addRegionChangedCallback(region_changed_callback_t); + typedef boost::signals2::signal region_changed_signal_t; + + boost::signals2::connection addRegionChangedCallback(const region_changed_signal_t::slot_type& cb); void removeRegionChangedCallback(boost::signals2::connection callback); private: LLViewerRegion *mRegionp; - typedef boost::signals2::signal region_changed_signal_t; region_changed_signal_t mRegionChangedSignal; //-------------------------------------------------------------------- -- cgit v1.2.3