From 73303d918465090b8e2a39514f4d9db49d0ff109 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 2 Nov 2020 19:35:31 +0200 Subject: SL-14075 Allow bulk download of textures/pictures --- indra/newview/llpreviewtexture.cpp | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra/newview/llpreviewtexture.cpp') diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 9d8be4b2fe..303034ca3d 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -50,6 +50,7 @@ #include "llviewertexture.h" #include "llviewertexturelist.h" #include "lluictrlfactory.h" +#include "llviewercontrol.h" #include "llviewerwindow.h" #include "lllineeditor.h" @@ -317,6 +318,44 @@ void LLPreviewTexture::saveTextureToFile(const std::vector& filenam 0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList); } + +void LLPreviewTexture::saveMultipleToFile() +{ + std::string texture_location(gSavedSettings.getString("TextureSaveLocation")); + std::string texture_name = getItem()->getName(); + + std::string filepath; + S32 i = 0; + S32 err = 0; + std::string extension(".png"); + do + { + filepath = texture_location; + filepath += gDirUtilp->getDirDelimiter(); + filepath += texture_name; + + if (i != 0) + { + filepath += llformat("_%.3d", i); + } + + filepath += extension; + + llstat stat_info; + err = LLFile::stat( filepath, &stat_info ); + i++; + } while (-1 != err); // Search until the file is not found (i.e., stat() gives an error). + + + mSaveFileName = filepath; + mLoadingFullImage = TRUE; + getWindow()->incBusyCount(); + + mImage->forceToSaveRawImage(0);//re-fetch the raw image if the old one is removed. + mImage->setLoadedCallback(LLPreviewTexture::onFileLoadedForSave, + 0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList); +} + // virtual void LLPreviewTexture::reshape(S32 width, S32 height, BOOL called_from_parent) { -- cgit v1.2.3 From 66793abc716d86660e2fa4c7731e235881525c69 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 2 Jul 2021 16:11:39 +0300 Subject: SL-14075 allow exporting multiple textures with the same name --- indra/newview/llpreviewtexture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpreviewtexture.cpp') diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 53869606bb..cd7b93aba7 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -319,10 +319,10 @@ void LLPreviewTexture::saveTextureToFile(const std::vector& filenam } -void LLPreviewTexture::saveMultipleToFile() +void LLPreviewTexture::saveMultipleToFile(const std::string& file_name) { std::string texture_location(gSavedSettings.getString("TextureSaveLocation")); - std::string texture_name = getItem()->getName(); + std::string texture_name = file_name.empty() ? getItem()->getName() : file_name; std::string filepath; S32 i = 0; -- cgit v1.2.3