disambiguated whether NodeParam::parent() would return a Node* or a QObject*

Old code assumes that a NodeParam's parent will always be a Node. The function
has been separated off and tweaked in the event that this is not the case.
This commit is contained in:
itsmattkc
2019-11-30 23:58:56 +11:00
parent a478b11fd0
commit 092d76f41a
15 changed files with 72 additions and 43 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ void AudioRenderWorker::SetParameters(const AudioRenderingParams &audio_params)
QVariant AudioRenderWorker::RenderAsSibling(NodeDependency dep)
{
NodeOutput* output = dep.node();
Node* node = output->parent();
Node* node = output->parentNode();
QList<NodeInput*> connected_inputs;
QVariant value;
@@ -66,7 +66,7 @@ void AudioRenderWorker::CloseInternal()
QVariant AudioRenderWorker::RenderBlock(NodeOutput* output, const TimeRange &range)
{
QList<Block*> active_blocks = ValidateBlockRange(static_cast<Block*>(output->parent()), range);
QList<Block*> active_blocks = ValidateBlockRange(static_cast<Block*>(output->parentNode()), range);
// All these blocks will need to output to a buffer so we create one here
QByteArray block_range_buffer(audio_params_.time_to_bytes(range.length()), 0);
+2 -2
View File
@@ -88,7 +88,7 @@ bool OpenGLBackend::TraverseCompiling(Node *n)
// Check if we have a shader or not
if (shader_cache_.GetShader(connected_output) == nullptr) {
// Since we don't have a shader, compile one now
QString node_code = connected_output->parent()->Code(connected_output);
QString node_code = connected_output->parentNode()->Code(connected_output);
// If the node has no code, it mustn't be GPU accelerated
if (!node_code.isEmpty()) {
@@ -126,7 +126,7 @@ bool OpenGLBackend::TraverseCompiling(Node *n)
}
}
if (!TraverseCompiling(connected_output->parent())) {
if (!TraverseCompiling(connected_output->parentNode())) {
return false;
}
}
@@ -10,7 +10,7 @@ OpenGLShaderCache::OpenGLShaderCache()
QString OpenGLShaderCache::GenerateShaderID(NodeOutput *output)
{
// Creates a unique identifier for this specific node and this specific output
return QString("%1:%2").arg(output->parent()->id(), output->id());
return QString("%1:%2").arg(output->parentNode()->id(), output->id());
}
void OpenGLShaderCache::Clear()
+1 -1
View File
@@ -86,7 +86,7 @@ void OpenGLWorker::ParametersChangedEvent()
QVariant OpenGLWorker::RunNodeAccelerated(NodeOutput *out)
{
OpenGLShaderPtr shader = shader_cache_->GetShader(out);
Node* node = out->parent();
Node* node = out->parentNode();
// Create the output texture
OpenGLTexturePtr output = std::make_shared<OpenGLTexture>();
+1 -1
View File
@@ -171,7 +171,7 @@ QList<NodeInput*> RenderWorker::ProcessNodeInputsForTime(Node *n, const TimeRang
QVariant RenderWorker::ProcessNodeNormally(const NodeDependency& dep)
{
NodeOutput* output = dep.node();
Node* node = dep.node()->parent();
Node* node = dep.node()->parentNode();
//qDebug() << "Processing" << node->id();
+2 -2
View File
@@ -21,7 +21,7 @@ void VideoRenderWorker::RenderInternal(const NodeDependency& path)
// Get hash of node graph
// We use SHA-1 for speed (benchmarks show it's the fastest hash available to us)
QCryptographicHash hasher(QCryptographicHash::Sha1);
HashNodeRecursively(&hasher, path.node()->parent(), path.in());
HashNodeRecursively(&hasher, path.node()->parentNode(), path.in());
QByteArray hash = hasher.result();
if (frame_cache_->HasHash(hash)) {
@@ -123,7 +123,7 @@ void VideoRenderWorker::CloseInternal()
QVariant VideoRenderWorker::RenderAsSibling(NodeDependency dep)
{
NodeOutput* output = dep.node();
Node* original_node = output->parent();
Node* original_node = output->parentNode();
Node* node;
rational time = dep.in();
QVariant value;