From 1147adae78fe036f01de349461ae06dcc8f2f37d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 26 Aug 2016 15:16:23 +1200 Subject: [PATCH] Add columns in entity list for render performance information --- .../entities/src/EntityItemProperties.cpp | 11 +++++ scripts/system/html/css/edit-style.css | 30 ++++++++++++-- scripts/system/html/entityList.html | 40 ++++++++++++++----- scripts/system/html/js/entityList.js | 32 +++++++++++---- scripts/system/libraries/entityList.js | 8 +++- 5 files changed, 97 insertions(+), 24 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 06c91b4f32..5fdb3ba2d1 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -580,6 +580,17 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID); + // Rendering info + if (!skipDefaults) { + QScriptValue renderInfo = engine->newObject(); + renderInfo.setProperty("verticesCount", QScriptValue(10)); + renderInfo.setProperty("texturesCount", QScriptValue(2)); + renderInfo.setProperty("texturesSize", QScriptValue(1024)); + renderInfo.setProperty("hasTransparent", QScriptValue(false)); + renderInfo.setProperty("drawCalls", QScriptValue(30)); + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(renderInfo, renderInfo); // Gettable but not settable + } + properties.setProperty("clientOnly", convertScriptValue(engine, getClientOnly())); properties.setProperty("owningAvatarID", convertScriptValue(engine, getOwningAvatarID())); diff --git a/scripts/system/html/css/edit-style.css b/scripts/system/html/css/edit-style.css index 8a6c7786bf..8ed044acbc 100644 --- a/scripts/system/html/css/edit-style.css +++ b/scripts/system/html/css/edit-style.css @@ -906,16 +906,38 @@ textarea:enabled[scrolling="true"]::-webkit-resizer { } #col-type { - width: 16%; + width: 10%; } #col-name { - width: 34%; + width: 20%; } #col-url { - width: 34%; + width: 20%; } #col-locked, #col-visible { - width: 8%; + width: 4%; +} +#col-verticesCount { + width: 10%; +} +#col-texturesCount { + width: 10%; +} +#col-texturesSize { + width: 10%; +} +#col-hasTransparent { + width: 4%; +} +#col-drawCalls { + width: 10%; +} +#col-hasScript { + width: 4%; +} + +.verticesCount, .texturesCount, .texturesSize, .drawCalls { + text-align: right; } #entity-table thead tr, #entity-table thead tr th, diff --git a/scripts/system/html/entityList.html b/scripts/system/html/entityList.html index b19a55b5a2..16598c1ae1 100644 --- a/scripts/system/html/entityList.html +++ b/scripts/system/html/entityList.html @@ -37,19 +37,31 @@
- - - - - + + + + + + + + + + + - - - - - + + + + + + + + + + + @@ -59,12 +71,18 @@ + + + + + + - +
TypeNameFileTypeNameFileVTSTDS
URL
? ?
diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index 8e5e190068..8dbef1247f 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -106,12 +106,18 @@ function loaded() { })); } - function addEntity(id, name, type, url, locked, visible) { + function addEntity(id, name, type, url, locked, visible, verticesCount, texturesCount, texturesSize, hasTransparent, + drawCalls, hasScript) { + var urlParts = url.split('/'); var filename = urlParts[urlParts.length - 1]; if (entities[id] === undefined) { - entityList.add([{ id: id, name: name, type: type, url: filename, locked: locked, visible: visible }], + entityList.add([{ + id: id, name: name, type: type, url: filename, locked: locked, visible: visible, verticesCount: verticesCount, + texturesCount: texturesCount, texturesSize: texturesSize, hasTransparent: hasTransparent, + drawCalls: drawCalls, hasScript: hasScript + }], function (items) { var currentElement = items[0].elm; var id = items[0]._values.id; @@ -264,7 +270,11 @@ function loaded() { var id = newEntities[i].id; addEntity(id, newEntities[i].name, newEntities[i].type, newEntities[i].url, newEntities[i].locked ? LOCKED_GLYPH : null, - newEntities[i].visible ? VISIBLE_GLYPH : null); + newEntities[i].visible ? VISIBLE_GLYPH : null, + newEntities[i].verticesCount, newEntities[i].texturesCount, newEntities[i].texturesSize, + newEntities[i].hasTransparent ? "T" : null, + newEntities[i].drawCalls, + newEntities[i].hasScript ? "T" : null); } updateSelectedEntities(data.selectedIDs); resize(); @@ -288,11 +298,17 @@ function loaded() { } else { // Reasonable widths if nothing is displayed var tableWidth = document.getElementById("entity-table").offsetWidth; - ths[0].width = 0.16 * tableWidth; - ths[1].width = 0.34 * tableWidth; - ths[2].width = 0.34 * tableWidth; - ths[3].width = 0.08 * tableWidth; - ths[4].width = 0.08 * tableWidth; + ths[0].width = 0.10 * tableWidth; + ths[1].width = 0.20 * tableWidth; + ths[2].width = 0.20 * tableWidth; + ths[3].width = 0.04 * tableWidth; + ths[4].width = 0.04 * tableWidth; + ths[5].width = 0.10 * tableWidth; + ths[6].width = 0.10 * tableWidth; + ths[7].width = 0.10 * tableWidth; + ths[8].width = 0.04 * tableWidth; + ths[9].width = 0.10 * tableWidth; + ths[10].width = 0.04 * tableWidth; } }; diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js index 448293a2ac..2eeb64e85e 100644 --- a/scripts/system/libraries/entityList.js +++ b/scripts/system/libraries/entityList.js @@ -60,7 +60,13 @@ EntityListTool = function(opts) { type: properties.type, url: properties.type == "Model" ? properties.modelURL : "", locked: properties.locked, - visible: properties.visible + visible: properties.visible, + verticesCount: properties.renderInfo.verticesCount, + texturesCount: properties.renderInfo.texturesCount, + texturesSize:properties.renderInfo.texturesSize, + hasTransparent: properties.renderInfo.hasTransparent, + drawCalls: properties.renderInfo.drawCalls, + hasScript: properties.script !== "" }); }