mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:09:52 +02:00
merging the various job/task/switch congif into one
This commit is contained in:
parent
7486e906eb
commit
767f413a2c
15 changed files with 144 additions and 125 deletions
|
@ -54,7 +54,7 @@ void RenderScriptingInterface::forceRenderMethod(RenderMethod renderMethod) {
|
||||||
_renderMethod = (int)renderMethod;
|
_renderMethod = (int)renderMethod;
|
||||||
_renderMethodSetting.set((int)renderMethod);
|
_renderMethodSetting.set((int)renderMethod);
|
||||||
|
|
||||||
auto config = dynamic_cast<task::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch"));
|
auto config = dynamic_cast<render::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch"));
|
||||||
if (config) {
|
if (config) {
|
||||||
config->setBranch((int)renderMethod);
|
config->setBranch((int)renderMethod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace render {
|
||||||
|
|
||||||
|
|
||||||
GPUTaskConfig() = default;
|
GPUTaskConfig() = default;
|
||||||
GPUTaskConfig(bool enabled) : TaskConfig(enabled) {}
|
GPUTaskConfig(bool enabled) : render::TaskConfig(enabled) {}
|
||||||
|
|
||||||
// Running Time measurement on GPU and for Batch execution
|
// Running Time measurement on GPU and for Batch execution
|
||||||
void setGPUBatchRunTime(double msGpuTime, double msBatchTime) { _msGPURunTime = msGpuTime; _msBatchRunTime = msBatchTime; }
|
void setGPUBatchRunTime(double msGpuTime, double msBatchTime) { _msGPURunTime = msGpuTime; _msBatchRunTime = msBatchTime; }
|
||||||
|
|
|
@ -79,8 +79,8 @@ void JobConfig::refresh() {
|
||||||
_jobConcept->applyConfiguration();
|
_jobConcept->applyConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskConfig* TaskConfig::getRootConfig(const std::string& jobPath, std::string& jobName) const {
|
JobConfig* JobConfig::getRootConfig(const std::string& jobPath, std::string& jobName) const {
|
||||||
TaskConfig* root = const_cast<TaskConfig*> (this);
|
JobConfig* root = const_cast<JobConfig*> (this);
|
||||||
|
|
||||||
std::list<std::string> tokens;
|
std::list<std::string> tokens;
|
||||||
std::size_t pos = 0, sepPos;
|
std::size_t pos = 0, sepPos;
|
||||||
|
@ -105,7 +105,7 @@ TaskConfig* TaskConfig::getRootConfig(const std::string& jobPath, std::string& j
|
||||||
while (tokens.size() > 1) {
|
while (tokens.size() > 1) {
|
||||||
auto taskName = tokens.front();
|
auto taskName = tokens.front();
|
||||||
tokens.pop_front();
|
tokens.pop_front();
|
||||||
root = root->findChild<TaskConfig*>((taskName.empty() ? QString() : QString(taskName.c_str())));
|
root = root->findChild<JobConfig*>((taskName.empty() ? QString() : QString(taskName.c_str())));
|
||||||
if (!root) {
|
if (!root) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ TaskConfig* TaskConfig::getRootConfig(const std::string& jobPath, std::string& j
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
JobConfig* TaskConfig::getJobConfig(const std::string& jobPath) const {
|
JobConfig* JobConfig::getJobConfig(const std::string& jobPath) const {
|
||||||
std::string jobName;
|
std::string jobName;
|
||||||
auto root = getRootConfig(jobPath, jobName);
|
auto root = getRootConfig(jobPath, jobName);
|
||||||
|
|
||||||
|
@ -134,10 +134,10 @@ JobConfig* TaskConfig::getJobConfig(const std::string& jobPath) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitchConfig::setBranch(uint8_t branch) {
|
void JobConfig::setBranch(uint8_t branch) {
|
||||||
if (_branch != branch) {
|
if (_branch != branch) {
|
||||||
_branch = branch;
|
_branch = branch;
|
||||||
// We can re-use this signal here
|
// We can re-use this signal here
|
||||||
emit dirtyEnabled();
|
emit dirtyEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,11 +83,19 @@ protected:
|
||||||
Setting::Handle<QString> _preset;
|
Setting::Handle<QString> _preset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class JobConfig;
|
||||||
|
|
||||||
|
class TConfigProxy {
|
||||||
|
public:
|
||||||
|
using Config = JobConfig;
|
||||||
|
};
|
||||||
|
|
||||||
// A default Config is always on; to create an enableable Config, use the ctor JobConfig(bool enabled)
|
// A default Config is always on; to create an enableable Config, use the ctor JobConfig(bool enabled)
|
||||||
class JobConfig : public QObject {
|
class JobConfig : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(double cpuRunTime READ getCPURunTime NOTIFY newStats()) //ms
|
Q_PROPERTY(double cpuRunTime READ getCPURunTime NOTIFY newStats()) //ms
|
||||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY dirtyEnabled())
|
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY dirtyEnabled())
|
||||||
|
Q_PROPERTY(int branch READ getBranch WRITE setBranch NOTIFY dirtyEnabled)
|
||||||
|
|
||||||
double _msCPURunTime{ 0.0 };
|
double _msCPURunTime{ 0.0 };
|
||||||
|
|
||||||
|
@ -96,7 +104,11 @@ protected:
|
||||||
|
|
||||||
bool _isEnabled{ true };
|
bool _isEnabled{ true };
|
||||||
|
|
||||||
|
uint8_t _branch { 0 };
|
||||||
public:
|
public:
|
||||||
|
bool _isTask{ false };
|
||||||
|
bool _isSwitch{ false };
|
||||||
|
|
||||||
using Persistent = PersistentConfig<JobConfig>;
|
using Persistent = PersistentConfig<JobConfig>;
|
||||||
|
|
||||||
JobConfig() = default;
|
JobConfig() = default;
|
||||||
|
@ -121,44 +133,86 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void load(const QVariantMap& map) { qObjectFromJsonValue(QJsonObject::fromVariantMap(map), *this); emit loaded(); }
|
Q_INVOKABLE void load(const QVariantMap& map) { qObjectFromJsonValue(QJsonObject::fromVariantMap(map), *this); emit loaded(); }
|
||||||
|
|
||||||
Q_INVOKABLE QObject* getConfig(const QString& name) { return nullptr; }
|
//Q_INVOKABLE QObject* getConfig(const QString& name) { return nullptr; }
|
||||||
|
|
||||||
// Running Time measurement
|
// Running Time measurement
|
||||||
// The new stats signal is emitted once per run time of a job when stats (cpu runtime) are updated
|
// The new stats signal is emitted once per run time of a job when stats (cpu runtime) are updated
|
||||||
void setCPURunTime(const std::chrono::nanoseconds& runtime) { _msCPURunTime = std::chrono::duration<double, std::milli>(runtime).count(); emit newStats(); }
|
void setCPURunTime(const std::chrono::nanoseconds& runtime) { _msCPURunTime = std::chrono::duration<double, std::milli>(runtime).count(); emit newStats(); }
|
||||||
double getCPURunTime() const { return _msCPURunTime; }
|
double getCPURunTime() const { return _msCPURunTime; }
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* @function Render.getConfig
|
||||||
|
* @param {string} name
|
||||||
|
* @returns {object}
|
||||||
|
*/
|
||||||
|
// Get a sub job config through task.getConfig(path)
|
||||||
|
// where path can be:
|
||||||
|
// - <job_name> search for the first job named job_name traversing the the sub graph of task and jobs (from this task as root)
|
||||||
|
// - <parent_name>.[<sub_parent_names>.]<job_name>
|
||||||
|
// Allowing to first look for the parent_name job (from this task as root) and then search from there for the
|
||||||
|
// 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
|
||||||
|
Q_INVOKABLE QObject* getConfig(const QString& name) { return getConfig<TConfigProxy>(name.toStdString()); }
|
||||||
|
|
||||||
|
// getter for cpp (strictly typed), prefer this getter
|
||||||
|
JobConfig* getRootConfig(const std::string& jobPath, std::string& jobName) const;
|
||||||
|
JobConfig* getJobConfig(const std::string& jobPath) const;
|
||||||
|
template <class T> typename T::Config* getConfig(std::string jobPath = "") const {
|
||||||
|
return dynamic_cast<typename T::Config*>(getJobConfig(jobPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_INVOKABLE bool isTask() const { return _isTask; }
|
||||||
|
Q_INVOKABLE bool isSwitch() const { return _isSwitch; }
|
||||||
|
|
||||||
|
Q_INVOKABLE QObjectList getSubConfigs() const {
|
||||||
|
auto list = findChildren<JobConfig*>(QRegExp(".*"), Qt::FindDirectChildrenOnly);
|
||||||
|
QObjectList returned;
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
returned.push_back(list[i]);
|
||||||
|
}
|
||||||
|
return returned;
|
||||||
|
}
|
||||||
|
Q_INVOKABLE int getNumSubs() const { return getSubConfigs().size(); }
|
||||||
|
Q_INVOKABLE QObject* getSubConfig(int i) const {
|
||||||
|
auto subs = getSubConfigs();
|
||||||
|
return ((i < 0 || i >= subs.size()) ? nullptr : subs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Describe the node graph data connections of the associated Job/Task
|
// Describe the node graph data connections of the associated Job/Task
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function Render.isTask
|
* @function Render.isTask
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE virtual bool isTask() const { return false; }
|
//Q_INVOKABLE virtual bool isTask() const { return false; }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function Render.getSubConfigs
|
* @function Render.getSubConfigs
|
||||||
* @returns {object[]}
|
* @returns {object[]}
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE virtual QObjectList getSubConfigs() const { return QObjectList(); }
|
// Q_INVOKABLE virtual QObjectList getSubConfigs() const { return QObjectList(); }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function Render.getNumSubs
|
* @function Render.getNumSubs
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE virtual int getNumSubs() const { return 0; }
|
// Q_INVOKABLE virtual int getNumSubs() const { return 0; }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @function Render.getSubConfig
|
* @function Render.getSubConfig
|
||||||
* @param {number} index
|
* @param {number} index
|
||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE virtual QObject* getSubConfig(int i) const { return nullptr; }
|
//Q_INVOKABLE virtual QObject* getSubConfig(int i) const { return nullptr; }
|
||||||
|
|
||||||
void connectChildConfig(std::shared_ptr<JobConfig> childConfig, const std::string& name);
|
void connectChildConfig(std::shared_ptr<JobConfig> childConfig, const std::string& name);
|
||||||
void transferChildrenConfigs(std::shared_ptr<JobConfig> source);
|
void transferChildrenConfigs(std::shared_ptr<JobConfig> source);
|
||||||
|
|
||||||
JobConcept* _jobConcept;
|
JobConcept* _jobConcept;
|
||||||
|
|
||||||
|
uint8_t getBranch() const { return _branch; }
|
||||||
|
void setBranch(uint8_t index);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -195,12 +249,9 @@ signals:
|
||||||
|
|
||||||
using QConfigPointer = std::shared_ptr<JobConfig>;
|
using QConfigPointer = std::shared_ptr<JobConfig>;
|
||||||
|
|
||||||
class TConfigProxy {
|
|
||||||
public:
|
|
||||||
using Config = JobConfig;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef SPECIALIZE_CONFIG
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @namespace Render
|
* @namespace Render
|
||||||
*
|
*
|
||||||
|
@ -270,7 +321,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
uint8_t _branch { 0 };
|
uint8_t _branch { 0 };
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // hifi_task_Config_h
|
#endif // hifi_task_Config_h
|
||||||
|
|
|
@ -69,7 +69,7 @@ class JobConcept {
|
||||||
public:
|
public:
|
||||||
using Config = JobConfig;
|
using Config = JobConfig;
|
||||||
|
|
||||||
JobConcept(const std::string& name, QConfigPointer config) : _config(config), _name(name) {}
|
JobConcept(const std::string& name, QConfigPointer config) : _config(config), _name(name) { config->_jobConcept = this; }
|
||||||
virtual ~JobConcept() = default;
|
virtual ~JobConcept() = default;
|
||||||
|
|
||||||
const std::string& getName() const { return _name; }
|
const std::string& getName() const { return _name; }
|
||||||
|
@ -80,7 +80,8 @@ public:
|
||||||
|
|
||||||
virtual QConfigPointer& getConfiguration() { return _config; }
|
virtual QConfigPointer& getConfiguration() { return _config; }
|
||||||
virtual void applyConfiguration() = 0;
|
virtual void applyConfiguration() = 0;
|
||||||
void setCPURunTime(const std::chrono::nanoseconds& runtime) { std::static_pointer_cast<Config>(_config)->setCPURunTime(runtime); }
|
void setCPURunTime(const std::chrono::nanoseconds& runtime) {
|
||||||
|
/*std::static_pointer_cast<Config>*/(_config)->setCPURunTime(runtime); }
|
||||||
|
|
||||||
QConfigPointer _config;
|
QConfigPointer _config;
|
||||||
protected:
|
protected:
|
||||||
|
@ -94,9 +95,9 @@ template <class T, class C> void jobConfigure(T& data, const C& configuration) {
|
||||||
template<class T> void jobConfigure(T&, const JobConfig&) {
|
template<class T> void jobConfigure(T&, const JobConfig&) {
|
||||||
// nop, as the default JobConfig was used, so the data does not need a configure method
|
// nop, as the default JobConfig was used, so the data does not need a configure method
|
||||||
}
|
}
|
||||||
template<class T> void jobConfigure(T&, const TaskConfig&) {
|
/*template<class T> void jobConfigure(T&, const TaskConfig&) {
|
||||||
// nop, as the default TaskConfig was used, so the data does not need a configure method
|
// nop, as the default TaskConfig was used, so the data does not need a configure method
|
||||||
}
|
}*/
|
||||||
|
|
||||||
template <class T, class JC> void jobRun(T& data, const JC& jobContext, const JobNoIO& input, JobNoIO& output) {
|
template <class T, class JC> void jobRun(T& data, const JC& jobContext, const JobNoIO& input, JobNoIO& output) {
|
||||||
data.run(jobContext);
|
data.run(jobContext);
|
||||||
|
@ -158,7 +159,17 @@ public:
|
||||||
return std::make_shared<Model>(name, input, std::make_shared<C>(), std::forward<A>(args)...);
|
return std::make_shared<Model>(name, input, std::make_shared<C>(), std::forward<A>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void createConfiguration() {
|
||||||
|
// A brand new config
|
||||||
|
auto config = std::make_shared<C>();
|
||||||
|
// Make sure we transfer the former children configs to the new config
|
||||||
|
config->transferChildrenConfigs(Concept::_config);
|
||||||
|
// swap
|
||||||
|
Concept::_config = config;
|
||||||
|
// Capture this
|
||||||
|
Concept::_config->_jobConcept = this;
|
||||||
|
}
|
||||||
|
|
||||||
void applyConfiguration() override {
|
void applyConfiguration() override {
|
||||||
TimeProfiler probe(("configure::" + JobConcept::getName()));
|
TimeProfiler probe(("configure::" + JobConcept::getName()));
|
||||||
|
|
||||||
|
@ -228,7 +239,7 @@ public:
|
||||||
using Context = JC;
|
using Context = JC;
|
||||||
using TimeProfiler = TP;
|
using TimeProfiler = TP;
|
||||||
using ContextPointer = std::shared_ptr<Context>;
|
using ContextPointer = std::shared_ptr<Context>;
|
||||||
using Config = TaskConfig;
|
using Config = JobConfig; //TaskConfig;
|
||||||
using JobType = Job<JC, TP>;
|
using JobType = Job<JC, TP>;
|
||||||
using None = typename JobType::None;
|
using None = typename JobType::None;
|
||||||
using Concept = typename JobType::Concept;
|
using Concept = typename JobType::Concept;
|
||||||
|
@ -247,14 +258,15 @@ public:
|
||||||
const Varying getOutput() const override { return _output; }
|
const Varying getOutput() const override { return _output; }
|
||||||
Varying& editInput() override { return _input; }
|
Varying& editInput() override { return _input; }
|
||||||
|
|
||||||
TaskConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input) {}
|
TaskConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input) {config->_isTask = true;}
|
||||||
|
|
||||||
// Create a new job in the container's queue; returns the job's output
|
// Create a new job in the container's queue; returns the job's output
|
||||||
template <class NT, class... NA> const Varying addJob(std::string name, const Varying& input, NA&&... args) {
|
template <class NT, class... NA> const Varying addJob(std::string name, const Varying& input, NA&&... args) {
|
||||||
_jobs.emplace_back((NT::JobModel::create(name, input, std::forward<NA>(args)...)));
|
_jobs.emplace_back((NT::JobModel::create(name, input, std::forward<NA>(args)...)));
|
||||||
|
|
||||||
// Conect the child config to this task's config
|
// Conect the child config to this task's config
|
||||||
std::static_pointer_cast<TaskConfig>(Concept::getConfiguration())->connectChildConfig(_jobs.back().getConfiguration(), name);
|
// std::static_pointer_cast<TaskConfig>(Concept::getConfiguration())->connectChildConfig(_jobs.back().getConfiguration(), name);
|
||||||
|
std::static_pointer_cast<JobConfig>(Concept::getConfiguration())->connectChildConfig(_jobs.back().getConfiguration(), name);
|
||||||
|
|
||||||
return _jobs.back().getOutput();
|
return _jobs.back().getOutput();
|
||||||
}
|
}
|
||||||
|
@ -285,8 +297,8 @@ public:
|
||||||
model->_data.build(*(model), model->_input, model->_output, std::forward<A>(args)...);
|
model->_data.build(*(model), model->_input, model->_output, std::forward<A>(args)...);
|
||||||
}
|
}
|
||||||
// Recreate the Config to use the templated type
|
// Recreate the Config to use the templated type
|
||||||
model->createConfiguration();
|
// model->createConfiguration();
|
||||||
model->applyConfiguration();
|
// model->applyConfiguration();
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -369,7 +381,7 @@ public:
|
||||||
using Context = JC;
|
using Context = JC;
|
||||||
using TimeProfiler = TP;
|
using TimeProfiler = TP;
|
||||||
using ContextPointer = std::shared_ptr<Context>;
|
using ContextPointer = std::shared_ptr<Context>;
|
||||||
using Config = SwitchConfig;
|
using Config = JobConfig; //SwitchConfig;
|
||||||
using JobType = Job<JC, TP>;
|
using JobType = Job<JC, TP>;
|
||||||
using None = typename JobType::None;
|
using None = typename JobType::None;
|
||||||
using Concept = typename JobType::Concept;
|
using Concept = typename JobType::Concept;
|
||||||
|
@ -388,14 +400,15 @@ public:
|
||||||
const Varying getOutput() const override { return _output; }
|
const Varying getOutput() const override { return _output; }
|
||||||
Varying& editInput() override { return _input; }
|
Varying& editInput() override { return _input; }
|
||||||
|
|
||||||
SwitchConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input) {}
|
SwitchConcept(const std::string& name, const Varying& input, QConfigPointer config) : Concept(name, config), _input(input)
|
||||||
|
{config->_isTask = true; config->_isSwitch = true; }
|
||||||
|
|
||||||
template <class NT, class... NA> const Varying addBranch(std::string name, uint8_t index, const Varying& input, NA&&... args) {
|
template <class NT, class... NA> const Varying addBranch(std::string name, uint8_t index, const Varying& input, NA&&... args) {
|
||||||
auto& branch = _branches[index];
|
auto& branch = _branches[index];
|
||||||
branch = JobType(NT::JobModel::create(name, input, std::forward<NA>(args)...));
|
branch = JobType(NT::JobModel::create(name, input, std::forward<NA>(args)...));
|
||||||
|
|
||||||
// Conect the child config to this task's config
|
// Conect the child config to this task's config
|
||||||
std::static_pointer_cast<SwitchConfig>(Concept::getConfiguration())->connectChildConfig(branch.getConfiguration(), name);
|
std::static_pointer_cast<JobConfig>(Concept::getConfiguration())->connectChildConfig(branch.getConfiguration(), name);
|
||||||
|
|
||||||
return branch.getOutput();
|
return branch.getOutput();
|
||||||
}
|
}
|
||||||
|
@ -405,7 +418,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, class C = SwitchConfig, class I = None, class O = None> class SwitchModel : public SwitchConcept {
|
template <class T, class C = Config, class I = None, class O = None> class SwitchModel : public SwitchConcept {
|
||||||
public:
|
public:
|
||||||
using Data = T;
|
using Data = T;
|
||||||
using Input = I;
|
using Input = I;
|
||||||
|
@ -427,8 +440,8 @@ public:
|
||||||
model->_data.build(*(model), model->_input, model->_output, std::forward<A>(args)...);
|
model->_data.build(*(model), model->_input, model->_output, std::forward<A>(args)...);
|
||||||
}
|
}
|
||||||
// Recreate the Config to use the templated type
|
// Recreate the Config to use the templated type
|
||||||
model->createConfiguration();
|
// model->createConfiguration();
|
||||||
model->applyConfiguration();
|
// model->applyConfiguration();
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -475,8 +488,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <class T, class C = SwitchConfig> using Model = SwitchModel<T, C, None, None>;
|
template <class T, class C = Config> using Model = SwitchModel<T, C, None, None>;
|
||||||
template <class T, class I, class C = SwitchConfig> using ModelI = SwitchModel<T, C, I, None>;
|
template <class T, class I, class C = Config> using ModelI = SwitchModel<T, C, I, None>;
|
||||||
// TODO: Switches don't support Outputs yet
|
// TODO: Switches don't support Outputs yet
|
||||||
//template <class T, class O, class C = SwitchConfig> using ModelO = SwitchModel<T, C, None, O>;
|
//template <class T, class O, class C = SwitchConfig> using ModelO = SwitchModel<T, C, None, O>;
|
||||||
//template <class T, class I, class O, class C = SwitchConfig> using ModelIO = SwitchModel<T, C, I, O>;
|
//template <class T, class I, class O, class C = SwitchConfig> using ModelIO = SwitchModel<T, C, I, O>;
|
||||||
|
@ -500,7 +513,7 @@ class Engine : public Task<JC, TP> {
|
||||||
public:
|
public:
|
||||||
using Context = JC;
|
using Context = JC;
|
||||||
using ContextPointer = std::shared_ptr<Context>;
|
using ContextPointer = std::shared_ptr<Context>;
|
||||||
using Config = TaskConfig;
|
using Config = JobConfig; //TaskConfig;
|
||||||
|
|
||||||
using TaskType = Task<JC, TP>;
|
using TaskType = Task<JC, TP>;
|
||||||
using ConceptPointer = typename TaskType::ConceptPointer;
|
using ConceptPointer = typename TaskType::ConceptPointer;
|
||||||
|
@ -526,10 +539,11 @@ protected:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define Task_DeclareTypeAliases(ContextType, TimeProfiler) \
|
#define Task_DeclareTypeAliases(ContextType, TimeProfiler) \
|
||||||
using JobConfig = task::JobConfig; \
|
using JobConfig = task::JobConfig; \
|
||||||
using TaskConfig = task::TaskConfig; \
|
using TaskConfig = task::JobConfig; \
|
||||||
using SwitchConfig = task::SwitchConfig; \
|
using SwitchConfig = task::JobConfig; \
|
||||||
template <class T> using PersistentConfig = task::PersistentConfig<T>; \
|
template <class T> using PersistentConfig = task::PersistentConfig<T>; \
|
||||||
using Job = task::Job<ContextType, TimeProfiler>; \
|
using Job = task::Job<ContextType, TimeProfiler>; \
|
||||||
using Switch = task::Switch<ContextType, TimeProfiler>; \
|
using Switch = task::Switch<ContextType, TimeProfiler>; \
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
// @param depth: the depth of the recurse loop since the initial call.
|
// @param depth: the depth of the recurse loop since the initial call.
|
||||||
function task_traverse(root, functor, depth) {
|
function task_traverse(root, functor, depth) {
|
||||||
if (root.isTask()) {
|
if (root.isTask()) {
|
||||||
depth++;
|
depth++;
|
||||||
for (var i = 0; i <root.getNumSubs(); i++) {
|
for (var i = 0; i <root.getNumSubs(); i++) {
|
||||||
var sub = root.getSubConfig(i);
|
var sub = root.getSubConfig(i);
|
||||||
if (functor(sub, depth, i)) {
|
if (functor(sub, depth, i)) {
|
||||||
|
@ -41,15 +41,19 @@ function task_traverseTree(root, functor) {
|
||||||
function job_propKeys(job) {
|
function job_propKeys(job) {
|
||||||
var keys = Object.keys(job)
|
var keys = Object.keys(job)
|
||||||
var propKeys = [];
|
var propKeys = [];
|
||||||
|
if (job.isSwitch()) {
|
||||||
|
propKeys.push("branch")
|
||||||
|
}
|
||||||
for (var k=0; k < keys.length;k++) {
|
for (var k=0; k < keys.length;k++) {
|
||||||
// Filter for relevant property
|
// Filter for relevant property
|
||||||
var key = keys[k]
|
var key = keys[k]
|
||||||
if ((typeof job[key]) !== "function") {
|
if ((typeof job[key]) !== "function") {
|
||||||
if ((key !== "objectName") && (key !== "cpuRunTime") && (key !== "enabled")) {
|
if ((key !== "objectName") && (key !== "cpuRunTime") && (key !== "enabled") && (key !== "branch")) {
|
||||||
propKeys.push(keys[k]);
|
propKeys.push(keys[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return propKeys;
|
return propKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var message = ""
|
var message = "sam"
|
||||||
var functor = Jet.job_print_functor(function (line) { message += line + "\n"; }, false, true);
|
var functor = Jet.job_print_functor(function (line) { message += line + "\n"; }, false, true);
|
||||||
Jet.task_traverseTree(rootConfig, functor);
|
Jet.task_traverseTree(rootConfig, functor);
|
||||||
textArea.append(message);
|
textArea.append(message);
|
||||||
|
|
|
@ -73,7 +73,7 @@ Prop.PropGroup {
|
||||||
anchors.right:parent.right
|
anchors.right:parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
filled: root.jobEnabled
|
filled: root.jobEnabled
|
||||||
fillColor: (root.jobEnabled ? global.colorGreenHighlight : global.colorOrangeAccent)
|
fillColor: (root.jobEnabled ? root.global.colorGreenHighlight : global.colorOrangeAccent)
|
||||||
icon: 5
|
icon: 5
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
|
|
|
@ -44,8 +44,8 @@ Item {
|
||||||
property alias labelControl: labelControl
|
property alias labelControl: labelControl
|
||||||
property alias label: labelControl.text
|
property alias label: labelControl.text
|
||||||
|
|
||||||
property var labelAreaWidth: root.width * global.splitterRightWidthScale - global.splitterWidth
|
property var labelAreaWidth: root.width * global.splitterLeftWidthScale - global.splitterWidth
|
||||||
|
|
||||||
PropText {
|
PropText {
|
||||||
id: labelControl
|
id: labelControl
|
||||||
text: root.label
|
text: root.label
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// PropItem.qml
|
// PropScalar.qml
|
||||||
//
|
//
|
||||||
// Created by Sam Gateau on 3/2/2019
|
// Created by Sam Gateau on 3/2/2019
|
||||||
// Copyright 2019 High Fidelity, Inc.
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
@ -42,8 +42,8 @@ PropItem {
|
||||||
enabled: root.showValue
|
enabled: root.showValue
|
||||||
|
|
||||||
anchors.left: root.splitter.right
|
anchors.left: root.splitter.right
|
||||||
|
anchors.right: (root.readOnly ? root.right : sliderControl.left)
|
||||||
anchors.verticalCenter: root.verticalCenter
|
anchors.verticalCenter: root.verticalCenter
|
||||||
width: root.width * (root.readOnly ? 1.0 : global.valueAreaWidthScale)
|
|
||||||
horizontalAlignment: global.valueTextAlign
|
horizontalAlignment: global.valueTextAlign
|
||||||
height: global.slimHeight
|
height: global.slimHeight
|
||||||
|
|
||||||
|
@ -55,17 +55,25 @@ PropItem {
|
||||||
border.width: global.valueBorderWidth
|
border.width: global.valueBorderWidth
|
||||||
radius: global.valueBorderRadius
|
radius: global.valueBorderRadius
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea{
|
||||||
|
id: mousearea
|
||||||
|
anchors.fill: parent
|
||||||
|
onDoubleClicked: { sliderControl.visible = !sliderControl.visible }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.Slider {
|
HifiControls.Slider {
|
||||||
id: sliderControl
|
id: sliderControl
|
||||||
visible: !root.readOnly
|
visible: !root.readOnly
|
||||||
|
|
||||||
stepSize: root.integral ? 1.0 : 0.0
|
stepSize: root.integral ? 1.0 : 0.0
|
||||||
anchors.left: valueLabel.right
|
|
||||||
anchors.right: root.right
|
|
||||||
anchors.verticalCenter: root.verticalCenter
|
|
||||||
value: root.sourceValueVar
|
value: root.sourceValueVar
|
||||||
onValueChanged: { applyValueVarFromWidgets(value) }
|
onValueChanged: { applyValueVarFromWidgets(value) }
|
||||||
|
|
||||||
|
width: root.width * (root.readOnly ? 0.0 : global.handleAreaWidthScale)
|
||||||
|
anchors.right: root.right
|
||||||
|
anchors.verticalCenter: root.verticalCnter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ Item {
|
||||||
readonly property var fontWeight: Font.DemiBold
|
readonly property var fontWeight: Font.DemiBold
|
||||||
readonly property color fontColor: hifi.colors.faintGray
|
readonly property color fontColor: hifi.colors.faintGray
|
||||||
|
|
||||||
readonly property var splitterRightWidthScale: 0.45
|
readonly property var splitterLeftWidthScale: 0.45
|
||||||
|
readonly property var splitterRightWidthScale: 1.0 - splitterLeftWidthScale
|
||||||
readonly property real splitterWidth: 8
|
readonly property real splitterWidth: 8
|
||||||
|
|
||||||
readonly property real iconWidth: fontSize
|
readonly property real iconWidth: fontSize
|
||||||
|
@ -49,8 +50,9 @@ Item {
|
||||||
readonly property var labelTextAlign: Text.AlignRight
|
readonly property var labelTextAlign: Text.AlignRight
|
||||||
readonly property var labelTextElide: Text.ElideMiddle
|
readonly property var labelTextElide: Text.ElideMiddle
|
||||||
|
|
||||||
readonly property var valueAreaWidthScale: 0.3 * (1.0 - splitterRightWidthScale)
|
readonly property var valueAreaWidthScale: 0.3 * (splitterRightWidthScale)
|
||||||
|
readonly property var handleAreaWidthScale: 0.7 * (splitterRightWidthScale)
|
||||||
readonly property var valueTextAlign: Text.AlignHCenter
|
readonly property var valueTextAlign: Text.AlignHCenter
|
||||||
readonly property real valueBorderWidth: 1
|
readonly property real valueBorderWidth: 1
|
||||||
readonly property real valueBorderRadius: 2
|
readonly property real valueBorderRadius: 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,5 @@
|
||||||
(function() {
|
var window = Desktop.createWindow(Script.resolvePath('./engineInspector.qml'), {
|
||||||
var TABLET_BUTTON_NAME = "Inspector";
|
title: "Render Engine Inspector",
|
||||||
var QMLAPP_URL = Script.resolvePath("./engineInspector.qml");
|
presentationMode: Desktop.PresentationMode.NATIVE,
|
||||||
var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg");
|
size: {x: 350, y: 700}
|
||||||
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-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 Inspector',
|
|
||||||
source: qml,
|
|
||||||
width: 250,
|
|
||||||
height: 500
|
|
||||||
});
|
|
||||||
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})
|
|
||||||
}
|
|
||||||
}());
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Item {
|
||||||
|
|
||||||
property var rootConfig: Render.getConfig("")
|
property var rootConfig: Render.getConfig("")
|
||||||
|
|
||||||
Jet.TaskListView {
|
Jet.TaskPropView {
|
||||||
rootConfig: root.rootConfig
|
rootConfig: root.rootConfig
|
||||||
anchors.fill: root
|
anchors.fill: root
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
function openEngineTaskView() {
|
var window = Desktop.createWindow(Script.resolvePath('./engineList.qml'), {
|
||||||
// Set up the qml ui
|
title: "Render Engine Inspector",
|
||||||
var qml = Script.resolvePath('engineList.qml');
|
presentationMode: Desktop.PresentationMode.NATIVE,
|
||||||
var window = new OverlayWindow({
|
size: {x: 350, y: 700}
|
||||||
title: 'Render Engine',
|
});
|
||||||
source: qml,
|
|
||||||
width: 300,
|
|
||||||
height: 400
|
|
||||||
});
|
|
||||||
window.setPosition(200, 50);
|
|
||||||
//window.closed.connect(function() { Script.stop(); });
|
|
||||||
}
|
|
||||||
openEngineTaskView();
|
|
|
@ -24,7 +24,7 @@ Item {
|
||||||
property var mainViewTask: Render.getConfig("RenderMainView")
|
property var mainViewTask: Render.getConfig("RenderMainView")
|
||||||
|
|
||||||
Jet.TaskList {
|
Jet.TaskList {
|
||||||
rootConfig: Render
|
rootConfig: Render.getConfig("")
|
||||||
anchors.fill: render
|
anchors.fill: render
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue