diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llfloatermediasettings.cpp | 13 | ||||
| -rw-r--r-- | indra/newview/llpanelmediasettingsgeneral.cpp | 37 | ||||
| -rw-r--r-- | indra/newview/llpanelmediasettingsgeneral.h | 3 | ||||
| -rw-r--r-- | indra/newview/llpanelmediasettingspermissions.cpp | 95 | ||||
| -rw-r--r-- | indra/newview/llpanelmediasettingspermissions.h | 3 | ||||
| -rw-r--r-- | indra/newview/llpanelmediasettingssecurity.cpp | 100 | ||||
| -rw-r--r-- | indra/newview/llpanelmediasettingssecurity.h | 5 | ||||
| -rw-r--r-- | indra/newview/llselectmgr.cpp | 95 | ||||
| -rw-r--r-- | indra/newview/llselectmgr.h | 3 | 
9 files changed, 189 insertions, 165 deletions
| diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp index 976af121ae..7388f7ea3f 100644 --- a/indra/newview/llfloatermediasettings.cpp +++ b/indra/newview/llfloatermediasettings.cpp @@ -149,13 +149,14 @@ void LLFloaterMediaSettings::apply()  	{  		LLSD settings;  		sInstance->mPanelMediaSettingsGeneral->preApply(); -		sInstance->mPanelMediaSettingsGeneral->getValues( settings ); +		sInstance->mPanelMediaSettingsGeneral->getValues( settings, false );  		sInstance->mPanelMediaSettingsSecurity->preApply(); -		sInstance->mPanelMediaSettingsSecurity->getValues( settings ); +		sInstance->mPanelMediaSettingsSecurity->getValues( settings, false );  		sInstance->mPanelMediaSettingsPermissions->preApply(); -		sInstance->mPanelMediaSettingsPermissions->getValues( settings ); -		LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA ); -		LLSelectMgr::getInstance()->selectionSetMediaData(settings); +		sInstance->mPanelMediaSettingsPermissions->getValues( settings, false ); +			 +		LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA, settings ); +  		sInstance->mPanelMediaSettingsGeneral->postApply();  		sInstance->mPanelMediaSettingsSecurity->postApply();  		sInstance->mPanelMediaSettingsPermissions->postApply(); @@ -176,6 +177,8 @@ void LLFloaterMediaSettings::onClose(bool app_quitting)  //static   void LLFloaterMediaSettings::initValues( const LLSD& media_settings, bool editable )  { +	if (sInstance->hasFocus()) return; +	  	sInstance->clearValues(editable);  	// update all panels with values from simulator  	sInstance->mPanelMediaSettingsGeneral-> diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp index f574f55beb..f601a8d51c 100644 --- a/indra/newview/llpanelmediasettingsgeneral.cpp +++ b/indra/newview/llpanelmediasettingsgeneral.cpp @@ -250,18 +250,18 @@ bool LLPanelMediaSettingsGeneral::isMultiple()  ////////////////////////////////////////////////////////////////////////////////  // static  -void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& media_settings ,bool editable) +void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& _media_settings, bool editable)  {  	LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;  	self->mMediaEditable = editable; +	LLSD media_settings = _media_settings; +	  	if ( LLPanelMediaSettingsGeneral::isMultiple() )  	{ -		self->clearValues(self, self->mMediaEditable); -		// only show multiple  -		self->mHomeURL->setText(LLTrans::getString("Multiple Media")); -		self->mCurrentURL->setText(LLTrans::getString("Multiple Media")); -		return; +		// *HACK:  "edit" the incoming media_settings +		media_settings[LLMediaEntry::CURRENT_URL_KEY] = LLTrans::getString("Multiple Media"); +		media_settings[LLMediaEntry::HOME_URL_KEY] = LLTrans::getString("Multiple Media");  	}  	std::string base_key( "" ); @@ -286,7 +286,7 @@ void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& media_  		{ LLMediaEntry::WIDTH_PIXELS_KEY,			self->mWidthPixels,		"LLSpinCtrl" },  		{ "", NULL , "" }  	}; - +	  	for( int i = 0; data_set[ i ].key_name.length() > 0; ++i )  	{  		base_key = std::string( data_set[ i ].key_name ); @@ -405,20 +405,21 @@ void LLPanelMediaSettingsGeneral::preApply()  ////////////////////////////////////////////////////////////////////////////////  // -void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in ) +void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in, bool include_tentative )  { -	fill_me_in[LLMediaEntry::AUTO_LOOP_KEY] = (LLSD::Boolean)mAutoLoop->getValue(); -	fill_me_in[LLMediaEntry::AUTO_PLAY_KEY] = (LLSD::Boolean)mAutoPlay->getValue(); -	fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = (LLSD::Boolean)mAutoScale->getValue(); -	fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = (LLSD::Boolean)mAutoZoom->getValue(); +	if (include_tentative || !mAutoLoop->getTentative()) fill_me_in[LLMediaEntry::AUTO_LOOP_KEY] = (LLSD::Boolean)mAutoLoop->getValue(); +	if (include_tentative || !mAutoPlay->getTentative()) fill_me_in[LLMediaEntry::AUTO_PLAY_KEY] = (LLSD::Boolean)mAutoPlay->getValue(); +	if (include_tentative || !mAutoScale->getTentative()) fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = (LLSD::Boolean)mAutoScale->getValue(); +	if (include_tentative || !mAutoZoom->getTentative()) fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = (LLSD::Boolean)mAutoZoom->getValue();  	//Don't fill in current URL: this is only supposed to get changed via navigate -	// fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue(); -	fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = (LLSD::Integer)mHeightPixels->getValue(); +	// if (include_tentative || !mCurrentURL->getTentative()) fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue(); +	if (include_tentative || !mHeightPixels->getTentative()) fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = (LLSD::Integer)mHeightPixels->getValue();  	// Don't fill in the home URL if it is the special "Multiple Media" string! -	if (LLTrans::getString("Multiple Media") != mHomeURL->getValue()) -		fill_me_in[LLMediaEntry::HOME_URL_KEY] = (LLSD::String)mHomeURL->getValue(); -	fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = (LLSD::Boolean)mFirstClick->getValue(); -	fill_me_in[LLMediaEntry::WIDTH_PIXELS_KEY] = (LLSD::Integer)mWidthPixels->getValue(); +	if ((include_tentative || !mHomeURL->getTentative()) +		&& LLTrans::getString("Multiple Media") != mHomeURL->getValue()) +			fill_me_in[LLMediaEntry::HOME_URL_KEY] = (LLSD::String)mHomeURL->getValue(); +	if (include_tentative || !mFirstClick->getTentative()) fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = (LLSD::Boolean)mFirstClick->getValue(); +	if (include_tentative || !mWidthPixels->getTentative()) fill_me_in[LLMediaEntry::WIDTH_PIXELS_KEY] = (LLSD::Integer)mWidthPixels->getValue();  }  //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelmediasettingsgeneral.h b/indra/newview/llpanelmediasettingsgeneral.h index 5f90321362..a3f0990f35 100644 --- a/indra/newview/llpanelmediasettingsgeneral.h +++ b/indra/newview/llpanelmediasettingsgeneral.h @@ -54,7 +54,8 @@ public:  	// Hook that the floater calls before applying changes from the panel  	void preApply();  	// Function that asks the panel to fill in values associated with the panel -    void getValues(LLSD &fill_me_in); +	// 'include_tentative' means fill in tentative values as well, otherwise do not +	void getValues(LLSD &fill_me_in, bool include_tentative = true);  	// Hook that the floater calls after applying changes to the panel  	void postApply(); diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp index a23aed2e98..e5caaaaffc 100644 --- a/indra/newview/llpanelmediasettingspermissions.cpp +++ b/indra/newview/llpanelmediasettingspermissions.cpp @@ -149,27 +149,6 @@ void LLPanelMediaSettingsPermissions::clearValues( void* userdata, bool editable  void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& media_settings ,  bool editable)  {      LLPanelMediaSettingsPermissions *self =(LLPanelMediaSettingsPermissions *)userdata; - -	if ( LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo ) -	{ -		if(LLFloaterMediaSettings::getInstance()->mMultipleMedia)  -		{ -			self->clearValues(self, editable); -			// only show multiple  -			return; -		} -		 -	} -	else -	{ -		if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)  -		{ -			self->clearValues(self, editable); -			// only show multiple  -			return; -		}			 -		 -	}      std::string base_key( "" );      std::string tentative_key( "" ); @@ -215,7 +194,29 @@ void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& me              data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );          };      }; - +	 +	// *NOTE: If any of a particular flavor is tentative, we have to disable  +	// them all because of an architectural issue: namely that we represent  +	// these as a bit field, and we can't selectively apply only one bit to all selected +	// faces if they don't match.  Also see the *NOTE below. +	if ( self->mPermsOwnerInteract->getTentative() || +		 self->mPermsGroupInteract->getTentative() || +		 self->mPermsWorldInteract->getTentative()) +	{ +		self->mPermsOwnerInteract->setEnabled(false); +		self->mPermsGroupInteract->setEnabled(false); +		self->mPermsWorldInteract->setEnabled(false); +	}	 +	if ( self->mPermsOwnerControl->getTentative() || +		 self->mPermsGroupControl->getTentative() || +		 self->mPermsWorldControl->getTentative()) +	{ +		self->mPermsOwnerControl->setEnabled(false); +		self->mPermsGroupControl->setEnabled(false); +		self->mPermsWorldControl->setEnabled(false); +	} +	 +	  	self->childSetEnabled("media_perms_label_owner", editable );  	self->childSetText("media_perms_label_owner",  LLTrans::getString("Media Perms Owner") );  	self->childSetEnabled("media_perms_label_group", editable ); @@ -233,29 +234,47 @@ void LLPanelMediaSettingsPermissions::preApply()  ////////////////////////////////////////////////////////////////////////////////  // -void LLPanelMediaSettingsPermissions::getValues( LLSD &fill_me_in ) +void LLPanelMediaSettingsPermissions::getValues( LLSD &fill_me_in, bool include_tentative )  {  	// moved over from the 'General settings' tab -	fill_me_in[LLMediaEntry::CONTROLS_KEY] = (LLSD::Integer)mControls->getCurrentIndex(); - -    // *NOTE: For some reason, gcc does not like these symbol references in the  -    // expressions below (inside the static_casts).  I have NO idea why :(. -    // For some reason, assigning them to const temp vars here fixes the link -    // error.  Bizarre. -    const U8 none = LLMediaEntry::PERM_NONE; -    const U8 owner = LLMediaEntry::PERM_OWNER; -    const U8 group = LLMediaEntry::PERM_GROUP; -    const U8 anyone = LLMediaEntry::PERM_ANYONE; -    const LLSD::Integer control = static_cast<LLSD::Integer>( +	if (include_tentative || !mControls->getTentative()) fill_me_in[LLMediaEntry::CONTROLS_KEY] = (LLSD::Integer)mControls->getCurrentIndex(); +	 +	// *NOTE: For some reason, gcc does not like these symbol references in the  +	// expressions below (inside the static_casts).	 I have NO idea why :(. +	// For some reason, assigning them to const temp vars here fixes the link +	// error.  Bizarre. +	const U8 none = LLMediaEntry::PERM_NONE; +	const U8 owner = LLMediaEntry::PERM_OWNER; +	const U8 group = LLMediaEntry::PERM_GROUP; +	const U8 anyone = LLMediaEntry::PERM_ANYONE;  +	const LLSD::Integer control = static_cast<LLSD::Integer>(  		(mPermsOwnerControl->getValue() ? owner : none ) |  		(mPermsGroupControl->getValue() ? group: none  ) |  		(mPermsWorldControl->getValue() ? anyone : none )); -    const LLSD::Integer interact = static_cast<LLSD::Integer>( -		(mPermsOwnerInteract->getValue() ? owner: none  ) | +	const LLSD::Integer interact = static_cast<LLSD::Integer>( +		(mPermsOwnerInteract->getValue() ? owner: none	) |  		(mPermsGroupInteract->getValue() ? group : none ) |  		(mPermsWorldInteract->getValue() ? anyone : none )); -    fill_me_in[LLMediaEntry::PERMS_CONTROL_KEY] = control; -    fill_me_in[LLMediaEntry::PERMS_INTERACT_KEY] = interact; +	 +	// *TODO: This will fill in the values of all permissions values, even if +	// one or more is tentative.  This is not quite the user expectation...what +	// it should do is only change the bit that was made "untentative", but in +	// a multiple-selection situation, this isn't possible given the architecture +	// for how settings are applied. +	if (include_tentative ||  +		!mPermsOwnerControl->getTentative() ||  +		!mPermsGroupControl->getTentative() ||  +		!mPermsWorldControl->getTentative()) +	{ +		fill_me_in[LLMediaEntry::PERMS_CONTROL_KEY] = control; +	} +	if (include_tentative ||  +		!mPermsOwnerInteract->getTentative() ||  +		!mPermsGroupInteract->getTentative() ||  +		!mPermsWorldInteract->getTentative()) +	{ +		fill_me_in[LLMediaEntry::PERMS_INTERACT_KEY] = interact; +	}  } diff --git a/indra/newview/llpanelmediasettingspermissions.h b/indra/newview/llpanelmediasettingspermissions.h index bd0c3b8ab5..858544605c 100644 --- a/indra/newview/llpanelmediasettingspermissions.h +++ b/indra/newview/llpanelmediasettingspermissions.h @@ -57,7 +57,8 @@ public:  	// Hook that the floater calls before applying changes from the panel  	void preApply();  	// Function that asks the panel to fill in values associated with the panel -    void getValues(LLSD &fill_me_in); +	// 'include_tentative' means fill in tentative values as well, otherwise do not +	void getValues(LLSD &fill_me_in, bool include_tentative = true);  	// Hook that the floater calls after applying changes to the panel  	void postApply(); diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp index 81842e3851..1b1346c41a 100644 --- a/indra/newview/llpanelmediasettingssecurity.cpp +++ b/indra/newview/llpanelmediasettingssecurity.cpp @@ -94,27 +94,6 @@ void LLPanelMediaSettingsSecurity::draw()  void LLPanelMediaSettingsSecurity::initValues( void* userdata, const LLSD& media_settings , bool editable)  {  	LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata; - -	if ( LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo ) -	{ -		if(LLFloaterMediaSettings::getInstance()->mMultipleMedia)  -		{ -			self->clearValues(self, editable); -			// only show multiple  -			return; -		} -		 -	} -	else -	{ -		if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)  -		{ -			self->clearValues(self, editable); -			// only show multiple  -			return; -		}			 -		 -	}  	std::string base_key( "" );  	std::string tentative_key( "" ); @@ -136,6 +115,8 @@ void LLPanelMediaSettingsSecurity::initValues( void* userdata, const LLSD& media  		base_key = std::string( data_set[ i ].key_name );          tentative_key = base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX ); +		bool enabled_overridden = false; +		  		// TODO: CP - I bet there is a better way to do this using Boost  		if ( media_settings[ base_key ].isDefined() )  		{ @@ -150,20 +131,31 @@ void LLPanelMediaSettingsSecurity::initValues( void* userdata, const LLSD& media  				// get control   				LLScrollListCtrl* list = static_cast< LLScrollListCtrl* >( data_set[ i ].ctrl_ptr );  				list->deleteAllItems(); - +				  				// points to list of white list URLs  				LLSD url_list = media_settings[ base_key ]; - -				// iterate over them and add to scroll list -				LLSD::array_iterator iter = url_list.beginArray(); -				while( iter != url_list.endArray() ) +				 +				// better be the whitelist +				llassert(data_set[ i ].ctrl_ptr == self->mWhiteListList); +				 +				// If tentative, don't add entries +				if (media_settings[ tentative_key ].asBoolean())  				{ -					std::string entry = *iter; -					self->addWhiteListEntry( entry ); -					++iter; -				}; +					self->mWhiteListList->setEnabled(false); +					enabled_overridden = true; +				} +				else { +					// iterate over them and add to scroll list +					LLSD::array_iterator iter = url_list.beginArray(); +					while( iter != url_list.endArray() ) +					{ +						std::string entry = *iter; +						self->addWhiteListEntry( entry ); +						++iter; +					} +				}  			}; -			data_set[ i ].ctrl_ptr->setEnabled(editable); +			if ( ! enabled_overridden) data_set[ i ].ctrl_ptr->setEnabled(editable);  			data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );  		};  	}; @@ -192,25 +184,29 @@ void LLPanelMediaSettingsSecurity::preApply()  ////////////////////////////////////////////////////////////////////////////////  // -void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in ) +void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in, bool include_tentative )  { -    fill_me_in[LLMediaEntry::WHITELIST_ENABLE_KEY] = (LLSD::Boolean)mEnableWhiteList->getValue(); - -    // iterate over white list and extract items -    std::vector< LLScrollListItem* > whitelist_items = mWhiteListList->getAllData(); -    std::vector< LLScrollListItem* >::iterator iter = whitelist_items.begin(); - -	// *NOTE: need actually set the key to be an emptyArray(), or the merge -	// we do with this LLSD will think there's nothing to change. -    fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray(); -    while( iter != whitelist_items.end() ) -    { -		LLScrollListCell* cell = (*iter)->getColumn( ENTRY_COLUMN ); -		std::string whitelist_url = cell->getValue().asString(); - -        fill_me_in[ LLMediaEntry::WHITELIST_KEY ].append( whitelist_url ); -        ++iter; -    }; +    if (include_tentative || !mEnableWhiteList->getTentative())  +		fill_me_in[LLMediaEntry::WHITELIST_ENABLE_KEY] = (LLSD::Boolean)mEnableWhiteList->getValue(); +	 +	if (include_tentative || !mWhiteListList->getTentative()) +	{ +		// iterate over white list and extract items +		std::vector< LLScrollListItem* > whitelist_items = mWhiteListList->getAllData(); +		std::vector< LLScrollListItem* >::iterator iter = whitelist_items.begin(); +		 +		// *NOTE: need actually set the key to be an emptyArray(), or the merge +		// we do with this LLSD will think there's nothing to change. +		fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray(); +		while( iter != whitelist_items.end() ) +		{ +			LLScrollListCell* cell = (*iter)->getColumn( ENTRY_COLUMN ); +			std::string whitelist_url = cell->getValue().asString(); +			 +			fill_me_in[ LLMediaEntry::WHITELIST_KEY ].append( whitelist_url ); +			++iter; +		}; +	}  }  //////////////////////////////////////////////////////////////////////////////// @@ -247,6 +243,10 @@ const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string&  // white list list box widget and build a list to test against.   bool LLPanelMediaSettingsSecurity::urlPassesWhiteList( const std::string& test_url )  { +	// If the whitlelist list is tentative, it means we have multiple settings. +	// In that case, we have no choice but to return true +	if ( mWhiteListList->getTentative() ) return true; +	  	// the checkUrlAgainstWhitelist(..) function works on a vector  	// of strings for the white list entries - in this panel, the white list  	// is stored in the widgets themselves so we need to build something compatible. @@ -330,7 +330,7 @@ void LLPanelMediaSettingsSecurity::addWhiteListEntry( const std::string& entry )  	// always add in the entry itself  	row[ "columns" ][ ENTRY_COLUMN ][ "type" ] = "text";  	row[ "columns" ][ ENTRY_COLUMN ][ "value" ] = entry; - +	  	// add to the white list scroll box  	mWhiteListList->addElement( row );  }; diff --git a/indra/newview/llpanelmediasettingssecurity.h b/indra/newview/llpanelmediasettingssecurity.h index 66ccb23f46..94f2fdc89c 100644 --- a/indra/newview/llpanelmediasettingssecurity.h +++ b/indra/newview/llpanelmediasettingssecurity.h @@ -53,11 +53,12 @@ public:  	// Hook that the floater calls before applying changes from the panel  	void preApply();  	// Function that asks the panel to fill in values associated with the panel -    void getValues(LLSD &fill_me_in); +	// 'include_tentative' means fill in tentative values as well, otherwise do not +	void getValues(LLSD &fill_me_in, bool include_tentative = true);  	// Hook that the floater calls after applying changes to the panel  	void postApply(); -	static void initValues( void* userdata, const LLSD& media_settings,bool editable ); +	static void initValues( void* userdata, const LLSD& media_settings, bool editable);  	static void clearValues( void* userdata, bool editable);  	void addWhiteListEntry( const std::string& url );  	void setParent( LLFloaterMediaSettings* parent ); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index bf08756051..9540894646 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -41,6 +41,7 @@  #include "lldbstrings.h"  #include "lleconomy.h"  #include "llgl.h" +#include "llmediaentry.h"  #include "llrender.h"  #include "llnotifications.h"  #include "llpermissions.h" @@ -1739,70 +1740,70 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright)  	getSelection()->applyToObjects(&sendfunc);  } -void LLSelectMgr::selectionSetMedia(U8 media_type) -{ -	 -	struct f : public LLSelectedTEFunctor -	{ -		U8 mMediaFlags; -		f(const U8& t) : mMediaFlags(t) {} -		bool apply(LLViewerObject* object, S32 te) -		{ -			if (object->permModify()) -			{ -				// update viewer has media -				object->setTEMediaFlags(te, mMediaFlags); -			} -			return true; -		} -	} setfunc(media_type); -	getSelection()->applyToTEs(&setfunc); -	struct f2 : public LLSelectedObjectFunctor -	{ -		virtual bool apply(LLViewerObject* object) -		{ -			if (object->permModify()) -			{ -				object->sendTEUpdate(); -			} -			return true; -		} -	} func2; -	mSelectedObjects->applyToObjects( &func2 ); -} -  // This function expects media_data to be a map containing relevant  // media data name/value pairs (e.g. home_url, etc.) -void LLSelectMgr::selectionSetMediaData(const LLSD &media_data) -{ - +void LLSelectMgr::selectionSetMedia(U8 media_type, const LLSD &media_data) +{	  	struct f : public LLSelectedTEFunctor  	{ +		U8 mMediaFlags;  		const LLSD &mMediaData; -		f(const LLSD& t) : mMediaData(t) {} +		f(const U8& t, const LLSD& d) : mMediaFlags(t), mMediaData(d) {}  		bool apply(LLViewerObject* object, S32 te)  		{  			if (object->permModify())  			{ -                LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object); -                if (NULL != vo)  -                { -                    vo->syncMediaData(te, mMediaData, true/*merge*/, true/*ignore_agent*/); -                }                 +				// If we are adding media, then check the current state of the +				// media data on this face.   +				//  - If it does not have media, AND we are NOT setting the HOME URL, then do NOT add media to this +				// face. +				//  - If it does not have media, and we ARE setting the HOME URL, add media to this face. +				//  - If it does already have media, add/update media to/on this face +				// If we are removing media, just do it (ignore the passed-in LLSD). +				if (mMediaFlags & LLTextureEntry::MF_HAS_MEDIA) +				{ +					llassert(mMediaData.isMap()); +					const LLTextureEntry *texture_entry = object->getTE(te); +					if (!mMediaData.isMap() || +						(NULL != texture_entry) && !texture_entry->hasMedia() && !mMediaData.has(LLMediaEntry::HOME_URL_KEY)) +					{ +						// skip adding/updating media +					} +					else { +						// Add/update media +						object->setTEMediaFlags(te, mMediaFlags); +						LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object); +						llassert(NULL != vo); +						if (NULL != vo)  +						{ +							vo->syncMediaData(te, mMediaData, true/*merge*/, true/*ignore_agent*/); +						} +					} +				} +				else +				{ +					// delete media (or just set the flags) +					object->setTEMediaFlags(te, mMediaFlags); +				}  			}  			return true;  		} -	} setfunc(media_data); +	} setfunc(media_type, media_data);  	getSelection()->applyToTEs(&setfunc); - +	  	struct f2 : public LLSelectedObjectFunctor  	{  		virtual bool apply(LLViewerObject* object)  		{  			if (object->permModify())  			{ -                LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object); -                if (NULL != vo)  +				object->sendTEUpdate(); +				LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object); +				llassert(NULL != vo); +				// It's okay to skip this object if hasMedia() is false... +				// the sendTEUpdate() above would remove all media data if it were +				// there. +                if (NULL != vo && vo->hasMedia())                  {                      // Send updated media data FOR THE ENTIRE OBJECT                      vo->sendMediaDataUpdate(); @@ -1811,11 +1812,9 @@ void LLSelectMgr::selectionSetMediaData(const LLSD &media_data)  			return true;  		}  	} func2; -	getSelection()->applyToObjects(&func2); +	mSelectedObjects->applyToObjects( &func2 );  } - -  void LLSelectMgr::selectionSetGlow(F32 glow)  {  	struct f1 : public LLSelectedTEFunctor diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index f8ecfd0674..00474827ca 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -502,8 +502,7 @@ public:  	void selectionSetTexGen( U8 texgen );  	void selectionSetShiny( U8 shiny );  	void selectionSetFullbright( U8 fullbright ); -	void selectionSetMedia( U8 media_type ); -	void selectionSetMediaData(const LLSD &media_data); // NOTE: modifies media_data!!! +	void selectionSetMedia( U8 media_type, const LLSD &media_data );  	void selectionSetClickAction(U8 action);  	void selectionSetIncludeInSearch(bool include_in_search);  	void selectionSetGlow(const F32 glow); | 
