summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2023-08-03 18:54:49 -0700
committerCallum Prentice <callum@lindenlab.com>2023-08-03 18:54:49 -0700
commit263e097ef7772ddbb69f575e20b31fd801dafc8e (patch)
tree753b62b2522fde645adec57fcf0255ee6570f1de /indra
parentc92d6e3f154ca11206a868a29afea0a0ffcc0327 (diff)
SL-20109: Big clean up. Now supports arbitrary mix of folders and entries for both items and textures. Better logging output
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterbulkythumbs.cpp374
-rw-r--r--indra/newview/llfloaterbulkythumbs.h11
-rw-r--r--indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml109
3 files changed, 254 insertions, 240 deletions
diff --git a/indra/newview/llfloaterbulkythumbs.cpp b/indra/newview/llfloaterbulkythumbs.cpp
index f7ee538033..9ffb71b394 100644
--- a/indra/newview/llfloaterbulkythumbs.cpp
+++ b/indra/newview/llfloaterbulkythumbs.cpp
@@ -38,6 +38,7 @@
#include "llinventorymodel.h"
#include "llinventoryfunctions.h"
#include "lltexteditor.h"
+#include "llmediactrl.h"
#include "lluuid.h"
#include "llaisapi.h"
@@ -58,16 +59,16 @@ BOOL LLFloaterBulkyThumbs::postBuild()
mPasteTexturesBtn = getChild<LLUICtrl>("paste_textures_btn");
mPasteTexturesBtn->setCommitCallback(boost::bind(&LLFloaterBulkyThumbs::onPasteTextures, this));
- mInventoryItems = getChild<LLTextEditor>("inventory_items");
- mInventoryItems->setMaxTextLength(0xffff * 0x10);
+ mOutputLog = getChild<LLTextEditor>("output_log");
+ mOutputLog->setMaxTextLength(0xffff * 0x10);
- mProcessBulkyThumbsBtn = getChild<LLUICtrl>("process_bulky_thumbs");
- mProcessBulkyThumbsBtn->setCommitCallback(boost::bind(&LLFloaterBulkyThumbs::onProcessBulkyThumbs, this));
- mProcessBulkyThumbsBtn->setEnabled(false);
+ mMergeItemsTexturesBtn = getChild<LLUICtrl>("merge_items_textures");
+ mMergeItemsTexturesBtn->setCommitCallback(boost::bind(&LLFloaterBulkyThumbs::onMergeItemsTextures, this));
+ mMergeItemsTexturesBtn->setEnabled(false);
- mWriteBulkyThumbsBtn = getChild<LLUICtrl>("write_bulky_thumbs");
- mWriteBulkyThumbsBtn->setCommitCallback(boost::bind(&LLFloaterBulkyThumbs::onWriteBulkyThumbs, this));
- mWriteBulkyThumbsBtn->setEnabled(false);
+ mWriteThumbnailsBtn = getChild<LLUICtrl>("write_items_thumbnails");
+ mWriteThumbnailsBtn->setCommitCallback(boost::bind(&LLFloaterBulkyThumbs::onWriteThumbnails, this));
+ mWriteThumbnailsBtn->setEnabled(false);
return true;
}
@@ -82,36 +83,14 @@ void LLFloaterBulkyThumbs::recordInventoryItemEntry(LLViewerInventoryItem* item)
LLUUID id = item->getUUID();
mItemNamesIDs.insert({name, id});
- std::string output_line = "ITEM: ";
- output_line += name;
- output_line += "|";
- output_line += id.asString();
- output_line += "\n";
- mInventoryItems->appendText(output_line, false);
- }
- else
- {
- // dupe - do not save
- }
-}
-
-void LLFloaterBulkyThumbs::recordTextureItemEntry(LLViewerInventoryItem* item)
-{
- const std::string name = item->getName();
-
- std::map<std::string, LLUUID>::iterator iter = mTextureNamesIDs.find(name);
- if (iter == mTextureNamesIDs.end())
- {
- //LLUUID id = item->getUUID();
- LLUUID id = item->getAssetUUID();
- mTextureNamesIDs.insert({name, id});
-
- std::string output_line = "TEXR: ";
- output_line += name;
- output_line += "|";
- output_line += id.asString();
- output_line += "\n";
- mInventoryItems->appendText(output_line, false);
+ mOutputLog->appendText(
+ STRINGIZE(
+ "ITEM " << mItemNamesIDs.size() << "> " <<
+ name <<
+ //" | " <<
+ //id.asString() <<
+ std::endl
+ ), false);
}
else
{
@@ -126,49 +105,85 @@ void LLFloaterBulkyThumbs::onPasteItems()
return;
}
+ mOutputLog->appendText(
+ STRINGIZE(
+ "\n==== Pasting items from inventory ====" <<
+ std::endl
+ ), false);
+
std::vector<LLUUID> objects;
LLClipboard::instance().pasteFromClipboard(objects);
size_t count = objects.size();
- if (count > 0)
+ for (size_t i = 0; i < count; i++)
{
- for (size_t i = 0; i < count; i++)
- {
- const LLUUID& item_id = objects.at(i);
+ const LLUUID& entry = objects.at(i);
- const LLInventoryCategory* cat = gInventory.getCategory(item_id);
- if (cat)
+ const LLInventoryCategory* cat = gInventory.getCategory(entry);
+ if (cat)
+ {
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+
+ LLIsType is_object(LLAssetType::AT_OBJECT);
+ gInventory.collectDescendentsIf(cat->getUUID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_object);
+
+ LLIsType is_bodypart(LLAssetType::AT_BODYPART);
+ gInventory.collectDescendentsIf(cat->getUUID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_bodypart);
+
+ for (size_t i = 0; i < item_array.size(); i++)
{
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- LLIsType is_object(LLAssetType::AT_OBJECT);
- gInventory.collectDescendentsIf(cat->getUUID(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_object);
-
-
- for (size_t i = 0; i < item_array.size(); i++)
- {
- LLViewerInventoryItem* item = item_array.at(i);
- recordInventoryItemEntry(item);
- }
+ LLViewerInventoryItem* item = item_array.at(i);
+ recordInventoryItemEntry(item);
}
+ }
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if (item)
+ LLViewerInventoryItem* item = gInventory.getItem(entry);
+ if (item)
+ {
+ const LLAssetType::EType item_type = item->getType();
+ if (item_type == LLAssetType::AT_OBJECT || item_type == LLAssetType::AT_BODYPART)
{
- if (item->getType() == LLAssetType::AT_OBJECT)
- {
- recordInventoryItemEntry(item);
- }
+ recordInventoryItemEntry(item);
}
}
+ }
- mInventoryItems->setCursorAndScrollToEnd();
+ mOutputLog->setCursorAndScrollToEnd();
+
+ mMergeItemsTexturesBtn->setEnabled(true);
+}
+
+void LLFloaterBulkyThumbs::recordTextureItemEntry(LLViewerInventoryItem* item)
+{
+ const std::string name = item->getName();
+
+ std::map<std::string, LLUUID>::iterator iter = mTextureNamesIDs.find(name);
+ if (iter == mTextureNamesIDs.end())
+ {
+ LLUUID id = item->getAssetUUID();
+ mTextureNamesIDs.insert({name, id});
- mProcessBulkyThumbsBtn->setEnabled(true);
+ mOutputLog->appendText(
+ STRINGIZE(
+ "TEXTURE " << mTextureNamesIDs.size() << "> " <<
+ name <<
+ //" | " <<
+ //id.asString() <<
+ std::endl
+ ), false);
+ }
+ else
+ {
+ // dupe - do not save
}
}
@@ -179,127 +194,127 @@ void LLFloaterBulkyThumbs::onPasteTextures()
return;
}
+ mOutputLog->appendText(
+ STRINGIZE(
+ "\n==== Pasting textures from inventory ====" <<
+ std::endl
+ ), false);
+
std::vector<LLUUID> objects;
LLClipboard::instance().pasteFromClipboard(objects);
size_t count = objects.size();
- if (count > 0)
+ for (size_t i = 0; i < count; i++)
{
- for (size_t i = 0; i < count; i++)
+ const LLUUID& entry = objects.at(i);
+
+ const LLInventoryCategory* cat = gInventory.getCategory(entry);
+ if (cat)
{
- const LLUUID& item_id = objects.at(i);
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+
+ LLIsType is_object(LLAssetType::AT_TEXTURE);
+ gInventory.collectDescendentsIf(cat->getUUID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_object);
- const LLInventoryCategory* cat = gInventory.getCategory(item_id);
- if (cat)
+ for (size_t i = 0; i < item_array.size(); i++)
{
- LLInventoryModel::cat_array_t cat_array;
- LLInventoryModel::item_array_t item_array;
- LLIsType is_texture(LLAssetType::AT_TEXTURE);
- gInventory.collectDescendentsIf(cat->getUUID(),
- cat_array,
- item_array,
- LLInventoryModel::EXCLUDE_TRASH,
- is_texture);
-
- for (size_t i = 0; i < item_array.size(); i++)
- {
- LLViewerInventoryItem* item = item_array.at(i);
- recordTextureItemEntry(item);
- }
+ LLViewerInventoryItem* item = item_array.at(i);
+ recordTextureItemEntry(item);
}
+ }
- LLViewerInventoryItem* item = gInventory.getItem(item_id);
- if (item)
+ LLViewerInventoryItem* item = gInventory.getItem(entry);
+ if (item)
+ {
+ const LLAssetType::EType item_type = item->getType();
+ if (item_type == LLAssetType::AT_TEXTURE)
{
- if (item->getType() == LLAssetType::AT_TEXTURE)
- {
- recordTextureItemEntry(item);
- }
+ recordTextureItemEntry(item);
}
}
+ }
- mInventoryItems->setCursorAndScrollToEnd();
+ mOutputLog->setCursorAndScrollToEnd();
- mProcessBulkyThumbsBtn->setEnabled(true);
- }
+ mMergeItemsTexturesBtn->setEnabled(true);
}
-void LLFloaterBulkyThumbs::onProcessBulkyThumbs()
+void LLFloaterBulkyThumbs::onMergeItemsTextures()
{
+ mOutputLog->appendText(
+ STRINGIZE(
+ "\n==== Matching items and textures for " <<
+ mItemNamesIDs.size() <<
+ " entries ====" <<
+ std::endl
+ ), false);
+
std::map<std::string, LLUUID>::iterator item_iter = mItemNamesIDs.begin();
+ size_t index = 1;
+
while (item_iter != mItemNamesIDs.end())
{
- std::string output_line = "PROCESSING: ";
std::string item_name = (*item_iter).first;
- output_line += item_name;
- output_line += "\n";
- mInventoryItems->appendText(output_line, false);
- bool found = false;
- std::map<std::string, LLUUID>::iterator texture_iter = mTextureNamesIDs.begin();
- while (texture_iter != mTextureNamesIDs.end())
- {
- std::string output_line = " COMPARING WITH: ";
- std::string texture_name = (*texture_iter).first;
- output_line += texture_name;
+ mOutputLog->appendText(
+ STRINGIZE(
+ "MATCHING ITEM (" << index++ << "/" << mItemNamesIDs.size() << ") " << item_name << "> "
+ ), false);
- if (item_name == texture_name)
- {
- output_line += " MATCH";
- found = true;
- output_line += "\n";
- mInventoryItems->appendText(output_line, false);
- break;
- }
- else
- {
- output_line += " NO MATCH";
- }
- output_line += "\n";
- mInventoryItems->appendText(output_line, false);
- mInventoryItems->setCursorAndScrollToEnd();
-
-
- ++texture_iter;
- }
-
- if (found == true)
+ std::map<std::string, LLUUID>::iterator texture_iter = mTextureNamesIDs.find(item_name);
+ if (texture_iter != mTextureNamesIDs.end())
{
+ mOutputLog->appendText(
+ STRINGIZE(
+ "MATCHED" <<
+ std::endl
+ ), false);
+
mNameItemIDTextureId.insert({item_name, {(*item_iter).second, (*texture_iter).second}});
}
else
{
- std::string output_line = "WARNING: ";
- output_line += "No texture found for ";
- output_line += item_name;
- output_line += "\n";
- mInventoryItems->appendText(output_line, false);
- mInventoryItems->setCursorAndScrollToEnd();
-
+ mOutputLog->appendText(
+ STRINGIZE(
+ "NO MATCH FOUND" <<
+ std::endl
+ ), false);
}
++item_iter;
}
- mInventoryItems->appendText("Finished - final list is", true);
- std::map<std::string, std::pair< LLUUID, LLUUID>>::iterator iter = mNameItemIDTextureId.begin();
- while (iter != mNameItemIDTextureId.end())
- {
- std::string output_line = (*iter).first;
- output_line += "\n";
- output_line += "item ID: ";
- output_line += ((*iter).second).first.asString();
- output_line += "\n";
- output_line += "thumbnail texture ID: ";
- output_line += ((*iter).second).second.asString();
- output_line += "\n";
- mInventoryItems->appendText(output_line, true);
-
- ++iter;
- }
- mInventoryItems->setCursorAndScrollToEnd();
-
- mWriteBulkyThumbsBtn->setEnabled(true);
+ mOutputLog->appendText(
+ STRINGIZE(
+ "==== Matched list of items and textures has " <<
+ mNameItemIDTextureId.size() <<
+ " entries ====" <<
+ std::endl
+ ), true);
+
+ //std::map<std::string, std::pair< LLUUID, LLUUID>>::iterator iter = mNameItemIDTextureId.begin();
+ //while (iter != mNameItemIDTextureId.end())
+ //{
+ // std::string output_line = (*iter).first;
+ // output_line += "\n";
+ // output_line += "item ID: ";
+ // output_line += ((*iter).second).first.asString();
+ // output_line += "\n";
+ // output_line += "thumbnail texture ID: ";
+ // output_line += ((*iter).second).second.asString();
+ // output_line += "\n";
+ // mOutputLog->appendText(output_line, true);
+
+ // ++iter;
+ //}
+ mOutputLog->setCursorAndScrollToEnd();
+
+ mWriteThumbnailsBtn->setEnabled(true);
}
#if 1
@@ -331,41 +346,38 @@ bool writeThumbnailID(LLUUID item_id, LLUUID thumbnail_asset_id)
}
else
{
- LL_WARNS() << "Unable to write inventory thumbnail because AIS API is not available" << LL_ENDL;
+ LL_WARNS() << "Unable to write inventory thumbnail because the AIS API is not available" << LL_ENDL;
return false;
}
}
-void LLFloaterBulkyThumbs::onWriteBulkyThumbs()
+void LLFloaterBulkyThumbs::onWriteThumbnails()
{
- // look at void LLFloaterChangeItemThumbnail::setThumbnailId(const LLUUID& new_thumbnail_id, const LLUUID& object_id, LLInventoryObject* obj)
+ mOutputLog->appendText(
+ STRINGIZE(
+ "\n==== Writing thumbnails for " <<
+ mNameItemIDTextureId.size() <<
+ " entries ====" <<
+ std::endl
+ ), false);
- /**
- * Results I get - compare with what the manual image update code gives us
- Senra Blake - bottom - sweatpants - green
- item ID: 1daf6aab-e42f-42aa-5a85-4d73458a355d
- thumbnail texture ID: cba71b7c-2335-e15c-7646-ead0f9e817fb
-
- Correct values (from mnala path) are:
- Updating thumbnail forSenra Blake - bottom - sweatpants - green:
- ID: 1daf6aab-e42f-42aa-5a85-4d73458a355d
- THUMB_ID: 8f5db9e7-8d09-c8be-0efd-0a5e4f3c925d
- */
-
- mInventoryItems->appendText("Writing thumbnails", true);
std::map<std::string, std::pair< LLUUID, LLUUID>>::iterator iter = mNameItemIDTextureId.begin();
+ size_t index = 1;
+
while (iter != mNameItemIDTextureId.end())
{
- std::string output_line = (*iter).first;
- output_line += "\n";
- output_line += "item ID: ";
- output_line += ((*iter).second).first.asString();
- output_line += "\n";
- output_line += "thumbnail texture ID: ";
- output_line += ((*iter).second).second.asString();
- output_line += "\n";
- mInventoryItems->appendText(output_line, true);
-
+ mOutputLog->appendText(
+ STRINGIZE(
+ "WRITING THUMB (" << index++ << "/" << mNameItemIDTextureId.size() << ")> " <<
+ (*iter).first <<
+ "\n" <<
+ "item ID: " <<
+ ((*iter).second).first.asString() <<
+ "\n" <<
+ "thumbnail texture ID: " <<
+ ((*iter).second).second.asString() <<
+ "\n"
+ ), true);
LLUUID item_id = ((*iter).second).first;
LLUUID thumbnail_asset_id = ((*iter).second).second;
@@ -374,5 +386,5 @@ void LLFloaterBulkyThumbs::onWriteBulkyThumbs()
++iter;
}
- mInventoryItems->setCursorAndScrollToEnd();
+ mOutputLog->setCursorAndScrollToEnd();
}
diff --git a/indra/newview/llfloaterbulkythumbs.h b/indra/newview/llfloaterbulkythumbs.h
index f5390a3791..75657002b3 100644
--- a/indra/newview/llfloaterbulkythumbs.h
+++ b/indra/newview/llfloaterbulkythumbs.h
@@ -30,6 +30,7 @@
#include "llfloater.h"
class LLTextEditor;
+class LLMediaCtrl;
class LLViewerInventoryItem;
class LLUUID;
@@ -48,13 +49,13 @@ class LLFloaterBulkyThumbs:
LLUICtrl* mPasteTexturesBtn;
void onPasteTextures();
- LLTextEditor* mInventoryItems;
+ LLTextEditor* mOutputLog;
- LLUICtrl* mProcessBulkyThumbsBtn;
- void onProcessBulkyThumbs();
+ LLUICtrl* mMergeItemsTexturesBtn;
+ void onMergeItemsTextures();
- LLUICtrl* mWriteBulkyThumbsBtn;
- void onWriteBulkyThumbs();
+ LLUICtrl* mWriteThumbnailsBtn;
+ void onWriteThumbnails();
void recordInventoryItemEntry(LLViewerInventoryItem* item);
void recordTextureItemEntry(LLViewerInventoryItem* item);
diff --git a/indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml b/indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml
index ab34e35dac..e94717f947 100644
--- a/indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml
+++ b/indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml
@@ -1,56 +1,57 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
- legacy_header_height="18"
- can_resize="true"
- height="600"
- layout="topleft"
- min_height="175"
- min_width="500"
- name="contents"
- help_topic="contents"
- title="BULKY THUMBS"
- width="500">
- <button follows="left|top"
- height="20"
- label="Paste item info from Inventory"
- layout="topleft"
- left="10"
- name="paste_items_btn"
- top="26 "
- width="200" />
-
- <button follows="left|top"
- height="20"
- label="Paste texture info from Inventory"
- layout="topleft"
- left="250"
- name="paste_textures_btn"
- top="26 "
- width="200" />
-
- <text_editor
- height="510"
- follows="top|left|right|bottom"
- left="10"
- name="inventory_items"
- top_pad="10"
- width="480">
- </text_editor>
- <button follows="left|bottom"
- height="20"
- label="Merge items and textures"
- layout="bottomleft"
- left="10"
- name="process_bulky_thumbs"
- bottom="8"
- width="200" />
-
- <button follows="left|bottom"
- height="20"
- label="Write Thumbnails"
- layout="bottomleft"
- left="250"
- name="write_bulky_thumbs"
- bottom="8"
- width="200" />
-</floater>
+ legacy_header_height="18"
+ can_resize="true"
+ height="600"
+ layout="topleft"
+ min_height="175"
+ min_width="500"
+ name="contents"
+ help_topic="contents"
+ title="BULKY THUMBS"
+ width="500">
+ <button
+ follows="left|top"
+ height="20"
+ label="Paste items from Inventory"
+ layout="topleft"
+ left="10"
+ name="paste_items_btn"
+ top="26 "
+ width="200" />
+ <button
+ follows="left|top"
+ height="20"
+ label="Paste textures from Inventory"
+ layout="topleft"
+ left="250"
+ name="paste_textures_btn"
+ top="26 "
+ width="200" />
+ <text_editor
+ height="510"
+ follows="top|left|right|bottom"
+ left="10"
+ name="output_log"
+ top_pad="10"
+ width="480">
+ </text_editor>
+ <button
+ follows="left|bottom"
+ height="20"
+ label="Merge items and textures"
+ layout="bottomleft"
+ left="10"
+ name="merge_items_textures"
+ bottom="8"
+ width="200" />
+ <button
+ follows="left|bottom"
+ height="20"
+ label="Write Thumbnails"
+ layout="bottomleft"
+ left="250"
+ name="write_items_thumbnails"
+ bottom="8"
+ width="200" />
+</floater> \ No newline at end of file