diff options
| author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-10-25 15:15:02 +0300 | 
|---|---|---|
| committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-10-25 15:15:02 +0300 | 
| commit | a95d846a5c2ba681c165e62699a163780f5d4b75 (patch) | |
| tree | 2d61094c76b3dd84d9c657e71dbaaf8a5fe0277a | |
| parent | a7011655227fbeb417dbbb9631c6dff40093d5d5 (diff) | |
SL-16218 treat texture selection similar to diffuse map handling.
| -rw-r--r-- | indra/newview/llpanelface.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/llpanelvolume.cpp | 26 | ||||
| -rw-r--r-- | indra/newview/llpanelvolume.h | 3 | ||||
| -rw-r--r-- | indra/newview/llselectmgr.cpp | 38 | ||||
| -rw-r--r-- | indra/newview/llselectmgr.h | 4 | 
5 files changed, 62 insertions, 13 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 23394b26f2..71657239a6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -361,7 +361,7 @@ void LLPanelFace::sendBump(U32 bumpiness)  	//  	LLSelectedTEMaterial::setNormalID(this, current_normal_map); -	LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); +	LLSelectMgr::getInstance()->selectionSetBumpmap( bump, bumpytexture_ctrl->getImageItemID() );  }  void LLPanelFace::sendTexGen() @@ -390,7 +390,7 @@ void LLPanelFace::sendShiny(U32 shininess)  	LLSelectedTEMaterial::setSpecularID(this, specmap); -	LLSelectMgr::getInstance()->selectionSetShiny( shiny ); +	LLSelectMgr::getInstance()->selectionSetShiny( shiny, texture_ctrl->getImageItemID() );  	updateShinyControls(!specmap.isNull(), true); diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 05d9346f89..89c558e4f8 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -50,6 +50,7 @@  //#include "llfirstuse.h"  #include "llfocusmgr.h"  #include "llmanipscale.h" +#include "llinventorymodel.h"  #include "llpreviewscript.h"  #include "llresmgr.h"  #include "llselectmgr.h" @@ -57,6 +58,7 @@  #include "lltextbox.h"  #include "lltool.h"  #include "lltoolcomp.h" +#include "lltooldraganddrop.h"  #include "lltoolmgr.h"  #include "lltrans.h"  #include "llui.h" @@ -780,7 +782,7 @@ void LLPanelVolume::onLightCancelTexture(const LLSD& data)          // selection of "None" texture.          LLUUID tex_id = LightTextureCtrl->getImageAssetID();          bool is_spotlight = volobjp->isLightSpotlight(); -        volobjp->setLightTextureID(tex_id); //updates spotlight +        setLightTextureID(tex_id, LightTextureCtrl->getImageItemID(), volobjp); //updates spotlight          if (!is_spotlight && tex_id.notNull())          { @@ -825,7 +827,7 @@ void LLPanelVolume::onLightSelectTexture(const LLSD& data)  	if(LightTextureCtrl)  	{  		LLUUID id = LightTextureCtrl->getImageAssetID(); -		volobjp->setLightTextureID(id); +		setLightTextureID(id, LightTextureCtrl->getImageItemID(), volobjp);  	}  } @@ -888,11 +890,12 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )  	if(LightTextureCtrl)  	{  		LLUUID id = LightTextureCtrl->getImageAssetID(); +        LLUUID item_id = LightTextureCtrl->getImageItemID();  		if (id.notNull())  		{  			if (!volobjp->isLightSpotlight())  			{ //this commit is making this a spot light, set UI to default params -				volobjp->setLightTextureID(id); +                setLightTextureID(id, item_id, volobjp);  				LLVector3 spot_params = volobjp->getSpotLightParams();  				self->getChild<LLUICtrl>("Light FOV")->setValue(spot_params.mV[0]);  				self->getChild<LLUICtrl>("Light Focus")->setValue(spot_params.mV[1]); @@ -902,7 +905,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )  			{ //modifying existing params, this time volobjp won't change params on its own.                  if (volobjp->getLightTextureID() != id)                  { -                    volobjp->setLightTextureID(id); +                    setLightTextureID(id, item_id, volobjp);                  }  				LLVector3 spot_params; @@ -914,7 +917,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )  		}  		else if (volobjp->isLightSpotlight())  		{ //no longer a spot light -			volobjp->setLightTextureID(id); +			setLightTextureID(id, item_id, volobjp);  			//self->getChildView("Light FOV")->setEnabled(FALSE);  			//self->getChildView("Light Focus")->setEnabled(FALSE);  			//self->getChildView("Light Ambiance")->setEnabled(FALSE); @@ -931,6 +934,19 @@ void LLPanelVolume::onCommitIsLight( LLUICtrl* ctrl, void* userdata )  	self->sendIsLight();  } +// static +void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item_id, LLVOVolume* volobjp) +{ +    if (volobjp) +    { +        LLViewerInventoryItem* item = gInventory.getItem(item_id); +        if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) +        { +            LLToolDragAndDrop::handleDropTextureProtections(volobjp, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); +        }     +        volobjp->setLightTextureID(asset_id); +    } +}  //----------------------------------------------------------------------------  // static diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index 66117316cf..6e49ccb742 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -40,6 +40,7 @@ class LLButton;  class LLViewerObject;  class LLComboBox;  class LLColorSwatchCtrl; +class LLVOVolume;  class LLPanelVolume : public LLPanel  { @@ -73,6 +74,8 @@ public:  	void		onLightCancelTexture(const LLSD& data);   	void		onLightSelectTexture(const LLSD& data); +    static void    setLightTextureID(const LLUUID &asset_id, const LLUUID &item_id, LLVOVolume* volobjp); +  protected:  	void			getState(); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 5bbdeb1f98..b0a566755f 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1936,7 +1936,7 @@ BOOL LLSelectMgr::selectionRevertTextures()  	return revert_successful;  } -void LLSelectMgr::selectionSetBumpmap(U8 bumpmap) +void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id)  {  	struct f : public LLSelectedTEFunctor  	{ @@ -1952,7 +1952,22 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap)  			return true;  		}  	} setfunc(bumpmap); -	getSelection()->applyToTEs(&setfunc); + +    LLViewerInventoryItem* item = gInventory.getItem(image_id); +    if(item  +        && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()) +        && (mSelectedObjects->getNumNodes() > 1) ) +    { +        LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; +        return; +    } +    if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) +    { +        LLViewerObject *object = mSelectedObjects->getFirstRootObject(); +        if (!object) return; +        LLToolDragAndDrop::handleDropTextureProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); +    } +    getSelection()->applyToTEs(&setfunc);  	LLSelectMgrSendFunctor sendfunc;  	getSelection()->applyToObjects(&sendfunc); @@ -1981,7 +1996,7 @@ void LLSelectMgr::selectionSetTexGen(U8 texgen)  } -void LLSelectMgr::selectionSetShiny(U8 shiny) +void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id)  {  	struct f : public LLSelectedTEFunctor  	{ @@ -1997,7 +2012,22 @@ void LLSelectMgr::selectionSetShiny(U8 shiny)  			return true;  		}  	} setfunc(shiny); -	getSelection()->applyToTEs(&setfunc); + +    LLViewerInventoryItem* item = gInventory.getItem(image_id); +    if(item  +        && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()) +        && (mSelectedObjects->getNumNodes() > 1) ) +    { +        LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; +        return; +    } +    if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) +    { +        LLViewerObject *object = mSelectedObjects->getFirstRootObject(); +        if (!object) return; +        LLToolDragAndDrop::handleDropTextureProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); +    } +    getSelection()->applyToTEs(&setfunc);  	LLSelectMgrSendFunctor sendfunc;  	getSelection()->applyToObjects(&sendfunc); diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 57fdfce152..2b00fa1595 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -609,9 +609,9 @@ public:  	void selectionRevertColors();  	void selectionRevertShinyColors();  	BOOL selectionRevertTextures(); -	void selectionSetBumpmap( U8 bumpmap ); +	void selectionSetBumpmap( U8 bumpmap, const LLUUID &image_id );  	void selectionSetTexGen( U8 texgen ); -	void selectionSetShiny( U8 shiny ); +	void selectionSetShiny( U8 shiny, const LLUUID &image_id );  	void selectionSetFullbright( U8 fullbright );  	void selectionSetMedia( U8 media_type, const LLSD &media_data );  	void selectionSetClickAction(U8 action);  | 
