debugging and fixing the problem to get Config for complex path

This commit is contained in:
Sam Gateau 2018-07-06 10:53:09 +02:00
parent d2a66b9e7d
commit 2eec5b01fa
4 changed files with 31 additions and 21 deletions

View file

@ -4444,7 +4444,7 @@ void Application::idle() {
PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get<StatTracker>()->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();

View file

@ -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<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;
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<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));
QString jobToken;
if (tokens.empty()) {
// return dynamic_cast<typename T::Config*>(const_cast<TaskConfig*> (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<TaskConfig*>(name);
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*>(tokens.front());
return root->findChild<typename T::Config*>(jobToken);
}
#pragma optimize("", on)
Q_INVOKABLE bool isTask() const override { return true; }
Q_INVOKABLE QObjectList getSubConfigs() const override {
auto list = findChildren<JobConfig*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);

View file

@ -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

View file

@ -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
} */
}
}