nodes: link edges to IDs rather than objects

Allows code to know whether the connected parameters has been removed or
not.
This commit is contained in:
itsmattkc
2020-10-02 16:04:50 +10:00
parent 2fb7066155
commit 4204910796
16 changed files with 112 additions and 38 deletions
+6 -1
View File
@@ -55,6 +55,11 @@ TrackOutput::TrackOutput() :
track_height_ = kTrackHeightDefault;
}
TrackOutput::~TrackOutput()
{
DisconnectAll();
}
void TrackOutput::set_track_type(const Timeline::TrackType &track_type)
{
track_type_ = track_type;
@@ -553,7 +558,7 @@ void TrackOutput::BlockConnected(NodeEdgePtr edge)
void TrackOutput::BlockDisconnected(NodeEdgePtr edge)
{
Block* b = static_cast<Block*>(edge->output()->parentNode());
Block* b = static_cast<Block*>(edge->output_node());
if (block_cache_.contains(b)) {
block_cache_.removeOne(b);
+2
View File
@@ -36,6 +36,8 @@ class TrackOutput : public Node
public:
TrackOutput();
virtual ~TrackOutput() override;
const Timeline::TrackType& track_type() const;
void set_track_type(const Timeline::TrackType& track_type);
+6 -2
View File
@@ -134,7 +134,7 @@ TrackOutput* TrackList::AddTrack()
return track;
}
void TrackList::RemoveTrack()
void TrackList::RemoveTrack(QObject* new_parent)
{
if (track_cache_.isEmpty()) {
return;
@@ -144,7 +144,11 @@ void TrackList::RemoveTrack()
GetParentGraph()->TakeNode(track);
delete track;
if (!new_parent) {
delete track;
} else {
track->setParent(new_parent);
}
track_input_->RemoveLast();
}
+1 -1
View File
@@ -44,7 +44,7 @@ public:
TrackOutput *AddTrack();
void RemoveTrack();
void RemoveTrack(QObject *new_parent);
const rational& GetTotalLength() const;
+5
View File
@@ -62,6 +62,11 @@ ViewerOutput::ViewerOutput() :
uuid_ = QUuid::createUuid();
}
ViewerOutput::~ViewerOutput()
{
DisconnectAll();
}
Node *ViewerOutput::copy() const
{
return new ViewerOutput();
+2
View File
@@ -47,6 +47,8 @@ class ViewerOutput : public Node
public:
ViewerOutput();
virtual ~ViewerOutput() override;
virtual Node* copy() const override;
virtual QString Name() const override;