revise operation cache blocking system

Fixes #1553
This commit is contained in:
itsmattkc
2021-04-08 19:05:12 +10:00
parent abe28f81bf
commit 5b0332260f
7 changed files with 115 additions and 111 deletions
+12 -13
View File
@@ -47,7 +47,8 @@ Node::Node(bool create_default_output) :
can_be_deleted_(true),
override_color_(-1),
last_change_time_(0),
folder_(nullptr)
folder_(nullptr),
operation_stack_(0)
{
if (create_default_output) {
AddOutput();
@@ -1027,18 +1028,14 @@ void Node::InvalidateCache(const TimeRange &range, const QString &from, int elem
void Node::BeginOperation()
{
// Ripple through graph
for (const std::pair<NodeOutput, NodeInput>& output : output_connections_) {
output.second.node()->BeginOperation();
}
// Increase operation stack
operation_stack_++;
}
void Node::EndOperation()
{
// Ripple through graph
for (const std::pair<NodeOutput, NodeInput>& output : output_connections_) {
output.second.node()->EndOperation();
}
// Decrease operation stack
operation_stack_--;
}
TimeRange Node::InputTimeAdjustment(const QString &, int, const TimeRange &input_time) const
@@ -1177,11 +1174,13 @@ Node *Node::CopyNodeInGraph(const Node *node, MultiUndoCommand *command)
void Node::SendInvalidateCache(const TimeRange &range, qint64 job_time)
{
for (const OutputConnection& conn : output_connections_) {
// Send clear cache signal to the Node
const NodeInput& in = conn.second;
if (GetOperationStack() == 0) {
for (const OutputConnection& conn : output_connections_) {
// Send clear cache signal to the Node
const NodeInput& in = conn.second;
in.node()->InvalidateCache(range, in.input(), in.element(), job_time);
in.node()->InvalidateCache(range, in.input(), in.element(), job_time);
}
}
}