From 871ada01215d55dc69475778e284d70d86debdf7 Mon Sep 17 00:00:00 2001 From: Beeks Date: Fri, 17 Sep 2010 19:57:51 -0400 Subject: [PATCH] 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 --- indra/newview/llpreview.h | 4 +-- indra/newview/llpreviewtexture.cpp | 28 ++++++++++++++++--- indra/newview/llpreviewtexture.h | 1 + .../xui/en-us/floater_preview_texture.xml | 5 ++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h index fba4ef203..084023f02 100644 --- a/indra/newview/llpreview.h +++ b/indra/newview/llpreview.h @@ -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 diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 23d77ed84..b2db762e8 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -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; } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index 2f0be6f22..f82fdabd1 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -110,6 +110,7 @@ private: S32 mLastHeight; S32 mLastWidth; F32 mAspectRatio; // 0 = Unconstrained + S32 mAlphaMaskResult; }; diff --git a/indra/newview/skins/default/xui/en-us/floater_preview_texture.xml b/indra/newview/skins/default/xui/en-us/floater_preview_texture.xml index 0cd554eaa..f5a20edf6 100644 --- a/indra/newview/skins/default/xui/en-us/floater_preview_texture.xml +++ b/indra/newview/skins/default/xui/en-us/floater_preview_texture.xml @@ -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" /> + + Loading... +