73 lines
1.8 KiB
C++
73 lines
1.8 KiB
C++
/***
|
|
|
|
Olive - Non-Linear Video Editor
|
|
Copyright (C) 2019 Olive Team
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
#include "node.h"
|
|
|
|
#include "common/qobjectlistcast.h"
|
|
|
|
Node::Node(QObject *parent) :
|
|
QObject(parent)
|
|
{
|
|
}
|
|
|
|
QString Node::Category()
|
|
{
|
|
// Return an empty category for any nodes that don't use one
|
|
return QString();
|
|
}
|
|
|
|
QString Node::Description()
|
|
{
|
|
// Return an empty string by default
|
|
return QString();
|
|
}
|
|
|
|
void Node::InvalidateCache(const rational &start_range, const rational &end_range)
|
|
{
|
|
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 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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
QList<NodeParam *> Node::parameters()
|
|
{
|
|
return static_qobjectlist_cast<NodeParam>(children());
|
|
}
|
|
|
|
int Node::ParameterCount()
|
|
{
|
|
return children().size();
|
|
}
|
|
|
|
int Node::IndexOfParameter(NodeParam *param)
|
|
{
|
|
return children().indexOf(param);
|
|
}
|