From 2eec5b01fa69874c580fb49febe32dbe16d7c41f Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 6 Jul 2018 10:53:09 +0200 Subject: [PATCH] debugging and fixing the problem to get Config for complex path --- interface/src/Application.cpp | 6 ++--- libraries/task/src/task/Config.h | 23 ++++++++++++++----- .../utilities/lib/jet/qml/TaskListView.qml | 15 ++++++------ .../utilities/render/engineInspector.qml | 8 +++---- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index fbba8c5c87..487fafe2df 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4444,7 +4444,7 @@ void Application::idle() { PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get()->getStat("PendingProcessing").toInt()); auto renderConfig = _graphicsEngine.getRenderEngine()->getConfiguration(); PROFILE_COUNTER_IF_CHANGED(render, "gpuTime", float, (float)_graphicsEngine.getGPUContext()->getFrameTimerGPUAverage()); - auto opaqueRangeTimer = renderConfig->getConfig("OpaqueRangeTimer"); +/* auto opaqueRangeTimer = renderConfig->getConfig("OpaqueRangeTimer"); auto linearDepth = renderConfig->getConfig("LinearDepth"); auto surfaceGeometry = renderConfig->getConfig("SurfaceGeometry"); auto renderDeferred = renderConfig->getConfig("RenderDeferred"); @@ -4456,7 +4456,7 @@ void Application::idle() { { "SurfaceGeometry", surfaceGeometry ? surfaceGeometry->property("gpuRunTime") : 0 }, { "RenderDeferred", renderDeferred ? renderDeferred->property("gpuRunTime") : 0 }, { "ToneAndPostRangeTimer", toneAndPostRangeTimer ? toneAndPostRangeTimer->property("gpuRunTime") : 0 } - }); + });*/ PROFILE_RANGE(app, __FUNCTION__); @@ -5759,7 +5759,7 @@ void Application::update(float deltaTime) { // TODO: Fix this by modeling the way the secondary camera works on how the main camera works // ie. Use a camera object stored in the game logic and informs the Engine on where the secondary // camera should be. - updateSecondaryCameraViewFrustum(); + // updateSecondaryCameraViewFrustum(); } quint64 now = usecTimestampNow(); diff --git a/libraries/task/src/task/Config.h b/libraries/task/src/task/Config.h index 0ecfa9bfd7..4a9414fd42 100644 --- a/libraries/task/src/task/Config.h +++ b/libraries/task/src/task/Config.h @@ -219,30 +219,41 @@ 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(name.toStdString()); } // getter for cpp (strictly typed), prefer this getter template typename T::Config* getConfig(std::string job = "") const { const TaskConfig* root = this; - QString path = (job.empty() ? QString() : QString(job.c_str())); // an empty string is not a null string - auto tokens = path.split('.', QString::SkipEmptyParts); + 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 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)); + QString jobToken; if (tokens.empty()) { // return dynamic_cast(const_cast (root)); - tokens.push_back(QString()); + //tokens.push_back(std::string()); } else { while (tokens.size() > 1) { auto name = tokens.front(); tokens.pop_front(); - root = QObject::findChild(name); + root = root->findChild((name.empty() ? QString() : QString(name.c_str()))); if (!root) { return nullptr; } } + jobToken = QString(tokens.front().c_str()); } - return root->findChild(tokens.front()); + return root->findChild(jobToken); } - +#pragma optimize("", on) Q_INVOKABLE bool isTask() const override { return true; } Q_INVOKABLE QObjectList getSubConfigs() const override { auto list = findChildren(QRegExp(".*"), Qt::FindDirectChildrenOnly); diff --git a/scripts/developer/utilities/lib/jet/qml/TaskListView.qml b/scripts/developer/utilities/lib/jet/qml/TaskListView.qml index 7c077f495a..f8997dfaf4 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskListView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskListView.qml @@ -27,29 +27,29 @@ Rectangle { Component.onCompleted: { //var functor = Jet.job_tree_model_functor(jobsModel) - /* var functor = Jet.job_tree_model_functor(jobsModel, 1, function(node) { + var functor = Jet.job_tree_model_functor(jobsModel, 3, function(node) { node["cpuT"] = 0.0 }) Jet.task_traverseTree(rootConfig, functor); - */ + - var tfunctor = Jet.job_tree_model_array_functor(jobsModel.engineJobItemModel, function(node) { + /* var tfunctor = Jet.job_tree_model_array_functor(jobsModel.engineJobItemModel, function(node) { node["init"] = (node.level < 3) node["fullpath"] = (node.path + "." + node.name) node["cpuT"] = 0.0 }) Jet.task_traverseTree(rootConfig, tfunctor); - +*/ // var currentParentStach = [] // currentParentStach.push(jobsModel); - Jet.job_traverseTreeNodeRoot(jobsModel.engineJobItemModel[0], function(node, depth, index) { + /* Jet.job_traverseTreeNodeRoot(jobsModel.engineJobItemModel[0], function(node, depth, index) { print(node.name + depth + " - " + index) return true - }) + })*/ } @@ -64,8 +64,7 @@ Rectangle { id: objRecursiveColumn clip: true visible: model.init - // visible: (node.level < 2) - + function switchFold() { for(var i = 1; i < children.length - 1; ++i) { children[i].visible = !children[i].visible diff --git a/scripts/developer/utilities/render/engineInspector.qml b/scripts/developer/utilities/render/engineInspector.qml index d3bd2e96fd..7a2dfcc9e2 100644 --- a/scripts/developer/utilities/render/engineInspector.qml +++ b/scripts/developer/utilities/render/engineInspector.qml @@ -24,13 +24,13 @@ Item { property var mainViewTask: Render.getConfig("RenderMainView") - Jet.TaskTimeFrameView { + /* Jet.TaskTimeFrameView { rootConfig: Render anchors.fill: render - } - /* Jet.TaskListView { + }*/ + Jet.TaskListView { rootConfig: Render anchors.fill: render - } */ + } } \ No newline at end of file