Provide count of textures for entity items

This commit is contained in:
David Rowe 2016-08-27 12:13:34 +12:00
parent a0691a581c
commit 0d1daecf12
2 changed files with 13 additions and 7 deletions

View file

@ -582,12 +582,18 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
// Rendering info
if (!skipDefaults) {
/*
renderInfo.setProperty("verticesCount", QScriptValue(randIntInRange(6, 1000)));
renderInfo.setProperty("texturesCount", QScriptValue(randIntInRange(0, 10)));
renderInfo.setProperty("texturesSize", QScriptValue(randIntInRange(0, 2048)));
renderInfo.setProperty("hasTransparent", QScriptValue(randIntInRange(0, 1)));
renderInfo.setProperty("drawCalls", QScriptValue(randIntInRange(10, 5000)));
*/
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));
if (_type == EntityTypes::Model || _type == EntityTypes::PolyLine || _type == EntityTypes::ParticleEffect) {
renderInfo.setProperty("texturesCount", QScriptValue(_textureNames.count()));
}
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(renderInfo, renderInfo); // Gettable but not settable
}

View file

@ -62,8 +62,8 @@ EntityListTool = function(opts) {
locked: properties.locked,
visible: properties.visible,
verticesCount: properties.renderInfo.verticesCount,
texturesCount: properties.renderInfo.texturesCount,
texturesSize:properties.renderInfo.texturesSize,
texturesCount: properties.renderInfo.texturesCount ? properties.renderInfo.texturesCount : "",
texturesSize: properties.renderInfo.texturesSize ? properties.renderInfo.texturesSize : "",
hasTransparent: properties.renderInfo.hasTransparent,
drawCalls: properties.renderInfo.drawCalls,
hasScript: properties.script !== ""