Skip to content

Commit

Permalink
move ignore connections to input flag
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattkc committed Feb 21, 2023
1 parent 11e4e05 commit 7348d28
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 29 deletions.
11 changes: 3 additions & 8 deletions app/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void Node::ConnectEdge(Node *output, const NodeInput &input)
emit output->OutputConnected(output, input);

// Invalidate all if this node isn't ignoring this input
if (!input.node()->ignore_connections_.contains(input.input())) {
if (!(input.node()->GetInputFlags(input.input()) & kInputFlagIgnoreConnections)) {
input.node()->InvalidateAll(input.input(), input.element());
}
}
Expand All @@ -230,7 +230,7 @@ void Node::DisconnectEdge(Node *output, const NodeInput &input)
emit input.node()->InputDisconnected(output, input);
emit output->OutputDisconnected(output, input);

if (!input.node()->ignore_connections_.contains(input.input())) {
if (!(input.node()->GetInputFlags(input.input()) & kInputFlagIgnoreConnections)) {
input.node()->InvalidateAll(input.input(), input.element());
}
}
Expand Down Expand Up @@ -1307,11 +1307,6 @@ void Node::SetInputName(const QString &id, const QString &name)
}
}

void Node::IgnoreInvalidationsFrom(const QString& input_id)
{
ignore_connections_.append(input_id);
}

const QString &Node::GetLabel() const
{
return label_;
Expand Down Expand Up @@ -1644,7 +1639,7 @@ void Node::ParameterValueChanged(const QString& input, int element, const TimeRa

emit ValueChanged(NodeInput(this, input, element), range);

if (ignore_connections_.contains(input)) {
if (GetInputFlags(input) & kInputFlagIgnoreConnections) {
return;
}

Expand Down
11 changes: 0 additions & 11 deletions app/node/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -995,15 +995,6 @@ class Node : public QObject

void SendInvalidateCache(const TimeRange &range, const InvalidateCacheOptions &options);

/**
* @brief Don't send cache invalidation signals if `input` is connected or disconnected
*
* By default, when a node is connected or disconnected from input, the Node assumes that the
* parameters has changed throughout the duration of the clip (essential from 0 to infinity).
* In some scenarios, it may be preferable to handle this signal separately in order to
*/
void IgnoreInvalidationsFrom(const QString &input_id);

enum GizmoScaleHandles {
kGizmoScaleTopLeft,
kGizmoScaleTopCenter,
Expand Down Expand Up @@ -1212,8 +1203,6 @@ protected slots:

void ClearElement(const QString &input, int index);

QVector<QString> ignore_connections_;

/**
* @brief Custom user label for node
*/
Expand Down
6 changes: 1 addition & 5 deletions app/node/output/track/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ Track::Track() :
locked_(false),
sequence_(nullptr)
{
AddInput(kBlockInput, NodeValue::kNone, InputFlags(kInputFlagArray | kInputFlagNotKeyframable | kInputFlagHidden));

// Since blocks are time based, we can handle the invalidate timing a little more intelligently
// on our end
IgnoreInvalidationsFrom(kBlockInput);
AddInput(kBlockInput, NodeValue::kNone, InputFlags(kInputFlagArray | kInputFlagNotKeyframable | kInputFlagHidden | kInputFlagIgnoreConnections));

AddInput(kMutedInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));

Expand Down
6 changes: 4 additions & 2 deletions app/node/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ enum InputFlag {
kInputFlagArray = 0x1,
kInputFlagNotKeyframable = 0x2,
kInputFlagNotConnectable = 0x4,
kInputFlagStatic = kInputFlagNotKeyframable | kInputFlagNotConnectable,
kInputFlagHidden = 0x8
kInputFlagHidden = 0x8,
kInputFlagIgnoreConnections = 0x10,

kInputFlagStatic = kInputFlagNotKeyframable | kInputFlagNotConnectable
};

class InputFlags {
Expand Down
4 changes: 1 addition & 3 deletions app/node/project/sequence/sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ Sequence::Sequence()
// Create track input
QString track_input_id = kTrackInputFormat.arg(i);

AddInput(track_input_id, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable | kInputFlagArray | kInputFlagHidden));

IgnoreInvalidationsFrom(track_input_id);
AddInput(track_input_id, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable | kInputFlagArray | kInputFlagHidden | kInputFlagIgnoreConnections));

TrackList* list = new TrackList(this, static_cast<Track::Type>(i), track_input_id);
track_lists_.replace(i, list);
Expand Down

0 comments on commit 7348d28

Please sign in to comment.