Skip to content
Snippets Groups Projects
Commit 34f561c8 authored by William Todd Stinson's avatar William Todd Stinson
Browse files

NORSPEC-8: Adding ability to parse GET data over multiple frames to avoid...

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 d593b8b3
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "llhttpclient.h" #include "llhttpclient.h"
#include "lllineeditor.h" #include "lllineeditor.h"
#include "llmaterialid.h" #include "llmaterialid.h"
#include "llresmgr.h"
#include "llscrolllistcell.h" #include "llscrolllistcell.h"
#include "llscrolllistctrl.h" #include "llscrolllistctrl.h"
#include "llscrolllistitem.h" #include "llscrolllistitem.h"
...@@ -125,6 +126,9 @@ BOOL LLFloaterDebugMaterials::postBuild() ...@@ -125,6 +126,9 @@ BOOL LLFloaterDebugMaterials::postBuild()
llassert(mGetButton != NULL); llassert(mGetButton != NULL);
mGetButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetClicked, this)); mGetButton->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetClicked, this));
mParsingStatusText = findChild<LLTextBase>("loading_status");
llassert(mParsingStatusText != NULL);
mGetNormalMapScrollList = findChild<LLScrollListCtrl>("get_normal_map_scroll_list"); mGetNormalMapScrollList = findChild<LLScrollListCtrl>("get_normal_map_scroll_list");
llassert(mGetNormalMapScrollList != NULL); llassert(mGetNormalMapScrollList != NULL);
mGetNormalMapScrollList->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetScrollListSelectionChange, this, _1)); mGetNormalMapScrollList->setCommitCallback(boost::bind(&LLFloaterDebugMaterials::onGetScrollListSelectionChange, this, _1));
...@@ -321,10 +325,20 @@ void LLFloaterDebugMaterials::onClose(bool pIsAppQuitting) ...@@ -321,10 +325,20 @@ void LLFloaterDebugMaterials::onClose(bool pIsAppQuitting)
LLFloater::onClose(pIsAppQuitting); LLFloater::onClose(pIsAppQuitting);
} }
void LLFloaterDebugMaterials::draw()
{
if (mUnparsedGetData.isDefined())
{
parseGetResponse();
}
LLFloater::draw();
}
LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams) LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams)
: LLFloater(pParams), : LLFloater(pParams),
mStatusText(NULL), mStatusText(NULL),
mGetButton(NULL), mGetButton(NULL),
mParsingStatusText(NULL),
mGetNormalMapScrollList(NULL), mGetNormalMapScrollList(NULL),
mGetSpecularMapScrollList(NULL), mGetSpecularMapScrollList(NULL),
mGetOtherDataScrollList(NULL), mGetOtherDataScrollList(NULL),
...@@ -361,7 +375,9 @@ LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams) ...@@ -361,7 +375,9 @@ LLFloaterDebugMaterials::LLFloaterDebugMaterials(const LLSD& pParams)
mErrorColor(), mErrorColor(),
mRegionCrossConnection(), mRegionCrossConnection(),
mTeleportFailedConnection(), mTeleportFailedConnection(),
mSelectionUpdateConnection() mSelectionUpdateConnection(),
mUnparsedGetData(),
mNextUnparsedGetDataIndex(-1)
{ {
} }
...@@ -500,10 +516,11 @@ void LLFloaterDebugMaterials::onDeferredRequestPostMaterials(LLUUID regionId, bo ...@@ -500,10 +516,11 @@ void LLFloaterDebugMaterials::onDeferredRequestPostMaterials(LLUUID regionId, bo
void LLFloaterDebugMaterials::onGetResponse(bool pRequestStatus, const LLSD& pContent) void LLFloaterDebugMaterials::onGetResponse(bool pRequestStatus, const LLSD& pContent)
{ {
clearGetResults();
if (pRequestStatus) if (pRequestStatus)
{ {
setState(kRequestCompleted); setState(kRequestCompleted);
parseGetResponse(pContent); setUnparsedGetData(pContent);
} }
else else
{ {
...@@ -887,35 +904,31 @@ void LLFloaterDebugMaterials::queryViewableObjects() ...@@ -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 (mUnparsedGetData.isDefined())
if (!unzip_llsd(responseContent, responseStream, responseSize))
{
LL_ERRS("debugMaterials") << "cannot unzip LLSD binary content" << LL_ENDL;
}
else
{ {
llassert(responseContent.isArray()); LLScrollListCell::Params cellParams;
for (LLSD::array_const_iterator materialIter = responseContent.beginArray(); materialIter != responseContent.endArray(); LLScrollListItem::Params normalMapRowParams;
++materialIter) 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; const LLSD &material = *materialIter;
llassert(material.isMap()); llassert(material.isMap());
...@@ -1088,6 +1101,16 @@ void LLFloaterDebugMaterials::parseGetResponse(const LLSD& pContent) ...@@ -1088,6 +1101,16 @@ void LLFloaterDebugMaterials::parseGetResponse(const LLSD& pContent)
mGetSpecularMapScrollList->addRow(specularMapRowParams); mGetSpecularMapScrollList->addRow(specularMapRowParams);
mGetOtherDataScrollList->addRow(otherDataRowParams); mGetOtherDataScrollList->addRow(otherDataRowParams);
} }
if (materialIter != mUnparsedGetData.endArray())
{
mNextUnparsedGetDataIndex = materialIndex;
updateGetParsingStatus();
}
else
{
clearUnparsedGetData();
}
} }
} }
...@@ -1290,6 +1313,7 @@ void LLFloaterDebugMaterials::clearGetResults() ...@@ -1290,6 +1313,7 @@ void LLFloaterDebugMaterials::clearGetResults()
mGetNormalMapScrollList->deleteAllItems(); mGetNormalMapScrollList->deleteAllItems();
mGetSpecularMapScrollList->deleteAllItems(); mGetSpecularMapScrollList->deleteAllItems();
mGetOtherDataScrollList->deleteAllItems(); mGetOtherDataScrollList->deleteAllItems();
clearUnparsedGetData();
} }
void LLFloaterDebugMaterials::clearPutResults() void LLFloaterDebugMaterials::clearPutResults()
...@@ -1309,6 +1333,63 @@ void LLFloaterDebugMaterials::clearViewableObjectsResults() ...@@ -1309,6 +1333,63 @@ void LLFloaterDebugMaterials::clearViewableObjectsResults()
mViewableObjectsScrollList->deleteAllItems(); 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() void LLFloaterDebugMaterials::updateStatusMessage()
{ {
std::string statusText; std::string statusText;
......
...@@ -55,6 +55,8 @@ class LLFloaterDebugMaterials : public LLFloater ...@@ -55,6 +55,8 @@ class LLFloaterDebugMaterials : public LLFloater
virtual void onOpen(const LLSD& pKey); virtual void onOpen(const LLSD& pKey);
virtual void onClose(bool pIsAppQuitting); virtual void onClose(bool pIsAppQuitting);
virtual void draw();
protected: protected:
private: private:
...@@ -106,7 +108,7 @@ class LLFloaterDebugMaterials : public LLFloater ...@@ -106,7 +108,7 @@ class LLFloaterDebugMaterials : public LLFloater
void queryViewableObjects(); void queryViewableObjects();
void parseGetResponse(const LLSD& pContent); void parseGetResponse();
void parsePutResponse(const LLSD& pContent); void parsePutResponse(const LLSD& pContent);
void parsePostResponse(const LLSD& pContent); void parsePostResponse(const LLSD& pContent);
...@@ -119,6 +121,10 @@ class LLFloaterDebugMaterials : public LLFloater ...@@ -119,6 +121,10 @@ class LLFloaterDebugMaterials : public LLFloater
void clearPostResults(); void clearPostResults();
void clearViewableObjectsResults(); void clearViewableObjectsResults();
void setUnparsedGetData(const LLSD& pGetData);
void clearUnparsedGetData();
void updateGetParsingStatus();
void updateStatusMessage(); void updateStatusMessage();
void updateControls(); void updateControls();
std::string convertToPrintableMaterialID(const LLSD& pBinaryHash) const; std::string convertToPrintableMaterialID(const LLSD& pBinaryHash) const;
...@@ -145,6 +151,7 @@ class LLFloaterDebugMaterials : public LLFloater ...@@ -145,6 +151,7 @@ class LLFloaterDebugMaterials : public LLFloater
LLTextBase* mStatusText; LLTextBase* mStatusText;
LLButton* mGetButton; LLButton* mGetButton;
LLTextBase* mParsingStatusText;
LLScrollListCtrl* mGetNormalMapScrollList; LLScrollListCtrl* mGetNormalMapScrollList;
LLScrollListCtrl* mGetSpecularMapScrollList; LLScrollListCtrl* mGetSpecularMapScrollList;
LLScrollListCtrl* mGetOtherDataScrollList; LLScrollListCtrl* mGetOtherDataScrollList;
...@@ -186,6 +193,9 @@ class LLFloaterDebugMaterials : public LLFloater ...@@ -186,6 +193,9 @@ class LLFloaterDebugMaterials : public LLFloater
boost::signals2::connection mRegionCrossConnection; boost::signals2::connection mRegionCrossConnection;
boost::signals2::connection mTeleportFailedConnection; boost::signals2::connection mTeleportFailedConnection;
boost::signals2::connection mSelectionUpdateConnection; boost::signals2::connection mSelectionUpdateConnection;
LLSD mUnparsedGetData;
S32 mNextUnparsedGetDataIndex;
}; };
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
can_tear_off="false" can_tear_off="false"
can_resize="true" can_resize="true"
height="725" height="725"
width="1030" width="1040"
min_height="750" min_height="750"
min_width="1030" min_width="1040"
layout="topleft" layout="topleft"
name="floater_debug_materials" name="floater_debug_materials"
reuse_instance="true" reuse_instance="true"
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
<floater.string name="status_request_completed">Request received.</floater.string> <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_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="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 <panel
border="false" border="false"
bevel_style="none" bevel_style="none"
...@@ -64,7 +66,7 @@ ...@@ -64,7 +66,7 @@
left="10" left="10"
top_pad="10" top_pad="10"
height="620" height="620"
width="1010"> width="1020">
<panel <panel
border="true" border="true"
bevel_style="none" bevel_style="none"
...@@ -73,15 +75,15 @@ ...@@ -73,15 +75,15 @@
label="Current region" label="Current region"
height="620" height="620"
top_pad="10" top_pad="10"
width="1010"> width="1020">
<panel <panel
border="false" border="false"
bevel_style="none" bevel_style="none"
follows="left|top|right" follows="left|top|right"
layout="topleft" layout="topleft"
height="458" height="479"
top_pad="10" top_pad="10"
width="1010"> width="1020">
<button <button
follows="left|top" follows="left|top"
height="22" height="22"
...@@ -90,17 +92,46 @@ ...@@ -90,17 +92,46 @@
name="get_button" name="get_button"
top_pad="0" top_pad="0"
width="214"/> 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 <scroll_list
column_padding="0" column_padding="0"
draw_heading="true" draw_heading="true"
follows="left|top|right" follows="left|top|right"
height="135" height="135"
layout="topleft" layout="topleft"
left="0"
top_pad="10" top_pad="10"
tab_stop="false" tab_stop="false"
multi_select="false" multi_select="false"
name="get_other_data_scroll_list" name="get_other_data_scroll_list"
width="765"> width="775">
<scroll_list.columns <scroll_list.columns
label="Material ID" label="Material ID"
name="id" name="id"
...@@ -136,7 +167,7 @@ ...@@ -136,7 +167,7 @@
tab_stop="false" tab_stop="false"
multi_select="false" multi_select="false"
name="get_specular_map_scroll_list" name="get_specular_map_scroll_list"
width="1010"> width="1020">
<scroll_list.columns <scroll_list.columns
label="Material ID" label="Material ID"
name="id" name="id"
...@@ -176,7 +207,7 @@ ...@@ -176,7 +207,7 @@
tab_stop="false" tab_stop="false"
multi_select="false" multi_select="false"
name="get_normal_map_scroll_list" name="get_normal_map_scroll_list"
width="1010"> width="1020">
<scroll_list.columns <scroll_list.columns
label="Material ID" label="Material ID"
name="id" name="id"
...@@ -827,7 +858,7 @@ ...@@ -827,7 +858,7 @@
label="Viewable objects" label="Viewable objects"
height="620" height="620"
top_pad="10" top_pad="10"
width="1010"> width="1020">
<panel <panel
border="false" border="false"
bevel_style="none" bevel_style="none"
...@@ -835,7 +866,7 @@ ...@@ -835,7 +866,7 @@
layout="topleft" layout="topleft"
height="620" height="620"
top_pad="0" top_pad="0"
width="1010"> width="1020">
<panel <panel
border="false" border="false"
bevel_style="none" bevel_style="none"
...@@ -895,7 +926,7 @@ ...@@ -895,7 +926,7 @@
name="horiz_separator" name="horiz_separator"
top_pad="10" top_pad="10"
left="0" left="0"
width="1010"/> width="1020"/>
<panel <panel
border="false" border="false"
bevel_style="none" bevel_style="none"
...@@ -903,7 +934,7 @@ ...@@ -903,7 +934,7 @@
layout="topleft" layout="topleft"
height="458" height="458"
top_pad="10" top_pad="10"
width="1010"> width="1020">
<button <button
follows="left|top" follows="left|top"
height="22" height="22"
...@@ -931,7 +962,7 @@ ...@@ -931,7 +962,7 @@
tab_stop="false" tab_stop="false"
multi_select="false" multi_select="false"
name="post_other_data_scroll_list" name="post_other_data_scroll_list"
width="765"> width="775">
<scroll_list.columns <scroll_list.columns
label="Material ID" label="Material ID"
name="id" name="id"
...@@ -967,7 +998,7 @@ ...@@ -967,7 +998,7 @@
tab_stop="false" tab_stop="false"
multi_select="false" multi_select="false"
name="post_specular_map_scroll_list" name="post_specular_map_scroll_list"
width="1010"> width="1020">
<scroll_list.columns <scroll_list.columns
label="Material ID" label="Material ID"
name="id" name="id"
...@@ -1007,7 +1038,7 @@ ...@@ -1007,7 +1038,7 @@
tab_stop="false" tab_stop="false"
multi_select="false" multi_select="false"
name="post_normal_map_scroll_list" name="post_normal_map_scroll_list"
width="1010"> width="1020">
<scroll_list.columns <scroll_list.columns
label="Material ID" label="Material ID"
name="id" name="id"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment