mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
clarifying the engine inspector and engine profiler
This commit is contained in:
parent
36eb4eafc6
commit
07299291fc
11 changed files with 202 additions and 58 deletions
|
@ -171,7 +171,7 @@ void SecondaryCameraJobConfig::setOrientation(glm::quat orient) {
|
|||
}
|
||||
|
||||
void SecondaryCameraJobConfig::enableSecondaryCameraRenderConfigs(bool enabled) {
|
||||
qApp->getRenderEngine()->getConfiguration()->getConfig<SecondaryCameraRenderTask>()->setEnabled(enabled);
|
||||
qApp->getRenderEngine()->getConfiguration()->getConfig<SecondaryCameraRenderTask>("SecondaryCameraJob")->setEnabled(enabled);
|
||||
setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,3 +68,57 @@ void TaskConfig::refresh() {
|
|||
_task->applyConfiguration();
|
||||
}
|
||||
|
||||
TaskConfig* TaskConfig::getRootConfig(const std::string& jobPath, std::string& jobName) const {
|
||||
TaskConfig* root = const_cast<TaskConfig*> (this);
|
||||
|
||||
std::list<std::string> tokens;
|
||||
std::size_t pos = 0, sepPos;
|
||||
while ((sepPos = jobPath.find_first_of('.', pos)) != std::string::npos) {
|
||||
std::string token = jobPath.substr(pos, sepPos - pos);
|
||||
if (!token.empty()) {
|
||||
tokens.push_back(token);
|
||||
}
|
||||
pos = sepPos + 1;
|
||||
}
|
||||
{
|
||||
std::string token = jobPath.substr(pos, sepPos - pos);
|
||||
if (!token.empty()) {
|
||||
tokens.push_back(token);
|
||||
}
|
||||
}
|
||||
|
||||
if (tokens.empty()) {
|
||||
return root;
|
||||
}
|
||||
else {
|
||||
while (tokens.size() > 1) {
|
||||
auto taskName = tokens.front();
|
||||
tokens.pop_front();
|
||||
root = root->findChild<TaskConfig*>((taskName.empty() ? QString() : QString(taskName.c_str())));
|
||||
if (!root) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
jobName = tokens.front();
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
JobConfig* TaskConfig::getJobConfig(const std::string& jobPath) const {
|
||||
std::string jobName;
|
||||
auto root = getRootConfig(jobPath, jobName);
|
||||
|
||||
if (!root) {
|
||||
return nullptr;
|
||||
}
|
||||
if (jobName.empty()) {
|
||||
return root;
|
||||
} else {
|
||||
|
||||
auto found = root->findChild<JobConfig*>((jobName.empty() ? QString() : QString(jobName.c_str())));
|
||||
if (!found) {
|
||||
return nullptr;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,41 +219,16 @@ public:
|
|||
// optional sub_parent_names and finally from there looking for the job_name (assuming every job in the path were found)
|
||||
//
|
||||
// getter for qml integration, prefer the templated getter
|
||||
#pragma optimize("", off)
|
||||
Q_INVOKABLE QObject* getConfig(const QString& name) { return getConfig<TConfigProxy>(name.toStdString()); }
|
||||
|
||||
// getter for cpp (strictly typed), prefer this getter
|
||||
template <class T> typename T::Config* getConfig(std::string job = "") const {
|
||||
const TaskConfig* root = this;
|
||||
std::string jobPath = (job);
|
||||
//QString path = (job.empty() ? QString() : QString(job.c_str())); // an empty string is not a null string
|
||||
//auto tokens = path.split('.', QString::SkipEmptyParts);
|
||||
std::list<std::string> tokens;
|
||||
std::size_t pos = 0, found;
|
||||
while ((found = jobPath.find_first_of('.', pos)) != std::string::npos) {
|
||||
tokens.push_back(jobPath.substr(pos, found - pos));
|
||||
pos = found + 1;
|
||||
}
|
||||
tokens.push_back(jobPath.substr(pos));
|
||||
TaskConfig* getRootConfig(const std::string& jobPath, std::string& jobName) const;
|
||||
JobConfig* getJobConfig(const std::string& jobPath) const;
|
||||
|
||||
QString jobToken;
|
||||
if (tokens.empty()) {
|
||||
// return dynamic_cast<typename T::Config*>(const_cast<TaskConfig*> (root));
|
||||
//tokens.push_back(std::string());
|
||||
} else {
|
||||
while (tokens.size() > 1) {
|
||||
auto name = tokens.front();
|
||||
tokens.pop_front();
|
||||
root = root->findChild<TaskConfig*>((name.empty() ? QString() : QString(name.c_str())));
|
||||
if (!root) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
jobToken = QString(tokens.front().c_str());
|
||||
}
|
||||
|
||||
return root->findChild<typename T::Config*>(jobToken);
|
||||
template <class T> typename T::Config* getConfig(std::string jobPath = "") const {
|
||||
return dynamic_cast<typename T::Config*>(getJobConfig(jobPath));
|
||||
}
|
||||
#pragma optimize("", on)
|
||||
|
||||
Q_INVOKABLE bool isTask() const override { return true; }
|
||||
Q_INVOKABLE QObjectList getSubConfigs() const override {
|
||||
auto list = findChildren<JobConfig*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);
|
||||
|
|
|
@ -19,7 +19,7 @@ import "../jet.js" as Jet
|
|||
|
||||
Rectangle {
|
||||
HifiConstants { id: hifi;}
|
||||
color: hifi.colors.baseGray;
|
||||
// color: hifi.colors.baseGray;
|
||||
id: root;
|
||||
|
||||
property var rootConfig : Workload
|
||||
|
|
|
@ -19,7 +19,7 @@ import "../jet.js" as Jet
|
|||
|
||||
Rectangle {
|
||||
HifiConstants { id: hifi;}
|
||||
color: hifi.colors.baseGray;
|
||||
// color: hifi.colors.baseGray;
|
||||
id: root;
|
||||
|
||||
property var rootConfig : Workload
|
||||
|
|
|
@ -277,11 +277,20 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
Separator {}
|
||||
HifiControls.Button {
|
||||
text: "Engine"
|
||||
// activeFocusOnPress: false
|
||||
onClicked: {
|
||||
sendToScript({method: "openEngineView"});
|
||||
Row {
|
||||
HifiControls.Button {
|
||||
text: "Inspector"
|
||||
// activeFocusOnPress: false
|
||||
onClicked: {
|
||||
sendToScript({method: "openEngineInspector"});
|
||||
}
|
||||
}
|
||||
HifiControls.Button {
|
||||
text: "EnProfilergine"
|
||||
// activeFocusOnPress: false
|
||||
onClicked: {
|
||||
sendToScript({method: "openEngineProfiler"});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
function createWindow() {
|
||||
var qml = Script.resolvePath(QMLAPP_URL);
|
||||
window = new OverlayWindow({
|
||||
title: 'Render Engine',
|
||||
title: 'Render Engine Inspector',
|
||||
source: qml,
|
||||
width: 500,
|
||||
height: 100
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// deferredLighting.qml
|
||||
// EngineInspector.qml
|
||||
//
|
||||
// Created by Sam Gateau on 6/6/2016
|
||||
// Created by Sam Gateau on 06/07/2018
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
|
@ -18,19 +18,13 @@ import "../lib/jet/qml" as Jet
|
|||
|
||||
Item {
|
||||
HifiConstants { id: hifi;}
|
||||
id: render;
|
||||
id: root;
|
||||
anchors.fill: parent
|
||||
|
||||
property var mainViewTask: Render.getConfig("RenderMainView")
|
||||
property var rootConfig: Render.getConfig("RenderMainView")
|
||||
|
||||
|
||||
/* Jet.TaskTimeFrameView {
|
||||
rootConfig: Render
|
||||
anchors.fill: render
|
||||
}*/
|
||||
Jet.TaskListView {
|
||||
rootConfig: Render
|
||||
anchors.fill: render
|
||||
}
|
||||
|
||||
rootConfig: root.rootConfig
|
||||
anchors.fill: root
|
||||
}
|
||||
}
|
59
scripts/developer/utilities/render/engineProfiler.js
Normal file
59
scripts/developer/utilities/render/engineProfiler.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
|
||||
|
||||
(function() {
|
||||
var TABLET_BUTTON_NAME = "Render Engine Profiler";
|
||||
var QMLAPP_URL = Script.resolvePath("./engineProfiler.qml");
|
||||
var ICON_URL = Script.resolvePath("../../../system/assets/images/lod-i.svg");
|
||||
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/lod-a.svg");
|
||||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
text: TABLET_BUTTON_NAME,
|
||||
icon: ICON_URL,
|
||||
activeIcon: ACTIVE_ICON_URL
|
||||
});
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
killWindow()
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
});
|
||||
|
||||
button.clicked.connect(onClicked);
|
||||
|
||||
var onScreen = false;
|
||||
var window;
|
||||
|
||||
function onClicked() {
|
||||
if (onScreen) {
|
||||
killWindow()
|
||||
} else {
|
||||
createWindow()
|
||||
}
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
var qml = Script.resolvePath(QMLAPP_URL);
|
||||
window = new OverlayWindow({
|
||||
title: 'Render Engine Profiler',
|
||||
source: qml,
|
||||
width: 500,
|
||||
height: 100
|
||||
});
|
||||
window.setPosition(200, 50);
|
||||
window.closed.connect(killWindow);
|
||||
onScreen = true
|
||||
button.editProperties({isActive: true});
|
||||
}
|
||||
|
||||
function killWindow() {
|
||||
if (window !== undefined) {
|
||||
window.closed.disconnect(killWindow);
|
||||
window.close()
|
||||
window = undefined
|
||||
}
|
||||
onScreen = false
|
||||
button.editProperties({isActive: false})
|
||||
}
|
||||
}());
|
||||
|
31
scripts/developer/utilities/render/engineProfiler.qml
Normal file
31
scripts/developer/utilities/render/engineProfiler.qml
Normal file
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// EngineProfiler.qml
|
||||
//
|
||||
// Created by Sam Gateau on 06/07/2018
|
||||
// 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: root;
|
||||
anchors.fill: parent
|
||||
|
||||
property var rootConfig: Render.getConfig("")
|
||||
|
||||
|
||||
Jet.TaskTimeFrameView {
|
||||
rootConfig: root.rootConfig
|
||||
anchors.fill: root
|
||||
}
|
||||
}
|
|
@ -90,19 +90,22 @@
|
|||
|
||||
function fromQml(message) {
|
||||
switch (message.method) {
|
||||
case "openEngineView":
|
||||
openEngineTaskView();
|
||||
case "openEngineInspector":
|
||||
openEngineInspector();
|
||||
break;
|
||||
case "openEngineProfiler":
|
||||
openEngineProfiler();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var engineInspectorView = null
|
||||
function openEngineTaskView() {
|
||||
function openEngineInspector() {
|
||||
if (engineInspectorView == null) {
|
||||
var qml = Script.resolvePath('engineInspector.qml');
|
||||
var window = new OverlayWindow({
|
||||
title: 'Render Engine',
|
||||
title: 'Render Engine Inspector',
|
||||
source: qml,
|
||||
width: 300,
|
||||
height: 400
|
||||
|
@ -115,7 +118,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
var engineProfilerView = null
|
||||
function openEngineProfiler() {
|
||||
if (engineProfilerView == null) {
|
||||
var qml = Script.resolvePath('engineProfiler.qml');
|
||||
var window = new OverlayWindow({
|
||||
title: 'Render Engine Profiler',
|
||||
source: qml,
|
||||
width: 300,
|
||||
height: 400
|
||||
});
|
||||
window.setPosition(200, 50);
|
||||
engineProfilerView = window
|
||||
window.closed.connect(function() { engineProfilerView = null; });
|
||||
} else {
|
||||
engineProfilerView.setPosition(200, 50);
|
||||
}
|
||||
}
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
if (onLuciScreen) {
|
||||
|
@ -128,5 +147,8 @@
|
|||
if (engineInspectorView !== null) {
|
||||
engineInspectorView.close()
|
||||
}
|
||||
if (engineProfilerView !== null) {
|
||||
engineProfilerView.close()
|
||||
}
|
||||
});
|
||||
}());
|
Loading…
Reference in a new issue