summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewtexture.cpp
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2010-02-26 17:34:39 -0800
committerRoxie Linden <roxie@lindenlab.com>2010-02-26 17:34:39 -0800
commit5352954eb65076d877cc74d4328620e910b93d1c (patch)
treea8bf1c956c0de44a5ab7eb0a2a05d5e9ed29b751 /indra/newview/llpreviewtexture.cpp
parent13d4257868451d1e3a5797bd02a0e6f749cc0836 (diff)
parentb1891e2982cc03ccd695eae82989d3e58695616c (diff)
automated merge
Diffstat (limited to 'indra/newview/llpreviewtexture.cpp')
-rw-r--r--indra/newview/llpreviewtexture.cpp58
1 files changed, 42 insertions, 16 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 028807a6bd..dfc67d0126 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -74,22 +74,10 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key)
mLastHeight(0),
mLastWidth(0),
mAspectRatio(0.f),
- mPreviewToSave(FALSE)
+ mPreviewToSave(FALSE),
+ mImage(NULL)
{
- const LLViewerInventoryItem *item = static_cast<const LLViewerInventoryItem*>(getItem());
- if(item)
- {
- mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID();
- mImageID = item->getAssetUUID();
- mIsCopyable = item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
- }
- else // not an item, assume it's an asset id
- {
- mImageID = mItemUUID;
- mCopyToInv = TRUE;
- mIsCopyable = TRUE;
- }
-
+ updateImageID();
if (key.has("save_as"))
{
mPreviewToSave = TRUE;
@@ -97,7 +85,6 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key)
//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_texture.xml", FALSE);
}
-
LLPreviewTexture::~LLPreviewTexture()
{
if( mLoadingFullImage )
@@ -493,3 +480,42 @@ LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus()
}
return mAssetStatus;
}
+
+void LLPreviewTexture::updateImageID()
+{
+ const LLViewerInventoryItem *item = static_cast<const LLViewerInventoryItem*>(getItem());
+ if(item)
+ {
+ mImageID = item->getAssetUUID();
+ mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID();
+ mCopyToInv = FALSE;
+ mIsCopyable = item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED);
+ }
+ else // not an item, assume it's an asset id
+ {
+ mImageID = mItemUUID;
+ mShowKeepDiscard = FALSE;
+ mCopyToInv = TRUE;
+ mIsCopyable = TRUE;
+ }
+
+}
+
+/* virtual */
+void LLPreviewTexture::setObjectID(const LLUUID& object_id)
+{
+ mObjectUUID = object_id;
+
+ const LLUUID old_image_id = mImageID;
+
+ // Update what image we're pointing to, such as if we just specified the mObjectID
+ // that this mItemID is part of.
+ updateImageID();
+
+ // If the imageID has changed, start over and reload the new image.
+ if (mImageID != old_image_id)
+ {
+ mAssetStatus = PREVIEW_ASSET_UNLOADED;
+ loadAsset();
+ }
+}