making luci2 better

This commit is contained in:
Sam Gateau 2019-04-19 16:56:55 -07:00
parent af3d981ad1
commit ba02aa7098
9 changed files with 236 additions and 97 deletions

View file

@ -31,7 +31,15 @@ Prop.PropGroup {
property var showProps: true property var showProps: true
property var showSubs: true property var showSubs: true
property var jobEnabled: rootConfig.getConfig(jobPath).enabled property var jobEnabled: rootConfig.getConfig(jobPath).enabled
property var jobCpuTime: rootConfig.getConfig(jobPath).cpuRunTime.toPrecision(3) property var jobCpuTime: pullCpuTime()
function pullCpuTime() {
if (jobEnabled) {
return rootConfig.getConfig(jobPath).cpuRunTime.toPrecision(3);
} else {
return '.'
}
}
property var toggleJobActivation: function() { property var toggleJobActivation: function() {
console.log("the button has been pressed and jobEnabled is " + jobEnabled ) console.log("the button has been pressed and jobEnabled is " + jobEnabled )
@ -52,7 +60,7 @@ Prop.PropGroup {
} }
Prop.PropLabel { Prop.PropLabel {
id: cpuTime id: cpuTime
visible: root.jobEnabled visible: false // root.jobEnabled
width: 50 width: 50
text: jobCpuTime text: jobCpuTime
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft

View file

@ -10,7 +10,7 @@
// //
// Set up the qml ui // Set up the qml ui
var qml = Script.resolvePath('culling.qml'); var qml = Script.resolvePath('luci/Culling.qml');
var window = new OverlayWindow({ var window = new OverlayWindow({
title: 'Render Draws', title: 'Render Draws',
source: qml, source: qml,

View file

@ -10,10 +10,13 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
(function() { (function() {
var AppUi = Script.require('appUi'); var AppUi = Script.require('appUi');
var MaterialInspector = Script.require('./materialInspector.js'); var MaterialInspector = Script.require('./materialInspector.js');
var Page = Script.require('./luci/Page.js');
var moveDebugCursor = false; var moveDebugCursor = false;
var onMousePressEvent = function (e) { var onMousePressEvent = function (e) {
@ -43,83 +46,12 @@
Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 }; Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 };
} }
function Page(title, qmlurl, width, height, handleWindowFunc) {
this.title = title;
this.qml = qmlurl;
this.width = width;
this.height = height;
this.handleWindowFunc = handleWindowFunc;
this.window;
print("Page: New Page:" + JSON.stringify(this));
}
Page.prototype.killView = function () {
print("Page: Kill window for page:" + JSON.stringify(this));
if (this.window) {
print("Page: Kill window for page:" + this.title);
//this.window.closed.disconnect(function () {
// this.killView();
//});
this.window.close();
this.window = false;
}
};
Page.prototype.createView = function () {
var that = this;
if (!this.window) {
print("Page: New window for page:" + this.title);
this.window = Desktop.createWindow(Script.resolvePath(this.qml), {
title: this.title,
presentationMode: Desktop.PresentationMode.NATIVE,
size: {x: this.width, y: this.height}
});
this.handleWindowFunc(this.window);
this.window.closed.connect(function () {
that.killView();
this.handleWindowFunc(undefined);
});
}
};
var Pages = function () {
this._pages = {};
};
Pages.prototype.addPage = function (command, title, qmlurl, width, height, handleWindowFunc) {
if (handleWindowFunc === undefined) {
// Workaround for bad linter
handleWindowFunc = function(window){};
}
this._pages[command] = new Page(title, qmlurl, width, height, handleWindowFunc);
};
Pages.prototype.open = function (command) {
print("Pages: command = " + command);
if (!this._pages[command]) {
print("Pages: unknown command = " + command);
return;
}
this._pages[command].createView();
};
Pages.prototype.clear = function () {
for (var p in this._pages) {
print("Pages: kill page: " + p);
this._pages[p].killView();
delete this._pages[p];
}
this._pages = {};
};
var pages = new Pages(); var pages = new Pages();
pages.addPage('openEngineView', 'Render Engine', 'engineInspector.qml', 300, 400); pages.addPage('openEngineLODView', 'Render LOD', '../lod.qml', 300, 400);
pages.addPage('openEngineLODView', 'Render LOD', 'lod.qml', 300, 400); pages.addPage('openCullInspectorView', 'Cull Inspector', '../luci/Culling.qml', 300, 400);
pages.addPage('openCullInspectorView', 'Cull Inspector', 'culling.qml', 300, 400); pages.addPage('openMaterialInspectorView', 'Material Inspector', '../materialInspector.qml', 300, 400, MaterialInspector.setWindow);
pages.addPage('openMaterialInspectorView', 'Material Inspector', 'materialInspector.qml', 300, 400, MaterialInspector.setWindow);
function fromQml(message) { function fromQml(message) {
if (pages.open(message.method)) { if (pages.open(message.method)) {
@ -132,7 +64,7 @@
ui = new AppUi({ ui = new AppUi({
buttonName: "LUCI", buttonName: "LUCI",
home: Script.resolvePath("deferredLighting.qml"), home: Script.resolvePath("deferredLighting.qml"),
additionalAppScreens: Script.resolvePath("engineInspector.qml"), additionalAppScreens : Script.resolvePath("engineInspector.qml"),
onMessage: fromQml, onMessage: fromQml,
normalButton: Script.resolvePath("../../../system/assets/images/luci-i.svg"), normalButton: Script.resolvePath("../../../system/assets/images/luci-i.svg"),
activeButton: Script.resolvePath("../../../system/assets/images/luci-a.svg") activeButton: Script.resolvePath("../../../system/assets/images/luci-a.svg")
@ -144,8 +76,5 @@
Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent); Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent);
Controller.mouseMoveEvent.disconnect(onMouseMoveEvent); Controller.mouseMoveEvent.disconnect(onMouseMoveEvent);
pages.clear(); pages.clear();
// killEngineInspectorView();
// killCullInspectorView();
// killEngineLODWindow();
}); });
}()); }());

View file

@ -62,6 +62,31 @@ Rectangle {
Antialiasing {} Antialiasing {}
} }
} }
Prop.PropFolderPanel {
label: "Culling"
panelFrameData: Component {
Culling {}
}
}
Prop.PropFolderPanel {
label: "Tools"
panelFrameData: Component {
Row {
HifiControls.Button {
text: "LOD"
onClicked: {
sendToScript({method: "openEngineLODView"});
}
}
HifiControls.Button {
text: "Material"
onClicked: {
sendToScript({method: "openMaterialInspectorView"});
}
}
}
}
}
Jet.TaskPropView { Jet.TaskPropView {
id: "le" id: "le"
jobPath: "" jobPath: ""

View file

@ -9,11 +9,16 @@
// //
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import "configSlider"
import "../../lib/prop" as Prop
Column { Column {
id: root id: root
spacing: 8 spacing: 8
anchors.left: parent.left;
anchors.right: parent.right;
property var sceneOctree: Render.getConfig("RenderMainView.DrawSceneOctree"); property var sceneOctree: Render.getConfig("RenderMainView.DrawSceneOctree");
property var itemSelection: Render.getConfig("RenderMainView.DrawItemSelection"); property var itemSelection: Render.getConfig("RenderMainView.DrawItemSelection");
@ -36,6 +41,10 @@ Column {
GroupBox { GroupBox {
title: "Culling" title: "Culling"
anchors.left: parent.left;
anchors.right: parent.right;
Row { Row {
spacing: 8 spacing: 8
Column { Column {
@ -91,6 +100,7 @@ Column {
} }
} }
} }
} }
GroupBox { GroupBox {
@ -103,13 +113,14 @@ Column {
anchors.right: parent.right; anchors.right: parent.right;
Repeater { Repeater {
model: [ "Opaque:RenderMainView.DrawOpaqueDeferred", "Transparent:RenderMainView.DrawTransparentDeferred", "Light:RenderMainView.DrawLight", model: [ "Opaque:RenderMainView.DrawOpaqueDeferred", "Transparent:RenderMainView.DrawTransparentDeferred", "Light:RenderMainView.DrawLight",
"Opaque Overlays:RenderMainView.DrawOverlay3DOpaque", "Transparent Overlays:RenderMainView.DrawOverlay3DTransparent" ] "Opaque InFront:RenderMainView.DrawInFrontOpaque", "Transparent InFront:RenderMainView.DrawInFrontTransparent",
ConfigSlider { "Opaque HUD:RenderMainView.DrawHUDOpaque", "Transparent HUD:RenderMainView.DrawHUDTransparent" ]
Prop.PropScalar {
label: qsTr(modelData.split(":")[0]) label: qsTr(modelData.split(":")[0])
integral: true integral: true
config: Render.getConfig(modelData.split(":")[1]) object: Render.getConfig(modelData.split(":")[1])
property: "maxDrawn" property: "maxDrawn"
max: config.numDrawn max: object.numDrawn
min: -1 min: -1
} }
} }

View file

@ -0,0 +1,90 @@
//
// Page.js
//
// Sam Gateau, created on 4/19/2019
// Copyright 2019 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
"use strict";
(function() {
function Page(title, qmlurl, width, height, onViewCreated, onViewClosed) {
this.title = title;
this.qml = qmlurl;
this.width = width;
this.height = height;
this.onViewCreated = onViewCreated;
this.onViewClosed = onViewClosed;
this.window;
print("Page: New Page:" + JSON.stringify(this));
}
Page.prototype.killView = function () {
print("Page: Kill window for page:" + JSON.stringify(this));
if (this.window) {
print("Page: Kill window for page:" + this.title);
//this.window.closed.disconnect(function () {
// this.killView();
//});
this.window.close();
this.window = false;
}
};
Page.prototype.createView = function () {
var that = this;
if (!this.window) {
print("Page: New window for page:" + this.title);
this.window = Desktop.createWindow(Script.resolvePath(this.qml), {
title: this.title,
presentationMode: Desktop.PresentationMode.NATIVE,
size: {x: this.width, y: this.height}
});
this.onViewCreated(this.window);
this.window.closed.connect(function () {
that.killView();
that.onViewClosed();
});
}
};
Pages = function () {
this._pages = {};
};
Pages.prototype.addPage = function (command, title, qmlurl, width, height, onViewCreated, onViewClosed) {
if (onViewCreated === undefined) {
// Workaround for bad linter
onViewCreated = function(window) {};
}
if (onViewClosed === undefined) {
// Workaround for bad linter
onViewClosed = function() {};
}
this._pages[command] = new Page(title, qmlurl, width, height, onViewCreated, onViewClosed);
};
Pages.prototype.open = function (command) {
print("Pages: command = " + command);
if (!this._pages[command]) {
print("Pages: unknown command = " + command);
return;
}
this._pages[command].createView();
};
Pages.prototype.clear = function () {
for (var p in this._pages) {
print("Pages: kill page: " + p);
this._pages[p].killView();
delete this._pages[p];
}
this._pages = {};
};
}());

View file

@ -3,4 +3,5 @@ ShadingModel 1.0 ShadingModel.qml
ToneMapping 1.0 ToneMapping.qml ToneMapping 1.0 ToneMapping.qml
BoundingBoxes 1.0 BoundingBoxes.qml BoundingBoxes 1.0 BoundingBoxes.qml
Framebuffer 1.0 Framebuffer.qml Framebuffer 1.0 Framebuffer.qml
Antialiasing 1.0 Antialiasing.qml Antialiasing 1.0 Antialiasing.qml
Culling 1.0 Culling.qml

View file

@ -1,10 +1,83 @@
var MaterialInspector = Script.require('./materialInspector.js');
var Page = Script.require('./luci/Page.js');
function openView() { function openView() {
// Set up the qml ui
var window = Desktop.createWindow(Script.resolvePath('luci.qml'), {
title: this.title,
presentationMode: Desktop.PresentationMode.NATIVE,
size: {x: 300, y: 400}
});
//window.closed.connect(function() { Script.stop(); }); //window.closed.connect(function() { Script.stop(); });
var pages = new Pages();
function fromQml(message) {
if (pages.open(message.method)) {
return;
}
}
var luciWindow
function openLuciWindow(window) {
if (luciWindow !== undefined) {
activeWindow.fromQml.disconnect(fromQml);
}
if (window !== undefined) {
window.fromQml.connect(fromQml);
}
luciWindow = window;
var moveDebugCursor = false;
var onMousePressEvent = function (e) {
if (e.isMiddleButton) {
moveDebugCursor = true;
setDebugCursor(e.x, e.y);
}
};
Controller.mousePressEvent.connect(onMousePressEvent);
var onMouseReleaseEvent = function () {
moveDebugCursor = false;
};
Controller.mouseReleaseEvent.connect(onMouseReleaseEvent);
var onMouseMoveEvent = function (e) {
if (moveDebugCursor) {
setDebugCursor(e.x, e.y);
}
};
Controller.mouseMoveEvent.connect(onMouseMoveEvent);
function setDebugCursor(x, y) {
var nx = 2.0 * (x / Window.innerWidth) - 1.0;
var ny = 1.0 - 2.0 * ((y) / (Window.innerHeight));
Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 };
}
}
function closeLuciWindow() {
if (luciWindow !== undefined) {
activeWindow.fromQml.disconnect(fromQml);
}
luciWindow = {};
Controller.mousePressEvent.disconnect(onMousePressEvent);
Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent);
Controller.mouseMoveEvent.disconnect(onMouseMoveEvent);
pages.clear();
}
pages.addPage('Luci', 'Luci', '../luci.qml', 300, 420, openLuciWindow, closeLuciWindow);
pages.addPage('openEngineLODView', 'Render LOD', '../lod.qml', 300, 400);
pages.addPage('openMaterialInspectorView', 'Material Inspector', '../materialInspector.qml', 300, 400, MaterialInspector.setWindow, MaterialInspector.setWindow);
pages.open('Luci');
return pages;
} }
openView();
openView();

View file

@ -109,7 +109,9 @@ function mouseReleaseEvent(event) {
} }
function killWindow() { function killWindow() {
setWindow(undefined); activeWindow = undefined;
// setWindow(undefined);
} }
function toQml(message) { function toQml(message) {
@ -138,14 +140,14 @@ function setSelectedObject(id, type) {
function setWindow(window) { function setWindow(window) {
if (activeWindow !== undefined) { if (activeWindow !== undefined) {
setSelectedObject(Uuid.NULL, ""); setSelectedObject(Uuid.NULL, "");
activeWindow.closed.disconnect(killWindow); // activeWindow.closed.disconnect(killWindow);
activeWindow.fromQml.disconnect(fromQml); activeWindow.fromQml.disconnect(fromQml);
Controller.mousePressEvent.disconnect(mousePressEvent); Controller.mousePressEvent.disconnect(mousePressEvent);
Controller.mouseReleaseEvent.disconnect(mouseReleaseEvent); Controller.mouseReleaseEvent.disconnect(mouseReleaseEvent);
activeWindow.close(); activeWindow.close();
} }
if (window !== undefined) { if (window !== undefined) {
window.closed.connect(killWindow); // window.closed.connect(killWindow);
window.fromQml.connect(fromQml); window.fromQml.connect(fromQml);
Controller.mousePressEvent.connect(mousePressEvent); Controller.mousePressEvent.connect(mousePressEvent);
Controller.mouseReleaseEvent.connect(mouseReleaseEvent); Controller.mouseReleaseEvent.connect(mouseReleaseEvent);