diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterstinson.cpp | 123 | ||||
-rw-r--r-- | indra/newview/llfloaterstinson.h | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_stinson.xml | 87 |
3 files changed, 202 insertions, 15 deletions
diff --git a/indra/newview/llfloaterstinson.cpp b/indra/newview/llfloaterstinson.cpp index ff8fc18112..5da1d9b242 100644 --- a/indra/newview/llfloaterstinson.cpp +++ b/indra/newview/llfloaterstinson.cpp @@ -39,7 +39,11 @@ #include "llbutton.h" #include "llenvmanager.h" #include "llfloater.h" +#include "llfontgl.h" #include "llhttpclient.h" +#include "llscrolllistcell.h" +#include "llscrolllistctrl.h" +#include "llscrolllistitem.h" #include "llsd.h" #include "llselectmgr.h" #include "llstring.h" @@ -116,6 +120,9 @@ BOOL LLFloaterStinson::postBuild() llassert(mPutButton != NULL); mPutButton->setCommitCallback(boost::bind(&LLFloaterStinson::onPutClicked, this)); + mMaterialsScrollList = findChild<LLScrollListCtrl>("materials_scroll_list"); + llassert(mMaterialsScrollList != NULL); + mWarningColor = LLUIColorTable::instance().getColor("MaterialWarningColor"); mErrorColor = LLUIColorTable::instance().getColor("MaterialErrorColor"); @@ -144,10 +151,13 @@ void LLFloaterStinson::onOpen(const LLSD& pKey) } checkRegionMaterialStatus(); + clearMaterialsList(); } void LLFloaterStinson::onClose(bool pIsAppQuitting) { + clearMaterialsList(); + if (mSelectionUpdateConnection.connected()) { mSelectionUpdateConnection.disconnect(); @@ -224,7 +234,7 @@ void LLFloaterStinson::onGetResponse(bool pRequestStatus, const LLSD& pContent) if (pRequestStatus) { setState(kRequestCompleted); - parseResponse("GET", pContent); + parseGetResponse(pContent); } else { @@ -237,7 +247,7 @@ void LLFloaterStinson::onPutResponse(bool pRequestStatus, const LLSD& pContent) if (pRequestStatus) { setState(kRequestCompleted); - parseResponse("PUT", pContent); + printResponse("PUT", pContent); } else { @@ -445,7 +455,109 @@ void LLFloaterStinson::requestPutMaterials(const LLUUID& regionId) } } -void LLFloaterStinson::parseResponse(const std::string& pRequestType, const LLSD& pContent) const +void LLFloaterStinson::parseGetResponse(const LLSD& pContent) +{ + printResponse("GET", pContent); + clearMaterialsList(); + + LLScrollListCell::Params cellParams; + LLScrollListItem::Params rowParams; + + llassert(pContent.isArray()); + for (LLSD::array_const_iterator materialIter = pContent.beginArray(); materialIter != pContent.endArray(); + ++materialIter) + { + const LLSD &material = *materialIter; + llassert(material.isMap()); + llassert(material.has(MATERIALS_CAP_OBJECT_ID_FIELD)); + llassert(material.get(MATERIALS_CAP_OBJECT_ID_FIELD).isBinary()); + + const LLSD::Binary &materialIDValue = material.get(MATERIALS_CAP_OBJECT_ID_FIELD).asBinary(); + unsigned int valueSize = materialIDValue.size(); + + std::string materialID(reinterpret_cast<const char *>(&materialIDValue[0]), valueSize); + std::string materialIDString; + for (unsigned int i = 0; i < valueSize; ++i) + { + materialIDString += llformat("%02x", materialID.c_str()[i]); + } + + llassert(material.has(MATERIALS_CAP_MATERIAL_FIELD)); + const LLSD &materialData = material.get(MATERIALS_CAP_MATERIAL_FIELD); + llassert(materialData.isMap()); + + llassert(materialData.has(MATERIALS_CAP_NORMAL_MAP_FIELD)); + llassert(materialData.get(MATERIALS_CAP_NORMAL_MAP_FIELD).isUUID()); + const LLUUID &normalMapID = materialData.get(MATERIALS_CAP_NORMAL_MAP_FIELD).asUUID(); + + llassert(materialData.has(MATERIALS_CAP_SPECULAR_MAP_FIELD)); + llassert(materialData.get(MATERIALS_CAP_SPECULAR_MAP_FIELD).isUUID()); + const LLUUID &specularMapID = materialData.get(MATERIALS_CAP_SPECULAR_MAP_FIELD).asUUID(); + + llassert(materialData.has(MATERIALS_CAP_SPECULAR_COLOR_FIELD)); + llassert(materialData.get(MATERIALS_CAP_SPECULAR_COLOR_FIELD).isArray()); + LLColor4U specularColor; + specularColor.setValue(materialData.get(MATERIALS_CAP_SPECULAR_COLOR_FIELD)); + + llassert(materialData.has(MATERIALS_CAP_SPECULAR_EXP_FIELD)); + llassert(materialData.get(MATERIALS_CAP_SPECULAR_EXP_FIELD).isInteger()); + S32 specularExp = materialData.get(MATERIALS_CAP_SPECULAR_EXP_FIELD).asInteger(); + + llassert(materialData.has(MATERIALS_CAP_ENV_INTENSITY_FIELD)); + llassert(materialData.get(MATERIALS_CAP_ENV_INTENSITY_FIELD).isInteger()); + S32 envIntensity = materialData.get(MATERIALS_CAP_ENV_INTENSITY_FIELD).asInteger(); + + llassert(materialData.has(MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD)); + llassert(materialData.get(MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD).isInteger()); + S32 alphaMaskCutoff = materialData.get(MATERIALS_CAP_ALPHA_MASK_CUTOFF_FIELD).asInteger(); + + llassert(materialData.has(MATERIALS_CAP_DIFFUSE_ALPHA_IS_MASK_FIELD)); + llassert(materialData.get(MATERIALS_CAP_DIFFUSE_ALPHA_IS_MASK_FIELD).isInteger()); + BOOL isDiffuseAlphaMask = static_cast<BOOL>(materialData.get(MATERIALS_CAP_DIFFUSE_ALPHA_IS_MASK_FIELD).asInteger()); + + + cellParams.font = LLFontGL::getFontMonospace(); + + cellParams.column = "id"; + cellParams.value = materialIDString; + rowParams.columns.add(cellParams); + + cellParams.column = "normal_map"; + cellParams.value = normalMapID.asString(); + rowParams.columns.add(cellParams); + + cellParams.column = "specular_map"; + cellParams.value = specularMapID.asString(); + rowParams.columns.add(cellParams); + + cellParams.font = LLFontGL::getFontSansSerif(); + + cellParams.column = "specular_color"; + cellParams.value = llformat("(%d, %d, %d, %d)", specularColor.mV[0], + specularColor.mV[1], specularColor.mV[2], specularColor.mV[3]); + rowParams.columns.add(cellParams); + + cellParams.column = "specular_exponent"; + cellParams.value = llformat("%d", specularExp); + rowParams.columns.add(cellParams); + + cellParams.column = "env_intensity"; + cellParams.value = llformat("%d", envIntensity); + rowParams.columns.add(cellParams); + + cellParams.column = "alpha_mask_cutoff"; + cellParams.value = llformat("%d", alphaMaskCutoff); + rowParams.columns.add(cellParams); + + cellParams.column = "is_diffuse_alpha_mask"; + cellParams.value = (isDiffuseAlphaMask ? "True" : "False"); + rowParams.columns.add(cellParams); + + mMaterialsScrollList->addRow(rowParams); + } +} + +void LLFloaterStinson::printResponse(const std::string& pRequestType, const LLSD& pContent) const { llinfos << "--------------------------------------------------------------------------" << llendl; llinfos << pRequestType << " Response: '" << pContent << "'" << llendl; @@ -459,6 +571,11 @@ void LLFloaterStinson::setState(EState pState) updateControls(); } +void LLFloaterStinson::clearMaterialsList() +{ + mMaterialsScrollList->deleteAllItems(); +} + void LLFloaterStinson::updateStatusMessage() { std::string statusText; diff --git a/indra/newview/llfloaterstinson.h b/indra/newview/llfloaterstinson.h index 1a4c511deb..5b8f157cd0 100644 --- a/indra/newview/llfloaterstinson.h +++ b/indra/newview/llfloaterstinson.h @@ -34,6 +34,7 @@ #include "v4color.h" class LLButton; +class LLScrollListCtrl; class LLSD; class LLTextBase; @@ -82,17 +83,21 @@ private: void requestPutMaterials(); void requestPutMaterials(const LLUUID& regionId); - void parseResponse(const std::string& pRequestType, const LLSD& pContent) const; + void parseGetResponse(const LLSD& pContent); + void printResponse(const std::string& pRequestType, const LLSD& pContent) const; void setState(EState pState); inline EState getState() const; + void clearMaterialsList(); + void updateStatusMessage(); void updateControls(); LLTextBase* mStatusText; LLButton* mGetButton; LLButton* mPutButton; + LLScrollListCtrl* mMaterialsScrollList; EState mState; LLColor4 mWarningColor; diff --git a/indra/newview/skins/default/xui/en/floater_stinson.xml b/indra/newview/skins/default/xui/en/floater_stinson.xml index 0ec6b281cf..559e6eb48f 100644 --- a/indra/newview/skins/default/xui/en/floater_stinson.xml +++ b/indra/newview/skins/default/xui/en/floater_stinson.xml @@ -2,15 +2,18 @@ <floater positioning="cascading" can_tear_off="false" - height="160" + can_resize="true" + height="315" + width="1194" + min_height="315" + min_width="1100" layout="topleft" name="floater_stinson" help_topic="floater_stinson" reuse_instance="true" - save_rect="true" + save_rect="false" single_instance="true" - title="Stinson Test" - width="240"> + title="Stinson Test"> <floater.string name="status_no_region">No current region available.</floater.string> <floater.string name="status_capabilities_loading">Region capabilities are loading.</floater.string> <floater.string name="status_ready">Materials are enabled for this region.</floater.string> @@ -57,22 +60,21 @@ </panel> <view_border bevel_style="none" - follows="left|right|bottom" + follows="left|right|top" height="0" layout="topleft" name="horiz_separator" top_pad="0" left="12" - width="214"/> + width="1170"/> <panel border="false" bevel_style="none" - follows="left|top" + follows="left|top|right" layout="topleft" - left="12" + height="167" top_pad="10" - height="61" - width="214"> + width="1170"> <button follows="left|top" height="22" @@ -81,13 +83,76 @@ name="get_button" top_pad="0" width="214"/> + <scroll_list + column_padding="0" + draw_heading="true" + follows="left|top|right" + height="135" + layout="topleft" + top_pad="10" + tab_stop="false" + multi_select="true" + name="materials_scroll_list" + width="1170"> + <scroll_list.columns + label="ID" + name="id" + dynamic_width="true" /> + <scroll_list.columns + label="Normal Map" + name="normal_map" + width="230" /> + <scroll_list.columns + label="Specular Map" + name="specular_map" + width="230" /> + <scroll_list.columns + label="Specular Color" + name="specular_color" + width="120" /> + <scroll_list.columns + label="Specular Exponent" + name="specular_exponent" + width="112" /> + <scroll_list.columns + label="Env Intensity" + name="env_intensity" + width="80" /> + <scroll_list.columns + label="Alpha Mask Cutoff" + name="alpha_mask_cutoff" + width="110" /> + <scroll_list.columns + label="Is Diffuse Alpha Mask" + name="is_diffuse_alpha_mask" + width="128" /> + </scroll_list> + </panel> + <view_border + bevel_style="none" + follows="left|right|top" + height="0" + layout="topleft" + name="horiz_separator" + top_pad="10" + left="12" + width="1170"/> + <panel + border="false" + bevel_style="none" + follows="left|top" + layout="topleft" + left="12" + top_pad="10" + height="22" + width="214"> <button follows="left|top" height="22" label="Put" layout="topleft" name="put_button" - top_pad="12" + top_pad="0" width="214"/> </panel> </floater> |