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 // Rendering info
if (!skipDefaults) { 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(); QScriptValue renderInfo = engine->newObject();
renderInfo.setProperty("verticesCount", QScriptValue(10)); if (_type == EntityTypes::Model || _type == EntityTypes::PolyLine || _type == EntityTypes::ParticleEffect) {
renderInfo.setProperty("texturesCount", QScriptValue(2)); renderInfo.setProperty("texturesCount", QScriptValue(_textureNames.count()));
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 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, locked: properties.locked,
visible: properties.visible, visible: properties.visible,
verticesCount: properties.renderInfo.verticesCount, verticesCount: properties.renderInfo.verticesCount,
texturesCount: properties.renderInfo.texturesCount, texturesCount: properties.renderInfo.texturesCount ? properties.renderInfo.texturesCount : "",
texturesSize:properties.renderInfo.texturesSize, texturesSize: properties.renderInfo.texturesSize ? properties.renderInfo.texturesSize : "",
hasTransparent: properties.renderInfo.hasTransparent, hasTransparent: properties.renderInfo.hasTransparent,
drawCalls: properties.renderInfo.drawCalls, drawCalls: properties.renderInfo.drawCalls,
hasScript: properties.script !== "" hasScript: properties.script !== ""