NORSPEC-8: Adding ability to parse GET data over multiple frames to avoid viewer timeout and crash on regions with large numbers of materials.
parent
d593b8b3b8
commit
34f561c853
|
|
@ -45,6 +45,7 @@
|
|||
#include "llhttpclient.h"
|
||||
#include "lllineeditor.h"
|
||||
#include "llmaterialid.h"
|
||||
#include "llresmgr.h"
|
||||
#include "llscrolllistcell.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llscrolllistitem.h"
|
||||
|
|
@ -125,6 +126,9 @@ BOOL LLFloaterDebugMaterials::postBuild()
|
|||
llassert(mGetButton != NULL);
|
||||
mGetButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetClicked, this));
|
||||
|
||||
mParsingStatusText = findChild<LLTextBase>("loading_status");
|
||||
llassert(mParsingStatusText != NULL);
|
||||
|
||||
mGetNormalMapScrollList = findChild<LLScrollListCtrl>("get_normal_map_scroll_list");
|
||||
llassert(mGetNormalMapScrollList != NULL);
|
||||
mGetNormalMapScrollList->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetScrollListSelectionChange, this, _1));
|
||||
|
|
@ -321,10 +325,20 @@ void LLFloaterDebugMaterials::onClose(bool pIsAppQuitting)
|
|||
LLFloater::onClose(pIsAppQuitting);
|
||||
}
|
||||
|
||||
void LLFloaterDebugMaterials::draw()
|
||||
{
|
||||
if (mUnparsedGetData.isDefined())
|
||||
{
|
||||
parseGetResponse();
|
||||
}
|
||||
LLFloater::draw();
|
||||
}
|
||||
|
||||
LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams)
|
||||
: LLFloater(pParams),
|
||||
mStatusText(NULL),
|
||||
mGetButton(NULL),
|
||||
mParsingStatusText(NULL),
|
||||
mGetNormalMapScrollList(NULL),
|
||||
mGetSpecularMapScrollList(NULL),
|
||||
mGetOtherDataScrollList(NULL),
|
||||
|
|
@ -361,7 +375,9 @@ LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams)
|
|||
mErrorColor(),
|
||||
mRegionCrossConnection(),
|
||||
mTeleportFailedConnection(),
|
||||
mSelectionUpdateConnection()
|
||||
mSelectionUpdateConnection(),
|
||||
mUnparsedGetData(),
|
||||
mNextUnparsedGetDataIndex(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -500,10 +516,11 @@ void LLFloaterDebugMaterials::onDeferredRequestPostMaterials(LLUUID regionId, bo
|
|||
|
||||
void LLFloaterDebugMaterials::onGetResponse(bool pRequestStatus, const LLSD& pContent)
|
||||
{
|
||||
clearGetResults();
|
||||
if (pRequestStatus)
|
||||
{
|
||||
setState(kRequestCompleted);
|
||||
parseGetResponse(pContent);
|
||||
setUnparsedGetData(pContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -887,35 +904,31 @@ void LLFloaterDebugMaterials::queryViewableObjects()
|
|||
}
|
||||
}
|
||||
|
||||
void LLFloaterDebugMaterials::parseGetResponse(const LLSD& pContent)
|
||||
void LLFloaterDebugMaterials::parseGetResponse()
|
||||
{
|
||||
clearGetResults();
|
||||
llassert(mUnparsedGetData.isDefined());
|
||||
llassert(mNextUnparsedGetDataIndex >= 0);
|
||||
|
||||
LLScrollListCell::Params cellParams;
|
||||
LLScrollListItem::Params normalMapRowParams;
|
||||
LLScrollListItem::Params specularMapRowParams;
|
||||
LLScrollListItem::Params otherDataRowParams;
|
||||
|
||||
llassert(pContent.isMap());
|
||||
llassert(pContent.has(MATERIALS_CAP_ZIP_FIELD));
|
||||
llassert(pContent.get(MATERIALS_CAP_ZIP_FIELD).isBinary());
|
||||
|
||||
LLSD::Binary responseBinary = pContent.get(MATERIALS_CAP_ZIP_FIELD).asBinary();
|
||||
S32 responseSize = static_cast<S32>(responseBinary.size());
|
||||
std::string responseString(reinterpret_cast<const char*>(responseBinary.data()), responseSize);
|
||||
|
||||
std::istringstream responseStream(responseString);
|
||||
|
||||
LLSD responseContent;
|
||||
if (!unzip_llsd(responseContent, responseStream, responseSize))
|
||||
if (mUnparsedGetData.isDefined())
|
||||
{
|
||||
LL_ERRS("debugMaterials") << "cannot unzip LLSD binary content" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
llassert(responseContent.isArray());
|
||||
for (LLSD::array_const_iterator materialIter = responseContent.beginArray(); materialIter != responseContent.endArray();
|
||||
++materialIter)
|
||||
LLScrollListCell::Params cellParams;
|
||||
LLScrollListItem::Params normalMapRowParams;
|
||||
LLScrollListItem::Params specularMapRowParams;
|
||||
LLScrollListItem::Params otherDataRowParams;
|
||||
|
||||
llassert(mUnparsedGetData.isArray());
|
||||
LLSD::array_const_iterator materialIter = mUnparsedGetData.beginArray();
|
||||
S32 materialIndex;
|
||||
|
||||
for (materialIndex = 0;
|
||||
(materialIndex < mNextUnparsedGetDataIndex) && (materialIter != mUnparsedGetData.endArray());
|
||||
++materialIndex, ++materialIter)
|
||||
{
|
||||
}
|
||||
|
||||
for (S32 currentParseCount = 0;
|
||||
(currentParseCount < 10) && (materialIter != mUnparsedGetData.endArray());
|
||||
++currentParseCount, ++materialIndex, ++materialIter)
|
||||
{
|
||||
const LLSD &material = *materialIter;
|
||||
llassert(material.isMap());
|
||||
|
|
@ -1088,6 +1101,16 @@ void LLFloaterDebugMaterials::parseGetResponse(const LLSD& pContent)
|
|||
mGetSpecularMapScrollList->addRow(specularMapRowParams);
|
||||
mGetOtherDataScrollList->addRow(otherDataRowParams);
|
||||
}
|
||||
|
||||
if (materialIter != mUnparsedGetData.endArray())
|
||||
{
|
||||
mNextUnparsedGetDataIndex = materialIndex;
|
||||
updateGetParsingStatus();
|
||||
}
|
||||
else
|
||||
{
|
||||
clearUnparsedGetData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1290,6 +1313,7 @@ void LLFloaterDebugMaterials::clearGetResults()
|
|||
mGetNormalMapScrollList->deleteAllItems();
|
||||
mGetSpecularMapScrollList->deleteAllItems();
|
||||
mGetOtherDataScrollList->deleteAllItems();
|
||||
clearUnparsedGetData();
|
||||
}
|
||||
|
||||
void LLFloaterDebugMaterials::clearPutResults()
|
||||
|
|
@ -1309,6 +1333,63 @@ void LLFloaterDebugMaterials::clearViewableObjectsResults()
|
|||
mViewableObjectsScrollList->deleteAllItems();
|
||||
}
|
||||
|
||||
void LLFloaterDebugMaterials::setUnparsedGetData(const LLSD& pGetData)
|
||||
{
|
||||
llassert(pGetData.isMap());
|
||||
llassert(pGetData.has(MATERIALS_CAP_ZIP_FIELD));
|
||||
llassert(pGetData.get(MATERIALS_CAP_ZIP_FIELD).isBinary());
|
||||
|
||||
LLSD::Binary getDataBinary = pGetData.get(MATERIALS_CAP_ZIP_FIELD).asBinary();
|
||||
S32 getDataSize = static_cast<S32>(getDataBinary.size());
|
||||
std::string getDataString(reinterpret_cast<const char*>(getDataBinary.data()), getDataSize);
|
||||
|
||||
std::istringstream getDataStream(getDataString);
|
||||
|
||||
llassert(!mUnparsedGetData.isDefined());
|
||||
if (!unzip_llsd(mUnparsedGetData, getDataStream, getDataSize))
|
||||
{
|
||||
LL_ERRS("debugMaterials") << "cannot unzip LLSD binary content" << LL_ENDL;
|
||||
}
|
||||
mNextUnparsedGetDataIndex = 0;
|
||||
|
||||
updateGetParsingStatus();
|
||||
}
|
||||
|
||||
void LLFloaterDebugMaterials::clearUnparsedGetData()
|
||||
{
|
||||
mUnparsedGetData.clear();
|
||||
mNextUnparsedGetDataIndex = -1;
|
||||
|
||||
updateGetParsingStatus();
|
||||
}
|
||||
|
||||
void LLFloaterDebugMaterials::updateGetParsingStatus()
|
||||
{
|
||||
std::string parsingStatus;
|
||||
|
||||
if (mUnparsedGetData.isDefined())
|
||||
{
|
||||
LLLocale locale(LLStringUtil::getLocale());
|
||||
std::string numProcessedString;
|
||||
LLResMgr::getInstance()->getIntegerString(numProcessedString, mNextUnparsedGetDataIndex);
|
||||
|
||||
std::string numTotalString;
|
||||
LLResMgr::getInstance()->getIntegerString(numTotalString, mUnparsedGetData.size());
|
||||
|
||||
LLStringUtil::format_map_t stringArgs;
|
||||
stringArgs["[NUM_PROCESSED]"] = numProcessedString;
|
||||
stringArgs["[NUM_TOTAL]"] = numTotalString;
|
||||
|
||||
parsingStatus = getString("loading_status_in_progress", stringArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
parsingStatus = getString("loading_status_done");
|
||||
}
|
||||
|
||||
mParsingStatusText->setText(static_cast<const LLStringExplicit>(parsingStatus));
|
||||
}
|
||||
|
||||
void LLFloaterDebugMaterials::updateStatusMessage()
|
||||
{
|
||||
std::string statusText;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public:
|
|||
virtual void onOpen(const LLSD& pKey);
|
||||
virtual void onClose(bool pIsAppQuitting);
|
||||
|
||||
virtual void draw();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
|
@ -106,7 +108,7 @@ private:
|
|||
|
||||
void queryViewableObjects();
|
||||
|
||||
void parseGetResponse(const LLSD& pContent);
|
||||
void parseGetResponse();
|
||||
void parsePutResponse(const LLSD& pContent);
|
||||
void parsePostResponse(const LLSD& pContent);
|
||||
|
||||
|
|
@ -119,6 +121,10 @@ private:
|
|||
void clearPostResults();
|
||||
void clearViewableObjectsResults();
|
||||
|
||||
void setUnparsedGetData(const LLSD& pGetData);
|
||||
void clearUnparsedGetData();
|
||||
void updateGetParsingStatus();
|
||||
|
||||
void updateStatusMessage();
|
||||
void updateControls();
|
||||
std::string convertToPrintableMaterialID(const LLSD& pBinaryHash) const;
|
||||
|
|
@ -145,6 +151,7 @@ private:
|
|||
|
||||
LLTextBase* mStatusText;
|
||||
LLButton* mGetButton;
|
||||
LLTextBase* mParsingStatusText;
|
||||
LLScrollListCtrl* mGetNormalMapScrollList;
|
||||
LLScrollListCtrl* mGetSpecularMapScrollList;
|
||||
LLScrollListCtrl* mGetOtherDataScrollList;
|
||||
|
|
@ -186,6 +193,9 @@ private:
|
|||
boost::signals2::connection mRegionCrossConnection;
|
||||
boost::signals2::connection mTeleportFailedConnection;
|
||||
boost::signals2::connection mSelectionUpdateConnection;
|
||||
|
||||
LLSD mUnparsedGetData;
|
||||
S32 mNextUnparsedGetDataIndex;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
can_tear_off="false"
|
||||
can_resize="true"
|
||||
height="725"
|
||||
width="1030"
|
||||
width="1040"
|
||||
min_height="750"
|
||||
min_width="1030"
|
||||
min_width="1040"
|
||||
layout="topleft"
|
||||
name="floater_debug_materials"
|
||||
reuse_instance="true"
|
||||
|
|
@ -20,6 +20,8 @@
|
|||
<floater.string name="status_request_completed">Request received.</floater.string>
|
||||
<floater.string name="status_not_enabled">Materials are not enabled for this region.</floater.string>
|
||||
<floater.string name="status_error">An error occurred during the request.</floater.string>
|
||||
<floater.string name="loading_status_in_progress">Processing [NUM_PROCESSED] out of [NUM_TOTAL]</floater.string>
|
||||
<floater.string name="loading_status_done">Complete</floater.string>
|
||||
<panel
|
||||
border="false"
|
||||
bevel_style="none"
|
||||
|
|
@ -64,7 +66,7 @@
|
|||
left="10"
|
||||
top_pad="10"
|
||||
height="620"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<panel
|
||||
border="true"
|
||||
bevel_style="none"
|
||||
|
|
@ -73,15 +75,15 @@
|
|||
label="Current region"
|
||||
height="620"
|
||||
top_pad="10"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<panel
|
||||
border="false"
|
||||
bevel_style="none"
|
||||
follows="left|top|right"
|
||||
layout="topleft"
|
||||
height="458"
|
||||
height="479"
|
||||
top_pad="10"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<button
|
||||
follows="left|top"
|
||||
height="22"
|
||||
|
|
@ -90,17 +92,46 @@
|
|||
name="get_button"
|
||||
top_pad="0"
|
||||
width="214"/>
|
||||
<text
|
||||
height="13"
|
||||
word_wrap="true"
|
||||
use_ellipses="false"
|
||||
type="string"
|
||||
text_color="LabelTextColor"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
layout="topleft"
|
||||
left="2"
|
||||
top_pad="8"
|
||||
width="150">
|
||||
Loading Status
|
||||
</text>
|
||||
<text
|
||||
height="13"
|
||||
word_wrap="true"
|
||||
use_ellipses="false"
|
||||
type="string"
|
||||
text_color="MaterialGoodColor"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
layout="topleft"
|
||||
left_pad="0"
|
||||
name="loading_status"
|
||||
top_pad="-13"
|
||||
width="400">
|
||||
</text>
|
||||
<scroll_list
|
||||
column_padding="0"
|
||||
draw_heading="true"
|
||||
follows="left|top|right"
|
||||
height="135"
|
||||
layout="topleft"
|
||||
left="0"
|
||||
top_pad="10"
|
||||
tab_stop="false"
|
||||
multi_select="false"
|
||||
name="get_other_data_scroll_list"
|
||||
width="765">
|
||||
width="775">
|
||||
<scroll_list.columns
|
||||
label="Material ID"
|
||||
name="id"
|
||||
|
|
@ -136,7 +167,7 @@
|
|||
tab_stop="false"
|
||||
multi_select="false"
|
||||
name="get_specular_map_scroll_list"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<scroll_list.columns
|
||||
label="Material ID"
|
||||
name="id"
|
||||
|
|
@ -176,7 +207,7 @@
|
|||
tab_stop="false"
|
||||
multi_select="false"
|
||||
name="get_normal_map_scroll_list"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<scroll_list.columns
|
||||
label="Material ID"
|
||||
name="id"
|
||||
|
|
@ -827,7 +858,7 @@
|
|||
label="Viewable objects"
|
||||
height="620"
|
||||
top_pad="10"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<panel
|
||||
border="false"
|
||||
bevel_style="none"
|
||||
|
|
@ -835,7 +866,7 @@
|
|||
layout="topleft"
|
||||
height="620"
|
||||
top_pad="0"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<panel
|
||||
border="false"
|
||||
bevel_style="none"
|
||||
|
|
@ -895,7 +926,7 @@
|
|||
name="horiz_separator"
|
||||
top_pad="10"
|
||||
left="0"
|
||||
width="1010"/>
|
||||
width="1020"/>
|
||||
<panel
|
||||
border="false"
|
||||
bevel_style="none"
|
||||
|
|
@ -903,7 +934,7 @@
|
|||
layout="topleft"
|
||||
height="458"
|
||||
top_pad="10"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<button
|
||||
follows="left|top"
|
||||
height="22"
|
||||
|
|
@ -931,7 +962,7 @@
|
|||
tab_stop="false"
|
||||
multi_select="false"
|
||||
name="post_other_data_scroll_list"
|
||||
width="765">
|
||||
width="775">
|
||||
<scroll_list.columns
|
||||
label="Material ID"
|
||||
name="id"
|
||||
|
|
@ -967,7 +998,7 @@
|
|||
tab_stop="false"
|
||||
multi_select="false"
|
||||
name="post_specular_map_scroll_list"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<scroll_list.columns
|
||||
label="Material ID"
|
||||
name="id"
|
||||
|
|
@ -1007,7 +1038,7 @@
|
|||
tab_stop="false"
|
||||
multi_select="false"
|
||||
name="post_normal_map_scroll_list"
|
||||
width="1010">
|
||||
width="1020">
|
||||
<scroll_list.columns
|
||||
label="Material ID"
|
||||
name="id"
|
||||
|
|
|
|||
Loading…
Reference in New Issue