summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorKitty Barnett <develop@catznip.com>2013-02-25 16:19:35 +0100
committerKitty Barnett <develop@catznip.com>2013-02-25 16:19:35 +0100
commitc970cb0283f7fa71aac09f0e7ab71e3a351abd07 (patch)
tree6416d8235729f18018f96a7d14ff16813eb5fbb8 /indra/newview
parentfbf8e51c6059791b12f60602b4dda0d72dc2d847 (diff)
Added "Selected Material Info" menu option to query basic material information about the current selection
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewermenu.cpp43
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml6
2 files changed, 49 insertions, 0 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 93e4f4428a..2c8de81b60 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -292,6 +292,7 @@ void request_friendship(const LLUUID& agent_id);
// Tools menu
void handle_selected_texture_info(void*);
+void handle_selected_material_info();
void handle_dump_followcam(void*);
void handle_viewer_enable_message_log(void*);
@@ -6937,6 +6938,47 @@ void handle_selected_texture_info(void*)
}
}
+void handle_selected_material_info()
+{
+ for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+
+ std::string msg;
+ msg.assign("Material info for: \n");
+ msg.append(node->mName);
+
+ U8 te_count = node->getObject()->getNumTEs();
+ // map from material ID to list of faces using it
+ typedef std::map<LLMaterialID, std::vector<U8> > map_t;
+ map_t faces_per_material;
+ for (U8 i = 0; i < te_count; i++)
+ {
+ if (!node->isTESelected(i)) continue;
+
+ const LLMaterialID& material_id = node->getObject()->getTE(i)->getMaterialID();
+ faces_per_material[material_id].push_back(i);
+ }
+ // Per-material, dump which faces are using it.
+ map_t::iterator it;
+ for (it = faces_per_material.begin(); it != faces_per_material.end(); ++it)
+ {
+ const LLMaterialID& material_id = it->first;
+ msg = llformat("%s on face ", material_id.asString());
+ for (U8 i = 0; i < it->second.size(); ++i)
+ {
+ msg.append( llformat("%d ", (S32)(it->second[i])));
+ }
+ msg.append("\n");
+ }
+
+ LLSD args;
+ args["MESSAGE"] = msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
+}
+
void handle_test_male(void*)
{
LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit");
@@ -8418,6 +8460,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLAdvancedToggleInfoDisplay(), "Advanced.ToggleInfoDisplay");
view_listener_t::addMenu(new LLAdvancedCheckInfoDisplay(), "Advanced.CheckInfoDisplay");
view_listener_t::addMenu(new LLAdvancedSelectedTextureInfo(), "Advanced.SelectedTextureInfo");
+ commit.add("Advanced.SelectedMaterialInfo", boost::bind(&handle_selected_material_info));
view_listener_t::addMenu(new LLAdvancedToggleWireframe(), "Advanced.ToggleWireframe");
view_listener_t::addMenu(new LLAdvancedCheckWireframe(), "Advanced.CheckWireframe");
// Develop > Render
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 67b7c0258e..abf23935ba 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2559,6 +2559,12 @@
<menu_item_call.on_click
function="Advanced.SelectedTextureInfo" />
</menu_item_call>
+ <menu_item_call
+ label="Selected Material Info"
+ name="Selected Material Info">
+ <menu_item_call.on_click
+ function="Advanced.SelectedMaterialInfo" />
+ </menu_item_call>
<menu_item_check
label="Wireframe"
name="Wireframe"