summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewtexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewtexture.cpp')
-rw-r--r--indra/newview/llpreviewtexture.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 1e91da529c..cd7b93aba7 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<std::string>& filenam
0, TRUE, FALSE, new LLUUID(mItemUUID), &mCallbackTextureList);
}
+
+void LLPreviewTexture::saveMultipleToFile(const std::string& file_name)
+{
+ std::string texture_location(gSavedSettings.getString("TextureSaveLocation"));
+ std::string texture_name = file_name.empty() ? getItem()->getName() : file_name;
+
+ 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)
{