diff --git a/.github/workflows/build_viewer.yml b/.github/workflows/build_viewer.yml index 1671216199..08872166db 100644 --- a/.github/workflows/build_viewer.yml +++ b/.github/workflows/build_viewer.yml @@ -5,6 +5,7 @@ env: EXTRA_ARGS: -DFMODSTUDIO=ON -DUSE_KDU=ON --crashreporting build_secrets_checkout: ${{github.workspace}}/signing + jobs: build_matrix: strategy: @@ -31,6 +32,18 @@ jobs: - name: Check python version run: python -V + - name: Free Disk Space (Ubuntu) + if: runner.os == 'Linux' + uses: jlumbroso/free-disk-space@main + with: + swap-storage: false + + - name: Set gcc version on Linux + if: runner.os == 'Linux' + run: | + echo "CC=gcc-10" >> $GITHUB_ENV + echo "CXX=g++-10" >> $GITHUB_ENV + - name: Install Bash 4 and GNU sed on Mac if: runner.os == 'macOS' run: | @@ -117,12 +130,14 @@ jobs: security set-key-partition-list -S apple-tool:,apple:, -s -k "$FS_KEYCHAIN_PASS" -t private ~/Library/Keychains/viewer.keychain security list-keychain -d user -s ~/Library/Keychains/viewer.keychain - - name: Install required Ubuntu packages + - name: Install required Ubuntu packages and release some space. if: runner.os == 'Linux' run: | dependencies=("python3-setuptools" "mesa-common-dev" "libgl1-mesa-dev" "libxinerama-dev" "libxrandr-dev" "libpulse-dev" "libglu1-mesa-dev" "libfreetype6-dev" "libfontconfig1") sudo apt-get update sudo apt-get install -y "${dependencies[@]}" + sudo apt-get autoremove --purge + sudo apt-get clean - name: test macOS bundles are present if: runner.os == 'MacOS' @@ -168,7 +183,9 @@ jobs: fi done shell: bash - + - name: Clean up packages to give more space + run: rm *${{ env.fallback_platform }}*bz2 + shell: bash - name: Configure run: autobuild configure --debug -c ReleaseFS -A${{matrix.addrsize}} -- --package --chan ${{env.FS_RELEASE_CHAN}} ${{env.EXTRA_ARGS}} ${{env.FS_GRID}} shell: bash diff --git a/autobuild.xml b/autobuild.xml index 8c76472e06..ae94d43640 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1098,11 +1098,11 @@ archive hash - e610f49fa7ed5b10b0cc6409b9bf4afc + 5fee0f9587f50531211ff9e1e860692f hash_algorithm md5 url - file:///opt/firestorm/fmodstudio-2.02.11-linux64-230190114.tar.bz2 + file:///opt/firestorm/fmodstudio-2.02.13-linux64-230861132.tar.bz2 name linux64 @@ -1112,11 +1112,11 @@ archive hash - 8b2fff1a0a7e057da99fdade1f9e82ff + 99c928b18a0d2f08b0ee33fca90c4118 hash_algorithm md5 url - file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.11-windows-230181802.tar.bz2 + file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.13-windows-230860911.tar.bz2 name windows @@ -1126,18 +1126,18 @@ archive hash - 6cf457e2268ed83326c6d77f3475e8f5 + 01946a6427d126570607c02b75560f02 hash_algorithm md5 url - file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.11-windows64-230181820.tar.bz2 + file:///c:/cygwin/opt/firestorm/fmodstudio-2.02.13-windows64-230860913.tar.bz2 name windows64 version - 2.02.11 + 2.02.13 fontconfig diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 6976035249..4d9af5bc84 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -65,6 +65,8 @@ #include "llcheckboxctrl.h" #include "llagentbenefits.h" +#include "llnotificationsutil.h" // detect and strip empty alpha layers from images on upload + const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; @@ -72,6 +74,10 @@ const S32 PREVIEW_VPAD = -24 + 35; // yuk, hard coded const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16 + 35; const S32 PREVIEW_TEXTURE_HEIGHT = 320; +// detect and strip empty alpha layers from images on upload +const U8 ALPHA_EMPTY_THRESHOLD = 253; +const F32 ALPHA_EMPTY_THRESHOLD_RATIO = 0.999f; +// //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- @@ -168,16 +174,99 @@ BOOL LLFloaterImagePreview::postBuild() } } - getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + // detect and strip empty alpha layers from images on upload + // getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterImagePreview::onBtnUpload, this)); + if (mRawImagep->getComponents() != 4) + { + return TRUE; + } + + U32 imageBytes = mRawImagep->getWidth() * mRawImagep->getHeight() * 4; + + U32 emptyAlphaCount = 0; + U8* data = mRawImagep->getData(); + for (U32 i = 3; i < imageBytes; i += 4) + { + if (data[i] > ALPHA_EMPTY_THRESHOLD) + { + emptyAlphaCount++; + } + } + + mEmptyAlphaCheck = getChild("strip_alpha_check"); + + if (emptyAlphaCount > (imageBytes / 4 * ALPHA_EMPTY_THRESHOLD_RATIO)) + { + getChild("image_alpha_warning")->setVisible(true); + + mEmptyAlphaCheck->setCommitCallback(boost::bind(&LLFloaterImagePreview::emptyAlphaCheckboxCallback, this)); + mEmptyAlphaCheck->setValue(true); + } + else + { + getChild("image_alpha_warning")->setVisible(false); + mEmptyAlphaCheck->setValue(false); + } + // return TRUE; } +// detect and strip empty alpha layers from images on upload +void LLFloaterImagePreview::emptyAlphaCheckboxCallback() +{ + if (!mEmptyAlphaCheck->getValue()) + { + LLNotificationsUtil::add("ImageEmptyAlphaLayer", LLSD(), LLSD(), boost::bind(&LLFloaterImagePreview::imageEmptyAlphaCallback, this, _1, _2)); + } +} + +bool LLFloaterImagePreview::imageEmptyAlphaCallback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + // 0 = strip alpha + if (option == 0) + { + mEmptyAlphaCheck->setValue(true); + } + + return true; +} + +void LLFloaterImagePreview::onBtnUpload() +{ + if(mEmptyAlphaCheck->getValue()) + { + LLPointer stripped_image = new LLImageRaw(mRawImagep->getWidth(), mRawImagep->getHeight(), 3); + stripped_image->copyUnscaled4onto3(mRawImagep); + + LLPointer stripped_png = new LLImagePNG; + + // 0.0 = encode time, apparently not used in the encode() function + stripped_png->encode(stripped_image, 0.0f); + + mFilenameAndPath = gDirUtilp->getTempFilename() + "." + stripped_png->getExtension(); + stripped_png->save(mFilenameAndPath); + + mDeleteTempFile = mFilenameAndPath; + } + + onBtnOK(); +} +// //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- LLFloaterImagePreview::~LLFloaterImagePreview() { + // detect and strip empty alpha layers from images on upload + if (!mDeleteTempFile.empty()) + { + LLFile::remove(mDeleteTempFile); + } + // clearAllPreviewTextures(); mRawImagep = NULL; diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index d034622c35..6a6f2f1c7c 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -39,6 +39,7 @@ class LLVOAvatar; class LLTextBox; class LLVertexBuffer; class LLVolume; +class LLCheckBoxCtrl; // detect and strip empty alpha layers from images on upload class LLImagePreviewSculpted : public LLViewerDynamicTexture { @@ -129,6 +130,11 @@ protected: void draw(); bool loadImage(const std::string& filename); + // detect and strip empty alpha layers from images on upload + void onBtnUpload(); + void emptyAlphaCheckboxCallback(); + bool imageEmptyAlphaCallback(const LLSD& notification, const LLSD& response); + // LLPointer mRawImagep; LLPointer mAvatarPreview; LLPointer mSculptedPreview; @@ -139,6 +145,10 @@ protected: LLPointer mImagep ; std::string mImageLoadError; + // detect and strip empty alpha layers from images on upload + std::string mDeleteTempFile; + LLCheckBoxCtrl* mEmptyAlphaCheck; + // }; #endif // LL_LLFLOATERIMAGEPREVIEW_H diff --git a/indra/newview/skins/default/xui/de/floater_image_preview.xml b/indra/newview/skins/default/xui/de/floater_image_preview.xml index 911546fe8b..b98f15828f 100644 --- a/indra/newview/skins/default/xui/de/floater_image_preview.xml +++ b/indra/newview/skins/default/xui/de/floater_image_preview.xml @@ -21,6 +21,9 @@ + + + Bild kann nicht gelesen werden. diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml index 78d8a0e43c..e55598a8db 100644 --- a/indra/newview/skins/default/xui/de/notifications.xml +++ b/indra/newview/skins/default/xui/de/notifications.xml @@ -5604,4 +5604,7 @@ URL auf Standard zurücksetzen? Gruppierung durch den Ordner „[FOLDER_NAME]“ aufheben? + + Die Textur, die Sie hochladen möchten, enthält einen leeren oder fast-leeren Alpha-Kanal (Transparenz-Informationen). Dies ist fast immer nicht gewünscht und der Kanel sollte daher entfernt werden. Das Hinzufügen eines Alpha-Kanals kann zu Textur-Flackern bei übereinanderliegenden Texturen bei unterschiedlichem Kamerawinkel führen. Zudem verringert sich dadurch die Darstellungsgeschwindigkeit. Sofern diese Textur nicht unbedingt einen (fast-)leeren Alpgha-Kanal benötigt, sollte dieser möglichst entfernt werden. + diff --git a/indra/newview/skins/default/xui/en/floater_image_preview.xml b/indra/newview/skins/default/xui/en/floater_image_preview.xml index d7d4aa91cc..7d1f01b6ac 100644 --- a/indra/newview/skins/default/xui/en/floater_image_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_image_preview.xml @@ -47,9 +47,9 @@ + + + + + + + + + + + + The image you are trying to upload contains an empty, or almost empty alpha channel (transparency information). This is almost always not desired and should be stripped off. Adding an alpha channel to an image will lead to textures flipping on top of each other at different camera angles, and it makes rendering slower. So, unless you really need this texture to have an empty / almost empty alpha channel, consider stripping it out. + confirm_strip +
+