From a8642c90dac302cf5d55be23343cc58d48a43b9a Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 9 Oct 2012 16:30:53 -0700 Subject: Adjusting the layout and adding functionality to query the viewerable objects with non-null material ids. --- indra/newview/llfloaterdebugmaterials.cpp | 148 +++++--- indra/newview/llfloaterdebugmaterials.h | 10 +- indra/newview/llviewerfloaterreg.cpp | 2 +- .../default/xui/en/floater_debug_materials.xml | 401 ++++++++++++++------- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- 5 files changed, 374 insertions(+), 189 deletions(-) diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp index 85a0fc7a2f..f91522eb22 100644 --- a/indra/newview/llfloaterdebugmaterials.cpp +++ b/indra/newview/llfloaterdebugmaterials.cpp @@ -121,13 +121,13 @@ BOOL LLFloaterDebugMaterials::postBuild() llassert(mGetButton != NULL); mGetButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetClicked, this)); - mGetNormalMapScrollList = findChild("normal_map_attrs_scroll_list"); + mGetNormalMapScrollList = findChild("get_normal_map_scroll_list"); llassert(mGetNormalMapScrollList != NULL); - mGetSpecularMapScrollList = findChild("specular_map_attrs_scroll_list"); + mGetSpecularMapScrollList = findChild("get_specular_map_scroll_list"); llassert(mGetSpecularMapScrollList != NULL); - mGetOtherDataScrollList = findChild("other_data_scroll_list"); + mGetOtherDataScrollList = findChild("get_other_data_scroll_list"); llassert(mGetOtherDataScrollList != NULL); mNormalMap = findChild("normal_map"); @@ -220,9 +220,12 @@ BOOL LLFloaterDebugMaterials::postBuild() mPutScrollList = findChild("put_scroll_list"); llassert(mPutScrollList != NULL); - mQueryVisibleObjectsButton = findChild("query_visible_object_button"); - llassert(mQueryVisibleObjectsButton != NULL); - mQueryVisibleObjectsButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onQueryVisibleObjectsClicked, this)); + mQueryViewableObjectsButton = findChild("query_viewable_objects_button"); + llassert(mQueryViewableObjectsButton != NULL); + mQueryViewableObjectsButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onQueryVisibleObjectsClicked, this)); + + mViewableObjectsScrollList = findChild("viewable_objects_scroll_list"); + llassert(mViewableObjectsScrollList != NULL); mGoodPostButton = findChild("good_post_button"); llassert(mGoodPostButton != NULL); @@ -232,8 +235,14 @@ BOOL LLFloaterDebugMaterials::postBuild() llassert(mBadPostButton != NULL); mBadPostButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onBadPostClicked, this)); - mPostScrollList = findChild("post_scroll_list"); - llassert(mPostScrollList != NULL); + mPostNormalMapScrollList = findChild("post_normal_map_scroll_list"); + llassert(mPostNormalMapScrollList != NULL); + + mPostSpecularMapScrollList = findChild("post_specular_map_scroll_list"); + llassert(mPostSpecularMapScrollList != NULL); + + mPostOtherDataScrollList = findChild("post_other_data_scroll_list"); + llassert(mPostOtherDataScrollList != NULL); mDefaultSpecularColor = LLUIColorTable::instance().getColor("White"); @@ -268,6 +277,7 @@ void LLFloaterDebugMaterials::onOpen(const LLSD& pKey) resetObjectEditInputs(); clearGetResults(); clearPutResults(); + clearViewableObjectsResults(); clearPostResults(); } @@ -276,6 +286,7 @@ void LLFloaterDebugMaterials::onClose(bool pIsAppQuitting) resetObjectEditInputs(); clearGetResults(); clearPutResults(); + clearViewableObjectsResults(); clearPostResults(); if (mSelectionUpdateConnection.connected()) @@ -323,10 +334,13 @@ LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams) mPutSetButton(NULL), mPutClearButton(NULL), mPutScrollList(NULL), - mQueryVisibleObjectsButton(NULL), + mQueryViewableObjectsButton(NULL), + mViewableObjectsScrollList(NULL), mGoodPostButton(NULL), mBadPostButton(NULL), - mPostScrollList(NULL), + mPostNormalMapScrollList(NULL), + mPostSpecularMapScrollList(NULL), + mPostOtherDataScrollList(NULL), mState(kNoRegion), mWarningColor(), mErrorColor(), @@ -375,38 +389,7 @@ void LLFloaterDebugMaterials::onPutClearClicked() void LLFloaterDebugMaterials::onQueryVisibleObjectsClicked() { - S32 numViewerObjects = gObjectList.getNumObjects(); - for (S32 viewerObjectIndex = 0; viewerObjectIndex < numViewerObjects; ++viewerObjectIndex) - { - const LLViewerObject *viewerObject = gObjectList.getObject(viewerObjectIndex); - if ((viewerObject != NULL) && !viewerObject->isDead()) - { - U8 objectNumTEs = viewerObject->getNumTEs(); - - if (objectNumTEs > 0U) - { - const LLUUID& objectId = viewerObject->getID(); - U32 objectLocalId = viewerObject->getLocalID(); - S32 objectNumFaces = viewerObject->getNumFaces(); - const LLViewerRegion* objectRegion = viewerObject->getRegion(); - for (U8 curTEIndex = 0U; curTEIndex < objectNumTEs; ++curTEIndex) - { - const LLTextureEntry* objectTE = viewerObject->getTE(curTEIndex); - llassert(objectTE != NULL); - const LLMaterialID& objectMaterialID = objectTE->getMaterialID(); - if (!objectMaterialID.isNull()) - { - llinfos << "STINSON DEBUG: #" << (viewerObjectIndex + 1) << ": " << objectId.asString() - << " (" << ((objectRegion != NULL) ? objectRegion->getRegionID().asString() : "") - << ") [" << objectLocalId << "] {" << static_cast(curTEIndex) - << "} : numFaces(" << objectNumFaces << ") material(" - << convertToPrintableMaterialID(objectMaterialID) << ")" << llendl; - } - } - } - - } - } + queryViewableObjects(); } void LLFloaterDebugMaterials::onGoodPostClicked() @@ -424,6 +407,7 @@ void LLFloaterDebugMaterials::onRegionCross() checkRegionMaterialStatus(); clearGetResults(); clearPutResults(); + clearViewableObjectsResults(); clearPostResults(); } @@ -755,6 +739,71 @@ void LLFloaterDebugMaterials::requestPostMaterials(const LLUUID& regionId, bool } } +void LLFloaterDebugMaterials::queryViewableObjects() +{ + clearViewableObjectsResults(); + + LLScrollListCell::Params cellParams; + LLScrollListItem::Params rowParams; + + S32 numViewerObjects = gObjectList.getNumObjects(); + for (S32 viewerObjectIndex = 0; viewerObjectIndex < numViewerObjects; ++viewerObjectIndex) + { + const LLViewerObject *viewerObject = gObjectList.getObject(viewerObjectIndex); + if ((viewerObject != NULL) && !viewerObject->isDead()) + { + U8 objectNumTEs = viewerObject->getNumTEs(); + + if (objectNumTEs > 0U) + { + const LLUUID& objectId = viewerObject->getID(); + U32 objectLocalId = viewerObject->getLocalID(); + const LLViewerRegion* objectRegion = viewerObject->getRegion(); + + for (U8 curTEIndex = 0U; curTEIndex < objectNumTEs; ++curTEIndex) + { + const LLTextureEntry* objectTE = viewerObject->getTE(curTEIndex); + llassert(objectTE != NULL); + const LLMaterialID& objectMaterialID = objectTE->getMaterialID(); + if (!objectMaterialID.isNull()) + { + cellParams.font = LLFontGL::getFontMonospace(); + + cellParams.column = "object_id"; + cellParams.value = objectId.asString(); + rowParams.columns.add(cellParams); + + cellParams.font = LLFontGL::getFontSansSerif(); + + cellParams.column = "region"; + cellParams.value = ((objectRegion == NULL) ? "" : objectRegion->getName()); + rowParams.columns.add(cellParams); + + cellParams.column = "local_id"; + cellParams.value = llformat("%d", objectLocalId); + rowParams.columns.add(cellParams); + + cellParams.column = "face_index"; + cellParams.value = llformat("%u", static_cast(curTEIndex)); + rowParams.columns.add(cellParams); + cellParams.font = LLFontGL::getFontMonospace(); + + std::string materialIDString = convertToPrintableMaterialID(objectMaterialID); + cellParams.column = "material_id"; + cellParams.value = materialIDString; + rowParams.columns.add(cellParams); + + rowParams.value = objectId; + + mViewableObjectsScrollList->addRow(rowParams); + } + } + } + + } + } +} + void LLFloaterDebugMaterials::parseGetResponse(const LLSD& pContent) { printResponse("GET", pContent); @@ -920,7 +969,7 @@ void LLFloaterDebugMaterials::parseGetResponse(const LLSD& pContent) specularMapRowParams.columns.add(cellParams); otherDataRowParams.columns.add(cellParams); - cellParams.column = "normal_map_list"; + cellParams.column = "normal_map_list_map"; cellParams.value = normalMapID.asString(); normalMapRowParams.columns.add(cellParams); @@ -995,7 +1044,7 @@ void LLFloaterDebugMaterials::parseGetResponse(const LLSD& pContent) cellParams.font = LLFontGL::getFontMonospace(); - cellParams.column = "specular_map_list"; + cellParams.column = "specular_map_list_map"; cellParams.value = specularMapID.asString(); specularMapRowParams.columns.add(cellParams); @@ -1149,6 +1198,7 @@ void LLFloaterDebugMaterials::parsePutResponse(const LLSD& pContent) void LLFloaterDebugMaterials::parsePostResponse(const LLSD& pContent) { printResponse("POST", pContent); +#if 0 clearPostResults(); LLScrollListCell::Params cellParams; @@ -1239,6 +1289,7 @@ void LLFloaterDebugMaterials::parsePostResponse(const LLSD& pContent) mPostScrollList->addRow(rowParams); } +#endif } void LLFloaterDebugMaterials::printResponse(const std::string& pRequestType, const LLSD& pContent) const @@ -1296,7 +1347,14 @@ void LLFloaterDebugMaterials::clearPutResults() void LLFloaterDebugMaterials::clearPostResults() { - mPostScrollList->deleteAllItems(); + mPostNormalMapScrollList->deleteAllItems(); + mPostSpecularMapScrollList->deleteAllItems(); + mPostOtherDataScrollList->deleteAllItems(); +} + +void LLFloaterDebugMaterials::clearViewableObjectsResults() +{ + mViewableObjectsScrollList->deleteAllItems(); } void LLFloaterDebugMaterials::updateStatusMessage() diff --git a/indra/newview/llfloaterdebugmaterials.h b/indra/newview/llfloaterdebugmaterials.h index 8419535ac0..204392d5e3 100644 --- a/indra/newview/llfloaterdebugmaterials.h +++ b/indra/newview/llfloaterdebugmaterials.h @@ -100,6 +100,8 @@ private: void requestPostMaterials(bool pUseGoodData); void requestPostMaterials(const LLUUID& regionId, bool pUseGoodData); + void queryViewableObjects(); + void parseGetResponse(const LLSD& pContent); void parsePutResponse(const LLSD& pContent); void parsePostResponse(const LLSD& pContent); @@ -112,6 +114,7 @@ private: void clearGetResults(); void clearPutResults(); void clearPostResults(); + void clearViewableObjectsResults(); void updateStatusMessage(); void updateControls(); @@ -161,10 +164,13 @@ private: LLButton* mPutSetButton; LLButton* mPutClearButton; LLScrollListCtrl* mPutScrollList; - LLButton* mQueryVisibleObjectsButton; + LLButton* mQueryViewableObjectsButton; + LLScrollListCtrl* mViewableObjectsScrollList; LLButton* mGoodPostButton; LLButton* mBadPostButton; - LLScrollListCtrl* mPostScrollList; + LLScrollListCtrl* mPostNormalMapScrollList; + LLScrollListCtrl* mPostSpecularMapScrollList; + LLScrollListCtrl* mPostOtherDataScrollList; LLColor4 mDefaultSpecularColor; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 136e8fa0c4..b630b5bbe6 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -256,7 +256,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("pathfinding_characters", "floater_pathfinding_characters.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("pathfinding_linksets", "floater_pathfinding_linksets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("debug_materials", "floater_debug_materials.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("floater_debug_materials", "floater_debug_materials.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_debug_materials.xml b/indra/newview/skins/default/xui/en/floater_debug_materials.xml index 17ca0e3450..85743e4501 100644 --- a/indra/newview/skins/default/xui/en/floater_debug_materials.xml +++ b/indra/newview/skins/default/xui/en/floater_debug_materials.xml @@ -3,12 +3,12 @@ positioning="cascading" can_tear_off="false" can_resize="true" - height="680" - width="1244" - min_height="600" - min_width="1100" + height="725" + width="1030" + min_height="750" + min_width="1030" layout="topleft" - name="debug_materials" + name="floater_debug_materials" reuse_instance="true" save_rect="false" single_instance="true" @@ -57,41 +57,31 @@ width="214"> - + height="620" + width="1010"> + width="1010"> + width="1010">