FIRE-21793: Improved inspect floater including VRAM usage, contributed by Chalice Yao and Arcane Portal, based on code originally by Cinder Roxley
parent
f647bd470f
commit
9f6b13b32e
|
|
@ -47,6 +47,11 @@
|
|||
#include "rlvcommon.h"
|
||||
#include "rlvui.h"
|
||||
// [/RLVa:KB]
|
||||
// PoundLife - Improved Object Inspect
|
||||
#include "lltexturectrl.h"
|
||||
#include "llviewerobjectlist.h" //gObjectList
|
||||
#include "llviewertexturelist.h"
|
||||
// PoundLife END
|
||||
|
||||
//LLFloaterInspect* LLFloaterInspect::sInstance = NULL;
|
||||
|
||||
|
|
@ -279,9 +284,24 @@ LLUUID LLFloaterInspect::getSelectedUUID()
|
|||
|
||||
void LLFloaterInspect::refresh()
|
||||
{
|
||||
// PoundLife - Improved Object Inspect
|
||||
mlinksetstats = "Total stats:\n\n";
|
||||
getChild<LLTextBase>("linksetstats_text")->setText(mlinksetstats);
|
||||
// PoundLife - End
|
||||
LLUUID creator_id;
|
||||
std::string creator_name;
|
||||
S32 pos = mObjectList->getScrollPos();
|
||||
// PoundLife - Improved Object Inspect
|
||||
LLSelectMgr* selmgr = LLSelectMgr::getInstance();
|
||||
S32 fcount = 0;
|
||||
S32 tcount = 0;
|
||||
S32 vcount = 0;
|
||||
S32 objcount = 0;
|
||||
S32 primcount = 0;
|
||||
texturecount = 0;
|
||||
texturememory = 0;
|
||||
vTextureList.clear();
|
||||
// PoundLife - End
|
||||
getChildView("button owner")->setEnabled(false);
|
||||
getChildView("button creator")->setEnabled(false);
|
||||
LLUUID selected_uuid;
|
||||
|
|
@ -415,6 +435,37 @@ void LLFloaterInspect::refresh()
|
|||
row["columns"][5]["type"] = "text";
|
||||
row["columns"][5]["value"] = llformat("%d", timestamp);
|
||||
// </FS:Ansariel>
|
||||
// PoundLife - Improved Object Inspect
|
||||
row["columns"][6]["column"] = "facecount";
|
||||
row["columns"][6]["type"] = "text";
|
||||
row["columns"][6]["value"] = llformat("%d", obj->getObject()->getNumFaces());
|
||||
|
||||
row["columns"][7]["column"] = "vertexcount";
|
||||
row["columns"][7]["type"] = "text";
|
||||
row["columns"][7]["value"] = llformat("%d", obj->getObject()->getNumVertices());
|
||||
|
||||
row["columns"][8]["column"] = "trianglecount";
|
||||
row["columns"][8]["type"] = "text";
|
||||
row["columns"][8]["value"] = llformat("%d", obj->getObject()->getNumIndices() / 3);
|
||||
|
||||
// Poundlife - Get VRAM
|
||||
U32 tempMem = 0;
|
||||
U32 tempCount = 0;
|
||||
getObjectVRAM(obj->getObject(), tempMem, tempCount);
|
||||
texturememory += tempMem;
|
||||
texturecount += tempCount;
|
||||
//
|
||||
|
||||
row["columns"][9]["column"] = "vramcount";
|
||||
row["columns"][9]["type"] = "text";
|
||||
row["columns"][9]["value"] = llformat("%d", tempMem / 1024);
|
||||
|
||||
primcount = selmgr->getSelection()->getObjectCount();
|
||||
objcount = selmgr->getSelection()->getRootObjectCount();
|
||||
fcount += obj->getObject()->getNumFaces();
|
||||
tcount += obj->getObject()->getNumIndices() / 3;
|
||||
vcount += obj->getObject()->getNumVertices();
|
||||
// PoundLife - END
|
||||
mObjectList->addElement(row, ADD_TOP);
|
||||
}
|
||||
if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index)
|
||||
|
|
@ -427,8 +478,90 @@ void LLFloaterInspect::refresh()
|
|||
}
|
||||
onSelectObject();
|
||||
mObjectList->setScrollPos(pos);
|
||||
// PoundLife - Total linkset stats.
|
||||
mlinksetstats += llformat("%d objects, %d prims.\n\n", objcount, primcount);
|
||||
mlinksetstats += llformat("Faces: %d\n", fcount);
|
||||
mlinksetstats += llformat("Vertices: %d\n", vcount);
|
||||
mlinksetstats += llformat("Triangles: %d\n\n", tcount);
|
||||
mlinksetstats += llformat("Textures: %d\n", texturecount);
|
||||
mlinksetstats += llformat("VRAM Use: %d kb", texturememory / 1024);
|
||||
getChild<LLTextBase>("linksetstats_text")->setText(mlinksetstats);
|
||||
// PoundLife - End
|
||||
}
|
||||
|
||||
// PoundLife - Improved Object Inspect
|
||||
void LLFloaterInspect::getObjectVRAM(LLViewerObject* object, U32 &memory, U32 &count)
|
||||
{
|
||||
if (!object) return;
|
||||
|
||||
S32 height;
|
||||
S32 width;
|
||||
std::string type_str;
|
||||
LLUUID uuid;
|
||||
U8 te_count = object->getNumTEs();
|
||||
// LLUUID uploader;
|
||||
|
||||
typedef std::map< LLUUID, std::vector<U8> > map_t;
|
||||
map_t faces_per_texture;
|
||||
for (U8 j = 0; j < te_count; j++)
|
||||
{
|
||||
LLViewerTexture* img = object->getTEImage(j);
|
||||
if (!img) continue;
|
||||
uuid = img->getID();
|
||||
height = img->getFullHeight();
|
||||
width = img->getFullWidth();
|
||||
addToVRAMTexList(uuid, height, width, memory, count);
|
||||
|
||||
// materials per face
|
||||
if (object->getTE(j)->getMaterialParams().notNull())
|
||||
{
|
||||
uuid = object->getTE(j)->getMaterialParams()->getNormalID();
|
||||
if (uuid.notNull())
|
||||
{
|
||||
LLViewerTexture* img = gTextureList.getImage(uuid);
|
||||
if (!img) continue;
|
||||
height = img->getFullHeight();
|
||||
width = img->getFullWidth();
|
||||
addToVRAMTexList(uuid, height, width, memory, count);
|
||||
}
|
||||
uuid = object->getTE(j)->getMaterialParams()->getSpecularID();
|
||||
if (uuid.notNull())
|
||||
{
|
||||
LLViewerTexture* img = gTextureList.getImage(uuid);
|
||||
if (!img) continue;
|
||||
height = img->getFullHeight();
|
||||
width = img->getFullWidth();
|
||||
addToVRAMTexList(uuid, height, width, memory, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sculpt map
|
||||
if (object->isSculpted() && !object->isMesh())
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)(object->getParameterEntry(LLNetworkData::PARAMS_SCULPT));
|
||||
uuid = sculpt_params->getSculptTexture();
|
||||
LLViewerTexture* img = gTextureList.getImage(uuid);
|
||||
if (img)
|
||||
{
|
||||
height = img->getFullHeight();
|
||||
width = img->getFullWidth();
|
||||
addToVRAMTexList(uuid, height, width, memory, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterInspect::addToVRAMTexList(const LLUUID& uuid, S32 height, S32 width, U32 &memory, U32 &count)
|
||||
{
|
||||
if (std::find(vTextureList.begin(), vTextureList.end(), uuid) == vTextureList.end())
|
||||
{
|
||||
vTextureList.push_back(uuid);
|
||||
memory += (((height * width) * 32) / 8);
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
// PoundLife - End
|
||||
|
||||
void LLFloaterInspect::onFocusReceived()
|
||||
{
|
||||
LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance());
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "llavatarname.h"
|
||||
#include "llfloater.h"
|
||||
#include "llviewerobject.h" // PoundLife - Improved Object Inspect
|
||||
|
||||
//class LLTool;
|
||||
class LLObjectSelection;
|
||||
|
|
@ -57,7 +58,10 @@ public:
|
|||
void onClickCreatorProfile();
|
||||
void onClickOwnerProfile();
|
||||
void onSelectObject();
|
||||
|
||||
// PoundLife - Improved Object Inspect
|
||||
std::string mlinksetstats;
|
||||
U64 mStatsMemoryTotal;
|
||||
// PoundLife - End
|
||||
LLScrollListCtrl* mObjectList;
|
||||
protected:
|
||||
// protected members
|
||||
|
|
@ -69,6 +73,14 @@ protected:
|
|||
// [/RLVa:KB]
|
||||
|
||||
private:
|
||||
// PoundLife - Improved Object Inspect
|
||||
LLUUID mObjectID;
|
||||
void getObjectVRAM(LLViewerObject* object, U32 &memory, U32 &count);
|
||||
void addToVRAMTexList(const LLUUID& uuid, S32 height, S32 width, U32 &memory, U32 &count);
|
||||
std::vector<LLUUID> vTextureList;
|
||||
U32 texturememory;
|
||||
U32 texturecount;
|
||||
// PoundLife - End
|
||||
void onGetOwnerNameCallback();
|
||||
void onGetCreatorNameCallback();
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ private:
|
|||
void addImageToList(LLViewerFetchedTexture *image);
|
||||
void removeImageFromList(LLViewerFetchedTexture *image);
|
||||
|
||||
public: // PoundLife - Improved Object Inspect
|
||||
LLViewerFetchedTexture * getImage(const LLUUID &image_id,
|
||||
FTType f_type = FTT_DEFAULT,
|
||||
BOOL usemipmap = TRUE,
|
||||
|
|
@ -166,6 +167,7 @@ private:
|
|||
LLHost request_from_host = LLHost()
|
||||
);
|
||||
|
||||
private: // PoundLife - Improved Object Inspect
|
||||
LLViewerFetchedTexture * getImageFromFile(const std::string& filename,
|
||||
FTType f_type = FTT_LOCAL_FILE,
|
||||
BOOL usemipmap = TRUE,
|
||||
|
|
|
|||
|
|
@ -19,38 +19,73 @@
|
|||
name="Group">
|
||||
(Group)
|
||||
</floater.string>
|
||||
|
||||
<text_editor
|
||||
top="24"
|
||||
left="5"
|
||||
width="120"
|
||||
height="242"
|
||||
layout="topleft"
|
||||
follows="left|top|bottom"
|
||||
name="linksetstats_text"
|
||||
max_length="2048"
|
||||
bg_visible="false"
|
||||
border_visible="true"
|
||||
allow_scroll="true"
|
||||
h_pad="2"
|
||||
v_pad="0"
|
||||
read_only="true"
|
||||
translate="false"
|
||||
value="(loading...)"
|
||||
word_wrap="true"/>
|
||||
<scroll_list
|
||||
bottom="268"
|
||||
top="24"
|
||||
height="242"
|
||||
column_padding="0"
|
||||
draw_heading="true"
|
||||
follows="top|right|left|bottom"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
left_pad="5"
|
||||
name="object_list"
|
||||
right="-10"
|
||||
tool_tip="Select an object from this list to highlight it in-world"
|
||||
top="20">
|
||||
right="-6"
|
||||
tool_tip="Select an object from this list to highlight it in-world">
|
||||
<scroll_list.columns
|
||||
relative_width="0.20"
|
||||
dynamic_width="true"
|
||||
label="Object Name"
|
||||
name="object_name" />
|
||||
<scroll_list.columns
|
||||
relative_width="0.20"
|
||||
dynamic_width="true"
|
||||
label="Description"
|
||||
name="description" />
|
||||
<scroll_list.columns
|
||||
dynamic_width="true"
|
||||
label="Owner Name"
|
||||
name="owner_name" />
|
||||
<scroll_list.columns
|
||||
relative_width="0.20"
|
||||
dynamic_width="true"
|
||||
label="Creator Name"
|
||||
name="creator_name" />
|
||||
<scroll_list.columns
|
||||
label="Faces"
|
||||
name="facecount"
|
||||
width="45" />
|
||||
<scroll_list.columns
|
||||
label="Vertices"
|
||||
name="vertexcount"
|
||||
width="55" />
|
||||
<scroll_list.columns
|
||||
label="Triangles"
|
||||
name="trianglecount"
|
||||
width="55" />
|
||||
<scroll_list.columns
|
||||
label="VRAM"
|
||||
name="vramcount"
|
||||
width="55" />
|
||||
<scroll_list.columns
|
||||
label="Creation Date"
|
||||
name="creation_date"
|
||||
relative_width="0.20"
|
||||
dynamic_width="true"
|
||||
sort_column="creation_date_sort"/>
|
||||
<scroll_list.columns
|
||||
label="Description"
|
||||
name="description"
|
||||
relative_width="0.20" />
|
||||
<scroll_list.columns
|
||||
label=""
|
||||
name="creation_date_sort"
|
||||
|
|
@ -63,7 +98,7 @@
|
|||
height="23"
|
||||
label="See Owner Profile..."
|
||||
layout="topleft"
|
||||
left_delta="-1"
|
||||
left="4"
|
||||
name="button owner"
|
||||
tool_tip="See profile of the highlighted object's owner"
|
||||
top_pad="4"
|
||||
|
|
|
|||
Loading…
Reference in New Issue