Open texture preview floater when clicking on disabled texture picker. Original implementation by Henri Beauchamp (Cool VL) with permission to use under LGPL (Fixes FIRE-1796)
parent
c873e97de6
commit
49fa618fd7
|
|
@ -60,7 +60,7 @@ const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f;
|
|||
|
||||
|
||||
LLPreviewTexture::LLPreviewTexture(const LLSD& key)
|
||||
: LLPreview(key),
|
||||
: LLPreview((key.has("uuid") ? key.get("uuid") : key)), // Changed for texture preview mode
|
||||
mLoadingFullImage( FALSE ),
|
||||
mShowKeepDiscard(FALSE),
|
||||
mCopyToInv(FALSE),
|
||||
|
|
@ -78,6 +78,14 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key)
|
|||
{
|
||||
mPreviewToSave = TRUE;
|
||||
}
|
||||
// Texture preview mode
|
||||
if (key.has("preview_only"))
|
||||
{
|
||||
mShowKeepDiscard = FALSE;
|
||||
mCopyToInv = FALSE;
|
||||
mIsCopyable = FALSE;
|
||||
mPreviewToSave = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
LLPreviewTexture::~LLPreviewTexture()
|
||||
|
|
|
|||
|
|
@ -992,7 +992,8 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
|
|||
mImageAssetID(p.image_id),
|
||||
mDefaultImageAssetID(p.default_image_id),
|
||||
mDefaultImageName(p.default_image_name),
|
||||
mFallbackImage(p.fallback_image)
|
||||
mFallbackImage(p.fallback_image),
|
||||
mPreviewMode(!p.enabled) // For texture preview mode
|
||||
{
|
||||
setAllowNoTexture(p.allow_no_texture);
|
||||
setCanApplyImmediately(p.can_apply_immediately);
|
||||
|
|
@ -1087,7 +1088,9 @@ void LLTextureCtrl::setEnabled( BOOL enabled )
|
|||
|
||||
mCaption->setEnabled( enabled );
|
||||
|
||||
LLView::setEnabled( enabled );
|
||||
// Texture preview mode
|
||||
LLView::setEnabled( (enabled || getValue().asUUID().notNull()) );
|
||||
mPreviewMode = !enabled;
|
||||
}
|
||||
|
||||
void LLTextureCtrl::setValid(BOOL valid )
|
||||
|
|
@ -1190,11 +1193,23 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
|
|||
|
||||
if (!handled && mBorder->parentPointInView(x, y))
|
||||
{
|
||||
showPicker(FALSE);
|
||||
//grab textures first...
|
||||
LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE));
|
||||
//...then start full inventory fetch.
|
||||
LLInventoryModelBackgroundFetch::instance().start();
|
||||
if (!mPreviewMode)
|
||||
{
|
||||
showPicker(FALSE);
|
||||
//grab textures first...
|
||||
LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE));
|
||||
//...then start full inventory fetch.
|
||||
LLInventoryModelBackgroundFetch::instance().start();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Open the preview floater for the texture
|
||||
LLSD params;
|
||||
params["uuid"] = getValue();
|
||||
params["preview_only"] = TRUE;
|
||||
LLFloaterReg::showInstance("preview_texture", params, TRUE);
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1533,7 +1548,10 @@ BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char)
|
|||
|
||||
void LLTextureCtrl::setValue( const LLSD& value )
|
||||
{
|
||||
setImageAssetID(value.asUUID());
|
||||
// Changed for texture preview mode
|
||||
LLUUID uuid = value.asUUID();
|
||||
setImageAssetID(uuid);
|
||||
LLView::setEnabled( (!mPreviewMode || uuid.notNull()) );
|
||||
}
|
||||
|
||||
LLSD LLTextureCtrl::getValue() const
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ private:
|
|||
BOOL mShowLoadingPlaceholder;
|
||||
std::string mLoadingPlaceholderString;
|
||||
S32 mLabelWidth;
|
||||
BOOL mPreviewMode; // If true open texture in preview floater
|
||||
};
|
||||
|
||||
// XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp
|
||||
|
|
|
|||
Loading…
Reference in New Issue