Separate panel for inspecting the engine

This commit is contained in:
samcake 2018-05-08 18:17:52 -07:00
parent 728577dfd8
commit 859b187db6
6 changed files with 100 additions and 33 deletions

View file

@ -46,19 +46,20 @@ function job_propKeys(job) {
}
// Use this function to create a functor that will print the content of the Job visited calling the specified 'printout' function
function job_print_functor(printout, maxDepth) {
function job_print_functor(printout, showProps, maxDepth) {
if (maxDepth === undefined) maxDepth = 100
return function (job, depth, index) {
var tab = " "
var depthTab = "";
for (var d = 0; d < depth; d++) { depthTab += tab }
printout(depthTab + index + " " + job.objectName + " " + (job.enabled ? "on" : "off"))
var keys = job_propKeys(job);
for (var p=0; p < keys.length;p++) {
var prop = job[keys[p]]
printout(depthTab + tab + tab + typeof prop + " " + keys[p] + " " + prop);
printout(depthTab + index + " " + job.objectName + " " + (job.enabled ? "on " : "off ") + job.cpuRunTime + "ms")
if (showProps) {
var keys = job_propKeys(job);
for (var p=0; p < keys.length;p++) {
var prop = job[keys[p]]
printout(depthTab + tab + tab + typeof prop + " " + keys[p] + " " + prop);
}
}
return true
// return depth < maxDepth;
}

View file

@ -32,14 +32,9 @@ Rectangle {
Component.onCompleted: {
var message = ""
var functor = Jet.job_print_functor(function (line) { message += line + "\n"; });
var functor = Jet.job_print_functor(function (line) { message += line + "\n"; }, false);
Jet.task_traverseTree(rootConfig, functor);
textArea.append(message);
}
function fromScript(mope) {
var message ='Received \n';
message += mope;
textArea.append(message);
}
function clearWindow() {

View file

@ -14,7 +14,6 @@ import QtQuick.Layouts 1.3
import "qrc:///qml/styles-uit"
import "qrc:///qml/controls-uit" as HifiControls
import "configSlider"
import "../lib/jet/qml" as Jet
Rectangle {
HifiConstants { id: hifi;}
@ -276,14 +275,12 @@ Rectangle {
}
}
Separator {}
Jet.TaskList {
rootConfig: Render
anchors.left: parent.left
anchors.right: parent.right
height: 200
HifiControls.Button {
text: "Engine"
// activeFocusOnPress: false
onClicked: {
sendToScript({method: "openEngineView"});
}
}
}
//}
}

View file

@ -0,0 +1,13 @@
function openEngineTaskView() {
// Set up the qml ui
var qml = Script.resolvePath('engineInspector.qml');
var window = new OverlayWindow({
title: 'Render Engine',
source: qml,
width: 300,
height: 400
});
window.setPosition(200, 50);
//window.closed.connect(function() { Script.stop(); });
}
openEngineTaskView();

View file

@ -0,0 +1,30 @@
//
// deferredLighting.qml
//
// Created by Sam Gateau on 6/6/2016
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import "qrc:///qml/styles-uit"
import "qrc:///qml/controls-uit" as HifiControls
import "../lib/jet/qml" as Jet
Item {
HifiConstants { id: hifi;}
id: render;
anchors.fill: parent
property var mainViewTask: Render.getConfig("RenderMainView")
Jet.TaskList {
rootConfig: Render
anchors.fill: render
}
}

View file

@ -64,9 +64,6 @@
button.editProperties({isActive: onLuciScreen});
wireEventBridge(onLuciScreen);
}
function fromQml(message) {
}
button.clicked.connect(onClicked);
tablet.screenChanged.connect(onScreenChanged);
@ -82,14 +79,6 @@
Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); });
Script.scriptEnding.connect(function () {
if (onLuciScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked);
tablet.screenChanged.disconnect(onScreenChanged);
tablet.removeButton(button);
});
function setDebugCursor(x, y) {
nx = (x / Window.innerWidth);
@ -98,4 +87,46 @@
Render.getConfig("RenderMainView").getConfig("Antialiasing").debugCursorTexcoord = { x: nx, y: ny };
}
function fromQml(message) {
switch (message.method) {
case "openEngineView":
openEngineTaskView();
break;
}
}
var engineInspectorView = null
function openEngineTaskView() {
if (engineInspectorView == null) {
var qml = Script.resolvePath('engineInspector.qml');
var window = new OverlayWindow({
title: 'Render Engine',
source: qml,
width: 300,
height: 400
});
window.setPosition(200, 50);
engineInspectorView = window
window.closed.connect(function() { engineInspectorView = null; });
} else {
engineInspectorView.setPosition(200, 50);
}
}
Script.scriptEnding.connect(function () {
if (onLuciScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked);
tablet.screenChanged.disconnect(onScreenChanged);
tablet.removeButton(button);
if (engineInspectorView !== null) {
engineInspectorView.close()
}
});
}());