began node viewer for dag insight
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "graph.h"
|
||||
|
||||
#include "qobjectlistcast.h"
|
||||
|
||||
NodeGraph::NodeGraph()
|
||||
{
|
||||
|
||||
@@ -34,3 +36,8 @@ void NodeGraph::set_name(const QString &name)
|
||||
{
|
||||
name_ = name;
|
||||
}
|
||||
|
||||
QList<Node *> NodeGraph::nodes()
|
||||
{
|
||||
return static_qobjectlist_cast<Node>(children());
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "node/node.h"
|
||||
|
||||
class NodeGraph : public QObject
|
||||
{
|
||||
public:
|
||||
@@ -31,6 +33,8 @@ public:
|
||||
const QString& name();
|
||||
void set_name(const QString& name);
|
||||
|
||||
QList<Node*> nodes();
|
||||
|
||||
private:
|
||||
QString name_;
|
||||
};
|
||||
|
||||
+11
-20
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "node.h"
|
||||
|
||||
#include "qobjectlistcast.h"
|
||||
|
||||
Node::Node(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
@@ -39,33 +41,22 @@ QString Node::Description()
|
||||
|
||||
void Node::InvalidateCache(const rational &start_range, const rational &end_range)
|
||||
{
|
||||
Q_UNUSED(start_range)
|
||||
Q_UNUSED(end_range)
|
||||
|
||||
/*
|
||||
ParamList params = Parameters();
|
||||
QList<NodeParam *> params = parameters();
|
||||
|
||||
// Loop through all parameters (there should be no children that are not NodeParams)
|
||||
for (int i=0;i<params.size();i++) {
|
||||
NodeParam* param = params.at(i);
|
||||
|
||||
if (param->type() == NodeParam::kOutput
|
||||
&& param->) {
|
||||
|
||||
// If the Node is an output, relay the signal to any Nodes that are connected to it
|
||||
if (param->type() == NodeParam::kOutput) {
|
||||
for (int i=0;i<param->edges().size();i++) {
|
||||
param->edges().at(i)->input()->parent()->InvalidateCache(start_range, end_range);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Node::ParamList Node::Parameters()
|
||||
QList<NodeParam *> Node::parameters()
|
||||
{
|
||||
const QObjectList& child_list = children();
|
||||
|
||||
ParamList params;
|
||||
params.reserve(child_list.size());
|
||||
|
||||
for (int i=0;i<child_list.size();i++) {
|
||||
params[i] = static_cast<NodeParam*>(child_list.at(i));
|
||||
}
|
||||
|
||||
return params;
|
||||
return static_qobjectlist_cast<NodeParam>(children());
|
||||
}
|
||||
|
||||
+13
-3
@@ -37,11 +37,21 @@ public:
|
||||
virtual QString Category();
|
||||
virtual QString Description();
|
||||
|
||||
/**
|
||||
* @brief Signal all dependent Nodes that anything cached between start_range and end_range is now invalid and
|
||||
* requires re-rendering
|
||||
*
|
||||
* Override this if your Node subclass keeps a cache, but call this base function at the end of the subclass function.
|
||||
* Default behavior is to relay this signal to all connected outputs, which will need to be done as to not break
|
||||
* the DAG. Even if the time needs to be transformed somehow (e.g. converting media time to sequence time), you can
|
||||
* call this function with transformed time and relay the signal that way.
|
||||
*/
|
||||
virtual void InvalidateCache(const rational& start_range, const rational& end_range);
|
||||
|
||||
using ParamList = QList<NodeParam *>;
|
||||
|
||||
ParamList Parameters();
|
||||
/**
|
||||
* @brief Return a list of NodeParams
|
||||
*/
|
||||
QList<NodeParam*> parameters();
|
||||
|
||||
public slots:
|
||||
virtual void Process(const rational& time) = 0;
|
||||
|
||||
@@ -45,6 +45,11 @@ Node *NodeParam::parent()
|
||||
return static_cast<Node*>(QObject::parent());
|
||||
}
|
||||
|
||||
const QVector<NodeEdgePtr> &NodeParam::edges()
|
||||
{
|
||||
return edges_;
|
||||
}
|
||||
|
||||
bool NodeParam::AreDataTypesCompatible(const NodeParam::DataType &output_type, const NodeParam::DataType &input_type)
|
||||
{
|
||||
if (input_type == output_type) {
|
||||
|
||||
@@ -62,6 +62,8 @@ public:
|
||||
|
||||
Node* parent();
|
||||
|
||||
const QVector<NodeEdgePtr>& edges();
|
||||
|
||||
static bool AreDataTypesCompatible(const DataType& output_type, const DataType& input_type);
|
||||
static bool AreDataTypesCompatible(const DataType& output_type, const QList<DataType>& input_types);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user