mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
making luci2 better
This commit is contained in:
parent
af3d981ad1
commit
ba02aa7098
9 changed files with 236 additions and 97 deletions
|
@ -31,7 +31,15 @@ Prop.PropGroup {
|
|||
property var showProps: true
|
||||
property var showSubs: true
|
||||
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() {
|
||||
console.log("the button has been pressed and jobEnabled is " + jobEnabled )
|
||||
|
@ -52,7 +60,7 @@ Prop.PropGroup {
|
|||
}
|
||||
Prop.PropLabel {
|
||||
id: cpuTime
|
||||
visible: root.jobEnabled
|
||||
visible: false // root.jobEnabled
|
||||
width: 50
|
||||
text: jobCpuTime
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
|
||||
// Set up the qml ui
|
||||
var qml = Script.resolvePath('culling.qml');
|
||||
var qml = Script.resolvePath('luci/Culling.qml');
|
||||
var window = new OverlayWindow({
|
||||
title: 'Render Draws',
|
||||
source: qml,
|
||||
|
|
|
@ -10,10 +10,13 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
|
||||
(function() {
|
||||
var AppUi = Script.require('appUi');
|
||||
|
||||
var MaterialInspector = Script.require('./materialInspector.js');
|
||||
var Page = Script.require('./luci/Page.js');
|
||||
|
||||
var moveDebugCursor = false;
|
||||
var onMousePressEvent = function (e) {
|
||||
|
@ -43,83 +46,12 @@
|
|||
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();
|
||||
|
||||
pages.addPage('openEngineView', 'Render Engine', 'engineInspector.qml', 300, 400);
|
||||
pages.addPage('openEngineLODView', 'Render LOD', 'lod.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('openEngineLODView', 'Render LOD', '../lod.qml', 300, 400);
|
||||
pages.addPage('openCullInspectorView', 'Cull Inspector', '../luci/Culling.qml', 300, 400);
|
||||
pages.addPage('openMaterialInspectorView', 'Material Inspector', '../materialInspector.qml', 300, 400, MaterialInspector.setWindow);
|
||||
|
||||
function fromQml(message) {
|
||||
if (pages.open(message.method)) {
|
||||
|
@ -132,7 +64,7 @@
|
|||
ui = new AppUi({
|
||||
buttonName: "LUCI",
|
||||
home: Script.resolvePath("deferredLighting.qml"),
|
||||
additionalAppScreens: Script.resolvePath("engineInspector.qml"),
|
||||
additionalAppScreens : Script.resolvePath("engineInspector.qml"),
|
||||
onMessage: fromQml,
|
||||
normalButton: Script.resolvePath("../../../system/assets/images/luci-i.svg"),
|
||||
activeButton: Script.resolvePath("../../../system/assets/images/luci-a.svg")
|
||||
|
@ -144,8 +76,5 @@
|
|||
Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent);
|
||||
Controller.mouseMoveEvent.disconnect(onMouseMoveEvent);
|
||||
pages.clear();
|
||||
// killEngineInspectorView();
|
||||
// killCullInspectorView();
|
||||
// killEngineLODWindow();
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -62,6 +62,31 @@ Rectangle {
|
|||
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 {
|
||||
id: "le"
|
||||
jobPath: ""
|
||||
|
|
|
@ -9,11 +9,16 @@
|
|||
//
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import "configSlider"
|
||||
|
||||
import "../../lib/prop" as Prop
|
||||
|
||||
Column {
|
||||
id: root
|
||||
spacing: 8
|
||||
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
|
||||
property var sceneOctree: Render.getConfig("RenderMainView.DrawSceneOctree");
|
||||
property var itemSelection: Render.getConfig("RenderMainView.DrawItemSelection");
|
||||
|
||||
|
@ -36,6 +41,10 @@ Column {
|
|||
|
||||
GroupBox {
|
||||
title: "Culling"
|
||||
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
|
||||
Row {
|
||||
spacing: 8
|
||||
Column {
|
||||
|
@ -91,6 +100,7 @@ Column {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GroupBox {
|
||||
|
@ -103,13 +113,14 @@ Column {
|
|||
anchors.right: parent.right;
|
||||
Repeater {
|
||||
model: [ "Opaque:RenderMainView.DrawOpaqueDeferred", "Transparent:RenderMainView.DrawTransparentDeferred", "Light:RenderMainView.DrawLight",
|
||||
"Opaque Overlays:RenderMainView.DrawOverlay3DOpaque", "Transparent Overlays:RenderMainView.DrawOverlay3DTransparent" ]
|
||||
ConfigSlider {
|
||||
"Opaque InFront:RenderMainView.DrawInFrontOpaque", "Transparent InFront:RenderMainView.DrawInFrontTransparent",
|
||||
"Opaque HUD:RenderMainView.DrawHUDOpaque", "Transparent HUD:RenderMainView.DrawHUDTransparent" ]
|
||||
Prop.PropScalar {
|
||||
label: qsTr(modelData.split(":")[0])
|
||||
integral: true
|
||||
config: Render.getConfig(modelData.split(":")[1])
|
||||
object: Render.getConfig(modelData.split(":")[1])
|
||||
property: "maxDrawn"
|
||||
max: config.numDrawn
|
||||
max: object.numDrawn
|
||||
min: -1
|
||||
}
|
||||
}
|
90
scripts/developer/utilities/render/luci/Page.js
Normal file
90
scripts/developer/utilities/render/luci/Page.js
Normal 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 = {};
|
||||
};
|
||||
|
||||
}());
|
|
@ -3,4 +3,5 @@ ShadingModel 1.0 ShadingModel.qml
|
|||
ToneMapping 1.0 ToneMapping.qml
|
||||
BoundingBoxes 1.0 BoundingBoxes.qml
|
||||
Framebuffer 1.0 Framebuffer.qml
|
||||
Antialiasing 1.0 Antialiasing.qml
|
||||
Antialiasing 1.0 Antialiasing.qml
|
||||
Culling 1.0 Culling.qml
|
|
@ -1,10 +1,83 @@
|
|||
|
||||
|
||||
var MaterialInspector = Script.require('./materialInspector.js');
|
||||
var Page = Script.require('./luci/Page.js');
|
||||
|
||||
|
||||
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(); });
|
||||
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -109,7 +109,9 @@ function mouseReleaseEvent(event) {
|
|||
}
|
||||
|
||||
function killWindow() {
|
||||
setWindow(undefined);
|
||||
activeWindow = undefined;
|
||||
|
||||
// setWindow(undefined);
|
||||
}
|
||||
|
||||
function toQml(message) {
|
||||
|
@ -138,14 +140,14 @@ function setSelectedObject(id, type) {
|
|||
function setWindow(window) {
|
||||
if (activeWindow !== undefined) {
|
||||
setSelectedObject(Uuid.NULL, "");
|
||||
activeWindow.closed.disconnect(killWindow);
|
||||
// activeWindow.closed.disconnect(killWindow);
|
||||
activeWindow.fromQml.disconnect(fromQml);
|
||||
Controller.mousePressEvent.disconnect(mousePressEvent);
|
||||
Controller.mouseReleaseEvent.disconnect(mouseReleaseEvent);
|
||||
activeWindow.close();
|
||||
}
|
||||
if (window !== undefined) {
|
||||
window.closed.connect(killWindow);
|
||||
// window.closed.connect(killWindow);
|
||||
window.fromQml.connect(fromQml);
|
||||
Controller.mousePressEvent.connect(mousePressEvent);
|
||||
Controller.mouseReleaseEvent.connect(mouseReleaseEvent);
|
||||
|
|
Loading…
Reference in a new issue