diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-02-01 00:35:22 +0200 |
---|---|---|
committer | akleshchev <117672381+akleshchev@users.noreply.github.com> | 2023-02-01 16:38:47 +0200 |
commit | 6ada89ce0b9372d6a7f49ac45bad6713ad5d3355 (patch) | |
tree | 7e9f024aa51b30a03b7b6490f13c5259b9e4f8bc /indra/newview/llinspecttexture.cpp | |
parent | aa6c7902af2ab2cc10bc86000a91078edafb522f (diff) |
SL-19117 Extend texture preview to show thumbnails when present
Diffstat (limited to 'indra/newview/llinspecttexture.cpp')
-rw-r--r-- | indra/newview/llinspecttexture.cpp | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/indra/newview/llinspecttexture.cpp b/indra/newview/llinspecttexture.cpp index cd288e9603..af96561c45 100644 --- a/indra/newview/llinspecttexture.cpp +++ b/indra/newview/llinspecttexture.cpp @@ -136,14 +136,17 @@ BOOL LLInspectTexture::postBuild() LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p) { - const LLSD& sdTooltip = p.create_params; + const LLSD& sdTooltip = p.create_params; + + if (sdTooltip.has("thumbnail_id")) + { + // go straight for tooltip regardless of type + return LLUICtrlFactory::create<LLTextureToolTip>(p); + } LLInventoryType::EType eInvType = (sdTooltip.has("inv_type")) ? (LLInventoryType::EType)sdTooltip["inv_type"].asInteger() : LLInventoryType::IT_NONE; switch (eInvType) { - case LLInventoryType::IT_SNAPSHOT: - case LLInventoryType::IT_TEXTURE: - return LLUICtrlFactory::create<LLTextureToolTip>(p); case LLInventoryType::IT_CATEGORY: { if (sdTooltip.has("item_id")) @@ -277,23 +280,27 @@ LLTextureToolTip::~LLTextureToolTip() void LLTextureToolTip::initFromParams(const LLToolTip::Params& p) { - LLToolTip::initFromParams(p); - - // Create and add the preview control - LLView::Params p_preview; - p_preview.name = "texture_preview"; - LLRect rctPreview; - rctPreview.setOriginAndSize(mPadding, mTextBox->getRect().mTop, mPreviewSize, mPreviewSize); - p_preview.rect = rctPreview; - mPreviewView = LLUICtrlFactory::create<LLTexturePreviewView>(p_preview); - addChild(mPreviewView); - - // Parse the control params - const LLSD& sdTextureParams = p.create_params; - if (sdTextureParams.has("asset_id")) - mPreviewView->setImageFromAssetId(sdTextureParams["asset_id"].asUUID()); - else if (sdTextureParams.has("item_id")) - mPreviewView->setImageFromItemId(sdTextureParams["item_id"].asUUID()); + LLToolTip::initFromParams(p); + + // Create and add the preview control + LLView::Params p_preview; + p_preview.name = "texture_preview"; + LLRect rctPreview; + rctPreview.setOriginAndSize(mPadding, mTextBox->getRect().mTop, mPreviewSize, mPreviewSize); + p_preview.rect = rctPreview; + mPreviewView = LLUICtrlFactory::create<LLTexturePreviewView>(p_preview); + addChild(mPreviewView); + + // Parse the control params + const LLSD& sdTextureParams = p.create_params; + if (sdTextureParams.has("thumbnail_id")) + { + mPreviewView->setImageFromAssetId(sdTextureParams["thumbnail_id"].asUUID()); + } + else if (sdTextureParams.has("item_id")) + { + mPreviewView->setImageFromItemId(sdTextureParams["item_id"].asUUID()); + } snapToChildren(); } |