summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2021-07-02 16:11:39 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2021-07-02 16:11:39 +0300
commit66793abc716d86660e2fa4c7731e235881525c69 (patch)
treeee8ee8ad965efb60bb362ebed35d6633ecbde90c /indra
parent7a6b5a598487c6162c56246561bae205824c892b (diff)
SL-14075 allow exporting multiple textures with the same name
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinventorybridge.cpp2
-rw-r--r--indra/newview/llinventorybridge.h3
-rw-r--r--indra/newview/llinventoryfunctions.cpp11
-rw-r--r--indra/newview/llpreviewtexture.cpp4
-rw-r--r--indra/newview/llpreviewtexture.h2
5 files changed, 17 insertions, 5 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 9b5be70d86..86ee7e7a82 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -5497,7 +5497,7 @@ void LLTextureBridge::performAction(LLInventoryModel* model, std::string action)
LLPreviewTexture* preview_texture = LLFloaterReg::getTypedInstance<LLPreviewTexture>("preview_texture", mUUID);
if (preview_texture)
{
- preview_texture->saveMultipleToFile();
+ preview_texture->saveMultipleToFile(mFileName);
}
}
else
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 9af8664388..7db9c640f2 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -403,6 +403,9 @@ public:
virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
virtual void performAction(LLInventoryModel* model, std::string action);
bool canSaveTexture(void);
+ void setFileName(std::string& file_name) { mFileName = file_name; }
+protected:
+ std::string mFileName;
};
class LLSoundBridge : public LLItemBridge
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 5049174a8b..9cc67766ca 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2558,13 +2558,22 @@ void LLInventoryAction::saveMultipleTextures(const std::vector<std::string>& fil
LLFloater::setFloaterHost(multi_previewp);
+ std::map<std::string, S32> tex_names_map;
std::set<LLFolderViewItem*>::iterator set_iter;
+
for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
{
LLFolderViewItem* folder_item = *set_iter;
if(!folder_item) continue;
- LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
+ LLTextureBridge* bridge = (LLTextureBridge*)folder_item->getViewModelItem();
if(!bridge) continue;
+
+ std::string tex_name = bridge->getName();
+ if(!tex_names_map.insert(std::pair<std::string, S32>(tex_name, 0)).second)
+ {
+ tex_names_map[tex_name]++;
+ bridge->setFileName(tex_name + llformat("_%.3d", tex_names_map[tex_name]));
+ }
bridge->performAction(model, "save_selected_as");
}
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<std::string>& 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;
diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h
index cc6c7854b6..9b6a843875 100644
--- a/indra/newview/llpreviewtexture.h
+++ b/indra/newview/llpreviewtexture.h
@@ -63,7 +63,7 @@ public:
void openToSave();
void saveTextureToFile(const std::vector<std::string>& filenames);
- void saveMultipleToFile();
+ void saveMultipleToFile(const std::string& file_name = "");
static void onSaveAsBtn(void* data);