diff options
author | Mark Palange (Mani) <palange@lindenlab.com> | 2010-02-05 10:10:27 -0800 |
---|---|---|
committer | Mark Palange (Mani) <palange@lindenlab.com> | 2010-02-05 10:10:27 -0800 |
commit | 3c9daac7afeeb31d2feabde59183a2e005a30d7f (patch) | |
tree | 62c58ae3478f4763660687a59ca77491a604e1fa /indra/newview/llpreviewtexture.cpp | |
parent | e00082c644d201291a4f9243f915fc09c320eaa7 (diff) | |
parent | fed6c9eb0fa58559c13729b65ecee181f58f3c69 (diff) |
merge
Diffstat (limited to 'indra/newview/llpreviewtexture.cpp')
-rw-r--r-- | indra/newview/llpreviewtexture.cpp | 58 |
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(); + } +} |