Fixed the texture previewer so the window shows up right. Also added an "Alpha" tag on it that should let you know if a texture has alpha or not - Useful in some cases.
Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
@@ -178,12 +178,12 @@ const S32 PREVIEW_BORDER = 4;
|
||||
const S32 PREVIEW_PAD = 5;
|
||||
const S32 PREVIEW_BUTTON_WIDTH = 100;
|
||||
|
||||
const S32 PREVIEW_LINE_HEIGHT = 19;
|
||||
const S32 PREVIEW_LINE_HEIGHT = 20;
|
||||
const S32 PREVIEW_CLOSE_BOX_SIZE = 16;
|
||||
const S32 PREVIEW_BORDER_WIDTH = 2;
|
||||
const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
|
||||
const S32 PREVIEW_VPAD = 2;
|
||||
const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
|
||||
const S32 PREVIEW_HEADER_SIZE = 2*PREVIEW_LINE_HEIGHT + 2 * PREVIEW_VPAD;
|
||||
const S32 PREVIEW_HEADER_SIZE = 5*PREVIEW_LINE_HEIGHT + 2 * PREVIEW_VPAD;
|
||||
|
||||
#endif // LL_LLPREVIEW_H
|
||||
|
||||
@@ -140,7 +140,8 @@ LLPreviewTexture::LLPreviewTexture(
|
||||
mIsCopyable(copyable),
|
||||
mLastHeight(0),
|
||||
mLastWidth(0),
|
||||
mAspectRatio(0.f)
|
||||
mAspectRatio(0.f),
|
||||
mAlphaMaskResult(0)
|
||||
{
|
||||
|
||||
init();
|
||||
@@ -180,7 +181,6 @@ void LLPreviewTexture::init()
|
||||
childSetVisible("Discard", mShowKeepDiscard);
|
||||
childSetAction("openprofile", onClickProfile, this);
|
||||
|
||||
llinfos << "Image has alpha :" << mImage->getIsAlphaMask() << llendl;
|
||||
if (mCopyToInv)
|
||||
{
|
||||
childSetAction("Copy To Inventory",LLPreview::onBtnCopyToInv,this);
|
||||
@@ -233,6 +233,7 @@ void LLPreviewTexture::init()
|
||||
childSetText("uuid", getItemID().asString());
|
||||
childSetText("uploader", getItemCreatorName());
|
||||
childSetText("uploadtime", getItemCreationDate());
|
||||
childSetText("alphanote", std::string("Loading..."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,6 +279,20 @@ void LLPreviewTexture::draw()
|
||||
interior.getHeight(),
|
||||
mImage);
|
||||
|
||||
if (mAlphaMaskResult != mImage->getIsAlphaMask())
|
||||
{
|
||||
if (!mImage->getIsAlphaMask())
|
||||
{
|
||||
childSetColor("alphanote", LLColor4::green);
|
||||
childSetText("alphanote", std::string("No Alpha"));
|
||||
}
|
||||
else
|
||||
{
|
||||
childSetColor("alphanote", LLColor4::red);
|
||||
childSetText("alphanote", std::string("Has Alpha"));
|
||||
}
|
||||
mAlphaMaskResult = mImage->getIsAlphaMask();
|
||||
}
|
||||
// Pump the texture priority
|
||||
F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA : (F32)(interior.getWidth() * interior.getHeight() );
|
||||
mImage->addTextureStats( pixel_area );
|
||||
@@ -439,9 +454,14 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success,
|
||||
LLUUID LLPreviewTexture::getItemID()
|
||||
{
|
||||
const LLViewerInventoryItem* item = getItem();
|
||||
if(item && item->getPermissions().allowCopyBy(gAgent.getID()))
|
||||
if(item)
|
||||
{
|
||||
return item->getUUID();
|
||||
U32 perms = item->getPermissions().getMaskOwner();
|
||||
if ((perms & PERM_TRANSFER) &&
|
||||
(perms & PERM_COPY))
|
||||
{
|
||||
return item->getUUID();
|
||||
}
|
||||
}
|
||||
return LLUUID::null;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ private:
|
||||
S32 mLastHeight;
|
||||
S32 mLastWidth;
|
||||
F32 mAspectRatio; // 0 = Unconstrained
|
||||
S32 mAlphaMaskResult;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
follows="left|top|right" font="SansSerifSmall" handle_edit_keys_directly="false" height="16" left="93"
|
||||
right="-80" max_length="127" mouse_opaque="true" name="uploadtime" select_all_on_focus_received="false"
|
||||
select_on_focus="false" width="420" />
|
||||
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom_delta="-1" drop_shadow_visible="true" enabled="true" follows="right|top" font="SansSerifSmall"
|
||||
h_pad="50" halign="left" height="16" right="345" mouse_opaque="true" name="alphanote" v_pad="0" width="80">
|
||||
Loading...
|
||||
</text>
|
||||
<button bottom="8" enabled="true" follows="left|bottom" font="SansSerif" halign="center" height="20"
|
||||
label="Keep" label_selected="Keep" left="9" mouse_opaque="true" name="Keep" scale_image="true" width="100" />
|
||||
<button bottom="8" enabled="true" follows="left|bottom" font="SansSerif" halign="center" height="20"
|
||||
|
||||
Reference in New Issue
Block a user