summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelvolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelvolume.cpp')
-rw-r--r--indra/newview/llpanelvolume.cpp26
1 files changed, 21 insertions, 5 deletions
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